From 0fb5a19d59557a682d7c1493cf7ed2c110c56c74 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 2 Oct 2017 08:27:34 -0700 Subject: [PATCH 01/67] mersenne-twister: Fix export style (#20196) --- types/mersenne-twister/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/mersenne-twister/index.d.ts b/types/mersenne-twister/index.d.ts index 4bfb354f91..09f9675ef8 100644 --- a/types/mersenne-twister/index.d.ts +++ b/types/mersenne-twister/index.d.ts @@ -3,7 +3,8 @@ // Definitions by: KentarouTakeda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = class MersenneTwister { +export = MersenneTwister; +declare class MersenneTwister { /** * constructs mt with a number * @params seed @@ -44,4 +45,4 @@ export = class MersenneTwister { * generates a random number on [0,1) with 53-bit resolution */ random_long(): number; -}; +} From 95d011b77710e6cdcb76b44cdb8ecacbeba0d3af Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 2 Oct 2017 09:06:38 -0700 Subject: [PATCH 02/67] xxhashjs: Fix export style (#20197) * xxhashjs: Fix export style * `export const defaultExport` -> `declare` --- types/xxhashjs/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/xxhashjs/index.d.ts b/types/xxhashjs/index.d.ts index 59ca23d7f8..40c45cf3ab 100644 --- a/types/xxhashjs/index.d.ts +++ b/types/xxhashjs/index.d.ts @@ -19,4 +19,5 @@ export interface HashInterface { export const h32: HashInterface; export const h64: HashInterface; -export default { h32, h64 }; +declare const defaultExport: { h32: typeof h32, h64: typeof h64 }; +export default defaultExport; From 7b0a4497dbea374e1ee2a56284b17796fab3fb69 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 2 Oct 2017 09:07:00 -0700 Subject: [PATCH 03/67] ibm_db: Fix default export (#20195) * ibm_db: Fix default export * Fix lint --- types/ibm_db/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/ibm_db/index.d.ts b/types/ibm_db/index.d.ts index 2a1e968b2c..662a16ffb3 100644 --- a/types/ibm_db/index.d.ts +++ b/types/ibm_db/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -interface ConnStr { +export interface ConnStr { DATABASE: string; HOSTNAME: string; PORT: number | string; @@ -13,7 +13,7 @@ interface ConnStr { PWD: string; } -interface Options { +export interface Options { odbc?: ODBC; queue?: SimpleQueue | any[]; fetchMode?: number | null; @@ -22,7 +22,7 @@ interface Options { systemNaming?: boolean; } -interface DescribeObject { +export interface DescribeObject { database: string; schema?: string; type?: string; @@ -30,7 +30,7 @@ interface DescribeObject { column?: string; } -interface PoolOptions { +export interface PoolOptions { idleTimeout?: number; autoCleanIdle?: boolean; maxPoolSize?: number; @@ -38,7 +38,7 @@ interface PoolOptions { systemNaming?: any; } -declare class SimpleQueue { +export class SimpleQueue { fifo: any[]; executing: boolean; push(fn: (foo: any, bar: any) => void): void; @@ -46,7 +46,7 @@ declare class SimpleQueue { next(): void; } // Class SimpleQueue -export default (options?: Options) => new Database(options); +export default function(options?: Options): Database; export class Database implements Options { odbc: ODBC; From 24756a7ba8e906cb53f827336b7ef56dab5311a4 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 2 Oct 2017 09:07:36 -0700 Subject: [PATCH 04/67] activex-libreoffice: Avoid duplicating declaration of "SafeArray" from lib.scripthost.d.ts (#20194) --- types/activex-libreoffice/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/activex-libreoffice/index.d.ts b/types/activex-libreoffice/index.d.ts index be16c1441a..1698317e8f 100644 --- a/types/activex-libreoffice/index.d.ts +++ b/types/activex-libreoffice/index.d.ts @@ -12,9 +12,8 @@ declare class sequence { private typekey: sequence; } -declare class SafeArray { - private typekey: SafeArray; -} +// tslint:disable-next-line no-empty-interface +interface SafeArray {} declare namespace com.sun.star { namespace accessibility { From 6f4e38015cc75a2ea55ba243a080ecf8b8527315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20=C3=96llinger?= Date: Mon, 2 Oct 2017 19:30:13 +0200 Subject: [PATCH 05/67] recharts: fix callback signatures, add missing props (#20130) * recharts: fix callback signatures, add missing props * bump recharts version * remove undocumented HTMLAttributes * remove another className prop * changed version to 1.0.0 * change to version 1.0 --- types/recharts/index.d.ts | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 460a1813ff..311330b06d 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Recharts 0.22 +// Type definitions for Recharts 1.0 // Project: http://recharts.org/ // Definitions by: Maarten Mulders // Raphael Mueller @@ -10,6 +10,11 @@ import * as React from 'react'; export type Percentage = string; export type RechartsFunction = () => void; +export type LabelFormatter = (label: string | number) => React.ReactNode; +export type TooltipFormatter = (value: string | number | Array, name: string, + entry: TooltipPayload, index: number) => React.ReactNode; +export type ItemSorter = (a: T, b: T) => number; +export type ContentRenderer

= (props: P) => React.ReactNode; export type LegendType = 'line' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none'; export type LayoutType = 'horizontal' | 'vertical'; @@ -153,7 +158,7 @@ export interface CartesianAxisProps { tickSize?: number; interval?: "preserveStart" | "preserveEnd" | "preserveStartEnd" | number; tick?: boolean | any | React.ReactElement | RechartsFunction; - label?: string | number | React.ReactElement | RechartsFunction; + label?: string | number | React.ReactElement | ContentRenderer; mirror?: boolean; } @@ -261,7 +266,7 @@ export interface LegendProps { chartWidth?: number; chartHeight?: number; margin?: Margin; - content?: React.ReactElement | RechartsFunction; + content?: React.ReactElement | ContentRenderer; wrapperStyle?: any; onClick?: RechartsFunction; onMouseDown?: RechartsFunction; @@ -540,7 +545,7 @@ export interface ReferenceAreaProps { viewBox?: ViewBox; xAxis?: any; yAxis?: any; - label?: string | number | React.ReactElement | RechartsFunction; + label?: string | number | React.ReactElement | ContentRenderer; isFront?: boolean; } @@ -551,10 +556,11 @@ export interface ReferenceDotProps { yAxisId?: string | number; x: number | string; y: number | string; + r: number; alwaysShow?: boolean; xAxis: any; yAxis: any; - label?: string | number | React.ReactElement | RechartsFunction; + label?: string | number | React.ReactElement | ContentRenderer; isFront?: boolean; onClick?: RechartsFunction; onMouseDown?: RechartsFunction; @@ -577,7 +583,7 @@ export interface ReferenceLineProps { viewBox?: ViewBox; xAxis?: any; yAxis?: any; - label?: string | number | React.ReactElement | RechartsFunction; + label?: string | number | React.ReactElement | ContentRenderer; isFront?: boolean; } @@ -589,6 +595,7 @@ export interface ResponsiveContainerProps { height?: Percentage | number; minWidth?: number; minHeight?: number; + maxHeight?: Percentage | number; debounce?: number; } @@ -683,7 +690,7 @@ export interface Coordinate { } export interface TooltipPayload { name: string; - value: number; + value: string | number | Array; unit: string; } export interface TooltipProps { @@ -698,13 +705,14 @@ export interface TooltipProps { coordinate?: Coordinate; payload?: TooltipPayload[]; label?: string | number; - content?: React.ReactElement | React.StatelessComponent | RechartsFunction; - formatter?: RechartsFunction; - labelFormatter?: RechartsFunction; - itemSorter?: RechartsFunction; + content?: React.ReactElement | React.StatelessComponent | ContentRenderer; + formatter?: TooltipFormatter; + labelFormatter?: LabelFormatter; + itemSorter?: ItemSorter; isAnimationActive?: boolean; animationBegin?: number; animationEasing?: AnimationEasingType; + filterNull?: boolean; } export class Tooltip extends React.Component { } @@ -722,11 +730,11 @@ export interface TreemapProps { export interface Label { viewBox?: ViewBox | PolarViewBox; - formatter?: RechartsFunction; + formatter?: LabelFormatter; value: string | number; position?: PositionType; offset?: number; - content?: React.ReactElement | RechartsFunction; + content?: React.ReactElement | ContentRenderer

{ */ getNodes(): Array>; + /** + * Returns the wrapper's underlying node. + */ + getElement(): ReactElement; + + /** + * Returns the wrapper's underlying node. + */ + getElements(): Array>; + /** * Returns the outer most DOMComponent of the current wrapper. */ From 33a325efc8640ead8084cbeb38256b3f6a0d5bfa Mon Sep 17 00:00:00 2001 From: Alex Brick Date: Mon, 2 Oct 2017 19:38:38 +0200 Subject: [PATCH 22/67] [superagent] Improving the typing of the #field method (#20102) There are two major changes here: 1) The value of a field no longer needs to be a string. It also accepts arrays, buffers, blobs, streams, and booleans. 2) You may pass in an object, which sets all of the field values, instead of calling once for each field. --- types/superagent/index.d.ts | 9 +++++++-- types/superagent/superagent-tests.ts | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 05e1275ca0..fdf23891cb 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -16,6 +16,10 @@ type CallbackHandler = (err: any, res: request.Response) => void; type Serializer = (obj: any) => string; +type MultipartValueSingle = Blob | Buffer | fs.ReadStream | string | boolean | number; + +type MultipartValue = MultipartValueSingle | MultipartValueSingle[]; + declare const request: request.SuperAgentStatic; declare namespace request { @@ -103,14 +107,15 @@ declare namespace request { interface Request extends Promise { abort(): void; accept(type: string): this; - attach(field: string, file: Blob | Buffer | fs.ReadStream | string, filename?: string): this; + attach(field: string, file: MultipartValueSingle, options?: string | { filename?: string; contentType?: string }): this; auth(user: string, name: string): this; buffer(val?: boolean): this; ca(cert: Buffer): this; cert(cert: Buffer | string): this; clearTimeout(): this; end(callback?: CallbackHandler): this; - field(name: string, val: string): this; + field(name: string, val: MultipartValue): this; + field(fields: { [fieldName: string]: MultipartValue }): this; get(field: string): string; key(cert: Buffer | string): this; ok(callback: (res: Response) => boolean): this; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 6d7eeb793d..5978b37206 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -285,6 +285,7 @@ request .attach('avatar', 'path/to/tobi.png', 'user.png') .attach('image', 'path/to/loki.png') .attach('file', 'path/to/jane.png') + .attach('fileWithOptions', 'path/to/file.png', { filename: 'filename', contentType: 'contentType' }) .attach('blob', blob) .end(callback); @@ -293,6 +294,12 @@ request .post('/upload') .field('user[name]', 'Tobi') .field('user[email]', 'tobi@learnboost.com') + .field({ + field1: 'value1', + field2: Buffer.from([ 10, 20 ]), + field3: [ 'value1', 'value2' ], + field4: true, + }) .attach('image', 'path/to/tobi.png') .end(callback); From 49f1f3aeeb8b5fbfd5baf86aae00b8277b028e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20B=C5=99e=C4=8Dka?= Date: Mon, 2 Oct 2017 19:39:01 +0200 Subject: [PATCH 23/67] ramda: fix prop function definition (#20099) --- types/ramda/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index c538d555a0..1aeaab905d 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1438,7 +1438,7 @@ declare namespace R { * Note: TS1.9 # replace any by dictionary */ prop(p: string, obj: any): T; - prop(p: string): (obj: any) => T; + prop(p: string): (obj: any) => T; /** * Determines whether the given property of an object has a specific From 3879a43f4ad3748b2349e1cdcef531c9cda65c3d Mon Sep 17 00:00:00 2001 From: ccodin Date: Mon, 2 Oct 2017 19:39:16 +0200 Subject: [PATCH 24/67] Add missing 'cookie' property in nano declaration file (#20106) --- types/nano/index.d.ts | 1 + types/nano/nano-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/nano/index.d.ts b/types/nano/index.d.ts index 45e70ee70e..96e7253f4b 100644 --- a/types/nano/index.d.ts +++ b/types/nano/index.d.ts @@ -16,6 +16,7 @@ declare function nano( declare namespace nano { interface Configuration { url: string; + cookie?: string; requestDefaults?: CoreOptions; log?(id: string, args: any): void; parseUrl?: boolean; diff --git a/types/nano/nano-tests.ts b/types/nano/nano-tests.ts index 7d53b38814..2e44fd3872 100644 --- a/types/nano/nano-tests.ts +++ b/types/nano/nano-tests.ts @@ -6,6 +6,7 @@ import * as nano from "nano"; */ const config: nano.Configuration = { url: "http://localhost:5984/foo", + cookie: "someAuthSession", requestDefaults: { proxy: "http://someproxy" } }; From 515573deb955aa2e2ce62ddf38c029c3f56516af Mon Sep 17 00:00:00 2001 From: RalfNieuwenhuizen Date: Mon, 2 Oct 2017 19:40:25 +0200 Subject: [PATCH 25/67] Update index.d.ts (#20025) Add IOSBackgroundTask to config options --- types/react-native-fetch-blob/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/react-native-fetch-blob/index.d.ts b/types/react-native-fetch-blob/index.d.ts index cda116ec0c..cb9af73ef8 100644 --- a/types/react-native-fetch-blob/index.d.ts +++ b/types/react-native-fetch-blob/index.d.ts @@ -568,6 +568,11 @@ export interface RNFetchBlobConfig { session?: string; addAndroidDownloads?: AddAndroidDownloads; + + /** + * Fix IOS request timeout issue #368 by change default request setting to defaultSessionConfiguration, and make backgroundSessionConfigurationWithIdentifier optional + */ + IOSBackgroundTask?: boolean; } export interface AddAndroidDownloads { From 63834a2d2be73620fb3c1c1fb39b8f51b84c1c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Robles=20Fern=C3=A1ndez?= Date: Mon, 2 Oct 2017 19:40:44 +0200 Subject: [PATCH 26/67] Cookie interface don't inherit from RawResult, only the Cookie responses (#19998) http://webdriver.io/api/cookie/setCookie.html https://github.com/SeleniumHQ/selenium/blob/master/cpp/iedriver/BrowserCookie.cpp#L23 --- types/webdriverio/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/webdriverio/index.d.ts b/types/webdriverio/index.d.ts index 737f963ab7..ff0628ced4 100644 --- a/types/webdriverio/index.d.ts +++ b/types/webdriverio/index.d.ts @@ -309,13 +309,13 @@ declare namespace WebdriverIO { ensureCleanSession?: boolean; } - interface Cookie extends RawResult { + interface Cookie { name: string; value: string; path?: string; httpOnly?: boolean; expiry?: number; - secure: boolean; + secure?: boolean; } interface Suite { @@ -769,8 +769,8 @@ declare namespace WebdriverIO { deleteCookie(name?: string): Client> & RawResult; deleteCookie

(name?: string): Client

; - getCookie(): Client & Cookie[]; - getCookie(name: string): Client & Cookie; + getCookie(): Client>> & Cookie[] & Array>; + getCookie(name: string): Client> & Cookie & RawResult; getCookie

(name?: string): Client

; setCookie(cookie: Cookie): Client> & RawResult; @@ -1033,12 +1033,12 @@ declare namespace WebdriverIO { /** @deprecated in favour of Actions.pointerUp */ buttonUp

(button?: string | Button): Client

; - cookie(): Client> & RawResult; + cookie(): Client>>> & RawResult>>; cookie( method: Method, - key?: Cookie | string - ): Client> & RawResult; + key?: (Cookie & RawResult) | string + ): Client>>> & RawResult>>; /** @deprecated in favour of Actions.pointerDown(0) + Actions.pointerMove */ doDoubleClick(): Client> & RawResult & never; From dad4c42dd71ac6c272a54600fc4821443e4fea89 Mon Sep 17 00:00:00 2001 From: Glen M Date: Mon, 2 Oct 2017 13:41:57 -0400 Subject: [PATCH 27/67] Update the Atom type definitions. (#20146) * Update the Atom type definitions. * Atom: support additional dtslint rules. Minor fixes to definitions. * Atom: enable unified signatures for dtslint. * Atom: fix the scan and replace functions. Enable ban-types in dtslint. * Atom: enable no-declare-current-package and no-single-declare-module. --- types/atom-keymap/.editorconfig | 2 +- types/atom-keymap/README.md | 21 + types/atom-keymap/atom-keymap-tests.ts | 97 +- types/atom-keymap/index.d.ts | 315 +- types/atom-keymap/tsconfig.json | 4 +- types/atom-keymap/tslint.json | 38 + types/atom-keymap/v5/.editorconfig | 3 + types/atom-keymap/v5/atom-keymap-tests.ts | 20 + types/atom-keymap/v5/index.d.ts | 133 + types/atom-keymap/v5/tsconfig.json | 27 + types/atom/.editorconfig | 3 + types/atom/README.md | 42 + types/atom/atom-tests.ts | 2119 +++++++- types/atom/index.d.ts | 5904 ++++++++++++++------- types/atom/package.json | 6 + types/atom/services/index.d.ts | 190 + types/atom/tsconfig.json | 11 +- types/atom/tslint.json | 39 + types/atom/{ => v0}/api-docs.d.ts | 0 types/atom/v0/atom-tests.ts | 70 + types/atom/v0/index.d.ts | 1977 +++++++ types/atom/v0/tsconfig.json | 29 + types/event-kit/.editorconfig | 2 +- types/event-kit/README.md | 22 + types/event-kit/event-kit-tests.ts | 92 +- types/event-kit/index.d.ts | 205 +- types/event-kit/tsconfig.json | 4 +- types/event-kit/tslint.json | 38 + types/event-kit/v1/.editorconfig | 3 + types/event-kit/v1/event-kit-tests.ts | 57 + types/event-kit/v1/index.d.ts | 91 + types/event-kit/v1/tsconfig.json | 26 + types/first-mate/.editorconfig | 2 +- types/first-mate/README.md | 22 + types/first-mate/first-mate-tests.ts | 93 +- types/first-mate/index.d.ts | 343 +- types/first-mate/tsconfig.json | 4 +- types/first-mate/tslint.json | 39 + types/first-mate/v4/.editorconfig | 3 + types/first-mate/v4/first-mate-tests.ts | 10 + types/first-mate/v4/index.d.ts | 105 + types/first-mate/v4/tsconfig.json | 27 + types/pathwatcher/.editorconfig | 3 + types/pathwatcher/README.md | 28 + types/pathwatcher/index.d.ts | 308 +- types/pathwatcher/pathwatcher-tests.ts | 110 +- types/pathwatcher/tsconfig.json | 7 +- types/pathwatcher/tslint.json | 38 + types/pathwatcher/v0/index.d.ts | 88 + types/pathwatcher/v0/pathwatcher-tests.ts | 10 + types/pathwatcher/v0/tsconfig.json | 26 + types/status-bar/README.md | 1 + types/status-bar/index.d.ts | 2 +- types/status-bar/tsconfig.json | 5 +- types/text-buffer/.editorconfig | 3 + types/text-buffer/README.md | 31 + types/text-buffer/index.d.ts | 1600 +++++- types/text-buffer/text-buffer-tests.ts | 810 ++- types/text-buffer/tsconfig.json | 7 +- types/text-buffer/tslint.json | 38 + types/text-buffer/v0/index.d.ts | 301 ++ types/text-buffer/v0/text-buffer-tests.ts | 19 + types/text-buffer/v0/tsconfig.json | 26 + 63 files changed, 13072 insertions(+), 2627 deletions(-) create mode 100644 types/atom-keymap/README.md create mode 100644 types/atom-keymap/tslint.json create mode 100644 types/atom-keymap/v5/.editorconfig create mode 100644 types/atom-keymap/v5/atom-keymap-tests.ts create mode 100644 types/atom-keymap/v5/index.d.ts create mode 100644 types/atom-keymap/v5/tsconfig.json create mode 100644 types/atom/.editorconfig create mode 100644 types/atom/README.md create mode 100644 types/atom/package.json create mode 100644 types/atom/services/index.d.ts create mode 100644 types/atom/tslint.json rename types/atom/{ => v0}/api-docs.d.ts (100%) create mode 100644 types/atom/v0/atom-tests.ts create mode 100644 types/atom/v0/index.d.ts create mode 100644 types/atom/v0/tsconfig.json create mode 100644 types/event-kit/README.md create mode 100644 types/event-kit/tslint.json create mode 100644 types/event-kit/v1/.editorconfig create mode 100644 types/event-kit/v1/event-kit-tests.ts create mode 100644 types/event-kit/v1/index.d.ts create mode 100644 types/event-kit/v1/tsconfig.json create mode 100644 types/first-mate/README.md create mode 100644 types/first-mate/tslint.json create mode 100644 types/first-mate/v4/.editorconfig create mode 100644 types/first-mate/v4/first-mate-tests.ts create mode 100644 types/first-mate/v4/index.d.ts create mode 100644 types/first-mate/v4/tsconfig.json create mode 100644 types/pathwatcher/.editorconfig create mode 100644 types/pathwatcher/README.md create mode 100644 types/pathwatcher/tslint.json create mode 100644 types/pathwatcher/v0/index.d.ts create mode 100644 types/pathwatcher/v0/pathwatcher-tests.ts create mode 100644 types/pathwatcher/v0/tsconfig.json create mode 100644 types/status-bar/README.md create mode 100644 types/text-buffer/.editorconfig create mode 100644 types/text-buffer/README.md create mode 100644 types/text-buffer/tslint.json create mode 100644 types/text-buffer/v0/index.d.ts create mode 100644 types/text-buffer/v0/text-buffer-tests.ts create mode 100644 types/text-buffer/v0/tsconfig.json diff --git a/types/atom-keymap/.editorconfig b/types/atom-keymap/.editorconfig index 570211f898..2b997514d2 100644 --- a/types/atom-keymap/.editorconfig +++ b/types/atom-keymap/.editorconfig @@ -1,3 +1,3 @@ [*.ts] indent_style = tab -indent_size = 4 +indent_size = 2 diff --git a/types/atom-keymap/README.md b/types/atom-keymap/README.md new file mode 100644 index 0000000000..f900dc1a4c --- /dev/null +++ b/types/atom-keymap/README.md @@ -0,0 +1,21 @@ +## Atom Keymap Type Definitions + +TypeScript type definitions for [Atom Keymap](https://github.com/atom/atom-keymap), which is published as "[atom-keymap](https://www.npmjs.com/package/atom-keymap)" on NPM. + +### Usage Notes + +#### Exports + +This module has a single entity as its export: the [KeymapManager](https://github.com/atom/atom-keymap/blob/master/src/keymap-manager.coffee) class. The require syntax is typically used to import modules like this. + +```ts +import KeymapManager = require("atom-keymap"); +``` + +#### The AtomKeymap Namespace + +Many of the types used by Atom Keymap can be referenced from the AtomKeymap namespace. + +```ts +function example(keybind: AtomKeymap.KeyBinding) {} +``` diff --git a/types/atom-keymap/atom-keymap-tests.ts b/types/atom-keymap/atom-keymap-tests.ts index 1c92bff5c9..6c8871c737 100644 --- a/types/atom-keymap/atom-keymap-tests.ts +++ b/types/atom-keymap/atom-keymap-tests.ts @@ -1,20 +1,91 @@ +import KeymapManager = require("atom-keymap"); +import * as ImportTest from "atom-keymap"; +declare const element: HTMLElement; +declare let sub: EventKit.Disposable; +declare const event: KeyboardEvent; -import { KeymapManager, ICompleteMatchEvent } from "atom-keymap"; +// NPM Examples =============================================================== +const keymaps = new KeymapManager(); +keymaps.defaultTarget = document.body; -var manager = new KeymapManager(); -manager.add('some/unique/path', { - '.workspace': { - 'ctrl-x': 'package:do-something', - 'ctrl-y': 'package:do-something-else' - }, - '.mini.editor': { - 'enter': 'core:confirm' - } +// Pass all the window's keydown events to the KeymapManager +document.addEventListener("keydown", (event): void => { + keymaps.handleKeyboardEvent(event); }); -manager.onDidMatchBinding((event: ICompleteMatchEvent): void => { - console.log(event.binding.command); -}) +// Add some keymaps. It can also be a directory of json / cson files. +keymaps.loadKeymap("/path/to/keymap-file.json"); +// OR +keymaps.add("/key/for/these/keymaps", { + body: { + up: "core:move-up", + down: "core:move-down", + }, +}); + +// When a keybinding is triggered, it will dispatch it on the node that was focused +window.addEventListener("core:move-up", (event) => console.log("up", event)); +window.addEventListener("core:move-down", (event) => console.log("down", event)); + +// General Usage ============================================================== +const manager = new KeymapManager(); +manager.add("some/unique/path", { + ".workspace": { + "ctrl-x": "package:do-something", + "ctrl-y": "package:do-something-else", + }, + ".test": { + enter: "core:confirm", + }, +}); + +manager.onDidMatchBinding((event): void => { + console.log(event.binding.command); +}); manager.destroy(); + +// Atom API Testing =========================================================== +// Class Methods +KeymapManager.buildKeydownEvent("a"); +KeymapManager.buildKeydownEvent("a", { alt: true }); + +// Construction and Destruction +new KeymapManager({ defaultTarget: element }); +manager.clear(); +manager.destroy(); + +// Event Subscription +sub = manager.onDidMatchBinding((event): void => { event.keystrokes; }); +sub = manager.onDidPartiallyMatchBindings((event): void => { event.partiallyMatchedBindings; }); +sub = manager.onDidFailToMatchBinding((event): void => { event.keystrokes; }); +sub = manager.onDidFailToReadFile((event): void => { event.stack; }); + +// Adding and Removing Bindings +sub = manager.add("a", {}, 0); + +// Accessing Bindings +let bindings: AtomKeymap.KeyBinding[] = manager.getKeyBindings(); +bindings = manager.findKeyBindings(); +bindings = manager.findKeyBindings({ command: "a" }); +bindings = manager.findKeyBindings({ keystrokes: "a" }); +bindings = manager.findKeyBindings({ target: element }); +bindings = manager.findKeyBindings({ command: "a", keystrokes: "b"}); +bindings = manager.findKeyBindings({ command: "a", keystrokes: "b", target: element }); + +// Managing Keymap Files +manager.loadKeymap("Test.file"); +manager.loadKeymap("Test.file", { watch: true }); +manager.loadKeymap("Test.file", { watch: true, priority: 0}); + +// Managing Keyboard Events +manager.handleKeyboardEvent(event); +manager.keystrokeForKeyboardEvent(event); + +sub = manager.addKeystrokeResolver((event): string => { + event.layoutName; + return "Test"; +}); + +const num: number = manager.getPartialMatchTimeout(); diff --git a/types/atom-keymap/index.d.ts b/types/atom-keymap/index.d.ts index 58d75ec709..9472e75215 100644 --- a/types/atom-keymap/index.d.ts +++ b/types/atom-keymap/index.d.ts @@ -1,135 +1,236 @@ -// Type definitions for atom-keymap v5.1.5 -// Project: https://github.com/atom/atom-keymap/ -// Definitions by: Vadim Macagon +// Type definitions for atom-keymap 8.x +// Project: https://github.com/atom/atom-keymap +// Definitions by: GlenCFL // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// -import * as AtomEventKit from 'event-kit'; +declare global { + namespace AtomKeymap { + /** Objects that appear as parameters to callbacks. */ + namespace Events { + interface FullKeybindingMatch { + /** The string of keystrokes that matched the binding. */ + keystrokes: string; -export = AtomKeymap; + /** The KeyBinding that the keystrokes matched. */ + binding: KeyBinding; -declare namespace AtomKeymap { - type Disposable = AtomEventKit.Disposable; + /** The DOM element that was the target of the most recent keyboard event. */ + keyboardEventTarget: Element; + } - /** Instance side of KeyBinding class. */ - interface KeyBinding { - enabled: boolean; - source: string; - command: string; - keystrokes: string; - keystrokeCount: number; - selector: string; - specificity: number; + interface PartialKeybindingMatch { + /** The string of keystrokes that matched the binding. */ + keystrokes: string; - matches(keystroke: string): boolean; - compare(keyBinding: KeyBinding): number; - } + /** The KeyBindings that the keystrokes partially matched. */ + partiallyMatchedBindings: KeyBinding[]; - interface ICompleteMatchEvent { - /** Keystrokes that matched the binding. */ - keystrokes: string; - /** Binding that was matched to the keystrokes. */ - binding: KeyBinding; - /** DOM element that was the target of the most recent `KeyboardEvent`. */ - keyboardEventTarget: Element; - } + /** DOM element that was the target of the most recent keyboard event. */ + keyboardEventTarget: Element; + } - interface IPartialMatchEvent { - /** Keystrokes that matched the binding. */ - keystrokes: string; - /** Bindings that were partially matched to the keystrokes. */ - partiallyMatchedBindings: KeyBinding[]; - /** DOM element that was the target of the most recent `KeyboardEvent`. */ - keyboardEventTarget: Element; - } + interface FailedKeybindingMatch { + /** The string of keystrokes that failed to match the binding. */ + keystrokes: string; - interface IFailedMatchEvent { - /** Keystrokes that failed to match a binding. */ - keystrokes: string; - /** DOM element that was the target of the most recent `KeyboardEvent`. */ - keyboardEventTarget: Element; - } + /** The DOM element that was the target of the most recent keyboard event. */ + keyboardEventTarget: Element; + } - interface IKeymapLoadEvent { - /** Path to a keymap file. */ - path: string; - } + interface FailedKeymapFileRead { + /** The error message. */ + message: string; - /** Static side of KeymapManager class. */ - interface KeymapManagerStatic { - prototype: KeymapManager; - new (options?: { defaultTarget?: Element }): KeymapManager; - } + /** The error stack trace. */ + stack: string; + } - /** Instance side of KeymapManager class. */ - interface KeymapManager { - constructor: KeymapManagerStatic; - /** Unwatches all watched paths. */ - destroy(): void; + interface KeymapLoaded { + /** The path of the keymap file. */ + path: string; + } - // Event Subscription + interface AddedKeystrokeResolver { + /** The currently resolved keystroke string. If your function returns a falsy + * value, this is how Atom will resolve your keystroke. + */ + keystroke: string; - /** Sets callback to invoke when one or more keystrokes completely match a key binding. */ - onDidMatchBinding(callback: (event: ICompleteMatchEvent) => void): Disposable; - /** Sets callback to invoke when one or more keystrokes partially match a binding. */ - onDidPartiallyMatchBindings(callback: (event: IPartialMatchEvent) => void): Disposable; - /** Sets callback to invoke when one or more keystrokes fail to match any bindings. */ - onDidFailToMatchBinding(callback: (event: IFailedMatchEvent) => void): Disposable; - /** Sets callback to invoke when a keymap file is reloaded. */ - onDidReloadKeymap(callback: (event: IKeymapLoadEvent) => void): Disposable; - /** Sets callback to invoke when a keymap file is unloaded. */ - onDidUnloadKeymap(callback: (event: IKeymapLoadEvent) => void): Disposable; - /** Sets callback to invoke when a keymap file could not to be loaded. */ - onDidFailToReadFile(callback: (error: Error) => void): Disposable; + /** The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API documentation + * for more details. + */ + event: KeyboardEvent; - // Adding and Removing Bindings + /** The OS-specific name of the current keyboard layout. */ + layoutName: string; - /** Adds sets of key bindings grouped by CSS selector. */ - add(source: string, keyBindingsBySelector: any): Disposable; + /** An object mapping DOM 3 `KeyboardEvent.code` values to objects with the + * typed character for that key in each modifier state, based on the current + * operating system layout. + */ + keymap: object; + } + } - // Accessing Bindings + /** Objects that appear as parameters to functions. */ + namespace Options { + interface BuildKeyEvent { + ctrl?: boolean; + alt?: boolean; + shift?: boolean; + cmd?: boolean; + which?: number; + target?: Element; + } + } - getKeyBindings(): KeyBinding[]; - findKeyBindings(params?: { - keystrokes: string; // e.g. 'ctrl-x ctrl-s' - command: string; // e.g. 'editor:backspace' - target?: Element; - }): KeyBinding[]; + /** The static side to each exported class. Should generally only be used internally. */ + namespace Statics { + /* tslint:disable:no-unnecessary-qualifier */ + /** The static side to the KeymapManager class. */ + interface KeymapManager { + /** Create a keydown DOM event. */ + buildKeydownEvent(key: string, options?: AtomKeymap.Options.BuildKeyEvent): void; - // Managing Keymap Files + /** Create a keyup DOM event. */ + buildKeyupEvent(key: string, options?: AtomKeymap.Options.BuildKeyEvent): void; - /** - * Loads the key bindings from the given path. - * - * @param bindingsPath A path to a file or a directory. If the path is a directory all files - * inside it will be loaded. + /** Create a new KeymapManager. */ + new (options?: { defaultTarget?: HTMLElement }): AtomKeymap.KeymapManager; + } + /* tslint:enable:no-unnecessary-qualifier */ + } + + /** This custom subclass of CustomEvent exists to provide the ::abortKeyBinding + * method, as well as versions of the ::stopPropagation methods that record the + * intent to stop propagation so event bubbling can be properly simulated for + * detached elements. */ - loadKeymap(bindingsPath: string, options?: { watch: boolean }): void; - /** - * Starts watching the given file/directory for changes, reloading any keymaps at that location - * when changes are detected. - * - * @param filePath A path to a file or a directory. - */ - watchKeymap(filePath: string): void; + interface CommandEvent extends CustomEvent { + keyBindingAborted: boolean; + propagationStopped: boolean; - // Managing Keyboard Events + abortKeyBinding(): void; + stopPropagation(): CustomEvent; + stopImmediatePropagation(): CustomEvent; + } - /** - * Dispatches a custom event associated with the matching key binding for the given - * `KeyboardEvent` if one can be found. + interface KeyBinding { + // Properties + enabled: boolean; + source: string; + command: string; + keystrokes: string; + keystrokeArray: string[]; + keystrokeCount: number; + selector: string; + specificity: number; + + // Comparison + /** Determines whether the given keystroke matches any contained within this binding. */ + matches(keystroke: string): boolean; + + /** Compare another KeyBinding to this instance. + * Returns <= -1 if the argument is considered lesser or of lower priority. + * Returns 0 if this binding is equivalent to the argument. + * Returns >= 1 if the argument is considered greater or of higher priority. + */ + compare(other: KeyBinding): number; + } + + /** Allows commands to be associated with keystrokes in a context-sensitive way. + * In Atom, you can access a global instance of this object via `atom.keymaps`. */ - handleKeyboardEvent(event: KeyboardEvent): void; - /** Translates a keydown event to a keystroke string. */ - keystrokeForKeyboardEvent(event: KeyboardEvent): string; - /** - * @return The number of milliseconds allowed before pending states caused by partial matches of - * multi-keystroke bindings are terminated. - */ - getPartialMatchTimeout(): number; + /** Instance side of KeymapManager class. */ + interface KeymapManager { + defaultTarget: HTMLElement; + + partialMatchTimeout: number; + + /** Clear all registered key bindings and enqueued keystrokes. For use in tests. */ + clear(): void; + + /** Unwatch all watched paths. */ + destroy(): void; + + // Event Subscription + /** Invoke the given callback when one or more keystrokes completely match a key binding. */ + onDidMatchBinding(callback: (event: Events.FullKeybindingMatch) => void): + EventKit.Disposable; + + /** Invoke the given callback when one or more keystrokes partially match a binding. */ + onDidPartiallyMatchBindings(callback: (event: Events.PartialKeybindingMatch) => + void): EventKit.Disposable; + + /** Invoke the given callback when one or more keystrokes fail to match any bindings. */ + onDidFailToMatchBinding(callback: (event: Events.FailedKeybindingMatch) => + void): EventKit.Disposable; + + /** Invoke the given callback when a keymap file is reloaded. */ + onDidReloadKeymap(callback: (event: Events.KeymapLoaded) => void): + EventKit.Disposable; + + /** Invoke the given callback when a keymap file is unloaded. */ + onDidUnloadKeymap(callback: (event: Events.KeymapLoaded) => void): + EventKit.Disposable; + + /** Invoke the given callback when a keymap file not able to be loaded. */ + onDidFailToReadFile(callback: (error: Events.FailedKeymapFileRead) => void): + EventKit.Disposable; + + // Adding and Removing Bindings + /** Construct KeyBindings from an object grouping them by CSS selector. */ + build(source: string, bindings: { [key: string]: { [key: string]: string }}, + priority?: number): KeyBinding[]; + + /** Add sets of key bindings grouped by CSS selector. */ + add(source: string, bindings: { [key: string]: { [key: string]: string }}, + priority?: number): EventKit.Disposable; + + // Accessing Bindings + /** Get all current key bindings. */ + getKeyBindings(): KeyBinding[]; + + /** Get the key bindings for a given command and optional target. */ + findKeyBindings(params?: { + keystrokes?: string, // e.g. 'ctrl-x ctrl-s' + command?: string, // e.g. 'editor:backspace' + target?: Element, + }): KeyBinding[]; + + // Managing Keymap Files + /** Load the key bindings from the given path. */ + loadKeymap(bindingsPath: string, options?: { watch?: boolean, priority?: number }): + void; + + /** Cause the keymap to reload the key bindings file at the given path whenever + * it changes. + */ + watchKeymap(filePath: string, options?: { priority: number }): void; + + // Managing Keyboard Events + /** Dispatch a custom event associated with the matching key binding for the + * given `KeyboardEvent` if one can be found. + */ + handleKeyboardEvent(event: KeyboardEvent): void; + + /** Translates a keydown event to a keystroke string. */ + keystrokeForKeyboardEvent(event: KeyboardEvent): string; + + /** Customize translation of raw keyboard events to keystroke strings. */ + addKeystrokeResolver(resolver: (event: Events.AddedKeystrokeResolver) => string): + EventKit.Disposable; + + /** Get the number of milliseconds allowed before pending states caused by + * partial matches of multi-keystroke bindings are terminated. + */ + getPartialMatchTimeout(): number; + } } - - /** Allows commands to be associated with keystrokes in a context-sensitive way.*/ - var KeymapManager: KeymapManagerStatic; } + +declare const KeymapManager: AtomKeymap.Statics.KeymapManager; +export = KeymapManager; diff --git a/types/atom-keymap/tsconfig.json b/types/atom-keymap/tsconfig.json index 84ac8aff2e..ef3f191a31 100644 --- a/types/atom-keymap/tsconfig.json +++ b/types/atom-keymap/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "atom-keymap-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/atom-keymap/tslint.json b/types/atom-keymap/tslint.json new file mode 100644 index 0000000000..cd8f17056a --- /dev/null +++ b/types/atom-keymap/tslint.json @@ -0,0 +1,38 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // Custom rules. + "class-name": true, + "indent": [true, "tabs"], + "jsdoc-format": true, + "linebreak-style": [true, "LF"], + "max-line-length": [true, 100], + "quotemark": [true, "double", "avoid-escape"], + "trailing-comma": [true, { + "multiline": { "objects": "always", "arrays": "always", "functions": "never" }, + "singleline": { "objects": "never", "arrays": "never", "functions": "never" } + }], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-type", + "check-typecast", + "check-rest-spread", + "check-preblock" + ], + // Soon to be defaults. + "arrow-return-shorthand": [true, "multiline"], + "no-any": true, + "no-floating-promises": true, + "no-unbound-method": true, + "no-unsafe-any": true, + "number-literal-format": true, + "restrict-plus-operands": true, + "return-undefined": true, + "switch-final-break": true + } +} diff --git a/types/atom-keymap/v5/.editorconfig b/types/atom-keymap/v5/.editorconfig new file mode 100644 index 0000000000..570211f898 --- /dev/null +++ b/types/atom-keymap/v5/.editorconfig @@ -0,0 +1,3 @@ +[*.ts] +indent_style = tab +indent_size = 4 diff --git a/types/atom-keymap/v5/atom-keymap-tests.ts b/types/atom-keymap/v5/atom-keymap-tests.ts new file mode 100644 index 0000000000..1c92bff5c9 --- /dev/null +++ b/types/atom-keymap/v5/atom-keymap-tests.ts @@ -0,0 +1,20 @@ + + +import { KeymapManager, ICompleteMatchEvent } from "atom-keymap"; + +var manager = new KeymapManager(); +manager.add('some/unique/path', { + '.workspace': { + 'ctrl-x': 'package:do-something', + 'ctrl-y': 'package:do-something-else' + }, + '.mini.editor': { + 'enter': 'core:confirm' + } +}); + +manager.onDidMatchBinding((event: ICompleteMatchEvent): void => { + console.log(event.binding.command); +}) + +manager.destroy(); diff --git a/types/atom-keymap/v5/index.d.ts b/types/atom-keymap/v5/index.d.ts new file mode 100644 index 0000000000..9ffa0a41d3 --- /dev/null +++ b/types/atom-keymap/v5/index.d.ts @@ -0,0 +1,133 @@ +// Type definitions for atom-keymap v5.1.5 +// Project: https://github.com/atom/atom-keymap/ +// Definitions by: Vadim Macagon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as AtomEventKit from 'event-kit'; + +export = AtomKeymap; + +declare namespace AtomKeymap { + type Disposable = AtomEventKit.Disposable; + + /** Instance side of KeyBinding class. */ + interface KeyBinding { + enabled: boolean; + source: string; + command: string; + keystrokes: string; + keystrokeCount: number; + selector: string; + specificity: number; + + matches(keystroke: string): boolean; + compare(keyBinding: KeyBinding): number; + } + + interface ICompleteMatchEvent { + /** Keystrokes that matched the binding. */ + keystrokes: string; + /** Binding that was matched to the keystrokes. */ + binding: KeyBinding; + /** DOM element that was the target of the most recent `KeyboardEvent`. */ + keyboardEventTarget: Element; + } + + interface IPartialMatchEvent { + /** Keystrokes that matched the binding. */ + keystrokes: string; + /** Bindings that were partially matched to the keystrokes. */ + partiallyMatchedBindings: KeyBinding[]; + /** DOM element that was the target of the most recent `KeyboardEvent`. */ + keyboardEventTarget: Element; + } + + interface IFailedMatchEvent { + /** Keystrokes that failed to match a binding. */ + keystrokes: string; + /** DOM element that was the target of the most recent `KeyboardEvent`. */ + keyboardEventTarget: Element; + } + + interface IKeymapLoadEvent { + /** Path to a keymap file. */ + path: string; + } + + /** Static side of KeymapManager class. */ + interface KeymapManagerStatic { + prototype: KeymapManager; + new (options?: { defaultTarget?: Element }): KeymapManager; + } + + /** Instance side of KeymapManager class. */ + interface KeymapManager { + constructor: KeymapManagerStatic; + /** Unwatches all watched paths. */ + destroy(): void; + + // Event Subscription + + /** Sets callback to invoke when one or more keystrokes completely match a key binding. */ + onDidMatchBinding(callback: (event: ICompleteMatchEvent) => void): Disposable; + /** Sets callback to invoke when one or more keystrokes partially match a binding. */ + onDidPartiallyMatchBindings(callback: (event: IPartialMatchEvent) => void): Disposable; + /** Sets callback to invoke when one or more keystrokes fail to match any bindings. */ + onDidFailToMatchBinding(callback: (event: IFailedMatchEvent) => void): Disposable; + /** Sets callback to invoke when a keymap file is reloaded. */ + onDidReloadKeymap(callback: (event: IKeymapLoadEvent) => void): Disposable; + /** Sets callback to invoke when a keymap file is unloaded. */ + onDidUnloadKeymap(callback: (event: IKeymapLoadEvent) => void): Disposable; + /** Sets callback to invoke when a keymap file could not to be loaded. */ + onDidFailToReadFile(callback: (error: Error) => void): Disposable; + + // Adding and Removing Bindings + + /** Adds sets of key bindings grouped by CSS selector. */ + add(source: string, keyBindingsBySelector: any): Disposable; + + // Accessing Bindings + + getKeyBindings(): KeyBinding[]; + findKeyBindings(params?: { + keystrokes: string; // e.g. 'ctrl-x ctrl-s' + command: string; // e.g. 'editor:backspace' + target?: Element; + }): KeyBinding[]; + + // Managing Keymap Files + + /** + * Loads the key bindings from the given path. + * + * @param bindingsPath A path to a file or a directory. If the path is a directory all files + * inside it will be loaded. + */ + loadKeymap(bindingsPath: string, options?: { watch: boolean }): void; + /** + * Starts watching the given file/directory for changes, reloading any keymaps at that location + * when changes are detected. + * + * @param filePath A path to a file or a directory. + */ + watchKeymap(filePath: string): void; + + // Managing Keyboard Events + + /** + * Dispatches a custom event associated with the matching key binding for the given + * `KeyboardEvent` if one can be found. + */ + handleKeyboardEvent(event: KeyboardEvent): void; + /** Translates a keydown event to a keystroke string. */ + keystrokeForKeyboardEvent(event: KeyboardEvent): string; + /** + * @return The number of milliseconds allowed before pending states caused by partial matches of + * multi-keystroke bindings are terminated. + */ + getPartialMatchTimeout(): number; + } + + /** Allows commands to be associated with keystrokes in a context-sensitive way.*/ + var KeymapManager: KeymapManagerStatic; +} diff --git a/types/atom-keymap/v5/tsconfig.json b/types/atom-keymap/v5/tsconfig.json new file mode 100644 index 0000000000..001df42114 --- /dev/null +++ b/types/atom-keymap/v5/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "atom-keymap": [ "atom-keymap/v5" ], + "event-kit": [ "event-kit/v1" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "atom-keymap-tests.ts" + ] +} diff --git a/types/atom/.editorconfig b/types/atom/.editorconfig new file mode 100644 index 0000000000..2b997514d2 --- /dev/null +++ b/types/atom/.editorconfig @@ -0,0 +1,3 @@ +[*.ts] +indent_style = tab +indent_size = 2 diff --git a/types/atom/README.md b/types/atom/README.md new file mode 100644 index 0000000000..cb0b596665 --- /dev/null +++ b/types/atom/README.md @@ -0,0 +1,42 @@ +## Atom API Type Definitions + +TypeScript type definitions for the [Atom Text Editor](https://atom.io/) public API, which is used to develop packages for the editor. Documentation for the public API can be found [here](https://atom.io/docs/api/v1.19.5/), though these type definitions include many types and class properties not mentioned within that documentation. + +### Exports + +#### The "atom" Variable + +These definitions declare a global static variable named "atom" as ambient. Once these definitions have been referenced within your project, you will be able to access properties and member functions from the [AtomEnvironment](https://atom.io/docs/api/v1.19.5/AtomEnvironment) class off of this variable, as it is an instance of that class. + +```ts +if (atom.inDevMode()) {} +``` + +#### The Atom Namespace + +All of the types used by or referenced by the Atom public API have been pulled into the Atom namespace, providing a consistent and easy way to access each of them, without having to care about where that type actually lives within the Atom codebase. + +```ts +function example(buffer: Atom.TextBuffer) {} +``` + +#### The AtomCore Namespace + +All classes which are core to Atom itself have been provided under the AtomCore namespace. + +```ts +function example(cursor: AtomCore.Cursor) {} +``` + +### Service Type Definitions + +There are many services provided by other Atom packages that you may want to use within your own Atom package. We bundle type definitions for several of these services with these type definitions. + +```ts +/// +let completionProvider: Atom.Services.Autocomplete.Provider; +``` + +The currently supported services are: +- [Autocomplete](https://github.com/atom/autocomplete-plus) +- [Status Bar](https://github.com/atom/status-bar) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 5987f4901d..c846cde9f2 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -1,70 +1,2087 @@ -import path = require("path"); -import _atom = require("atom"); +declare let str: string; +declare let num: number; +declare let bool: boolean; +declare let strs: string[]; +declare let obj: object; +declare let objs: object[]; +declare let regExp: RegExp; -import PathWatcher = require("pathwatcher"); -var File = PathWatcher.File; +declare let element: HTMLElement; +declare let elements: HTMLElement[]; +declare const div: HTMLDivElement; -const jq: JQuery = $("selector"); +declare let grammar: Atom.Grammar; +declare let pos: Atom.Point; +declare let posArr: Atom.Point[]; +declare let range: Atom.Range; +declare let ranges: Atom.Range[]; +declare let marker: Atom.Marker; +declare let displayMarker: Atom.DisplayMarker; +declare let displayMarkers: Atom.DisplayMarker[]; +declare let displayMarkerLayer: Atom.DisplayMarkerLayer; +declare let sub: Atom.Disposable; +declare let dir: Atom.Directory; +declare let dirs: Atom.Directory[]; -class SampleView extends _atom.ScrollView { +declare let buffer: Atom.TextBuffer; +declare let cursor: Atom.Cursor; +declare let cursors: Atom.Cursor[]; +declare let editor: Atom.TextEditor; +declare let editors: Atom.TextEditor[]; +declare let decoration: Atom.Decoration; +declare let decorations: Atom.Decoration[]; +declare let notification: Atom.Notification; +declare let notifications: Atom.Notification[]; +declare let scopeDescriptor: Atom.ScopeDescriptor; +declare let pack: Atom.Package; +declare let packs: Atom.Package[]; +declare let pane: Atom.Pane; +declare let panes: Atom.Pane[]; +declare let panel: Atom.Panel; +declare let panels: Atom.Panel[]; +declare let project: Atom.Project; +declare let repository: Atom.GitRepository; +declare let repositories: Atom.GitRepository[]; +declare let gutter: Atom.Gutter; +declare let gutters: Atom.Gutter[]; +declare let historyPaths: Atom.HistoryProject[]; +declare let layerDecoration: Atom.LayerDecoration; +declare let selection: Atom.Selection; +declare let selections: Atom.Selection[]; +declare let styleManager: Atom.StyleManager; +declare let tooltips: Atom.Tooltip[]; +declare let dock: Atom.Dock; +declare let workspaceCenter: Atom.WorkspaceCenter; +declare let paneContainer: Atom.Dock|Atom.WorkspaceCenter; - editorId:string; - file:PathWatcher.IFile; - editor:AtomCore.IEditor; +// Exports Testing ============================================================ +import { BufferedNodeProcess, BufferedProcess, GitRepository, Notification, + TextBuffer, TextEditor, Point, Range, File, Directory, Emitter, Disposable, + CompositeDisposable, Task } from "atom"; - static deserialize(state:any):SampleView { - return new SampleView(state); - } +// global "atom" +atom.commands; +atom.config; +atom.clipboard; +atom.contextMenu; +atom.menu; +atom.keymaps; +atom.tooltips; +atom.notifications; +atom.project; +atom.grammars; +atom.history; +atom.packages; +atom.themes; +atom.styles; +atom.deserializers; +atom.views; +atom.workspace; +atom.textEditors; +atom.onDidBeep((): void => {}); +atom.onWillThrowError((): void => {}); +atom.onDidThrowError((): void => {}); +atom.whenShellEnvironmentLoaded((): void => {}); +atom.inDevMode(); +atom.inSafeMode(); +atom.inSpecMode(); +atom.getVersion(); +atom.isReleasedVersion(); +atom.getWindowLoadTime(); - static content():any { - return this.div({class: 'sample native-key-bindings', tabindex: -1}); - } +const loadSettings = atom.getLoadSettings(); +const testValue = loadSettings.env["test"]; +if (testValue) str = testValue; - constructor(params:{editorId?:string; filePath?:string;} = {}) { - super(); +atom.open({ devMode: false, newWindow: true, pathsToOpen: ["Test.file"], + safeMode: false }); +atom.close(); +atom.getSize(); +atom.setSize(42, 42); +atom.getPosition(); +atom.setPosition(42, 42); +atom.pickFolder((): void => {}); - this.editorId = params.editorId; +const window = atom.getCurrentWindow(); +const [windowWidth, windowHeight] = window.getSize(); - if (this.editorId) { - this.resolveEditor(this.editorId); - } else { - this.file = new File(params.filePath); +atom.center(); +atom.focus(); +atom.show(); +atom.hide(); +atom.reload(); +atom.restartApplication(); +atom.isMaximized(); +atom.isFullScreen(); +atom.setFullScreen(true); +atom.toggleFullScreen(); +atom.beep(); +atom.confirm({ buttons: ["Test"], detailedMessage: "Test", message: "Test" }); + +async function toggleDevTools() { + await atom.openDevTools(); + await atom.toggleDevTools(); +} + +atom.executeJavaScriptInDevTools("Test"); + +// Usage Testing ============================================================== +// Some examples taken from the Atom documentation. +// .commands +sub = atom.commands.add("test", { "execute-command": () => {}}); + +// .clipboard +str = atom.clipboard.read(); + +// .contextMenu +sub = atom.contextMenu.add({ + "atom-workspace": [{label: "Help", command: "application:open-documentation"}], + "atom-text-editor": [{ + label: "History", + submenu: [ + { label: "Undo", command: "core:undo" }, + { label: "Redo", command: "core:redo" }, + ], + }], +}); + +// .menu +sub = atom.menu.add([{ + label: "Hello", + submenu : [{ label: "World!", command: "hello:world" }], +}]); + +// .keymaps +atom.keymaps.add("Test.Path", { + selector: { + a: "execute-something", + }, +}); + +// .tooltips +sub = atom.tooltips.add(div, { title: "Tooltip Test" }); + +// .notifications +notification = atom.notifications.addError("Error"); + +// .project +atom.project.addPath("/var/test"); + +// .grammars +grammar = atom.grammars.loadGrammarSync("Test.file"); + +// .history +historyPaths = atom.history.getProjects(); + +// .packages +sub = atom.packages.onDidActivatePackage((atomPackage) => { + atomPackage.isCompatible(); +}); + +// .themes +sub = atom.themes.onDidChangeActiveThemes(() => {}); + +// .styles +sub = atom.styles.onDidAddStyleElement((styleElement) => {}); + +// .deserializers +const serializer = { + name: "Test", + deserialize: () => ({}), +}; +atom.deserializers.add(serializer); + +// .views +sub = atom.views.addViewProvider(Range, (range): HTMLElement => { + range.start; + return div; +}); + +// .workspace +sub = atom.workspace.observeTextEditors((editor) => { + sub = editor.onDidStopChanging((event) => { + for (const change of event.changes) { + change.newExtent; } + }); + + const text: string[] = editor.getBuffer().getLines(); +}); + +// .textEditors +atom.textEditors.add(editor); + +// Atom API Testing =========================================================== +//// AtomEnvironment ========================================================== +// Event Subscription +sub = atom.onDidBeep(() => {}); +sub = atom.onWillThrowError(event => event.message); +sub = atom.onDidThrowError(event => event.line); +sub = atom.whenShellEnvironmentLoaded(() => {}); + +// Atom Details +bool = atom.inDevMode(); +bool = atom.inSafeMode(); +bool = atom.inSpecMode(); +str = atom.getVersion(); +bool = atom.isReleasedVersion(); +num = atom.getWindowLoadTime(); +obj = atom.getLoadSettings(); + +// Managing The Atom Window +declare let dim: { width: number, height: number }; +declare let v2: { x: number, y: number }; + +// atom.open(params); +atom.close(); +dim = atom.getSize(); +atom.setSize(42, 42); +v2 = atom.getPosition(); +atom.setPosition(42, 42); + +atom.pickFolder((paths) => { + if (paths) { + paths.length; } +}); - serialize() { - return { - deserializer: 'SampleView', - editorId: this.editorId - }; - } +atom.getCurrentWindow(); +atom.center(); +atom.focus(); +atom.show(); +atom.hide(); +atom.reload(); +atom.restartApplication(); +bool = atom.isMaximized(); +bool = atom.isFullScreen(); +atom.setFullScreen(true); +atom.toggleFullScreen(); - destroy() { - this.unsubscribe(); - } +// Messaging the User +atom.beep(); - resolveEditor(editorId:string) { - var resolve = ()=> { - if (this.editor) { - jq.trigger("title-changed"); - } else { - var view = jq.parents('.pane').view(); - if (view) { - view.destroyItem(this); - } - } - }; +atom.confirm({ message: "Test" }); +atom.confirm({ message: "Test", buttons: [ "a", "b" ], detailedMessage: "Test" }); +num = atom.confirm({ message: "Test", detailedMessage: "Test", buttons: { + Test: () => { atom.beep(); }, +}}); - if (atom.workspace) { - resolve(); - } else { - atom.packages.once("activated", ()=> { - resolve(); - }); - } +// Managing the Dev Tools +async function manageDevTools() { + await atom.openDevTools(); + await atom.toggleDevTools(); +} + +atom.executeJavaScriptInDevTools("Test"); + +//// BufferedNodeProcess ====================================================== +const nodeProcess = new BufferedNodeProcess({ + command: "File.path", +}); + +new BufferedNodeProcess({ + command: "File.path", + args: [], + options: { + cwd: "/var/test", + detached: true, + }, + exit: (): void => {}, + stderr: (): void => {}, + stdout: (): void => {}, +}); + +//// BufferedProcess ========================================================== +const process = new BufferedProcess({ + command: "File.path", +}); + +new BufferedProcess({ + command: "File.path", + args: [], + options: {}, + exit: (): void => {}, + stderr: (): void => {}, + stdout: (): void => {}, +}); + +sub = process.onWillThrowError((error) => { + error.error; + error.handle(); +}); + +process.kill(); + +//// Clipboard ================================================================ +atom.clipboard.read(); +atom.clipboard.write("Test"); +const clip = atom.clipboard.readWithMetadata(); +str = clip.text; +obj = clip.metadata; + +//// Color ==================================================================== +declare const color: Atom.Color; +str = color.toHexString(); +str = color.toRGBAString(); + +//// CommandRegistry ========================================================== +atom.commands.add("test", "test:function", (event) => {}); +atom.commands.add("test", { + "test-function": (event) => {}, + "test-function2": (event) => {}, +}); + +const commands = atom.commands.findCommands({ target: element }); +atom.commands.dispatch(element, "test:function"); +sub = atom.commands.onWillDispatch((event) => { event.stopPropagation(); }); +sub = atom.commands.onDidDispatch((event) => { event.cancelable; }); + +//// CompositeDisposable -- See 'event-kit' testing. +//// Config =================================================================== +atom.config.observe("test", (event) => {}); +atom.config.observe("test", { scope: scopeDescriptor }, (value) => {}); + +atom.config.onDidChange((event) => { event.newValue; }); +atom.config.onDidChange("test", (event) => { event.oldValue; }); + +// Managing Settings +atom.config.get("test"); +atom.config.get("test", { scope: scopeDescriptor }); +atom.config.get("test", { excludeSources: ["test.source"] }); +atom.config.get("test", { sources: ["test.source"] }); +atom.config.get("test", { scope: scopeDescriptor, excludeSources: ["a"], + sources: ["b"] }); + +atom.config.set("test", 42); +atom.config.set("test", 42, { scopeSelector: "test-selector" }); +atom.config.set("test", 42, { source: "test" }); +atom.config.set("test", 42, {scopeSelector: "test-selector", source: "test" }); + +atom.config.unset("test"); +atom.config.unset("test", { scopeSelector: "test-selector" }); +atom.config.unset("test", { source: "test" }); +atom.config.unset("test", { scopeSelector: "test-selector", source: "test" }); + +const allConfigValues = atom.config.getAll("test"); +for (const { scopeDescriptor, value } of allConfigValues) { + scopeDescriptor.scopes; +} +atom.config.getAll("test", { scope: scopeDescriptor }); +atom.config.getAll("test", { excludeSources: ["test"] }); +atom.config.getAll("test", { sources: ["test"] }); +atom.config.getAll("test", { scope: scopeDescriptor, excludeSources: ["a"], + sources: ["b"] }); + +strs = atom.config.getSources(); + +atom.config.getSchema("test"); + +str = atom.config.getUserConfigPath(); + +atom.config.transact(() => {}); + +//// ContextMenuManager -- See above. +//// Cursor =================================================================== +// Event Subscription +sub = cursor.onDidChangePosition((event) => { event.newBufferPosition; }); +sub = cursor.onDidDestroy(() => {}); + +// Managing Cursor Position +cursor.setScreenPosition(pos); +cursor.setScreenPosition(pos, {}); +cursor.setScreenPosition(pos, { autoscroll: true }); + +pos = cursor.getScreenPosition(); + +cursor.setBufferPosition(pos); +cursor.setBufferPosition(pos, {}); +cursor.setBufferPosition(pos, { autoscroll: true }); + +pos = cursor.getBufferPosition(); +num = cursor.getScreenRow(); +num = cursor.getScreenColumn(); +num = cursor.getBufferRow(); +num = cursor.getBufferColumn(); +str = cursor.getCurrentBufferLine(); +bool = cursor.isAtBeginningOfLine(); +bool = cursor.isAtEndOfLine(); + +// Cursor Position Details +displayMarker = cursor.getMarker(); +bool = cursor.isSurroundedByWhitespace(); +bool = cursor.isBetweenWordAndNonWord(); + +bool = cursor.isInsideWord(); +bool = cursor.isInsideWord({}); +bool = cursor.isInsideWord({ wordRegex: regExp }); + +num = cursor.getIndentLevel(); +scopeDescriptor = cursor.getScopeDescriptor(); +bool = cursor.hasPrecedingCharactersOnLine(); +bool = cursor.isLastCursor(); + +// Moving the Cursor +cursor.moveUp(); +cursor.moveUp(42); +cursor.moveUp(42, {}); +cursor.moveUp(42, { moveToEndOfSelection: true }); + +cursor.moveDown(); +cursor.moveDown(42); +cursor.moveDown(42, {}); +cursor.moveDown(42, { moveToEndOfSelection: true }); + +cursor.moveLeft(); +cursor.moveLeft(42); +cursor.moveLeft(42, {}); +cursor.moveLeft(42, { moveToEndOfSelection: true }); + +cursor.moveRight(); +cursor.moveRight(42); +cursor.moveRight(42, {}); +cursor.moveRight(42, { moveToEndOfSelection: true }); + +cursor.moveToTop(); +cursor.moveToBottom(); +cursor.moveToBeginningOfScreenLine(); +cursor.moveToBeginningOfLine(); +cursor.moveToFirstCharacterOfLine(); +cursor.moveToEndOfScreenLine(); +cursor.moveToEndOfLine(); +cursor.moveToBeginningOfWord(); +cursor.moveToEndOfWord(); +cursor.moveToBeginningOfNextWord(); +cursor.moveToPreviousWordBoundary(); +cursor.moveToNextWordBoundary(); +cursor.moveToPreviousSubwordBoundary(); +cursor.moveToNextSubwordBoundary(); +cursor.skipLeadingWhitespace(); +cursor.moveToBeginningOfNextParagraph(); +cursor.moveToBeginningOfPreviousParagraph(); + +// Local Positions and Ranges +pos = cursor.getPreviousWordBoundaryBufferPosition(); +pos = cursor.getPreviousWordBoundaryBufferPosition({}); +pos = cursor.getPreviousWordBoundaryBufferPosition({ wordRegex: regExp }); + +cursor.getNextWordBoundaryBufferPosition(); +cursor.getNextWordBoundaryBufferPosition({ wordRegex: regExp }); + +cursor.getBeginningOfCurrentWordBufferPosition(); +cursor.getBeginningOfCurrentWordBufferPosition({}); +cursor.getBeginningOfCurrentWordBufferPosition({ wordRegex: regExp }); +cursor.getBeginningOfCurrentWordBufferPosition({ allowPrevious: true }); +cursor.getBeginningOfCurrentWordBufferPosition({ includeNonWordCharacters: true }); +cursor.getBeginningOfCurrentWordBufferPosition({ wordRegex: regExp, + allowPrevious: true, includeNonWordCharacters: true }); + +cursor.getEndOfCurrentWordBufferPosition(); +cursor.getEndOfCurrentWordBufferPosition({}); +cursor.getEndOfCurrentWordBufferPosition({ wordRegex: regExp }); +cursor.getEndOfCurrentWordBufferPosition({ includeNonWordCharacters: true }); +cursor.getEndOfCurrentWordBufferPosition({ wordRegex: regExp, includeNonWordCharacters: + true }); + +cursor.getBeginningOfNextWordBufferPosition(); +cursor.getBeginningOfNextWordBufferPosition({}); +cursor.getBeginningOfNextWordBufferPosition({ wordRegex: regExp }); + +cursor.getCurrentWordBufferRange(); +cursor.getCurrentWordBufferRange({}); +cursor.getCurrentWordBufferRange({ wordRegex: regExp }); + +cursor.getCurrentLineBufferRange(); +cursor.getCurrentLineBufferRange({}); +cursor.getCurrentLineBufferRange({ includeNewline: true }); + +range = cursor.getCurrentParagraphBufferRange(); +str = cursor.getCurrentWordPrefix(); + +// Comparing to another cursor +num = cursor.compare(cursor); + +// Utilities +cursor.clearSelection(); + +regExp = cursor.wordRegExp(); +regExp = cursor.wordRegExp({}); +regExp = cursor.wordRegExp({ includeNonWordCharacters: true }); + +regExp = cursor.subwordRegExp(); +regExp = cursor.subwordRegExp({}); +regExp = cursor.subwordRegExp({ backwards: true }); + +//// Decoration =============================================================== +// Construction and Destruction +decoration.destroy(); + +// Event Subscription +sub = decoration.onDidChangeProperties(event => { event.oldProperties.gutterName; }); +sub = decoration.onDidDestroy(() => {}); + +// Decoration Details +num = decoration.getId(); +displayMarker = decoration.getMarker(); + +// Properties +const decorationProps = decoration.getProperties(); + +decoration.setProperties(decorationProps); + +//// DeserializerManager ====================================================== +class StorableClass { + name: string; + + constructor() {} + deserialize() { return {}; } +} + +function isStorableClass(o: object): o is StorableClass { + if (typeof o === "object" && ( o).name && + ( o).name === "test") { + return true; + } else { + return false; } } -atom.deserializers.add(SampleView); +let serializable = new StorableClass(); +atom.deserializers.add(serializable); +const blob = atom.deserializers.deserialize({ name: "test" }); +if (blob && isStorableClass(blob)) serializable = blob; -export = SampleView; +//// Directory -- See 'pathwatcher' testing. +//// DisplayMarker -- See 'text-buffer' testing. +//// DisplayMarkerLayer -- See 'text-buffer' testing. +//// Disposable -- See 'event-kit' testing. +//// Dock ===================================================================== +// Methods +dock.activate(); +dock.show(); +dock.hide(); +dock.toggle(); +bool = dock.isVisible(); + +// Event Subscription +sub = dock.observePaneItems(() => {}); +sub = dock.onDidChangeActivePaneItem(() => {}); +sub = dock.onDidStopChangingActivePaneItem(() => {}); +sub = dock.observeActivePaneItem(() => {}); +sub = dock.onDidAddPane(event => event.pane.activate()); +sub = dock.onWillDestroyPane(event => event.pane); +sub = dock.onDidDestroyPane(event => event.pane); +sub = dock.observePanes(pane => pane.activate()); +sub = dock.onDidChangeActivePane(pane => pane.activate()); +sub = dock.observeActivePane(pane => pane.activate()); +sub = dock.onDidAddPaneItem(event => event.index && event.item && event.pane); +sub = dock.onWillDestroyPaneItem(event => event.index && event.item && event.pane); +sub = dock.onDidDestroyPaneItem(event => event.index && event.item && event.pane); + +// Pane Items +objs = dock.getPaneItems(); +obj = dock.getActivePaneItem(); + +// Panes +panes = dock.getPanes(); +pane = dock.getActivePane(); +bool = dock.activateNextPane(); +bool = dock.activatePreviousPane(); + +//// Emitter -- See 'event-kit' testing. +//// File -- See 'pathwatcher' testing. +//// GitRepository ============================================================ +// Construction and Destruction +repository = new GitRepository("Test"); +repository = new GitRepository("Test", {}); +repository = new GitRepository("Test", { refreshOnWindowFocus: true }); +repository = new GitRepository("Test", { config: atom.config }); +repository = new GitRepository("Test", { project: atom.project }); +repository = new GitRepository("Test", { refreshOnWindowFocus: false, config: atom.config, + project: atom.project }); +repository.destroy(); +bool = repository.isDestroyed(); + +// Event Subscription +sub = repository.onDidDestroy(() => {}); +sub = repository.onDidChangeStatus(event => event.path && event.pathStatus); +sub = repository.onDidChangeStatuses(() => {}); + +// Repository Details +repository.getType(); +str = repository.getPath(); +str = repository.getWorkingDirectory(); +bool = repository.isProjectAtRoot(); +str = repository.relativize(); +bool = repository.hasBranch("master"); + +str = repository.getShortHead(); +str = repository.getShortHead("test.path"); + +bool = repository.isSubmodule("test.path"); + +declare var aheadBehindCount: { ahead: number, behind: number }; +aheadBehindCount = repository.getAheadBehindCount("ref"); +aheadBehindCount = repository.getAheadBehindCount("ref", "test.path"); + +aheadBehindCount = repository.getCachedUpstreamAheadBehindCount(); +aheadBehindCount = repository.getCachedUpstreamAheadBehindCount("test.path"); + +str = repository.getConfigValue("username"); +str = repository.getConfigValue("username", "test.path"); + +str = repository.getOriginURL(); +str = repository.getOriginURL("test.path"); + +let upstreamBranch = repository.getUpstreamBranch(); +if (upstreamBranch) { + str = upstreamBranch; +} + +upstreamBranch = repository.getUpstreamBranch("test.path"); +if (upstreamBranch) { + str = upstreamBranch; +} + +declare var gitReferences: { heads: string[], remotes: string[], tags: string[] }; +gitReferences = repository.getReferences(); +gitReferences = repository.getReferences("test.path"); + +str = repository.getReferenceTarget("ref"); +str = repository.getReferenceTarget("ref", "test.path"); + +// Reading Status +bool = repository.isPathModified("file.path"); +bool = repository.isPathNew("file.path"); +bool = repository.isPathIgnored("file.path"); +num = repository.getDirectoryStatus("file.path"); +num = repository.getPathStatus("file.path"); + +const cachedPathStatus = repository.getCachedPathStatus("file.path"); +if (cachedPathStatus) { + num = cachedPathStatus; +} + +bool = repository.isStatusModified(42); +bool = repository.isStatusNew(42); + +// Retrieving Diffs +declare var diffStats: { added: number, deleted: number }; +diffStats = repository.getDiffStats("file.path"); + +declare var lineDiffs: Array<{ oldStart: number, newStart: number, oldLines: number, + newLines: number }>; +lineDiffs = repository.getLineDiffs("file.path", "contents"); + +// Checking Out +bool = repository.checkoutHead("file.path"); +bool = repository.checkoutReference("ref", true); + +//// Grammar -- See 'first-mate' testing. +//// GrammarRegistry -- See 'first-mate' testing. +//// Gutter =================================================================== +// Gutter Destruction +gutter.destroy(); + +// Event Subscription +sub = gutter.onDidChangeVisible(gutter => gutter.isVisible()); +sub = gutter.onDidDestroy(() => {}); + +// Visibility +gutter.hide(); +gutter.show(); +bool = gutter.isVisible(); +decoration = gutter.decorateMarker(displayMarker, { type: "line-number" }); + +//// HistoryManager =========================================================== +historyPaths = atom.history.getProjects(); +atom.history.clearProjects(); +sub = atom.history.onDidChangeProjects(() => {}); + +//// KeymapManager -- See 'atom-keymap' testing. +//// LayerDecoration ========================================================== +layerDecoration.destroy(); +bool = layerDecoration.isDestroyed(); +layerDecoration.getProperties(); +declare let decorationLayerProps: Atom.Structures.DecorationLayerProps; +layerDecoration.setProperties(decorationLayerProps); +layerDecoration.setPropertiesForMarker(marker, { type: "line", class: "test-class" }); + +//// MarkerLayer -- See 'text-buffer' testing. +//// MenuManager ============================================================== +sub = atom.menu.add([ + { + label: "Hello", + submenu : [{ label: "World!", command: "hello:world" }], + }, +]); +atom.menu.update(); + +//// Notification ============================================================= +notification = new Notification("fatal", "Test"); +notification = new Notification("success", "Test", {}); +notification = new Notification("info", "Test", { + buttons: [ + { className: "Test", text: "Test", onDidClick: () => {}}, + ], + description: "Test", + detail: "Test", + dismissable: false, + icon: "Test", +}); + +// Event Subscription +sub = notification.onDidDismiss(notification => notification.dismissed); +sub = notification.onDidDisplay(notification => notification.timestamp); + +// Methods +str = notification.getType(); +str = notification.getMessage(); + +// Extended Methods +notification.dismiss(); + +//// NotificationManager ====================================================== +// Events +atom.notifications.onDidAddNotification(notification => notification.dismiss()); + +// Adding Notifications +atom.notifications.addSuccess("Test"); +atom.notifications.addSuccess("Test", {}); +atom.notifications.addSuccess("Test", { + description: "Desc", + detail: "Details", + dismissable: true, + icon: "Icon", + buttons: [{ + text: "Button", + onDidClick: () => {}, + className: "test-class", + }], +}); + +atom.notifications.addInfo("Test"); +atom.notifications.addInfo("Test", {}); +atom.notifications.addInfo("Test", { description: "Desc" }); + +atom.notifications.addWarning("Test"); +atom.notifications.addWarning("Test", {}); +atom.notifications.addWarning("Test", { description: "Desc" }); + +atom.notifications.addError("Test"); +atom.notifications.addError("Test", {}); +atom.notifications.addError("Test", { stack: "Stack" }); + +atom.notifications.addFatalError("Test"); +atom.notifications.addFatalError("Test", {}); +atom.notifications.addFatalError("Test", { stack: "Stack" }); + +// Getting Notifications +notifications = atom.notifications.getNotifications(); + +//// Package ================================================================== +// Event Subscription +pack.onDidDeactivate(() => {}); + +// Native Module Compatibility +bool = pack.isCompatible(); +declare let exitInfo: Promise<{ code: number, stderr: string, stdout: string }>; +exitInfo = pack.rebuild(); + +const buildFailureOutput = pack.getBuildFailureOutput(); +if (buildFailureOutput) { + str = buildFailureOutput; +} + +//// PackageManager ===========================================================\ +// Event Subscription +sub = atom.packages.onDidLoadInitialPackages(() => {}); +sub = atom.packages.onDidActivateInitialPackages(() => {}); +sub = atom.packages.onDidActivatePackage(pack => pack.name); +sub = atom.packages.onDidDeactivatePackage(pack => pack.path); +sub = atom.packages.onDidLoadPackage(pack => pack.isCompatible()); +sub = atom.packages.onDidUnloadPackage(pack => pack.bundledPackage); + +// Package system data +str = atom.packages.getApmPath(); +strs = atom.packages.getPackageDirPaths(); + +// General package data +const packagePath = atom.packages.resolvePackagePath("Test"); +if (packagePath) { + str = packagePath; +} + +bool = atom.packages.isBundledPackage("Test"); + +// Enabling and disabling packages +let potentialPack = atom.packages.enablePackage("Test"); +if (potentialPack) { + pack = potentialPack; +} + +potentialPack = atom.packages.disablePackage("Test"); +if (potentialPack) { + pack = potentialPack; +} + +bool = atom.packages.isPackageDisabled("Test"); + +// Accessing active packages +packs = atom.packages.getActivePackages(); + +potentialPack = atom.packages.getActivePackage("Test"); +if (potentialPack) { + pack = potentialPack; +} + +bool = atom.packages.isPackageActive("Test"); +bool = atom.packages.hasActivatedInitialPackages(); + +// Accessing loaded packages +packs = atom.packages.getLoadedPackages(); + +potentialPack = atom.packages.getLoadedPackage("Test"); +if (potentialPack) { + pack = potentialPack; +} + +bool = atom.packages.isPackageLoaded("Test"); +bool = atom.packages.hasLoadedInitialPackages(); + +// Accessing available packages +strs = atom.packages.getAvailablePackagePaths(); +strs = atom.packages.getAvailablePackageNames(); +strs = atom.packages.getAvailablePackageMetadata(); + +//// Pane ===================================================================== +// Event Subscription +sub = pane.onDidChangeFlexScale(scale => num = scale); +sub = pane.observeFlexScale(scale => num = scale); +sub = pane.onDidActivate(() => {}); +sub = pane.onWillDestroy(() => {}); +sub = pane.onDidDestroy(() => {}); +sub = pane.onDidChangeActive(active => bool = active); +sub = pane.observeActive(active => bool = active); +sub = pane.onDidAddItem(event => event.index && event.item); +sub = pane.onDidRemoveItem(event => event.index && event.item); +sub = pane.onWillRemoveItem(event => event.index && event.item); +sub = pane.onDidMoveItem(event => event.item && event.oldIndex && event.newIndex); +sub = pane.observeItems((item) => {}); +sub = pane.onDidChangeActiveItem((item) => {}); +sub = pane.onChooseNextMRUItem((item) => {}); +sub = pane.onChooseLastMRUItem((item) => {}); +sub = pane.onDoneChoosingMRUItem(() => {}); +sub = pane.observeActiveItem((item) => {}); +sub = pane.onWillDestroyItem(event => event.index && event.item); + +// Items +objs = pane.getItems(); +obj = pane.getActiveItem(); + +let potentialItem = pane.itemAtIndex(42); +if (potentialItem) { + obj = potentialItem; +} + +pane.activateNextItem(); +pane.activatePreviousItem(); +pane.moveItemRight(); +pane.moveItemLeft(); +num = pane.getActiveItemIndex(); +pane.activateItemAtIndex(42); + +pane.activateItem(element); +pane.activateItem(element, { pending: true }); + +obj = pane.addItem(element); +obj = pane.addItem(element, {}); +obj = pane.addItem(element, { pending: true }); +obj = pane.addItem(element, { index: 42 }); +obj = pane.addItem(element, { pending: true, index: 42 }); + +objs = pane.addItems(objs); +objs = pane.addItems(objs, 42); + +pane.moveItem(element, 42); +pane.moveItemToPane(element, pane, 42); +pane.destroyActiveItem(); + +pane.destroyItem(element); +pane.destroyItem(element, true); + +pane.destroyItems(); +pane.destroyInactiveItems(); +pane.saveActiveItem(); +pane.saveActiveItemAs(() => {}); +pane.saveItem(element, () => {}); +pane.saveItemAs(element, () => {}); +pane.saveItems(); + +potentialItem = pane.itemForURI("https://test"); +if (potentialItem) { + obj = potentialItem; +} + +bool = pane.activateItemForURI("https://test"); + +// Lifecycle +bool = pane.isActive(); +pane.activate(); +pane.destroy(); +bool = pane.isDestroyed(); + +// Splitting +pane = pane.splitLeft(); +pane = pane.splitLeft({}); +pane = pane.splitLeft({ copyActiveItem: true }); +pane = pane.splitLeft({ items: elements }); +pane = pane.splitLeft({ copyActiveItem: true, items: elements }); + +pane = pane.splitRight(); +pane = pane.splitRight({}); +pane = pane.splitRight({ copyActiveItem: true }); +pane = pane.splitRight({ items: elements }); +pane = pane.splitRight({ copyActiveItem: true, items: elements }); + +pane = pane.splitUp(); +pane = pane.splitUp({}); +pane = pane.splitUp({ copyActiveItem: true }); +pane = pane.splitUp({ items: elements }); +pane = pane.splitUp({ copyActiveItem: true, items: elements }); + +pane = pane.splitDown(); +pane = pane.splitDown({}); +pane = pane.splitDown({ copyActiveItem: true }); +pane = pane.splitDown({ items: elements }); +pane = pane.splitDown({ copyActiveItem: true, items: elements }); + +//// Panel ==================================================================== +// Methods +panel.destroy(); + +// Event Subscription +sub = panel.onDidChangeVisible(visible => bool = visible); +sub = panel.onDidDestroy(panel => bool = panel.isVisible()); + +// Panel Details +obj = panel.getItem(); +num = panel.getPriority(); +bool = panel.isVisible(); +panel.hide(); +panel.show(); + +//// Point -- See 'text-buffer' testing. +//// Project ================================================================== +// Event Subscription +sub = project.onDidChangePaths(paths => paths.length); +sub = project.onDidAddBuffer(buffer => buffer.id); +sub = project.observeBuffers(buffer => buffer.file); + +// Accessing the git repository +repositories = project.getRepositories(); + +async function getDirectoryRepo() { + const potentialRepo = await project.repositoryForDirectory(dir); + if (potentialRepo) repository = potentialRepo; +} + +// Managing Paths +strs = project.getPaths(); +project.setPaths(["a", "b"]); +project.addPath("Test"); +project.removePath("Test"); +dirs = project.getDirectories(); + +const [projectPath, relativePath] = project.relativizePath("Test"); +if (projectPath) { + str = projectPath; +} +str = relativePath; + +bool = project.contains("Test"); + +//// Range -- See 'text-buffer' testing. +//// ScopeDescriptor ========================================================== +strs = scopeDescriptor.getScopesArray(); + +//// Selection ================================================================ +// Event Subscription +sub = selection.onDidChangeRange(event => event.newBufferRange && event.oldBufferRange && + event.newScreenRange && event.oldScreenRange && event.selection); +sub = selection.onDidDestroy(() => {}); + +// Managing the selection range +range = selection.getScreenRange(); + +selection.setScreenRange(range); +selection.setScreenRange([pos, pos]); +selection.setScreenRange([pos, [0, 0]]); +selection.setScreenRange([[0, 0], pos]); +selection.setScreenRange([[0, 0], [0, 0]]); +selection.setScreenRange([[0, 0], [0, 0]], {}); +selection.setScreenRange(range, { autoscroll: true, preserveFolds: false }); +selection.setScreenRange([pos, pos], { autoscroll: true }); + +range = selection.getBufferRange(); + +selection.setBufferRange(range); +selection.setBufferRange([pos, pos]); +selection.setBufferRange([pos, [0, 0]]); +selection.setBufferRange([[0, 0], pos]); +selection.setBufferRange([[0, 0], [0, 0]]); +selection.setBufferRange([[0, 0], [0, 0]], {}); +selection.setBufferRange(range, { autoscroll: true, preserveFolds: false }); +selection.setBufferRange([pos, pos], { autoscroll: true }); + +const [startingRow, endingRow ]: [number, number] = selection.getBufferRowRange(); + +// Info about the selection +bool = selection.isEmpty(); +bool = selection.isReversed(); +bool = selection.isSingleScreenLine(); +str = selection.getText(); +bool = selection.intersectsBufferRange(range); // Not range-compatible. +bool = selection.intersectsWith(selection); + +// Modifying the selected range +selection.clear(); +selection.clear({}); +selection.clear({ autoscroll: false }); + +selection.selectToScreenPosition(pos); +selection.selectToScreenPosition([0, 0]); + +selection.selectToBufferPosition(pos); +selection.selectToBufferPosition([0, 0]); + +selection.selectRight(); +selection.selectRight(42); + +selection.selectLeft(); +selection.selectLeft(42); + +selection.selectUp(); +selection.selectUp(42); + +selection.selectDown(); +selection.selectDown(42); + +selection.selectToTop(); +selection.selectToBottom(); +selection.selectAll(); +selection.selectToBeginningOfLine(); +selection.selectToFirstCharacterOfLine(); +selection.selectToEndOfLine(); +selection.selectToEndOfBufferLine(); +selection.selectToBeginningOfWord(); +selection.selectToEndOfWord(); +selection.selectToBeginningOfNextWord(); +selection.selectToPreviousWordBoundary(); +selection.selectToNextWordBoundary(); +selection.selectToPreviousSubwordBoundary(); +selection.selectToNextSubwordBoundary(); +selection.selectToBeginningOfNextParagraph(); +selection.selectToBeginningOfPreviousParagraph(); +selection.selectWord(); +selection.expandOverWord(); +selection.selectLine(42); +selection.expandOverLine(); + +// Modifying the selected text +selection.insertText("Replacement"); +selection.insertText("Replacement", {}); +selection.insertText("Replacement", { select: true }); +selection.insertText("Replacement", { autoIndent: true }); +selection.insertText("Replacement", { autoIndentNewline: true }); +selection.insertText("Replacement", { autoDecreaseIndent: true }); +selection.insertText("Replacement", { normalizeLineEndings: true }); +selection.insertText("Replacement", { undo: "skip" }); +selection.insertText("Replacement", { select: true, autoIndent: true, + autoIndentNewline: true, autoDecreaseIndent: true, normalizeLineEndings: true, + undo: "skip" }); + +selection.backspace(); +selection.deleteToPreviousWordBoundary(); +selection.deleteToNextWordBoundary(); +selection.deleteToBeginningOfWord(); +selection.deleteToBeginningOfLine(); +selection.delete(); +selection.deleteToEndOfLine(); +selection.deleteToEndOfWord(); +selection.deleteToBeginningOfSubword(); +selection.deleteToEndOfSubword(); +selection.deleteSelectedText(); +selection.deleteLine(); +selection.joinLines(); +selection.outdentSelectedRows(); +selection.autoIndentSelectedRows(); +selection.toggleLineComments(); +selection.cutToEndOfLine(); +selection.cutToEndOfBufferLine(); + +selection.cut(); +selection.cut(true); +selection.cut(true, true); + +selection.copy(); +selection.copy(true); +selection.copy(true, true); + +selection.fold(); +selection.indentSelectedRows(); + +// Managing multiple selections +selection.addSelectionBelow(); +selection.addSelectionAbove(); + +selection.merge(selection); +selection.merge(selection, {}); +selection.merge(selection, { preserveFolds: true }); +selection.merge(selection, { autoscroll: true }); +selection.merge(selection, { preserveFolds: true, autoscroll: true }); + +// Comparing to other selections +num = selection.compare(selection); + +//// StyleManager ============================================================= +// Event Subscription +sub = styleManager.observeStyleElements(styleElement => styleElement.context); +sub = styleManager.onDidAddStyleElement(styleElement => styleElement.sourcePath); +sub = styleManager.onDidRemoveStyleElement(styleElement => styleElement.onkeydown); +sub = styleManager.onDidUpdateStyleElement(styleElement => styleElement.sourcePath); + +// Reading Style Elements +const styleElements: HTMLStyleElement[] = styleManager.getStyleElements(); + +// Paths +str = styleManager.getUserStyleSheetPath(); + +//// Task ===================================================================== +let task: Atom.Task = Task.once("File.path", {}, () => {}); +task = new Task("File.path"); + +task.start({}, () => {}); +task.send("test-message"); +sub = task.on("test-message", () => {}); +task.terminate(); +task.cancel(); + +//// TextBuffer -- See 'text-buffer' testing. +//// TextEditor =============================================================== +// Event Subscription +sub = editor.onDidChangeTitle(title => str = title.charAt(0)); +sub = editor.onDidChangePath(path => str = path.charAt(0)); + +sub = editor.onDidChange(changes => { + for (const change of changes) { + change.newExtent; + change.oldExtent; + change.start; + } +}); + +sub = editor.onDidStopChanging(event => { + for (const change of event.changes) { + change.newExtent && change.oldExtent && change.newRange && change.oldRange && + change.newText && change.oldText && change.start; + } +}); + +sub = editor.onDidChangeCursorPosition(event => event.newBufferPosition); +sub = editor.onDidChangeSelectionRange(event => event.selection); +sub = editor.onDidSave(event => event.path); +sub = editor.onDidDestroy(() => {}); +sub = editor.observeGutters(gutter => gutter.show()); +sub = editor.onDidAddGutter(gutter => gutter.hide()); +sub = editor.onDidRemoveGutter(name => name.length); +sub = editor.onDidChangeSoftWrapped(softWrapped => {}); +sub = editor.onDidChangeEncoding(encoding => {}); +sub = editor.observeGrammar(grammar => grammar.name); +sub = editor.onDidChangeGrammar(grammar => grammar.scopeName); +sub = editor.onDidChangeModified(modified => {}); +sub = editor.onDidConflict(() => {}); +sub = editor.onWillInsertText(event => event.cancel && event.text); +sub = editor.onDidInsertText(event => event.text); +sub = editor.observeCursors(cursor => cursor.moveToBottom()); +sub = editor.onDidAddCursor(cursor => cursor.getMarker()); +sub = editor.onDidRemoveCursor(cursor => cursor.compare(cursor)); +sub = editor.observeSelections(selection => selection.cutToEndOfBufferLine()); +sub = editor.onDidAddSelection(selection => selection.selectWord()); +sub = editor.onDidRemoveSelection(selection => selection.toggleLineComments()); +sub = editor.observeDecorations(decoration => decoration.getId()); +sub = editor.onDidAddDecoration(decoration => decoration.id); +sub = editor.onDidRemoveDecoration(decoration => decoration.getId()); +sub = editor.onDidChangePlaceholderText(placeholderText => + placeholderText.toLowerCase()); +buffer = editor.getBuffer(); + +// File Details +str = editor.getTitle(); +str = editor.getLongTitle(); + +const filePath = editor.getPath(); +if (filePath) { + str = filePath; +} + +bool = editor.isModified(); +bool = editor.isEmpty(); +str = editor.getEncoding(); +editor.setEncoding("utf8"); + +// File Operations +editor.save(); +editor.saveAs("test.file"); + +// Reading Text +str = editor.getText(); +str = editor.getTextInBufferRange(range); +num = editor.getLineCount(); +num = editor.getScreenLineCount(); +num = editor.getLastBufferRow(); +num = editor.getLastScreenRow(); +str = editor.lineTextForBufferRow(42); +str = editor.lineTextForScreenRow(42); +range = editor.getCurrentParagraphBufferRange(); + +// Mutating Text +editor.setText("Test"); + +editor.setTextInBufferRange(range, "Test"); +editor.setTextInBufferRange([pos, pos], "Test"); +editor.setTextInBufferRange([pos, [0, 0]], "Test"); +editor.setTextInBufferRange([[0, 0], pos], "Test"); +editor.setTextInBufferRange([[0, 0], [0, 0]], "Test"); +editor.setTextInBufferRange(range, "Test", {}); +editor.setTextInBufferRange([pos, pos], "Test", { normalizeLineEndings: true }); +editor.setTextInBufferRange(range, "Test", { normalizeLineEndings: true, + undo: "skip" }); + +editor.insertText("Test"); +editor.insertText("Test", {}); +editor.insertText("Test", { autoDecreaseIndent: true }); +editor.insertText("Test", { autoIndent: true }); +editor.insertText("Test", { autoIndentNewline: true }); +editor.insertText("Test", { normalizeLineEndings: true }); +editor.insertText("Test", { select: true }); +editor.insertText("Test", { undo: "skip" }); +editor.insertText("Text", { autoDecreaseIndent: false, autoIndent: false, + autoIndentNewline: false, normalizeLineEndings: false, select: false, undo: "skip" }); + +editor.insertNewline(); +editor.delete(); +editor.backspace(); +editor.mutateSelectedText((selection, index) => { selection.clear(); }); +editor.transpose(); +editor.upperCase(); +editor.lowerCase(); +editor.toggleLineCommentsInSelection(); +editor.insertNewlineBelow(); +editor.insertNewlineAbove(); +editor.deleteToBeginningOfWord(); +editor.deleteToPreviousWordBoundary(); +editor.deleteToNextWordBoundary(); +editor.deleteToBeginningOfSubword(); +editor.deleteToEndOfSubword(); +editor.deleteToBeginningOfLine(); +editor.deleteToEndOfLine(); +editor.deleteToEndOfWord(); +editor.deleteLine(); + +// History +editor.undo(); +editor.redo(); + +editor.transact(() => {}); +editor.transact(42, () => {}); + +editor.abortTransaction(); +num = editor.createCheckpoint(); +bool = editor.revertToCheckpoint(42); +bool = editor.groupChangesSinceCheckpoint(42); + +// TextEditor Coordinates +pos = editor.screenPositionForBufferPosition(pos); +pos = editor.screenPositionForBufferPosition([0, 0]); +pos = editor.screenPositionForBufferPosition(pos, {}); +pos = editor.screenPositionForBufferPosition(pos, { clipDirection: "backward" }); +pos = editor.screenPositionForBufferPosition([0, 0], { clipDirection: "forward" }); + +pos = editor.bufferPositionForScreenPosition(pos); +pos = editor.bufferPositionForScreenPosition([0, 0]); +pos = editor.bufferPositionForScreenPosition(pos, {}); +pos = editor.bufferPositionForScreenPosition(pos, { clipDirection: "backward" }); +pos = editor.bufferPositionForScreenPosition([0, 0], { clipDirection: "forward" }); + +range = editor.screenRangeForBufferRange(range); +range = editor.screenRangeForBufferRange([pos, pos]); +range = editor.screenRangeForBufferRange([pos, [0, 0]]); +range = editor.screenRangeForBufferRange([[0, 0], pos]); +range = editor.screenRangeForBufferRange([[0, 0], [0, 0]]); + +range = editor.bufferRangeForScreenRange(range); +range = editor.bufferRangeForScreenRange([pos, pos]); +range = editor.bufferRangeForScreenRange([pos, [0, 0]]); +range = editor.bufferRangeForScreenRange([[0, 0], pos]); +range = editor.bufferRangeForScreenRange([[0, 0], [0, 0]]); + +pos = editor.clipBufferPosition(pos); +pos = editor.clipBufferPosition([0, 0]); + +range = editor.clipBufferRange(range); +range = editor.clipBufferRange([pos, pos]); +range = editor.clipBufferRange([pos, [0, 0]]); +range = editor.clipBufferRange([[0, 0], pos]); +range = editor.clipBufferRange([[0, 0], [0, 0]]); + +pos = editor.clipScreenPosition(pos); +pos = editor.clipScreenPosition([0, 0]); +pos = editor.clipScreenPosition(pos, {}); +pos = editor.clipScreenPosition(pos, { clipDirection: "closest" }); +pos = editor.clipScreenPosition([0, 0], { clipDirection: "closest" }); + +range = editor.clipScreenRange(range); +range = editor.clipScreenRange([pos, pos]); +range = editor.clipScreenRange([pos, [0, 0]]); +range = editor.clipScreenRange([[0, 0], pos]); +range = editor.clipScreenRange([[0, 0], [0, 0]]); +range = editor.clipScreenRange(range, {}); +range = editor.clipScreenRange(range, { clipDirection: "closest" }); +range = editor.clipScreenRange([pos, pos], { clipDirection: "closest" }); + +// Decorations +decoration = editor.decorateMarker(displayMarker, { type: "line" }); +decoration = editor.decorateMarker(displayMarker, { type: "line", avoidOverflow: true, + class: "test-class", gutterName: "gutterName", item: element, onlyEmpty: true, + onlyHead: true, onlyNonEmpty: true, position: "before" }); + +layerDecoration = editor.decorateMarkerLayer(displayMarkerLayer, { type: "line-number" }); +layerDecoration = editor.decorateMarkerLayer(displayMarkerLayer, { type: "line-number", + avoidOverflow: false, class: "test-class", item: element, onlyEmpty: false, onlyHead: false, + onlyNonEmpty: false, position: "after" }); + +decorations = editor.getDecorations(); +decorations = editor.getDecorations({}); +decorations = editor.getDecorations({ type: "line-number" }); +decorations = editor.getDecorations({ type: "line", avoidOverflow: true, + class: "test-class", gutterName: "gutterName", item: element, onlyEmpty: true, + onlyHead: true, onlyNonEmpty: true, position: "before" }); + +decorations = editor.getLineDecorations(); +decorations = editor.getLineDecorations({}); +decorations = editor.getLineDecorations({ avoidOverflow: true }); +decorations = editor.getLineDecorations({ avoidOverflow: true, class: "test-class", + item: element, onlyEmpty: true, onlyHead: true, onlyNonEmpty: true, + position: "before" }); + +decorations = editor.getLineNumberDecorations(); +decorations = editor.getLineNumberDecorations({}); +decorations = editor.getLineNumberDecorations({ onlyHead: true }); +decorations = editor.getLineNumberDecorations({ avoidOverflow: true, + class: "test-class", gutterName: "gutterName", item: element, onlyEmpty: true, + onlyHead: true, onlyNonEmpty: true, position: "before" }); + +decorations = editor.getHighlightDecorations(); +decorations = editor.getHighlightDecorations({}); +decorations = editor.getHighlightDecorations({ onlyHead: true }); +decorations = editor.getHighlightDecorations({ avoidOverflow: true, + class: "test-class", item: element, onlyEmpty: true, onlyHead: true, onlyNonEmpty: true, + position: "before" }); + +decorations = editor.getOverlayDecorations(); +decorations = editor.getOverlayDecorations({}); +decorations = editor.getOverlayDecorations({ onlyHead: true }); +decorations = editor.getOverlayDecorations({ avoidOverflow: true, + class: "test-class", item: element, onlyEmpty: true, onlyHead: true, onlyNonEmpty: true, + position: "before" }); + +// Markers +displayMarker = editor.markBufferRange(range); +displayMarker = editor.markBufferRange([pos, pos]); +displayMarker = editor.markBufferRange([pos, [0, 0]]); +displayMarker = editor.markBufferRange([[0, 0], pos]); +displayMarker = editor.markBufferRange([[0, 0], [0, 0]]); +displayMarker = editor.markBufferRange(range, {}); +displayMarker = editor.markBufferRange(range, { invalidate: "surround" }); +displayMarker = editor.markBufferRange(range, { maintainHistory: true }); +displayMarker = editor.markBufferRange(range, { reversed: true }); +displayMarker = editor.markBufferRange([[0, 0], [0, 0]], { invalidate: "overlap" }); +displayMarker = editor.markBufferRange(range, { invalidate: "surround", + maintainHistory: false, reversed: false }); + +displayMarker = editor.markBufferPosition(pos); +displayMarker = editor.markBufferPosition([0, 0]); +displayMarker = editor.markBufferPosition(pos, {}); +displayMarker = editor.markBufferPosition(pos, { invalidate: "never" }); +displayMarker = editor.markBufferPosition([0, 0], { invalidate: "surround" }); + +displayMarker = editor.markScreenPosition(pos); +displayMarker = editor.markScreenPosition([0, 0]); +displayMarker = editor.markScreenPosition(pos, {}); +displayMarker = editor.markScreenPosition(pos, { invalidate: "never" }); +displayMarker = editor.markScreenPosition(pos, { clipDirection: "forward" }); +displayMarker = editor.markScreenPosition([0, 0], { invalidate: "surround", + clipDirection: "backward" }); + +displayMarkers = editor.findMarkers({ startBufferRow: 42 }); +displayMarkers = editor.findMarkers({ endBufferRow: 42 }); +displayMarkers = editor.findMarkers({ containsBufferRange: range }); +displayMarkers = editor.findMarkers({ containsBufferRange: [pos, pos] }); +displayMarkers = editor.findMarkers({ containsBufferRange: [pos, [0, 0]] }); +displayMarkers = editor.findMarkers({ containsBufferRange: [[0, 0], pos] }); +displayMarkers = editor.findMarkers({ containsBufferRange: [[0, 0], [0, 0]] }); +displayMarkers = editor.findMarkers({ containsBufferPosition: pos }); +displayMarkers = editor.findMarkers({ containsBufferPosition: [42, 42] }); +displayMarkers = editor.findMarkers({ + startBufferPosition: pos, + endBufferPosition: pos, + startScreenPosition: pos, + endScreenPosition: pos, + startsInBufferRange: range, + endsInBufferRange: range, + startsInScreenRange: range, + endsInScreenRange: range, + startBufferRow: 42, + endBufferRow: 42, + startScreenRow: 42, + endScreenRow: 42, + intersectsBufferRowRange: [42, 42], + intersectsScreenRowRange: [42, 42], + containsBufferRange: range, + containsBufferPosition: pos, + containedInBufferRange: range, + containedInScreenRange: range, + intersectsBufferRange: range, + intersectsScreenRange: range, +}); + +displayMarkerLayer = editor.addMarkerLayer(); +displayMarkerLayer = editor.addMarkerLayer({}); +displayMarkerLayer = editor.addMarkerLayer({ maintainHistory: true }); +displayMarkerLayer = editor.addMarkerLayer({ persistent: true }); +displayMarkerLayer = editor.addMarkerLayer({ maintainHistory: true, persistent: true }); + +const potentialMarkerLayer = editor.getMarkerLayer(42); +if (potentialMarkerLayer) { + displayMarkerLayer = potentialMarkerLayer; +} + +displayMarkerLayer = editor.getDefaultMarkerLayer(); +displayMarker = editor.getMarker(42); +displayMarkers = editor.getMarkers(); +num = editor.getMarkerCount(); + +// Cursors +pos = editor.getCursorBufferPosition(); +posArr = editor.getCursorBufferPositions(); + +editor.setCursorBufferPosition(pos); +editor.setCursorBufferPosition(pos, {}); +editor.setCursorBufferPosition(pos, { autoscroll: true }); +editor.setCursorBufferPosition([0, 0], { autoscroll: true }); + +let potentialCursor = editor.getCursorAtScreenPosition(pos); +if (potentialCursor) { + cursor = potentialCursor; +} + +potentialCursor = editor.getCursorAtScreenPosition([0, 0]); +if (potentialCursor) { + cursor = potentialCursor; +} + +pos = editor.getCursorScreenPosition(); +posArr = editor.getCursorScreenPositions(); + +editor.setCursorScreenPosition(pos); +editor.setCursorScreenPosition([0, 0]); +editor.setCursorScreenPosition(pos, {}); +editor.setCursorBufferPosition(pos, { autoscroll: true }); + +cursor = editor.addCursorAtBufferPosition(pos); +cursor = editor.addCursorAtBufferPosition([0, 0]); + +cursor = editor.addCursorAtScreenPosition(pos); +cursor = editor.addCursorAtScreenPosition([0, 0]); + +bool = editor.hasMultipleCursors(); + +editor.moveUp(); +editor.moveUp(42); + +editor.moveDown(); +editor.moveDown(42); + +editor.moveLeft(); +editor.moveLeft(42); + +editor.moveRight(); +editor.moveRight(42); + +editor.moveToBeginningOfLine(); +editor.moveToBeginningOfScreenLine(); +editor.moveToFirstCharacterOfLine(); +editor.moveToEndOfLine(); +editor.moveToEndOfScreenLine(); +editor.moveToBeginningOfWord(); +editor.moveToEndOfWord(); +editor.moveToTop(); +editor.moveToBottom(); +editor.moveToBeginningOfNextWord(); +editor.moveToPreviousWordBoundary(); +editor.moveToNextWordBoundary(); +editor.moveToPreviousSubwordBoundary(); +editor.moveToNextSubwordBoundary(); +editor.moveToBeginningOfNextParagraph(); +editor.moveToBeginningOfPreviousParagraph(); +cursor = editor.getLastCursor(); + +str = editor.getWordUnderCursor(); +str = editor.getWordUnderCursor({}); +str = editor.getWordUnderCursor({ allowPrevious: true }); +str = editor.getWordUnderCursor({ includeNonWordCharacters: true }); +str = editor.getWordUnderCursor({ wordRegex: /r/ }); +str = editor.getWordUnderCursor({ allowPrevious: true, includeNonWordCharacters: true, + wordRegex: /r/ }); + +cursors = editor.getCursors(); +cursors = editor.getCursorsOrderedByBufferPosition(); + +// Selections +str = editor.getSelectedText(); +range = editor.getSelectedBufferRange(); +ranges = editor.getSelectedBufferRanges(); + +editor.setSelectedBufferRange(range); +editor.setSelectedBufferRange(range, {}); +editor.setSelectedBufferRange(range, { preserveFolds: true }); +editor.setSelectedBufferRange(range, { reversed: true }); +editor.setSelectedBufferRange(range, { preserveFolds: true, reversed: true }); +editor.setSelectedBufferRange([pos, pos]); +editor.setSelectedBufferRange([pos, [0, 0]]); +editor.setSelectedBufferRange([[0, 0], pos]); +editor.setSelectedBufferRange([[0, 0], [0, 0]]); + +editor.setSelectedBufferRanges(ranges); +editor.setSelectedBufferRanges([[pos, pos]]); +editor.setSelectedBufferRanges([[pos, [0, 0]]]); +editor.setSelectedBufferRanges([[[0, 0], pos]]); +editor.setSelectedBufferRanges([[[0, 0], [0, 0]]]); +editor.setSelectedBufferRanges(ranges, {}); +editor.setSelectedBufferRanges([[pos, pos]], {}); +editor.setSelectedBufferRanges(ranges, { reversed: true }); +editor.setSelectedBufferRanges([[pos, pos]], { preserveFolds: true }); +editor.setSelectedBufferRanges([[pos, pos]], { reversed: true, preserveFolds: true }); + +range = editor.getSelectedScreenRange(); +ranges = editor.getSelectedScreenRanges(); + +editor.setSelectedScreenRange(range); +editor.setSelectedScreenRange([pos, pos]); +editor.setSelectedScreenRange([pos, [0, 0]]); +editor.setSelectedScreenRange([[0, 0], pos]); +editor.setSelectedScreenRange([[0, 0], [0, 0]]); +editor.setSelectedScreenRange(range, {}); +editor.setSelectedScreenRange([pos, pos], {}); +editor.setSelectedScreenRange(range, { reversed: true }); +editor.setSelectedScreenRange([pos, pos], { reversed: true }); + +editor.setSelectedScreenRanges(ranges); +editor.setSelectedScreenRanges([[pos, pos]]); +editor.setSelectedScreenRanges([[pos, [0, 0]]]); +editor.setSelectedScreenRanges([[[0, 0], pos]]); +editor.setSelectedScreenRanges([[[0, 0], [0, 0]]]); +editor.setSelectedScreenRanges(ranges, {}); +editor.setSelectedScreenRanges([[pos, pos]], {}); +editor.setSelectedScreenRanges(ranges, { reversed: true }); +editor.setSelectedScreenRanges([[pos, pos]], { reversed: true }); + +selection = editor.addSelectionForBufferRange(range); +selection = editor.addSelectionForBufferRange([pos, pos]); +selection = editor.addSelectionForBufferRange([pos, [0, 0]]); +selection = editor.addSelectionForBufferRange([[0, 0], pos]); +selection = editor.addSelectionForBufferRange([[0, 0], [0, 0]]); +selection = editor.addSelectionForBufferRange(range, {}); +selection = editor.addSelectionForBufferRange(range, { preserveFolds: true }); +selection = editor.addSelectionForBufferRange(range, { reversed: true }); +selection = editor.addSelectionForBufferRange(range, { preserveFolds: false, + reversed: false }); +selection = editor.addSelectionForBufferRange([pos, pos], { preserveFolds: false }); + +selection = editor.addSelectionForScreenRange(range); +selection = editor.addSelectionForScreenRange([pos, pos]); +selection = editor.addSelectionForScreenRange([pos, [0, 0]]); +selection = editor.addSelectionForScreenRange([[0, 0], pos]); +selection = editor.addSelectionForScreenRange([[0, 0], [0, 0]]); +selection = editor.addSelectionForScreenRange(range, {}); +selection = editor.addSelectionForScreenRange(range, { preserveFolds: true }); +selection = editor.addSelectionForScreenRange(range, { reversed: true }); +selection = editor.addSelectionForScreenRange(range, { preserveFolds: false, + reversed: false }); +selection = editor.addSelectionForScreenRange([pos, pos], { preserveFolds: false }); + +editor.selectToBufferPosition(pos); +editor.selectToScreenPosition(pos); + +editor.selectUp(); +editor.selectUp(42); + +editor.selectDown(); +editor.selectDown(42); + +editor.selectLeft(); +editor.selectLeft(42); + +editor.selectRight(); +editor.selectRight(42); + +editor.selectToTop(); +editor.selectToBottom(); +editor.selectAll(); +editor.selectToBeginningOfLine(); +editor.selectToFirstCharacterOfLine(); +editor.selectToEndOfLine(); +editor.selectToBeginningOfWord(); +editor.selectToEndOfWord(); +editor.selectLinesContainingCursors(); +editor.selectWordsContainingCursors(); +editor.selectToPreviousSubwordBoundary(); +editor.selectToNextSubwordBoundary(); +editor.selectToPreviousWordBoundary(); +editor.selectToNextWordBoundary(); +editor.selectToBeginningOfNextWord(); +editor.selectToBeginningOfNextParagraph(); +editor.selectToBeginningOfPreviousParagraph(); + +const potentialRange = editor.selectMarker(displayMarker); +if (potentialRange) { + range = potentialRange; +} + +selection = editor.getLastSelection(); +selections = editor.getSelections(); +selections = editor.getSelectionsOrderedByBufferPosition(); +bool = editor.selectionIntersectsBufferRange(range); // not range-compatible + +// Searching and Replacing +editor.scan(/r/, params => { + num = params.match.index; + str = params.matchText; + range = params.range; + params.replace("Test"); + params.stop(); +}); + +editor.scan(/r/, {}, () => {}); +editor.scan(/r/, { leadingContextLineCount: 42 }, () => {}); +editor.scan(/r/, { trailingContextLineCount: 42 }, () => {}); +editor.scan(/r/, { leadingContextLineCount: 42, trailingContextLineCount: 42 }, + () => {}); + +editor.scanInBufferRange(/r/, range, () => {}); +editor.scanInBufferRange(/r/, [pos, pos], () => {}); +editor.scanInBufferRange(/r/, [pos, [0, 0]], () => {}); +editor.scanInBufferRange(/r/, [[0, 0], pos], () => {}); +editor.scanInBufferRange(/r/, [[0, 0], [0, 0]], () => {}); +editor.scanInBufferRange(/r/, range, params => { + num = params.match.index; + str = params.matchText; + range = params.range; + params.replace("Test"); + params.stop(); +}); + +editor.backwardsScanInBufferRange(/r/, range, () => {}); +editor.backwardsScanInBufferRange(/r/, [pos, pos], () => {}); +editor.backwardsScanInBufferRange(/r/, [pos, [0, 0]], () => {}); +editor.backwardsScanInBufferRange(/r/, [[0, 0], pos], () => {}); +editor.backwardsScanInBufferRange(/r/, [[0, 0], [0, 0]], () => {}); +editor.backwardsScanInBufferRange(/r/, range, params => { + num = params.match.index; + str = params.matchText; + range = params.range; + params.replace("Test"); + params.stop(); +}); + +// Tab Behavior +bool = editor.getSoftTabs(); +editor.setSoftTabs(true); +bool = editor.toggleSoftTabs(); +num = editor.getTabLength(); +editor.setTabLength(42); + +const potentialBool = editor.usesSoftTabs(); +if (potentialBool) { + bool = potentialBool; +} + +str = editor.getTabText(); + +// Soft Wrap Behavior +bool = editor.isSoftWrapped(); +editor.setSoftWrapped(true); +bool = editor.toggleSoftWrapped(); +num = editor.getSoftWrapColumn(); + +// Indentation +num = editor.indentationForBufferRow(42); + +editor.setIndentationForBufferRow(42, 42); +editor.setIndentationForBufferRow(42, 42, {}); +editor.setIndentationForBufferRow(42, 42, { preserveLeadingWhitespace: true }); + +editor.indentSelectedRows(); +editor.outdentSelectedRows(); +num = editor.indentLevelForLine("Test"); +editor.autoIndentSelectedRows(); + +// Grammars +grammar = editor.getGrammar(); +editor.setGrammar(grammar); + +// Managing Syntax Scopes +scopeDescriptor = editor.getRootScopeDescriptor(); + +scopeDescriptor = editor.scopeDescriptorForBufferPosition(pos); +scopeDescriptor = editor.scopeDescriptorForBufferPosition([0, 0]); + +range = editor.bufferRangeForScopeAtCursor("selector"); +bool = editor.isBufferRowCommented(42); + +// Clipboard Operations +editor.copySelectedText(); +editor.cutSelectedText(); + +editor.pasteText(); +editor.pasteText({}); +editor.pasteText({ autoIndentNewline: true }); +editor.pasteText({ autoIndent: true }); +editor.pasteText({ autoDecreaseIndent: true }); +editor.pasteText({ normalizeLineEndings: true }); +editor.pasteText({ select: true }); +editor.pasteText({ undo: "skip" }); +editor.pasteText({ autoIndentNewline: true, autoIndent: true, autoDecreaseIndent: true, + normalizeLineEndings: true, select: true, undo: "skip" }); + +editor.cutToEndOfLine(); +editor.cutToEndOfBufferLine(); + +// Folds +editor.foldCurrentRow(); +editor.unfoldCurrentRow(); +editor.foldBufferRow(42); +editor.unfoldBufferRow(42); +editor.foldSelectedLines(); +editor.foldAll(); +editor.unfoldAll(); +editor.foldAllAtIndentLevel(42); +editor.isFoldableAtBufferRow(42); +editor.isFoldableAtScreenRow(42); +editor.toggleFoldAtBufferRow(42); +editor.isFoldedAtCursorRow(); +editor.isFoldedAtBufferRow(42); +editor.isFoldedAtScreenRow(42); + +// Gutters +editor.addGutter({ name: "Test" }); +editor.addGutter({ name: "Test", priority: 42 }); +editor.addGutter({ name: "Test", visible: true }); +editor.addGutter({ name: "Test", priority: 42, visible: true }); + +gutters = editor.getGutters(); + +const potentialGutter = editor.gutterWithName("test-gutter"); +if (potentialGutter) { + gutter = potentialGutter; +} + +editor.scrollToCursorPosition(); +editor.scrollToCursorPosition({}); +editor.scrollToCursorPosition({ center: true }); + +editor.scrollToBufferPosition(pos); +editor.scrollToBufferPosition([0, 0]); +editor.scrollToBufferPosition(pos, {}); +editor.scrollToBufferPosition([0, 0], {}); +editor.scrollToBufferPosition(pos, { center: true }); +editor.scrollToBufferPosition([0, 0], { center: true }); + +editor.scrollToScreenPosition(pos); +editor.scrollToScreenPosition([0, 0]); +editor.scrollToScreenPosition(pos, {}); +editor.scrollToScreenPosition([0, 0], {}); +editor.scrollToScreenPosition(pos, { center: true }); +editor.scrollToScreenPosition([0, 0], { center: true }); + +// TextEditor Rendering +str = editor.getPlaceholderText(); +editor.setPlaceholderText("Test"); + +//// ThemeManager ============================================================= +// Event Subscription +sub = atom.themes.onDidChangeActiveThemes(() => {}); + +// Accessing Loaded Themes +let potentialStrs = atom.themes.getLoadedThemeNames(); +if (potentialStrs) { + strs = potentialStrs; +} + +let potentialPacks = atom.themes.getLoadedThemes(); +if (potentialPacks) { + packs = potentialPacks; +} + +// Accessing Active Themes +potentialStrs = atom.themes.getActiveThemeNames(); +if (potentialStrs) { + strs = potentialStrs; +} + +potentialPacks = atom.themes.getActiveThemes(); +if (potentialPacks) { + packs = potentialPacks; +} + +// Managing Enabled Themes +strs = atom.themes.getEnabledThemeNames(); + +//// TooltipManager =========================================================== +sub = atom.tooltips.add(element, { title: "Test"}); +sub = atom.tooltips.add(element, { title: "

Test

", html: true }); +sub = atom.tooltips.add(element, { item: element}); +sub = atom.tooltips.add(element, { class: "test-class" }); +sub = atom.tooltips.add(element, { placement: "top" }); + +sub = atom.tooltips.add(element, { placement: () => "left" }); + +sub = atom.tooltips.add(element, { trigger: "click" }); +sub = atom.tooltips.add(element, { delay: { hide: 42, show: 42 }}); +sub = atom.tooltips.add(element, { keyBindingCommand: "test-command", + keyBindingTarget: element }); + +tooltips = atom.tooltips.findTooltips(element); + +//// ViewRegistry ============================================================= +atom.views.addViewProvider(Point, (point) => { + point.column; + return element; +}); + +element = atom.views.getView(element); + +//// Workspace ================================================================ +// Event Subscription +sub = atom.workspace.observeTextEditors(editor => editor.id); +sub = atom.workspace.observePaneItems((item) => {}); +sub = atom.workspace.onDidChangeActivePaneItem((item) => {}); +sub = atom.workspace.onDidStopChangingActivePaneItem((item) => {}); + +sub = atom.workspace.onDidChangeActiveTextEditor(editor => { + if (editor) { + editor.alive; + } +}); + +sub = atom.workspace.observeActivePaneItem((item) => {}); + +sub = atom.workspace.observeActiveTextEditor(editor => { + if (editor) { + editor.id; + } +}); + +sub = atom.workspace.onDidOpen(event => event.index && event.item && event.pane && + event.uri); +sub = atom.workspace.onDidAddPane(event => event.pane); +sub = atom.workspace.onWillDestroyPane(event => event.pane); +sub = atom.workspace.onDidDestroyPane(event => event.pane); +sub = atom.workspace.observePanes(pane => pane.activate()); +sub = atom.workspace.onDidChangeActivePane(pane => pane.activate()); +sub = atom.workspace.observeActivePane(pane => pane.activate()); +sub = atom.workspace.onDidAddPaneItem(event => event.index && event.item && event.pane); +sub = atom.workspace.onWillDestroyPaneItem(event => event.index && event.item && event.pane); +sub = atom.workspace.onDidDestroyPaneItem(event => event.index && event.item && event.pane); +sub = atom.workspace.onDidAddTextEditor(event => event.index && event.pane && + event.textEditor); + +// Opening +async function workspaceOpen() { + obj = await atom.workspace.open(); + obj = await atom.workspace.open("https://test"); + obj = await atom.workspace.open("https://test", { activateItem: true }); + obj = await atom.workspace.open("https://test", { activatePane: true }); + obj = await atom.workspace.open("https://test", { initialColumn: 42 }); + obj = await atom.workspace.open("https://test", { initialLine: 42 }); + obj = await atom.workspace.open("https://test", { location: "right" }); + obj = await atom.workspace.open("https://test", { split: "up" }); + obj = await atom.workspace.open("https://test", { pending: true }); + obj = await atom.workspace.open("https://test", { searchAllPanes: true }); + obj = await atom.workspace.open("https://test", { + activateItem: true, + activatePane: true, + initialColumn: 42, + initialLine: 42, + location: "left", + split: "left", + pending: true, + searchAllPanes: true, + }); +} + +bool = atom.workspace.hide("https://test"); +bool = atom.workspace.hide(element); + +async function workspaceToggle() { + await atom.workspace.toggle("https://test"); + await atom.workspace.toggle(element); +} + +obj = atom.workspace.createItemForURI("https://test"); + +bool = atom.workspace.isTextEditor(obj); + +async function workspaceReopen() { + const result = await atom.workspace.reopenItem(); + if (result) obj = result; +} + +atom.workspace.addOpener(() => element); + +atom.workspace.buildTextEditor(obj); + +// Pane Items +objs = atom.workspace.getPaneItems(); +obj = atom.workspace.getActivePaneItem(); +editors = atom.workspace.getTextEditors(); + +let potentialEditor = atom.workspace.getActiveTextEditor(); +if (potentialEditor) { + editor = potentialEditor; +} + +// Panes +paneContainer = atom.workspace.getActivePaneContainer(); +panes = atom.workspace.getPanes(); +pane = atom.workspace.getActivePane(); +bool = atom.workspace.activateNextPane(); +bool = atom.workspace.activatePreviousPane(); + +let potentialPaneContainer = atom.workspace.paneContainerForURI("https://test"); +if (potentialPaneContainer) { + paneContainer = potentialPaneContainer; +} + +potentialPaneContainer = atom.workspace.paneContainerForItem(element); +if (potentialPaneContainer) { + paneContainer = potentialPaneContainer; +} + +let potentialPane = atom.workspace.paneForURI("https://test"); +if (potentialPane) { + pane = potentialPane; +} + +potentialPane = atom.workspace.paneForItem(element); +if (potentialPane) { + pane = potentialPane; +} + +// Pane Locations +workspaceCenter = atom.workspace.getCenter(); +dock = atom.workspace.getLeftDock(); +dock = atom.workspace.getRightDock(); +dock = atom.workspace.getBottomDock(); + +// Panels +panels = atom.workspace.getBottomPanels(); + +panel = atom.workspace.addBottomPanel({ item: element }); +panel = atom.workspace.addBottomPanel({ item: element, priority: 100, visible: true }); + +panels = atom.workspace.getLeftPanels(); + +panel = atom.workspace.addLeftPanel({ item: element }); +panel = atom.workspace.addLeftPanel({ item: element, priority: 100, visible: true }); + +panels = atom.workspace.getRightPanels(); + +panel = atom.workspace.addRightPanel({ item: element }); +panel = atom.workspace.addRightPanel({ item: element, priority: 100, visible: true }); + +panels = atom.workspace.getTopPanels(); + +panel = atom.workspace.addTopPanel({ item: element }); +panel = atom.workspace.addTopPanel({ item: element, priority: 100, visible: true }); + +panels = atom.workspace.getHeaderPanels(); + +panel = atom.workspace.addHeaderPanel({ item: element }); +panel = atom.workspace.addHeaderPanel({ item: element, priority: 100, visible: true }); + +panels = atom.workspace.getFooterPanels(); + +panel = atom.workspace.addFooterPanel({ item: element }); +panel = atom.workspace.addFooterPanel({ item: element, priority: 100, visible: true }); + +panels = atom.workspace.getModalPanels(); + +panel = atom.workspace.addModalPanel({ item: element }); +panel = atom.workspace.addModalPanel({ item: element, priority: 100, visible: true }); + +const potentialPanel = atom.workspace.panelForItem(element); +if (potentialPanel) { + panel = potentialPanel; +} + +const scanResults = atom.workspace.scan(/r/, () => {}); +scanResults.cancel(); + +// Searching and Replacing +async function workspaceScan() { + await scanResults; + + const scanOptions = { + onPathsSearched: (pathsSearched: number) => {}, + leadingContextLineCount: 5, + trailingContextLineCount: 5, + paths: ["a"], + }; + await atom.workspace.scan(/r/, scanOptions, (results) => { + str = results.filePath; + for (const match of results.matches) { + range = Range.fromObject(match.range); + strs = match.leadingContextLines; + strs = match.trailingContextLines; + } + }); +} + +async function workspaceReplace() { + await atom.workspace.replace(/r/, "Test", ["a"], (options) => {}); +} + +//// WorkspaceCenter ========================================================== +// Event Subscription +sub = workspaceCenter.observeTextEditors(editor => editor.id); +sub = workspaceCenter.observePaneItems(item => {}); +sub = workspaceCenter.onDidChangeActivePaneItem(item => {}); +sub = workspaceCenter.onDidStopChangingActivePaneItem(item => {}); +sub = workspaceCenter.observeActivePaneItem(item => {}); + +// Pane Items +objs = workspaceCenter.getPaneItems(); +workspaceCenter.getActivePaneItem(); +editors = workspaceCenter.getTextEditors(); + +potentialEditor = workspaceCenter.getActiveTextEditor(); +if (potentialEditor) { + editor = potentialEditor; +} + +// Panes +panes = workspaceCenter.getPanes(); +pane = workspaceCenter.getActivePane(); +workspaceCenter.activateNextPane(); +workspaceCenter.activatePreviousPane(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 1cd7090403..77e174d138 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -1,1977 +1,4147 @@ -// Type definitions for Atom -// Project: https://atom.io/ -// Definitions by: vvakame , smhxx +// Type definitions for Atom 1.20 +// Project: https://github.com/atom/atom +// Definitions by: GlenCFL // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +/// +/// /// -/// -/// -/// +/// +/// +/// /// -/// -// Policy: this definition file only declare element related to `atom`. -// if js file include to another npm package (e.g. "space-pen", "mixto" and "emissary"). -// you should create a separate file. +declare global { + /** The core classes for the Atom Text Editor. */ + namespace AtomCore { + /** Objects that appear as parameters to callbacks. */ + namespace Events { + interface ExceptionThrown { + originalError: Error; + message: string; + url: string; + line: number; + column: number; + } -// API documentation : https://atom.io/docs/api/v1.20.1 + interface PreventableExceptionThrown extends ExceptionThrown { + preventDefault(): void; + } -interface Window { - atom: AtomCore.IAtom; - measure(description:string, fn:Function):any; // return fn result - profile(description:string, fn:Function):any; // return fn result -} + interface SelectionChanged { + oldBufferRange: TextBuffer.Range; + oldScreenRange: TextBuffer.Range; + newBufferRange: TextBuffer.Range; + newScreenRange: TextBuffer.Range; + selection: Selection; + } -declare namespace AtomCore { + interface PaneItemObserved { + item: object; + pane: Pane; + index: number; + } - // https://atom.io/docs/v0.84.0/advanced/view-system - interface IWorkspaceViewStatic { - new ():IWorkspaceView; - version: number; - configDefaults:any; - content():any; - } + interface PaneItemOpened extends PaneItemObserved { + uri: string; + } - interface Decoration { - destroy(): void; - } + interface EditorChanged { + /** A Point representing where the change started. */ + start: TextBuffer.Point; - /** - * Represents a buffer annotation that remains logically stationary even as the buffer changes. This is used - * to represent cursors, folds, snippet targets, misspelled words, any anything else that needs to track a - * logical location in the buffer over time. - */ - interface Marker { - /** - * Destroys the marker, causing it to emit the 'destroyed' event. Once destroyed, a marker cannot be - * restored by undo/redo operations. + /** A Point representing the replaced extent. */ + oldExtent: TextBuffer.Point; + + /** A Point representing the replacement extent. */ + newExtent: TextBuffer.Point; + } + + interface StyleElementObserved extends HTMLStyleElement { + sourcePath: string; + context: string; + } + + interface TextEditorObserved { + textEditor: TextEditor; + pane: Pane; + index: number; + } + + interface RepoStatusChanged { + path: string; + + /** This value can be passed to ::isStatusModified or ::isStatusNew to get more + * information. + */ + pathStatus: number; + } + + interface PaneListItemShifted { + /** The pane item that was added or removed. */ + item: object; + + /** A number indicating where the item is located. */ + index: number; + } + + interface PaneItemMoved { + /** The removed pane item. */ + item: object; + + /** A number indicating where the item was located. */ + oldIndex: number; + + /** A number indicating where the item is now located. */ + newIndex: number; + } + + interface CursorPositionChanged { + oldBufferPosition: TextBuffer.Point; + oldScreenPosition: TextBuffer.Point; + newBufferPosition: TextBuffer.Point; + newScreenPosition: TextBuffer.Point; + textChanged: boolean; + Cursor: Cursor; + } + + interface DecorationPropsChanged { + /** Object the old parameters the decoration used to have. */ + oldProperties: Structures.DecorationProps; + + /** Object the new parameters the decoration now has */ + newProperties: Structures.DecorationProps; + } + } + + /** Objects that appear as parameters to functions. */ + namespace Options { + interface TextInsertion { + select?: boolean; + autoIndent?: boolean; + autoIndentNewline?: boolean; + autoDecreaseIndent?: boolean; + normalizeLineEndings?: boolean; + undo?: "skip"; + } + + interface Menu { + /** The menu itme's label. */ + label: string; + + /** An array of sub menus. */ + submenu?: ReadonlyArray; + + /** The command to trigger when the item is clicked. */ + command?: string; + } + + interface ContextMenu { + /** The menu item's label. */ + label?: string; + + /** The command to invoke on the target of the right click that invoked the + * context menu. + */ + command?: string; + + /** Whether the menu item should be clickable. Disabled menu items typically + * appear grayed out. Defaults to true. + */ + enabled?: boolean; + + /** An array of additional items. */ + submenu?: ReadonlyArray; + + /** If you want to create a separator, provide an item with type: 'separator' + * and no other keys. + */ + type?: "separator"; + + /** Whether the menu item should appear in the menu. Defaults to true. */ + visible?: boolean; + + /** A function that is called on the item each time a context menu is created + * via a right click. + */ + created?(event: Event): void; + + /** A function that is called to determine whether to display this item on a + * given context menu deployment. + */ + shouldDisplay?(event: Event): void; + } + + interface SpawnProcess { + /** Current working directory of the child process. */ + cwd?: string; + + /** Environment key-value pairs. */ + env?: { [key: string]: string }; + + /** The child's stdio configuration. */ + stdio?: string|Array; + + /** Prepare child to run independently of its parent process. */ + detached?: boolean; + + /** Sets the user identity of the process. */ + uid?: number; + + /** Sets the group identity of the process. */ + gid?: number; + + /** If true, runs command inside of a shell. Uses "/bin/sh" on UNIX, and process.env.ComSpec + * on Windows. A different shell can be specified as a string. + */ + shell?: boolean | string; + } + + interface NodeProcess { + /** The command to execute. */ + command: string; + + /** The array of arguments to pass to the command. */ + args?: ReadonlyArray; + + /** The options object to pass to Node's ChildProcess.spawn method. */ + options?: SpawnProcess; + + /** The callback that receives a single argument which contains the standard + * output from the command. + */ + stdout?(data: string): void; + + /** The callback that receives a single argument which contains the standard + * error output from the command. + */ + stderr?(data: string): void; + + /** The callback which receives a single argument containing the exit status. */ + exit?(code: number): void; + } + + interface Process extends NodeProcess { + /** Whether the command will automatically start when this BufferedProcess is + * created. + */ + autoStart?: boolean; + } + + interface Notification { + buttons?: Array<{ + className?: string; + onDidClick?(event: MouseEvent): void; + text?: string; + }>; + description?: string; + detail?: string; + dismissable?: boolean; + icon?: string; + } + + interface ErrorNotification extends Notification { + stack?: string; + } + + /** The options for a Bootstrap 3 Tooltip class, which Atom uses a variant of. */ + interface Tooltip { + /** Apply a CSS fade transition to the tooltip. */ + animation?: boolean; + + /** Appends the tooltip to a specific element. */ + container?: string|HTMLElement|false; + + /** Delay showing and hiding the tooltip (ms) - does not apply to manual + * trigger type. + */ + delay?: number|{ show: number, hide: number }; + + /** Allow HTML in the tooltip. */ + html?: boolean; + + /** How to position the tooltip. */ + placement?: "top"|"bottom"|"left"|"right"|"auto"; + + /** If a selector is provided, tooltip objects will be delegated to the + * specified targets. + */ + selector?: string; + + /** Base HTML to use when creating the tooltip. */ + template?: string; + + /** Default title value if title attribute isn't present. + * If a function is given, it will be called with its this reference set to + * the element that the tooltip is attached to. + */ + title?: string|HTMLElement|(() => string); + + /** How tooltip is triggered - click | hover | focus | manual. + * You may pass multiple triggers; separate them with a space. + */ + trigger?: string; + } + + interface WorkspaceScan { + /** An array of glob patterns to search within. */ + paths?: ReadonlyArray; + + /** A function to be periodically called with the number of paths searched. */ + onPathsSearched?(pathsSearched: number): void; + + /** The number of lines before the matched line to include in the results object. */ + leadingContextLineCount?: number; + + /** The number of lines after the matched line to include in the results object. */ + trailingContextLineCount?: number; + } + } + + /** The static side to each exported class. Should generally only be used internally. */ + namespace Statics { + /* tslint:disable:no-unnecessary-qualifier */ + /** The static side to the BufferedProcess class. */ + interface BufferedProcess { + new (options: AtomCore.Options.Process): AtomCore.BufferedProcess; + } + + /** The static side to the BufferedNodeProcess class. */ + interface BufferedNodeProcess { + /** Runs the given Node script by spawning a new child process. */ + new (options: AtomCore.Options.NodeProcess): AtomCore.BufferedNodeProcess; + } + + /** The static side to the GitRepository class. */ + interface GitRepository { + /** Creates a new GitRepository instance. */ + open(path: string, options?: { refreshOnWindowFocus?: boolean }): AtomCore.GitRepository; + + new (path: string, options?: { refreshOnWindowFocus?: boolean, config?: AtomCore.Config, + project?: AtomCore.Project }): AtomCore.GitRepository; + } + + /** The static side to the Notification class. */ + interface Notification { + new (type: "warning"|"info"|"success", message: string, options?: + AtomCore.Options.Notification): AtomCore.Notification; + new (type: "fatal"|"error", message: string, options?: + AtomCore.Options.ErrorNotification): AtomCore.Notification; + } + + /** The static side to the Task class. */ + interface Task { + // NOTE: this is actually the best we can do here with the REST parameter for + // this appearing in the middle of the parameter list, which isn't aligned with + // the ES6 spec. Maybe when they rewrite it in JavaScript this will change. + /** A helper method to easily launch and run a task once. */ + once(taskPath: string, ...args: any[]): AtomCore.Task; + + /** Creates a task. You should probably use .once */ + new (taskPath: string): AtomCore.Task; + } + + /** The static side to the TextEditor class. */ + type TextEditor = object; + /* tslint:enable:no-unnecessary-qualifier */ + } + + /** Data structures that are used within classes. */ + namespace Structures { + interface SharedDecorationProps { + /** This CSS class will be applied to the decorated line number, line, highlight, + * or overlay. + */ + class?: string; + + /** An HTMLElement or a model Object with a corresponding view registered. Only + * applicable to the gutter, overlay and block types. + */ + item?: HTMLElement; + + /** If true, the decoration will only be applied to the head of the DisplayMarker. + * Only applicable to the line and line-number types. + */ + onlyHead?: boolean; + + /** If true, the decoration will only be applied if the associated DisplayMarker + * is empty. Only applicable to the gutter, line, and line-number types. + */ + onlyEmpty?: boolean; + + /** If true, the decoration will only be applied if the associated DisplayMarker + * is non-empty. Only applicable to the gutter, line, and line-number types. + */ + onlyNonEmpty?: boolean; + + /** Only applicable to decorations of type overlay and block. Controls where the + * view is positioned relative to the TextEditorMarker. Values can be + * 'head' (the default) or 'tail' for overlay decorations, and 'before' (the default) + * or 'after' for block decorations. + */ + position?: "head"|"tail"|"before"|"after"; + + /** Only applicable to decorations of type overlay. Determines whether the decoration + * adjusts its horizontal or vertical position to remain fully visible when it would + * otherwise overflow the editor. Defaults to true. + */ + avoidOverflow?: boolean; + } + + interface DecorationProps extends SharedDecorationProps { + /** One of several supported decoration types. */ + type?: "line"|"line-number"|"highlight"|"overlay"|"gutter"|"block"; + + /** The name of the gutter we're decorating, if type is "gutter". */ + gutterName?: string; + } + + interface DecorationLayerProps extends SharedDecorationProps { + /** One of several supported decoration types. */ + type?: "line"|"line-number"|"highlight"|"block"; + } + + interface Invisibles { + tab?: string|false; + cr?: string|false; + eol?: string|false; + space?: string|false; + } + + interface CancellablePromise extends Promise { + cancel(): void; + } + + interface ScandalResult { + filePath: string; + matches: Array<{ + matchText: string; + lineText: string; + lineTextOffset: number; + range: [[number, number], [number, number]]; + leadingContextLines: string[]; + trailingContextLines: string[]; + }>; + } + + interface WindowLoadSettings { + appVersion: string; + atomHome: string; + devMode: boolean; + env: { [key: string]: string|undefined }; + profileStartup: boolean; + resourcePath: string; + safeMode: boolean; + } + } + + /** Atom global for dealing with packages, themes, menus, and the window. + * An instance of this class is always available as the atom global. */ - destroy(): void; + interface AtomEnvironment { + // Properties + /** A CommandRegistry instance. */ + commands: CommandRegistry; - /** - * Gets the screen range of the display marker. + /** A Config instance. */ + config: Config; + + /** A Clipboard instance. */ + clipboard: Clipboard; + + /** A ContextMenuManager instance. */ + contextMenu: ContextMenuManager; + + /** A MenuManager instance. */ + menu: MenuManager; + + /** A KeymapManager instance. */ + keymaps: AtomKeymap.KeymapManager; + + /** A TooltipManager instance. */ + tooltips: TooltipManager; + + /** A NotificationManager instance. */ + notifications: NotificationManager; + + /** A Project instance. */ + project: Project; + + /** A GrammarRegistry instance. */ + grammars: FirstMate.GrammarRegistry; + + /** A HistoryManager instance. */ + history: HistoryManager; + + /** A PackageManager instance. */ + packages: PackageManager; + + /** A ThemeManager instance. */ + themes: ThemeManager; + + /** A StyleManager instance. */ + styles: StyleManager; + + /** A DeserializerManager instance. */ + deserializers: DeserializerManager; + + /** A ViewRegistry instance. */ + views: ViewRegistry; + + /** A Workspace instance. */ + workspace: Workspace; + + /** A TextEditorRegistry instance. */ + textEditors: TextEditorRegistry; + + // Event Subscription + /** Invoke the given callback whenever ::beep is called. */ + onDidBeep(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when there is an unhandled error, but before + * the devtools pop open. + */ + onWillThrowError(callback: (event: Events.PreventableExceptionThrown) => + void): EventKit.Disposable; + + /** Invoke the given callback whenever there is an unhandled error. */ + onDidThrowError(callback: (event: Events.ExceptionThrown) => void): + EventKit.Disposable; + + /** Invoke the given callback as soon as the shell environment is loaded (or + * immediately if it was already loaded). + */ + whenShellEnvironmentLoaded(callback: () => void): EventKit.Disposable; + + // Atom Details + /** Returns a boolean that is true if the current window is in development mode. */ + inDevMode(): boolean; + + /** Returns a boolean that is true if the current window is in safe mode. */ + inSafeMode(): boolean; + + /** Returns a boolean that is true if the current window is running specs. */ + inSpecMode(): boolean; + + /** Get the version of the Atom application. */ + getVersion(): string; + + /** Returns a boolean that is true if the current version is an official release. */ + isReleasedVersion(): boolean; + + /** Get the time taken to completely load the current window. */ + getWindowLoadTime(): number; + + /** Get the load settings for the current window. */ + getLoadSettings(): Structures.WindowLoadSettings; + + // Managing the Atom Window + /** Open a new Atom window using the given options. */ + open(params: { + pathsToOpen: ReadonlyArray, + newWindow: boolean, + devMode: boolean, + safeMode: boolean, + }): void; + + /** Close the current window. */ + close(): void; + + /** Get the size of current window. */ + getSize(): { width: number, height: number }; + + /** Set the size of current window. */ + setSize(width: number, height: number): void; + + /** Get the position of current window. */ + getPosition(): { x: number, y: number }; + + /** Set the position of current window. */ + setPosition(x: number, y: number): void; + + /** Prompt the user to select one or more folders. */ + pickFolder(callback: (paths: string[]|null) => void): void; + + /** Get the current window. */ + getCurrentWindow(): Electron.BrowserWindow; + + /** Move current window to the center of the screen. */ + center(): void; + + /** Focus the current window. */ + focus(): void; + + /** Show the current window. */ + show(): void; + + /** Hide the current window. */ + hide(): void; + + /** Reload the current window. */ + reload(): void; + + /** Relaunch the entire application. */ + restartApplication(): void; + + /** Returns a boolean that is true if the current window is maximized. */ + isMaximized(): boolean; + + /** Returns a boolean that is true if the current window is in full screen mode. */ + isFullScreen(): boolean; + + /** Set the full screen state of the current window. */ + setFullScreen(fullScreen: boolean): void; + + /** Toggle the full screen state of the current window. */ + toggleFullScreen(): void; + + // Messaging the User + /** Visually and audibly trigger a beep. */ + beep(): void; + + /** A flexible way to open a dialog akin to an alert dialog. + * Returns the chosen button index number if the buttons option was an array. + */ + confirm(options: { + message: string, + detailedMessage?: string, + buttons?: ReadonlyArray, + }): void; + + /** A flexible way to open a dialog akin to an alert dialog. + * Returns the chosen button index number if the buttons option was an array. + */ + confirm(options: { + message: string, + detailedMessage?: string, + buttons?: { + [key: string]: () => void + }, + }): number; + + // Managing the Dev Tools + /** Open the dev tools for the current window. */ + openDevTools(): Promise; + + /** Toggle the visibility of the dev tools for the current window. */ + toggleDevTools(): Promise; + + /** Execute code in dev tools. */ + executeJavaScriptInDevTools(code: string): void; + } + + /** A wrapper which provides standard error/output line buffering for + * Node's ChildProcess. */ - getScreenRange(): Range; - } + interface BufferedProcess { + // Properties + process: NodeJS.EventEmitter; + + // Event Subscription + /** Will call your callback when an error will be raised by the process. Usually + * this is due to the command not being available or not on the PATH. You can + * call handle() on the object passed to your callback to indicate that you + * have handled this error. + */ + onWillThrowError(callback: (errorObject: { error: Error, handle(): void }) => + void): EventKit.Disposable; + + // Helper Methods + /** Terminate the process. */ + kill(): void; + + /** Runs the process. */ + start(): void; + } + + /** Like BufferedProcess, but accepts a Node script as the command to run. + * This is necessary on Windows since it doesn't support shebang #! lines. + */ + type BufferedNodeProcess = BufferedProcess; + + /** Represents the clipboard used for copying and pasting in Atom. */ + interface Clipboard { + /** Write the given text to the clipboard. */ + write(text: string, metadata?: object): void; + + /** Read the text from the clipboard. */ + read(): string; + + /** Read the text from the clipboard and return both the text and the associated + * metadata. + */ + readWithMetadata(): { text: string, metadata: object }; + } + + /** A simple color class returned from Config::get when the value at the key path is + * of type 'color'. + */ + interface Color { + /** Returns a string in the form '#abcdef'. */ + toHexString(): string; + + /** Returns a string in the form 'rgba(25, 50, 75, .9)'. */ + toRGBAString(): string; + } + + /** Used to access all of Atom's configuration details. */ + interface Config { + // Config Subscription + /** Add a listener for changes to a given key path. This is different than ::onDidChange in + * that it will immediately call your callback with the current value of the config entry. + */ + observe(keyPath: string, callback: (value: any) => void): + EventKit.Disposable; + /** Add a listener for changes to a given key path. This is different than ::onDidChange in + * that it will immediately call your callback with the current value of the config entry. + */ + observe(keyPath: string, options: { scope: string[]|ScopeDescriptor }, + callback: (value: any) => void): EventKit.Disposable; + + /** Add a listener for changes to a given key path. If keyPath is not specified, your + * callback will be called on changes to any key. + */ + onDidChange(callback: (values: { newValue: T, oldValue: T }) => void): + EventKit.Disposable; + /** Add a listener for changes to a given key path. If keyPath is not specified, your + * callback will be called on changes to any key. + */ + onDidChange(keyPath: string, callback: (values: { newValue: T, + oldValue: T }) => void): EventKit.Disposable; + /** Add a listener for changes to a given key path. If keyPath is not specified, your + * callback will be called on changes to any key. + */ + onDidChange(keyPath: string, options: { scope: string[]|ScopeDescriptor }, + callback: (values: { newValue: T, oldValue: T }) => void): EventKit.Disposable; + + // Managing Settings + /** Retrieves the setting for the given key. */ + get(keyPath: string, options?: { sources?: string[], excludeSources?: string[], + scope?: string[]|ScopeDescriptor }): any; + + /** Sets the value for a configuration setting. + * This value is stored in Atom's internal configuration file. + */ + set(keyPath: string, value: any, options?: { scopeSelector?: string, source?: + string }): void; + + /** Restore the setting at keyPath to its default value. */ + unset(keyPath: string, options?: { scopeSelector?: string, source?: string }): void; + + /** Get all of the values for the given key-path, along with their associated + * scope selector. + */ + getAll(keyPath: string, options?: { sources?: string[], excludeSources?: string[], + scope?: ScopeDescriptor }): Array<{ scopeDescriptor: ScopeDescriptor, value: any}>; + + /** Get an Array of all of the source Strings with which settings have been added + * via ::set. + */ + getSources(): string[]; + + /** Retrieve the schema for a specific key path. The schema will tell you what type + * the keyPath expects, and other metadata about the config option. + */ + getSchema(keyPath: string): object|null; + + /** Get the string path to the config file being used. */ + getUserConfigPath(): string; + + /** Suppress calls to handler functions registered with ::onDidChange and ::observe + * for the duration of callback. After callback executes, handlers will be called + * once if the value for their key-path has changed. + */ + transact(callback: () => void): void; + } + + /** Provides a registry for commands that you'd like to appear in the context menu. */ + interface ContextMenuManager { + /** Add context menu items scoped by CSS selectors. */ + add(itemsBySelector: { + [key: string]: ReadonlyArray + }): EventKit.Disposable; + } + + /** Associates listener functions with commands in a context-sensitive way + * using CSS selectors. + */ + interface CommandRegistry { + // Register a single command. + add(target: string|Node, commandName: string, callback: (event: + AtomKeymap.CommandEvent) => void): EventKit.Disposable; + + // Register multiple commands. + add(target: string|Node, commands: { [key: string]: (event: + AtomKeymap.CommandEvent) => void }): EventKit.CompositeDisposable; + + /** Find all registered commands matching a query. */ + findCommands(params: { target: Node }): Array<{ name: string, displayName: string }>; + + /** Simulate the dispatch of a command on a DOM node. */ + dispatch(target: Node, commandName: string): void; + + /** Invoke the given callback before dispatching a command event. */ + onWillDispatch(callback: (event: AtomKeymap.CommandEvent) => void): EventKit.Disposable; + + /** Invoke the given callback after dispatching a command event. */ + onDidDispatch(callback: (event: AtomKeymap.CommandEvent) => void): EventKit.Disposable; + } + + /** The Cursor class represents the little blinking line identifying where text + * can be inserted. + */ + interface Cursor { + // Event Subscription + /** Calls your callback when the cursor has been moved. */ + onDidChangePosition(callback: (event: Events.CursorPositionChanged) => void): + EventKit.Disposable; + + /** Calls your callback when the cursor is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + /** Calls your callback when the cursor's visibility has changed. */ + onDidChangeVisibility(callback: (visibility: boolean) => void): + EventKit.Disposable; + + // Managing Cursor Position + /** Moves a cursor to a given screen position. */ + setScreenPosition(screenPosition: TextBuffer.PointLike|[number, number], + options?: { autoscroll?: boolean }): void; + + /** Returns the screen position of the cursor as a Point. */ + getScreenPosition(): TextBuffer.Point; - interface IWorkspaceView extends View { - // Delegator.includeInto(WorkspaceView); - - // delegate to model property's property - fullScreen:boolean; - - // delegate to model property's method - open(uri:string, options:any):Q.Promise; - openSync(uri:string, options?:any):any; - saveActivePaneItem():any; - saveActivePaneItemAs():any; - saveAll():void; - destroyActivePaneItem():any; - destroyActivePane():any; - increaseFontSize():void; - decreaseFontSize():void; - - // own property & methods - initialize(model:IWorkspace):any; - initialize(view:View, args:any):void; // do not use - model:IWorkspace; - panes: IPaneContainerView; - getModel():IWorkspace; - installShellCommands():any; - handleFocus():any; - afterAttach(onDom?:any):any; - confirmClose():boolean; - updateTitle():any; - setTitle(title:string):any; - getEditorViews():any[]; // atom.EditorView - prependToTop(element:any):any; - appendToTop(element:any):any; - prependToBottom(element:any):any; - appendToBottom(element:any):any; - prependToLeft(element:any):any; - appendToLeft(element:any):any; - prependToRight(element:any):any; - appendToRight(element:any):any; - getActivePaneView():IPaneView; - getActiveView():View; - focusPreviousPaneView():any; - focusNextPaneView():any; - focusPaneViewAbove():any; - focusPaneViewBelow():any; - focusPaneViewOnLeft():any; - focusPaneViewOnRight():any; - eachPaneView(callback:(paneView:IPaneView)=>any):{ off():any; }; - getPaneViews():IPaneView[]; - eachEditorView(callback:(editorView:any /* EditorView */)=>any):{ off():any; }; - beforeRemove():any; - - command(eventName:string, handler:Function):any; - command(eventName:string, selector:Function, handler:Function):any; - command(eventName:string, options:any, handler:Function):any; - command(eventName:string, selector:Function, options:any, handler:Function):any; - - statusBar:StatusBar.IStatusBarView; - } + /** Moves a cursor to a given buffer position. */ + setBufferPosition(bufferPosition: TextBuffer.PointLike|[number, number], + options?: { autoscroll?: boolean }): void; - interface IPanes { - // TBD - } + /** Returns the current buffer position as an Array. */ + getBufferPosition(): TextBuffer.Point; - interface IPaneView { - // TBD - } + /** Returns the cursor's current screen row. */ + getScreenRow(): number; - interface IPaneContainerView { - // TBD - } + /** Returns the cursor's current screen column. */ + getScreenColumn(): number; - interface ITreeView { - // TBD - } + /** Retrieves the cursor's current buffer row. */ + getBufferRow(): number; - interface IGutterViewStatic { - new(): IGutterView; - content():any; - } + /** Returns the cursor's current buffer column. */ + getBufferColumn(): number; - interface IGutterView extends View { - firstScreenRow:any; - lastScreenRow:any; - initialize():void; - initialize(view:View, args:any):void; // do not use - afterAttach(onDom?:any):any; - beforeRemove():any; - handleMouseEvents(e:JQueryMouseEventObject):any; - getEditorView():any; /* EditorView */ - getEditor():IEditor; - getLineNumberElements():HTMLCollection; - getLineNumberElementsForClass(klass:string):NodeList; - getLineNumberElement(bufferRow:number):NodeList; - addClassToAllLines(klass:string):boolean; - removeClassFromAllLines(klass:string):boolean; - addClassToLine(bufferRow:number, klass:string):boolean; - removeClassFromLine(bufferRow:number, klass:string):boolean; - updateLineNumbers(changes:any[], startScreenRow?:number, endScreenRow?:number):any; - prependLineElements(lineElements:any):void; - appendLineElements(lineElements:any):void; - removeLineElements(numberOfElements:number):void; - buildLineElements(startScreenRow:any, endScreenRow:any):any; - buildLineElementsHtml(startScreenRow:any, endScreenRow:any):any; - updateFoldableClasses(changes:any[]):any; - removeLineHighlights():void; - addLineHighlight(row:number, emptySelection?:boolean):any; - highlightLines():boolean; - } + /** Returns the cursor's current buffer row of text excluding its line ending. */ + getCurrentBufferLine(): string; - interface ICommandRegistry { - add(target: string, commandName: Object, callback?: (event: any) => void): any; // selector:'atom-editor'|'atom-workspace' - findCommands(params: Object): Object[]; - dispatch(selector: any, name:string): void; - } + /** Returns whether the cursor is at the start of a line. */ + isAtBeginningOfLine(): boolean; - interface ICommandPanel { - // TBD - } + /** Returns whether the cursor is on the line return character. */ + isAtEndOfLine(): boolean; - interface IDisplayBufferStatic { - new(_arg?:any):IDisplayBuffer; - } + // Cursor Position Details + /** Returns the underlying DisplayMarker for the cursor. Useful with overlay + * Decorations. + */ + getMarker(): TextBuffer.DisplayMarker; - interface IDisplayBuffer /* extends Theorist.Model */ { - // Serializable.includeInto(Editor); - - constructor:IDisplayBufferStatic; - - verticalScrollMargin:number; - horizontalScrollMargin:number; - - declaredPropertyValues:any; - tokenizedBuffer: ITokenizedBuffer; - buffer: TextBuffer.ITextBuffer; - charWidthsByScope:any; - markers:{ [index:number]:IDisplayBufferMarker; }; - foldsByMarkerId:any; - maxLineLength:number; - screenLines:ITokenizedLine[]; - rowMap:any; // return type are RowMap - longestScreenRow:number; - subscriptions:Emissary.ISubscription[]; - subscriptionsByObject:any; // return type are WeakMap - behaviors:any; - subscriptionCounts:any; - eventHandlersByEventName:any; - pendingChangeEvent:any; - - softWrap:boolean; - - serializeParams():{id:number; softWrap:boolean; editorWidthInChars: number; scrollTop: number; scrollLeft: number; tokenizedBuffer: any; }; - deserializeParams(params:any):any; - copy():IDisplayBuffer; - updateAllScreenLines():any; - emitChanged(eventProperties:any, refreshMarkers?:boolean):any; - updateWrappedScreenLines():any; - setVisible(visible:any):any; - getVerticalScrollMargin():number; - setVerticalScrollMargin(verticalScrollMargin:number):number; - getHorizontalScrollMargin():number; - setHorizontalScrollMargin(horizontalScrollMargin:number):number; - getHeight():any; - setHeight(height:any):any; - getWidth():any; - setWidth(newWidth:any):any; - getScrollTop():number; - setScrollTop(scrollTop:number):number; - getScrollBottom():number; - setScrollBottom(scrollBottom:number):number; - getScrollLeft():number; - setScrollLeft(scrollLeft:number):number; - getScrollRight():number; - setScrollRight(scrollRight:number):number; - getLineHeight():any; - setLineHeight(lineHeight:any):any; - getDefaultCharWidth():any; - setDefaultCharWidth(defaultCharWidth:any):any; - getScopedCharWidth(scopeNames:any, char:any):any; - getScopedCharWidths(scopeNames:any):any; - setScopedCharWidth(scopeNames:any, char:any, width:any):any; - setScopedCharWidths(scopeNames:any, charWidths:any):any; - clearScopedCharWidths():any; - getScrollHeight():number; - getScrollWidth():number; - getVisibleRowRange():number[]; - intersectsVisibleRowRange(startRow:any, endRow:any):any; - selectionIntersectsVisibleRowRange(selection:any):any; - scrollToScreenRange(screenRange:any):any; - scrollToScreenPosition(screenPosition:any):any; - scrollToBufferPosition(bufferPosition:any):any; - pixelRectForScreenRange(screenRange:TextBuffer.IRange):any; - getTabLength():number; - setTabLength(tabLength:number):any; - setSoftWrap(softWrap:boolean):boolean; - getSoftWrap():boolean; - setEditorWidthInChars(editorWidthInChars:number):any; - getEditorWidthInChars():number; - getSoftWrapColumn():number; - lineForRow(row:number):any; - linesForRows(startRow:number, endRow:number):any; - getLines():any[]; - indentLevelForLine(line:any):any; - bufferRowsForScreenRows(startScreenRow:any, endScreenRow:any):any; - createFold(startRow:number, endRow:number):IFold; - isFoldedAtBufferRow(bufferRow:number):boolean; - isFoldedAtScreenRow(screenRow:number):boolean; - destroyFoldWithId(id:number):any; - unfoldBufferRow(bufferRow:number):any[]; - largestFoldStartingAtBufferRow(bufferRow:number):any; - foldsStartingAtBufferRow(bufferRow:number):any; - largestFoldStartingAtScreenRow(screenRow:any):any; - largestFoldContainingBufferRow(bufferRow:any):any; - outermostFoldsInBufferRowRange(startRow:any, endRow:any):any[]; - foldsContainingBufferRow(bufferRow:any):any[]; - screenRowForBufferRow(bufferRow:number):number; - lastScreenRowForBufferRow(bufferRow:number):number; - bufferRowForScreenRow(screenRow:number):number; - - screenRangeForBufferRange(bufferRange:TextBuffer.IPoint[]):TextBuffer.IRange; - - screenRangeForBufferRange(bufferRange:TextBuffer.IRange):TextBuffer.IRange; - - screenRangeForBufferRange(bufferRange:{start: TextBuffer.IPoint; end: TextBuffer.IPoint}):TextBuffer.IRange; - screenRangeForBufferRange(bufferRange:{start: number[]; end: TextBuffer.IPoint}):TextBuffer.IRange; - screenRangeForBufferRange(bufferRange:{start: {row:number; col:number;}; end: TextBuffer.IPoint}):TextBuffer.IRange; - - screenRangeForBufferRange(bufferRange:{start: TextBuffer.IPoint; end: number[]}):TextBuffer.IRange; - screenRangeForBufferRange(bufferRange:{start: number[]; end: number[]}):TextBuffer.IRange; - screenRangeForBufferRange(bufferRange:{start: {row:number; col:number;}; end: number[]}):TextBuffer.IRange; - - screenRangeForBufferRange(bufferRange:{start: TextBuffer.IPoint; end: {row:number; col:number;}}):TextBuffer.IRange; - screenRangeForBufferRange(bufferRange:{start: number[]; end: {row:number; col:number;}}):TextBuffer.IRange; - screenRangeForBufferRange(bufferRange:{start: {row:number; col:number;}; end: {row:number; col:number;}}):TextBuffer.IRange; - - bufferRangeForScreenRange(screenRange:TextBuffer.IPoint[]):TextBuffer.IRange; - - bufferRangeForScreenRange(screenRange:TextBuffer.IRange):TextBuffer.IRange; - - bufferRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: TextBuffer.IPoint}):TextBuffer.IRange; - bufferRangeForScreenRange(screenRange:{start: number[]; end: TextBuffer.IPoint}):TextBuffer.IRange; - bufferRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: TextBuffer.IPoint}):TextBuffer.IRange; - - bufferRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: number[]}):TextBuffer.IRange; - bufferRangeForScreenRange(screenRange:{start: number[]; end: number[]}):TextBuffer.IRange; - bufferRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: number[]}):TextBuffer.IRange; - - bufferRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: {row:number; col:number;}}):TextBuffer.IRange; - bufferRangeForScreenRange(screenRange:{start: number[]; end: {row:number; col:number;}}):TextBuffer.IRange; - bufferRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: {row:number; col:number;}}):TextBuffer.IRange; - - pixelRangeForScreenRange(screenRange:TextBuffer.IPoint[], clip?:boolean):TextBuffer.IRange; - - pixelRangeForScreenRange(screenRange:TextBuffer.IRange, clip?:boolean):TextBuffer.IRange; - - pixelRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: TextBuffer.IPoint}, clip?:boolean):TextBuffer.IRange; - pixelRangeForScreenRange(screenRange:{start: number[]; end: TextBuffer.IPoint}, clip?:boolean):TextBuffer.IRange; - pixelRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: TextBuffer.IPoint}, clip?:boolean):TextBuffer.IRange; - - pixelRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: number[]}, clip?:boolean):TextBuffer.IRange; - pixelRangeForScreenRange(screenRange:{start: number[]; end: number[]}, clip?:boolean):TextBuffer.IRange; - pixelRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: number[]}, clip?:boolean):TextBuffer.IRange; - - pixelRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: {row:number; col:number;}}, clip?:boolean):TextBuffer.IRange; - pixelRangeForScreenRange(screenRange:{start: number[]; end: {row:number; col:number;}}, clip?:boolean):TextBuffer.IRange; - pixelRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: {row:number; col:number;}}, clip?:boolean):TextBuffer.IRange; - - pixelPositionForScreenPosition(screenPosition:TextBuffer.IPoint, clip?:boolean):TextBuffer.IPoint; - pixelPositionForScreenPosition(screenPosition:number[], clip?:boolean):TextBuffer.IPoint; - pixelPositionForScreenPosition(screenPosition:{row:number; col:number;}, clip?:boolean):TextBuffer.IPoint; - - screenPositionForPixelPosition(pixelPosition:any):TextBuffer.IPoint; - - pixelPositionForBufferPosition(bufferPosition:any):any; - getLineCount():number; - getLastRow():number; - getMaxLineLength():number; - screenPositionForBufferPosition(bufferPosition:any, options:any):any; - bufferPositionForScreenPosition(bufferPosition:any, options:any):any; - scopesForBufferPosition(bufferPosition:any):any; - bufferRangeForScopeAtPosition(selector:any, position:any):any; - tokenForBufferPosition(bufferPosition:any):any; - getGrammar():IGrammar; - setGrammar(grammar:IGrammar):any; - reloadGrammar():any; - clipScreenPosition(screenPosition:any, options:any):any; - findWrapColumn(line:any, softWrapColumn:any):any; - rangeForAllLines():TextBuffer.IRange; - getMarker(id:number):IDisplayBufferMarker; - getMarkers():IDisplayBufferMarker[]; - getMarkerCount():number; - markScreenRange(range:TextBuffer.IRange, ...args:any[]):IDisplayBufferMarker; - markBufferRange(range:TextBuffer.IRange, options?:any):IDisplayBufferMarker; - markScreenPosition(screenPosition:TextBuffer.IPoint, options?:any):IDisplayBufferMarker; - markBufferPosition(bufferPosition:TextBuffer.IPoint, options?:any):IDisplayBufferMarker; - destroyMarker(id:number):any; - findMarker(params?:any):IDisplayBufferMarker; - findMarkers(params?:any):IDisplayBufferMarker[]; - translateToBufferMarkerParams(params?:any):any; - findFoldMarker(attributes:any):IMarker; - findFoldMarkers(attributes:any):IMarker[]; - getFoldMarkerAttributes(attributes?:any):any; - pauseMarkerObservers():any; - resumeMarkerObservers():any; - refreshMarkerScreenPositions():any; - destroy():any; - logLines(start:number, end:number):any[]; - handleTokenizedBufferChange(tokenizedBufferChange:any):any; - updateScreenLines(startBufferRow:any, endBufferRow:any, bufferDelta?:number, options?:any):any; - buildScreenLines(startBufferRow:any, endBufferRow:any):any; - findMaxLineLength(startScreenRow:any, endScreenRow:any, newScreenLines:any):any; - handleBufferMarkersUpdated():any; - handleBufferMarkerCreated(marker:any):any; - createFoldForMarker(maker:any):IFold; - foldForMarker(marker:any):any; - } + /** Identifies if the cursor is surrounded by whitespace. + * "Surrounded" here means that the character directly before and after the cursor + * are both whitespace. + */ + isSurroundedByWhitespace(): boolean; - interface IViewRegistry { - getView(selector:any):any; - } + /** This method returns false if the character before or after the cursor is whitespace. */ + isBetweenWordAndNonWord(): boolean; - interface ICursorStatic { - new (arg:{editor:IEditor; marker:IDisplayBufferMarker; id: number;}):ICursor; - } + /** Returns whether this cursor is between a word's start and end. */ + isInsideWord(options?: { wordRegex?: RegExp }): boolean; - interface ScopeDescriptor { - scopes: string[]; - } + /** Returns the indentation level of the current line. */ + getIndentLevel(): number; - interface ICursor /* extends Theorist.Model */ { - getScopeDescriptor(): ScopeDescriptor; - screenPosition:any; - bufferPosition:any; - goalColumn:any; - visible:boolean; - needsAutoscroll:boolean; - - editor:IEditor; - marker:IDisplayBufferMarker; - id: number; - - destroy():any; - changePosition(options:any, fn:Function):any; - getPixelRect():any; - setScreenPosition(screenPosition:any, options?:any):any; - getScreenPosition():TextBuffer.IPoint; - getScreenRange():TextBuffer.IRange; - setBufferPosition(bufferPosition:any, options?:any):any; - getBufferPosition():TextBuffer.IPoint; - autoscroll():any; - updateVisibility():any; - setVisible(visible:boolean):any; - isVisible():boolean; - wordRegExp(arg?:any):any; - isLastCursor():boolean; - isSurroundedByWhitespace():boolean; - isBetweenWordAndNonWord():boolean; - isInsideWord():boolean; - clearAutoscroll():void; - clearSelection():void; - getScreenRow():number; - getScreenColumn():number; - getBufferRow():number; - getBufferColumn():number; - getCurrentBufferLine():string; - moveUp(rowCount:number, arg?:any):any; - moveDown(rowCount:number, arg?:any):any; - moveLeft(arg?:any):any; - moveRight(arg?:any):any; - moveToTop():any; - moveToBottom():void; - moveToBeginningOfScreenLine():void; - moveToBeginningOfLine():void; - moveToFirstCharacterOfLine():void; - moveToEndOfScreenLine():void; - moveToEndOfLine():void; - moveToBeginningOfWord():void; - moveToEndOfWord():void; - moveToBeginningOfNextWord():void; - moveToPreviousWordBoundary():void; - moveToNextWordBoundary():void; - getBeginningOfCurrentWordBufferPosition(options?:any):TextBuffer.IPoint; - getPreviousWordBoundaryBufferPosition(options?:any):TextBuffer.IPoint; - getMoveNextWordBoundaryBufferPosition(options?:any):TextBuffer.IPoint; - getEndOfCurrentWordBufferPosition(options?:any):TextBuffer.IPoint; - getBeginningOfNextWordBufferPosition(options?:any):TextBuffer.IPoint; - getCurrentWordBufferRange(options?:any):TextBuffer.IPoint; - getCurrentLineBufferRange(options?:any):TextBuffer.IPoint; - getCurrentParagraphBufferRange():any; - getCurrentWordPrefix():string; - isAtBeginningOfLine():boolean; - getIndentLevel():number; - isAtEndOfLine():boolean; - getScopes():string[]; - hasPrecedingCharactersOnLine():boolean; - getMarker(): Marker; - } + /** Retrieves the scope descriptor for the cursor's current position. */ + getScopeDescriptor(): ScopeDescriptor; - interface ILanguageMode { - // TBD - } + /** Returns true if this cursor has no non-whitespace characters before its + * current position. + */ + hasPrecedingCharactersOnLine(): boolean; - interface ISelection { - // https://atom.io/docs/api/v1.7.3/Selection - - // Event Subscription - onDidChangeRange(callback: (event: { - oldBufferRange: TextBuffer.IRange; - oldScreenRange: TextBuffer.IRange; - newBufferRange: TextBuffer.IRange; - newScreenRange: TextBuffer.IRange; - selection: ISelection; - }) => {}): Disposable; - onDidDestroy(callback: () => {}): Disposable; - - // Managing the selection range - getScreenRange(): TextBuffer.IRange; - setScreenRange(screenRange: TextBuffer.IRange, options?: { - preserveFolds?: boolean; - autoscroll?: boolean; - }): void; - getBufferRange(): TextBuffer.IRange; - setBufferRange(bufferRange: TextBuffer.IRange, options?: { - preserveFolds?: boolean; - autoscroll?: boolean; - }): void; - getBufferRowRange(): [number]; - - // Info about the selection - isEmpty(): boolean; - isReversed(): boolean; - isSingleScreenLine(): boolean; - getText(): string; - intersectsBufferRange(bufferRange: TextBuffer.IRange): boolean; - intersectsWith(otherSelection: ISelection): boolean; - - // Modifying the selected range - clear(options?: {autoscroll?: boolean}): void; - selectToScreenPosition(position: any): void; - selectToBufferPosition(position: any): void; - selectRight(columnCount?: number): void; - selectLeft(columnCount?: number): void; - selectUp(rowCount: number): void; - selectDown(rowCount: number): void; - selectToTop(): void; - selectToBottom(): void; - selectAll(): void; - selectToBeginningOfLine(): void; - selectToFirstCharacterOfLine(): void; - selectToEndOfLine(): void; - selectToEndOfBufferLine(): void; - selectToBeginningOfWord(): void; - selectToEndOfWord(): void; - selectToBeginningOfNextWord(): void; - selectToPreviousWordBoundary(): void; - selectToNextWordBoundary(): void; - selectToPreviousSubwordBoundary(): void; - selectToNextSubwordBoundary(): void; - selectToBeginningOfNextParagraph(): void; - selectToBeginningOfPreviousParagraph(): void; - selectWord(): TextBuffer.IRange; - expandOverWord(): void; - selectLine(row?: number): void; - expandOverLine(): void; - - // Modifying the selected text - insertText(text: string, options?: { - select: boolean; - autoIndent: boolean; - autoIndentNewline: boolean; - autoDecreaseIndent: boolean; - normalizeLineEndings?: boolean; - undo?: 'skip'; - }): void; - backspace(): void; - deleteToPreviousWordBoundary(): void; - deleteToNextWordBoundary(): void; - deleteToBeginningOfWord(): void; - deleteToBeginningOfLine(): void; - delete(): void; - deleteToEndOfLine(): void; - deleteToEndOfWord(): void; - deleteToBeginningOfSubword(): void; - deleteToEndOfSubword(): void; - deleteSelectedText(): void; - deleteLine(): void; - joinLines(): void; - outdentSelectedRows(): void; - autoIndentSelectedRows(): void; - toggleLineComments(): void; - cutToEndOfLine(): void; - cutToEndOfBufferLine(): void; - cut(maintainClipboard?: boolean, fullLine?: boolean): void; - copy(maintainClipboard?: boolean, fullLine?: boolean): void; - fold(): void; - indentSelectedRows(): void; - - // Managing multiple selections - addSelectionBelow(): void; - addSelectionAbove(): void; - merge(otherSelection: ISelection, options?: { - preserveFolds?: boolean; - autoscroll?: boolean; - }): void; - - // Comparing to other selections - compare(otherSelection: ISelection): any; - } + /** Identifies if this cursor is the last in the TextEditor. + * "Last" is defined as the most recently added cursor. + */ + isLastCursor(): boolean; - interface IDecorationParams { - id?: number; - class: string; - type: any /* string or string[] */; - } + // Moving the Cursor + /** Moves the cursor up one screen row. */ + moveUp(rowCount?: number, options?: { moveToEndOfSelection?: boolean }): void; - interface IDecorationStatic { - isType(decorationParams:IDecorationParams, type:any /* string or string[] */):boolean; - new (marker:IDisplayBufferMarker, displayBuffer:IDisplayBuffer, params: IDecorationParams): IDecoration; - } + /** Moves the cursor down one screen row. */ + moveDown(rowCount?: number, options?: { moveToEndOfSelection?: boolean }): void; - interface IDecoration extends Emissary.IEmitter { - marker: IDisplayBufferMarker; - displayBuffer: IDisplayBuffer; - params: IDecorationParams - id: number; - flashQueue: any[]; - isDestroyed: boolean; - - destroy():void; - update(newParams:IDecorationParams):void; - getMarker():IDisplayBufferMarker; - getParams():IDecorationParams; - isType(type:string):boolean; - matchesPattern(decorationPattern:{[key:string]:IDecorationParams;}):boolean; - flash(klass:string, duration?:number):void; - consumeNextFlash():any; - } + /** Moves the cursor left one screen column. */ + moveLeft(columnCount?: number, options?: { moveToEndOfSelection?: boolean }): void; - interface IEditor { - // Serializable.includeInto(Editor); - // Delegator.includeInto(Editor); - - deserializing:boolean; - callDisplayBufferCreatedHook:boolean; - registerEditor:boolean; - buffer:TextBuffer.ITextBuffer; - languageMode: ILanguageMode; - cursors:ICursor[]; - selections: ISelection[]; - suppressSelectionMerging:boolean; - updateBatchDepth: number; - selectionFlashDuration: number; - softTabs: boolean; - displayBuffer: IDisplayBuffer; - - id:number; - behaviors:any; - declaredPropertyValues: any; - eventHandlersByEventName: any; - eventHandlersByNamespace: any; - lastOpened: number; - subscriptionCounts: any; - subscriptionsByObject: any; /* WeakMap */ - subscriptions: Emissary.ISubscription[]; - destroy():void; - - mini: any; - - serializeParams():{id:number; softTabs:boolean; scrollTop:number; scrollLeft:number; displayBuffer:any;}; - deserializeParams(params:any):any; - subscribeToBuffer():void; - subscribeToDisplayBuffer():void; - getViewClass():any; // return type are EditorView - destroyed():void; - isDestroyed():boolean; - copy():IEditor; - getTitle():string; - getLongTitle():string; - setVisible(visible:boolean):void; - setMini(mini:any):void; - setScrollTop(scrollTop:any):void; - getScrollTop():number; - setScrollLeft(scrollLeft:any):void; - getScrollLeft():number; - setEditorWidthInChars(editorWidthInChars:any):void; - getSoftWrapColumn():number; - getSoftTabs():boolean; - setSoftTabs(softTabs:boolean):void; - getSoftWrap():boolean; - setSoftWrap(softWrap:any):void; - getTabText():string; - getTabLength():number; - setTabLength(tabLength:any):void; - usesSoftTabs():boolean; - clipBufferPosition(bufferPosition:any):void; - clipBufferRange(range:any):void; - indentationForBufferRow(bufferRow:any):void; - setIndentationForBufferRow(bufferRow:any, newLevel:any, _arg:any):void; - indentLevelForLine(line:any):number; - buildIndentString(number:any):string; - save():void; - saveAs(filePath:any):void; - copyPathToClipboard():void; - getPath():string; - getText():string; - setText(text:any):void; - getTextInRange(range:any):any; - getLineCount():number; - getBuffer():TextBuffer.ITextBuffer; - getURI():string; - isBufferRowBlank(bufferRow:any):boolean; - isBufferRowCommented(bufferRow:any):void; - nextNonBlankBufferRow(bufferRow:any):void; - getEofBufferPosition():TextBuffer.IPoint; - getLastBufferRow():number; - bufferRangeForBufferRow(row:any, options:any):TextBuffer.IRange; - lineForBufferRow(row:number):string; - lineLengthForBufferRow(row:number):number; - scan():any; - scanInBufferRange():any; - backwardsScanInBufferRange():any; - isModified():boolean; - isEmpty():boolean; - shouldPromptToSave():boolean; - screenPositionForBufferPosition(bufferPosition:any, options?:any):TextBuffer.IPoint; - bufferPositionForScreenPosition(screenPosition:any, options?:any):TextBuffer.IPoint; - screenRangeForBufferRange(bufferRange:any):TextBuffer.IRange; - bufferRangeForScreenRange(screenRange:any):TextBuffer.IRange; - clipScreenPosition(screenPosition:any, options:any):TextBuffer.IRange; - lineForScreenRow(row:any):ITokenizedLine; - linesForScreenRows(start?:any, end?:any):ITokenizedLine[]; - getScreenLineCount():number; - getMaxScreenLineLength():number; - getLastScreenRow():number; - bufferRowsForScreenRows(startRow:any, endRow:any):any[]; - bufferRowForScreenRow(row:any):number; - scopesForBufferPosition(bufferPosition:any):string[]; - bufferRangeForScopeAtCursor(selector:string):any; - tokenForBufferPosition(bufferPosition:any):IToken; - getCursorScopes():string[]; - logCursorScope():void; - insertText(text:string, options?:any):TextBuffer.IRange[]; - insertNewline():TextBuffer.IRange[]; - insertNewlineBelow():TextBuffer.IRange[]; - insertNewlineAbove():any; - indent(options?:any):any; - backspace():any[]; - // deprecated backspaceToBeginningOfWord():any[]; - // deprecated backspaceToBeginningOfLine():any[]; - deleteToBeginningOfWord():any[]; - deleteToBeginningOfLine():any[]; - delete():any[]; - deleteToEndOfLine():any[]; - deleteToEndOfWord():any[]; - deleteLine():TextBuffer.IRange[]; - indentSelectedRows():TextBuffer.IRange[][]; - outdentSelectedRows():TextBuffer.IRange[][]; - toggleLineCommentsInSelection():TextBuffer.IRange[]; - autoIndentSelectedRows():TextBuffer.IRange[][]; - normalizeTabsInBufferRange(bufferRange:any):any; - cutToEndOfLine():boolean[]; - cutSelectedText():boolean[]; - copySelectedText():boolean[]; - pasteText(options?:any):TextBuffer.IRange[]; - undo():any[]; - redo():any[]; - foldCurrentRow():any; - unfoldCurrentRow():any[]; - foldSelectedLines():any[]; - foldAll():any[]; - unfoldAll():any[]; - foldAllAtIndentLevel(level:any):any; - foldBufferRow(bufferRow:any):any; - unfoldBufferRow(bufferRow:any):any; - isFoldableAtBufferRow(bufferRow:any):boolean; - isFoldableAtScreenRow(screenRow:any):boolean; - createFold(startRow:any, endRow:any):IFold; - destroyFoldWithId(id:any):any; - destroyFoldsIntersectingBufferRange(bufferRange:any):any; - toggleFoldAtBufferRow(bufferRow:any):any; - isFoldedAtCursorRow():boolean; - isFoldedAtBufferRow(bufferRow:any):boolean; - isFoldedAtScreenRow(screenRow:any):boolean; - largestFoldContainingBufferRow(bufferRow:any):boolean; - largestFoldStartingAtScreenRow(screenRow:any):any; - outermostFoldsInBufferRowRange(startRow:any, endRow:any):any[]; - moveLineUp():ISelection[]; - moveLineDown():ISelection[]; - duplicateLines():any[][]; - // duprecated duplicateLine():any[][]; - mutateSelectedText(fn:(selection:ISelection)=>any):any; - replaceSelectedText(options:any, fn:(selection:string)=>any):any; - decorationsForScreenRowRange(startScreenRow:any, endScreenRow:any):{[id:number]: IDecoration[]}; - decorateMarker(marker:IDisplayBufferMarker, decorationParams: {type:string; class: string;}):IDecoration; - decorationForId(id:number):IDecoration; - getMarker(id:number):IDisplayBufferMarker; - getMarkers():IDisplayBufferMarker[]; - findMarkers(...args:any[]):IDisplayBufferMarker[]; - markScreenRange(...args:any[]):IDisplayBufferMarker; - markBufferRange(...args:any[]):IDisplayBufferMarker; - markScreenPosition(...args:any[]):IDisplayBufferMarker; - markBufferPosition(...args:any[]):IDisplayBufferMarker; - destroyMarker(...args:any[]):boolean; - getMarkerCount():number; - hasMultipleCursors():boolean; - getCursors():ICursor[]; - getCursor():ICursor; - addCursorAtScreenPosition(screenPosition:any):ICursor; - addCursorAtBufferPosition(bufferPosition:any):ICursor; - addCursor(marker:any):ICursor; - removeCursor(cursor:any):ICursor[]; - addSelection(marker:any, options:any):ISelection; - addSelectionForBufferRange(bufferRange:any, options:any):ISelection; - setSelectedBufferRange(bufferRange:any, options:any):any; - setSelectedBufferRanges(bufferRanges:any, options:any):any; - removeSelection(selection:ISelection):any; - clearSelections():boolean; - consolidateSelections():boolean; - selectionScreenRangeChanged(selection:any):void; - getSelections():ISelection[]; - getSelection(index?:number):ISelection; - getLastSelection():ISelection; - getSelectionsOrderedByBufferPosition():ISelection[]; - getLastSelectionInBuffer():ISelection; - selectionIntersectsBufferRange(bufferRange:any):any; - setCursorScreenPosition(position:TextBuffer.IPoint, options?:any):any; - getCursorScreenPosition():TextBuffer.IPoint; - getCursorScreenRow():number; - setCursorBufferPosition(position:any, options?:any):any; - getCursorBufferPosition():TextBuffer.IPoint; - getSelectedScreenRange():TextBuffer.IRange; - getSelectedBufferRange():TextBuffer.IRange; - getSelectedBufferRanges():TextBuffer.IRange[]; - getSelectedText():string; - getTextInBufferRange(range:TextBuffer.IRange):string; - setTextInBufferRange(range:TextBuffer.IRange | any[], text:string):any; - getCurrentParagraphBufferRange():TextBuffer.IRange; - getWordUnderCursor(options?:any):string; - moveCursorUp(lineCount?:number):void; - moveCursorDown(lineCount?:number):void; - moveCursorLeft():void; - moveCursorRight():void; - moveCursorToTop():void; - moveCursorToBottom():void; - moveCursorToBeginningOfScreenLine():void; - moveCursorToBeginningOfLine():void; - moveCursorToFirstCharacterOfLine():void; - moveCursorToEndOfScreenLine():void; - moveCursorToEndOfLine():void; - moveCursorToBeginningOfWord():void; - moveCursorToEndOfWord():void; - moveCursorToBeginningOfNextWord():void; - moveCursorToPreviousWordBoundary():void; - moveCursorToNextWordBoundary():void; - moveCursorToBeginningOfNextParagraph():void; - moveCursorToBeginningOfPreviousParagraph():void; - moveToBottom():void; - scrollToCursorPosition(options:any):any; - pageUp():void; - pageDown():void; - selectPageUp():void; - selectPageDown():void; - getRowsPerPage():number; - moveCursors(fn:(cursor:ICursor)=>any):any; - cursorMoved(event:any):void; - selectToScreenPosition(position:TextBuffer.IPoint):any; - selectRight():ISelection[]; - selectLeft():ISelection[]; - selectUp(rowCount?:number):ISelection[]; - selectDown(rowCount?:number):ISelection[]; - selectToTop():ISelection[]; - selectAll():ISelection[]; - selectToBottom():ISelection[]; - selectToBeginningOfLine():ISelection[]; - selectToFirstCharacterOfLine():ISelection[]; - selectToEndOfLine():ISelection[]; - selectToPreviousWordBoundary():ISelection[]; - selectToNextWordBoundary():ISelection[]; - selectLine():ISelection[]; - selectLinesContainingCursors():ISelection[]; - addSelectionBelow():ISelection[]; - addSelectionAbove():ISelection[]; - splitSelectionsIntoLines():any[]; - transpose():TextBuffer.IRange[]; - upperCase():boolean[]; - lowerCase():boolean[]; - joinLines():any[]; - selectToBeginningOfWord():ISelection[]; - selectToEndOfWord():ISelection[]; - selectToBeginningOfNextWord():ISelection[]; - selectWord():ISelection[]; - selectToBeginningOfNextParagraph():ISelection[]; - selectToBeginningOfPreviousParagraph():ISelection[]; - selectMarker(marker:any):any; - mergeCursors():number[]; - expandSelectionsForward():any; - expandSelectionsBackward(fn:(selection:ISelection)=>any):ISelection[]; - finalizeSelections():boolean[]; - mergeIntersectingSelections():any; - preserveCursorPositionOnBufferReload():Emissary.ISubscription; - getGrammar(): IGrammar; - setGrammar(grammer:IGrammar):void; - reloadGrammar():any; - shouldAutoIndent():boolean; - shouldShowInvisibles():boolean; - updateInvisibles():void; - transact(fn:Function):any; - beginTransaction():ITransaction; - commitTransaction():any; - abortTransaction():any[]; - inspect():string; - logScreenLines(start:number, end:number):any[]; - handleTokenization():void; - handleGrammarChange():void; - handleMarkerCreated(marker:any):any; - getSelectionMarkerAttributes():{type: string; editorId: number; invalidate: string; }; - getVerticalScrollMargin():number; - setVerticalScrollMargin(verticalScrollMargin:number):void; - getHorizontalScrollMargin():number; - setHorizontalScrollMargin(horizontalScrollMargin:number):void; - getLineHeightInPixels():number; - setLineHeightInPixels(lineHeightInPixels:number):void; - batchCharacterMeasurement(fn:Function):void; - getScopedCharWidth(scopeNames:any, char:any):any; - setScopedCharWidth(scopeNames:any, char:any, width:any):any; - getScopedCharWidths(scopeNames:any):any; - clearScopedCharWidths():any; - getDefaultCharWidth():number; - setDefaultCharWidth(defaultCharWidth:number):void; - setHeight(height:number):void; - getHeight():number; - getClientHeight():number; - setWidth(width:number):void; - getWidth():number; - getScrollTop():number; - setScrollTop(scrollTop:number):void; - getScrollBottom():number; - setScrollBottom(scrollBottom:number):void; - getScrollLeft():number; - setScrollLeft(scrollLeft:number):void; - getScrollRight():number; - setScrollRight(scrollRight:number):void; - getScrollHeight():number; - getScrollWidth():number; - getVisibleRowRange():number; - intersectsVisibleRowRange(startRow:any, endRow:any):any; - selectionIntersectsVisibleRowRange(selection:any):any; - pixelPositionForScreenPosition(screenPosition:any):any; - pixelPositionForBufferPosition(bufferPosition:any):any; - screenPositionForPixelPosition(pixelPosition:any):any; - pixelRectForScreenRange(screenRange:any):any; - scrollToScreenRange(screenRange:any, options:any):any; - scrollToScreenPosition(screenPosition:any, options:any):any; - scrollToBufferPosition(bufferPosition:any, options:any):any; - horizontallyScrollable():any; - verticallyScrollable():any; - getHorizontalScrollbarHeight():any; - setHorizontalScrollbarHeight(height:any):any; - getVerticalScrollbarWidth():any; - setVerticalScrollbarWidth(width:any):any; - // deprecated joinLine():any; - - onDidChange(callback: Function): Disposable; - onDidDestroy(callback: Function): Disposable; - onDidStopChanging(callback: Function): Disposable; - onDidChangeCursorPosition(callback: Function): Disposable; - onDidSave(callback: (event: { path: string }) => void): Disposable; - - decorateMarker(marker: Marker, options: any): Decoration; - getLastCursor(): ICursor; - } + /** Moves the cursor right one screen column. */ + moveRight(columnCount?: number, options?: { moveToEndOfSelection?: boolean }): void; - interface IGrammar { - bundledPackage: boolean; - emitter: any; - fileTypes: [string]; - firstLineRegex: any; - foldingStopMarker: any; - includedGrammarScopes: [any]; - initialRule: any; - injectionSelector: any; - injections: any; - maxTokensPerLine: Number; - name: string; - packageName: string; - path: string; - rawPatterns: [any]; - rawRepository: any; - registration: Disposable; - registry: any; - repository: Object; - scopeName: string; - tokenizeLines: (text: string) => any; - // TBD + /** Moves the cursor to the top of the buffer. */ + moveToTop(): void; - } + /** Moves the cursor to the bottom of the buffer. */ + moveToBottom(): void; - interface IGrammars { - grammarForScopeName(scope: string): IGrammar; - } - - interface IPane /* extends Theorist.Model */ { - itemForURI: (uri:string)=>IEditor; - items:any[]; - activeItem:any; - - serializeParams():any; - deserializeParams(params:any):any; - getViewClass():any; // return type are PaneView - isActive():boolean; - isDestroyed():boolean; - focus():void; - blur():void; - activate():void; - getPanes():IPane[]; - getItems():any[]; - getActiveItem():any; - getActiveEditor():any; - itemAtIndex(index:number):any; - activateNextItem():any; - activatePreviousItem():any; - getActiveItemIndex():number; - activateItemAtIndex(index:number):any; - activateItem(item:any):any; - addItem(item:any, index:number):any; - addItems(items:any[], index:number):any[]; - removeItem(item:any, destroying:any):void; - moveItem(item:any, newIndex:number):void; - moveItemToPane(item:any, pane:IPane, index:number):void; - destroyActiveItem():boolean; // always return false - destroyItem(item:any):boolean; - destroyItems():any[]; - destroyInactiveItems():any[]; - destroy():void; - destroyed():any[]; - promptToSaveItem(item:any):boolean; - saveActiveItem():void; - saveActiveItemAs():void; - saveItem(item:any, nextAction:Function):void; - saveItemAs(item:any, nextAction:Function):void; - saveItems():any[]; - activateItemForURI(uri:any):any; - copyActiveItem():void; - splitLeft(params:any):IPane; - splitRight(params:any):IPane; - splitUp(params:any):IPane; - splitDown(params:any):IPane; - split(orientation:string, side:string, params:any):IPane; - findLeftmostSibling():IPane; - findOrCreateRightmostSibling():IPane; - } + /** Moves the cursor to the beginning of the line. */ + moveToBeginningOfScreenLine(): void; - // https://atom.io/docs/v0.84.0/advanced/serialization - interface ISerializationStatic { - deserialize(data:ISerializationInfo):T; - new (data:T): ISerialization; - } + /** Moves the cursor to the beginning of the buffer line. */ + moveToBeginningOfLine(): void; - interface ISerialization { - serialize():ISerializationInfo; - } + /** Moves the cursor to the beginning of the first character in the line. */ + moveToFirstCharacterOfLine(): void; - interface ISerializationInfo { - deserializer: string; - } + /** Moves the cursor to the end of the line. */ + moveToEndOfScreenLine(): void; - interface IBrowserWindow { - getPosition():number[]; - getSize():number[]; - } + /** Moves the cursor to the end of the buffer line. */ + moveToEndOfLine(): void; - interface IAtomWindowDimentions { - x:number; - y:number; - width:number; - height:number; - } + /** Moves the cursor to the beginning of the word. */ + moveToBeginningOfWord(): void; - interface IProjectStatic { - pathForRepositoryUrl(repoUrl:string):string; + /** Moves the cursor to the end of the word. */ + moveToEndOfWord(): void; - new (arg?:{path:any; buffers:any[];}):IProject; - } + /** Moves the cursor to the beginning of the next word. */ + moveToBeginningOfNextWord(): void; - interface IProject /* extends Theorist.Model */ { - // Serializable.includeInto(Project); - - path:string; - /** deprecated */ - rootDirectory?:PathWatcher.IDirectory; - rootDirectories:PathWatcher.IDirectory[]; - - serializeParams():any; - deserializeParams(params:any):any; - destroyed():any; - destroyRepo():any; - destroyUnretainedBuffers():any; - getRepo():IGit; - getPath():string; - setPath(projectPath:string):any; - getRootDirectory():PathWatcher.IDirectory; - resolve(uri:string):string; - relativize(fullPath:string):string; - contains(pathToCheck:string):boolean; - open(filePath:string, options?:any):Q.Promise; - openSync(filePath:string, options?:any):IEditor; - getBuffers():TextBuffer.ITextBuffer; - isPathModified(filePath:string):boolean; - findBufferForPath(filePath:string):TextBuffer.ITextBuffer; - bufferForPathSync(filePath:string):TextBuffer.ITextBuffer; - bufferForPath(filePath:string):Q.Promise; - bufferForId(id:any):TextBuffer.ITextBuffer; - buildBufferSync(absoluteFilePath:string):TextBuffer.ITextBuffer; - buildBuffer(absoluteFilePath:string):Q.Promise; - addBuffer(buffer:TextBuffer.ITextBuffer, options?:any):any; - addBufferAtIndex(buffer:TextBuffer.ITextBuffer, index:number, options?:any):any; - scan(regex:any, options:any, iterator:any):Q.Promise; - replace(regex:any, replacementText:any, filePaths:any, iterator:any):Q.Promise; - buildEditorForBuffer(buffer:any, editorOptions:any):IEditor; - eachBuffer(...args:any[]):any; - - onDidChangePaths(callback: Function): Disposable; - } + /** Moves the cursor to the previous word boundary. */ + moveToPreviousWordBoundary(): void; - interface IWorkspaceStatic { - new():IWorkspace; - } + /** Moves the cursor to the next word boundary. */ + moveToNextWordBoundary(): void; - interface IWorkspacePanelOptions{ - item:any; - visible?:boolean; - priority?:number; - } + /** Moves the cursor to the previous subword boundary. */ + moveToPreviousSubwordBoundary(): void; - interface Panel{ - getItem():any; - getPriority():any; - isVisible():boolean; - show():void; - hide():void; - } + /** Moves the cursor to the next subword boundary. */ + moveToNextSubwordBoundary(): void; - interface IWorkspace { - addBottomPanel(options:IWorkspacePanelOptions):Panel; - addLeftPanel(options:IWorkspacePanelOptions):Panel; - addRightPanel(options:IWorkspacePanelOptions):Panel; - addTopPanel(options:IWorkspacePanelOptions):Panel; - addModalPanel(options:IWorkspacePanelOptions):Panel; - addOpener(opener: Function): any; - - deserializeParams(params:any):any; - serializeParams():{paneContainer:any;fullScreen:boolean;}; - eachEditor(callback: Function): void; - getTextEditors():IEditor[]; - open(uri:string, options:any):Q.Promise; - openLicense():void; - openSync(uri:string, options:any):any; - openUriInPane(uri: string, pane: any, options: any): Q.Promise; - observeTextEditors(callback: Function): Disposable; - reopenItemSync():any; - registerOpener(opener:(urlToOpen:string)=>any):void; - unregisterOpener(opener:Function):void; - getOpeners():any; - getActivePane(): IPane; - getActivePaneItem(): IPane; - getActiveTextEditor(): IEditor; - getPanes():any; - saveAll():void; - activateNextPane():any; - activatePreviousPane():any; - paneForURI: (uri:string) => IPane; - saveActivePaneItem():any; - saveActivePaneItemAs():any; - destroyActivePaneItem():any; - destroyActivePane():any; - getActiveEditor():IEditor; - increaseFontSize():void; - decreaseFontSize():void; - resetFontSize():void; - itemOpened(item:any):void; - onPaneItemDestroyed(item:any):void; - destroyed():void; - isTextEditor(object: any): boolean; - - onDidChangeActivePaneItem(item:any):Disposable; - } + /** Moves the cursor to the beginning of the buffer line, skipping all whitespace. */ + skipLeadingWhitespace(): void; - interface IAtomSettings { - appVersion: string; - bootstrapScript: string; - devMode: boolean; - initialPath: string; - pathToOpen: string; - resourcePath: string; - shellLoadTime: number; - windowState:string; - } + /** Moves the cursor to the beginning of the next paragraph. */ + moveToBeginningOfNextParagraph(): void; - interface IAtomState { - mode:string; - packageStates:any; - project:any; - syntax:any; - version:number; - windowDimensions:any; - workspace:any; - } + /** Moves the cursor to the beginning of the previous paragraph. */ + moveToBeginningOfPreviousParagraph(): void; - interface IDeserializerManager { - deserializers:Function; - add:Function; - remove:Function; - deserialize:Function; - get:Function; - } + // Local Positions and Ranges + /** Returns buffer position of previous word boundary. It might be on the current + * word, or the previous word. + */ + getPreviousWordBoundaryBufferPosition(options?: { wordRegex?: RegExp }): + TextBuffer.Point; - interface IColorlike { - red: number; - green: number; - blue: number; - alpha: number; - } + /** Returns buffer position of the next word boundary. It might be on the current + * word, or the previous word. + */ + getNextWordBoundaryBufferPosition(options?: { wordRegex?: RegExp }): + TextBuffer.Point; - class Color { - public static parse(value:string): Color - public static parse(value:IColorlike): Color - public toHexString(): string - public toRGBAString(): string - } + /** Retrieves the buffer position of where the current word starts. */ + getBeginningOfCurrentWordBufferPosition(options?: { + wordRegex?: RegExp, + includeNonWordCharacters?: boolean, + allowPrevious?: boolean + }): TextBuffer.Point; - interface IConfigGetOptions { - sources?:Array; - excludeSources?:Array; - scope?:ScopeDescriptor; - } + /** Retrieves the buffer position of where the current word ends. */ + getEndOfCurrentWordBufferPosition(options?: { + wordRegex?: RegExp, + includeNonWordCharacters?: boolean + }): TextBuffer.Point; - interface IConfigSetOptions { - scopeSelector?:string; - source?:string; - } + /** Retrieves the buffer position of where the next word starts. */ + getBeginningOfNextWordBufferPosition(options?: { wordRegex?: RegExp }): TextBuffer.Point; - interface IConfigObserveOptions { - scope?:ScopeDescriptor; - } + /** Returns the buffer Range occupied by the word located under the cursor. */ + getCurrentWordBufferRange(options?: { wordRegex?: RegExp }): TextBuffer.Range; - interface IConfigChangeEvent { - newValue:T; - oldValue:T; - } + /** Returns the buffer Range for the current line. */ + getCurrentLineBufferRange(options?: { includeNewline?: boolean }): TextBuffer.Range; - type ConfigSetting = string | number | boolean | Color | IConfigArray | IConfigObject + /** Retrieves the range for the current paragraph. + * A paragraph is defined as a block of text surrounded by empty lines or comments. + */ + getCurrentParagraphBufferRange(): TextBuffer.Range; - interface IConfigArray extends Array { } + /** Returns the characters preceding the cursor in the current word. */ + getCurrentWordPrefix(): string; - interface IConfigObject { [key: string]: ConfigSetting } + // Visibility + /** Sets whether the cursor is visible. */ + setVisible(visible: boolean): void; - interface IConfig { - get(keyPath:string, options?:IConfigGetOptions):ConfigSetting; - set(keyPath:string, value:ConfigSetting, options?:IConfigSetOptions):boolean; - unset(keyPath:string, options?:IConfigSetOptions):void; - observe(keyPath:string, options?:IConfigObserveOptions, callback?:(value:ConfigSetting) => void):Disposable; - onDidChange(keyPath?:string, options?:IConfigObserveOptions, callback?:(event:IConfigChangeEvent) => void):Disposable; - } + /** Returns the visibility of the cursor. */ + isVisible(): boolean; - interface IKeymapManager { - defaultTarget:HTMLElement; - // TBD - } + // Comparing to another cursor + /** Compare this cursor's buffer position to another cursor's buffer position. + * See Point::compare for more details. + */ + compare(otherCursor: Cursor): number; - interface IPackage { - mainModulePath: string; - mainModule: any; - enable(): void; - disable(): void; - isTheme(): boolean; - getType(): string; - getStylesheetType(): string; - load(): IPackage; - reset(): void; - activate(): Q.Promise; - activateNow(): void; - // TBD - } + // Utilities + /** Prevents this cursor from causing scrolling. */ + clearAutoscroll(): void; - interface IPackageManager extends Emissary.IEmitter { - packageDirPaths:string[]; - loadedPackages:any; - activePackages:any; - packageStates:any; - packageActivators:any[]; - - getApmPath():string; - getPackageDirPaths():string; - getPackageState(name:string):any; - setPackageState(name:string, state:any):void; - enablePackage(name:string):any; - disablePackage(name:string):any; - activate():void; - registerPackageActivator(activator:any, types:any):void; - activatePackages(packages:any):void; - activatePackage(name:string):Q.Promise; - deactivatePackages():void; - deactivatePackage(name:string):void; - getActivePackages():any; - getActivePackage(name:string):any; - isPackageActive(name:string):boolean; - unobserveDisabledPackages():void; - observeDisabledPackages():void; - loadPackages():void; - loadPackage(nameOrPath:string):void; - unloadPackages():void; - unloadPackage(name:string):void; - getLoadedPackage(name:string):any; - isPackageLoaded(name:string):boolean; - getLoadedPackages():any; - getLoadedPackagesForTypes(types:any):any[]; - resolvePackagePath(name:string):string; - isPackageDisabled(name:string):boolean; - hasAtomEngine(packagePath:string):boolean; - isBundledPackage(name:string):boolean; - getPackageDependencies():any; - getAvailablePackagePaths():any[]; - getAvailablePackageNames():any[]; - getAvailablePackageMetadata():any[]; - } + /** Deselects the current selection. */ + clearSelection(): void; - interface INotifications { - addInfo: Function; - addError: Function; - addSuccess: Function; - addWarning: Function; - } + /** Get the RegExp used by the cursor to determine what a "word" is. */ + wordRegExp(options?: { includeNonWordCharacters?: boolean }): RegExp; + + /** Get the RegExp used by the cursor to determine what a "subword" is. */ + subwordRegExp(options?: { backwards?: boolean }): RegExp; + } - interface IThemeManager { - // TBD - } + /** Represents a decoration that follows a DisplayMarker. A decoration is basically + * a visual representation of a marker. It allows you to add CSS classes to line + * numbers in the gutter, lines, and add selection-line regions around marked ranges + * of text. + */ + interface Decoration { + id: number; + + // Construction and Destruction + /** Destroy this marker decoration. + * You can also destroy the marker if you own it, which will destroy this decoration. + */ + destroy(): void; + + // Event Subscription + /** When the Decoration is updated via Decoration::setProperties. */ + onDidChangeProperties(callback: (event: Events.DecorationPropsChanged) => void): + EventKit.Disposable; + + /** Invoke the given callback when the Decoration is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + // Decoration Details + /** An id unique across all Decoration objects. */ + getId(): number; + + /** Returns the marker associated with this Decoration. */ + getMarker(): TextBuffer.DisplayMarker; + + // Properties + /** Returns the Decoration's properties. */ + getProperties(): Structures.DecorationProps; + + /** Update the marker with new Properties. Allows you to change the decoration's + * class. + */ + setProperties(newProperties: Structures.DecorationProps): void; + } + + interface Deserializer { + name: string; + deserialize(state: object): object; + } + + /** Manages the deserializers used for serialized state. */ + interface DeserializerManager { + /** Register the given class(es) as deserializers. */ + add(...deserializers: Deserializer[]): EventKit.Disposable; - interface IContextMenuManager { - // TBD - } + /** Deserialize the state and params. */ + deserialize(state: object): object|undefined; + } - interface IMenuManager { - // TBD - } + /** A container at the edges of the editor window capable of holding items. */ + interface Dock { + // Methods + /** Show the dock and focus its active Pane. */ + activate(): void; - interface IClipboard { - write(text:string, metadata?:any):any; - read():string; - } + /** Show the dock without focusing it. */ + show(): void; - interface ISyntax { - // TBD - } + /** Hide the dock and activate the WorkspaceCenter if the dock was was previously focused. */ + hide(): void; - interface IWindowEventHandler { - // TBD - } + /** Toggle the dock's visiblity without changing the Workspace's active pane container. */ + toggle(): void; + + /** Check if the dock is visible. */ + isVisible(): boolean; + + // Event Subscription + /** Invoke the given callback when the visibility of the dock changes. */ + onDidChangeVisible(callback: (visible: boolean) => void): EventKit.Disposable; + + /** Invoke the given callback with the current and all future visibilities of the dock. */ + observeVisible(callback: (visible: boolean) => void): EventKit.Disposable; + + /** Invoke the given callback with all current and future panes items in the dock. */ + observePaneItems(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback when the active pane item changes. + * + * Because observers are invoked synchronously, it's important not to perform any expensive + * operations via this method. Consider ::onDidStopChangingActivePaneItem to delay operations + * until after changes stop occurring. + */ + onDidChangeActivePaneItem(callback: (item: object) => void): EventKit.Disposable; - interface IAtomStatic extends ISerializationStatic { - version: number; - loadSettings: IAtomSettings; - - /* Load or create the Atom environment in the given mode */ - loadOrCreate(mode:'editor'):IAtom; - /* Load or create the Atom environment in the given mode */ - loadOrCreate(mode:'spec'):IAtom; - /* Load or create the Atom environment in the given mode */ - loadOrCreate(mode:string):IAtom; - - loadState(mode:any):void; - getStatePath(mode:any):string; - getConfigDirPath():string; - getStorageDirPath():string; - getLoadSettings():IAtomSettings; - getCurrentWindow():IBrowserWindow; - getVersion():string; - isReleasedVersion():boolean; - - new(state:IAtomState):IAtom; - } + /** Invoke the given callback when the active pane item stops changing. */ + onDidStopChangingActivePaneItem(callback: (item: object) => void): EventKit.Disposable; - class Disposable { - constructor(disposalAction:any) - static isDisposable(object: any): boolean - dispose():void - } + /** Invoke the given callback with the current active pane item and with all future + * active pane items in the dock. + */ + observeActivePaneItem(callback: (item: object) => void): EventKit.Disposable; - class CompositeDisposable { - constructor(... disposables: Array) - clear():void - dispose():void - add(... disposables: Array): void - remove(disposable: Disposable): void - delete(disposable: Disposable): void - } + /** Invoke the given callback when a pane is added to the dock. */ + onDidAddPane(callback: (event: { pane: Pane }) => void): EventKit.Disposable; - // https://atom.io/docs/api/v0.106.0/api/classes/Atom.html - /* Global Atom class : instance members */ - interface IAtom { - constructor:IAtomStatic; - - state:IAtomState; - mode:string; - deserializers:IDeserializerManager; - config: IConfig; - commands: ICommandRegistry; - grammars: IGrammars; - keymaps: IKeymapManager; - keymap: IKeymapManager; - packages: IPackageManager; - themes: IThemeManager; - contextManu: IContextMenuManager; - menu: IMenuManager; - notifications: INotifications; // https://github.com/atom/notifications - clipboard:IClipboard; - syntax:ISyntax; - views: IViewRegistry; - windowEventHandler: IWindowEventHandler; - - // really exists? start - subscribe:Function; - unsubscribe:Function; - loadTime:number; - workspaceViewParentSelector:string; - - project: IProject; - workspaceView: IWorkspaceView; - workspace: IWorkspace; - // really exists? end - - initialize:Function; - // registerRepresentationClass:Function; - // registerRepresentationClasses:Function; - setBodyPlatformClass:Function; - getCurrentWindow():IBrowserWindow; - getWindowDimensions:Function; - setWindowDimensions:Function; - restoreWindowDimensions:Function; - storeWindowDimensions:Function; - getLoadSettings:Function; - deserializeProject: Function; - deserializeWorkspaceView:Function; - deserializePackageStates:Function; - deserializeEditorWindow:Function; - startEditorWindow:Function; - unloadEditorWindow:Function; - loadThemes:Function; - watchThemes:Function; - open:Function; - confirm:Function; - showSaveDialog:Function; - showSaveDialogSync:Function; - openDevTools:Function; - toggleDevTools:Function; - executeJavaScriptInDevTools:Function; - reload:Function; - focus:Function; - show:Function; - hide:Function; - setSize:Function; - setPosition:Function; - center:Function; - displayWindow:Function; - close:Function; - exit:Function; - inDevMode:Function; - inSpecMode:Function; - toggleFullScreen:Function; - setFullScreen:Function; - isFullScreen:Function; - getVersion:Function; - isReleasedVersion:Function; - getGitHubAuthTokenName:Function; - setGitHubAuthToken:Function; - getGitHubAuthToken:Function; - getConfigDirPath:Function; - saveSync:Function; - getWindowLoadTime():number; - crashMainProcess:Function; - crashRenderProcess:Function; - beep:Function; - getUserInitScriptPath:Function; - requireUserInitScript:Function; - requireWithGlobals:Function; - - services: any; // TODO: New services api - } + /** Invoke the given callback before a pane is destroyed in the dock. */ + onWillDestroyPane(callback: (event: { pane: Pane }) => void): EventKit.Disposable; - interface IBufferedNodeProcessStatic { - new (arg:any):IBufferedNodeProcess; - } + /** Invoke the given callback when a pane is destroyed in the dock. */ + onDidDestroyPane(callback: (event: { pane: Pane }) => void): EventKit.Disposable; - interface IBufferedNodeProcess extends IBufferedProcess { - } + /** Invoke the given callback with all current and future panes in the dock. */ + observePanes(callback: (pane: Pane) => void): EventKit.Disposable; - interface IBufferedProcessStatic { - new (arg:any):IBufferedProcess; - } + /** Invoke the given callback when the active pane changes. */ + onDidChangeActivePane(callback: (pane: Pane) => void): EventKit.Disposable; - interface IBufferedProcess { - process:Function; - killed:boolean; + /** Invoke the given callback with the current active pane and when the active pane changes. */ + observeActivePane(callback: (pane: Pane) => void): EventKit.Disposable; - bufferStream:Function; - kill:Function; - } + /** Invoke the given callback when a pane item is added to the dock. */ + onDidAddPaneItem(callback: (event: Events.PaneItemObserved) => void): + EventKit.Disposable; - interface IGitStatic { - new(path:any, options:any):IGit; - } + /** Invoke the given callback when a pane item is about to be destroyed, before the user is + * prompted to save it. + */ + onWillDestroyPaneItem(callback: (event: Events.PaneItemObserved) => void): + EventKit.Disposable; - interface IGit { - } + /** Invoke the given callback when a pane item is destroyed. */ + onDidDestroyPaneItem(callback: (event: Events.PaneItemObserved) => void): + EventKit.Disposable; - interface ITokenizedBuffer { - // TBD - } + // Pane Items + /** Get all pane items in the dock. */ + getPaneItems(): object[]; - interface ITokenizedLine { - // TBD - } + /** Get the active Pane's active item. */ + getActivePaneItem(): object; - interface IToken { - // TBD - } + // Panes + /** Returns an Array of Panes. */ + getPanes(): Pane[]; - interface IFoldStatic { - new (displayBuffer:IDisplayBuffer, marker:IMarker):IFold; - // TBD - } + /** Get the active Pane. */ + getActivePane(): Pane; - interface IFold { - id:number; - displayBuffer:IDisplayBuffer; - marker:IMarker; + /** Make the next pane active. */ + activateNextPane(): boolean; - // TBD - } + /** Make the previous pane active. */ + activatePreviousPane(): boolean; + } - interface IDisplayBufferMarkerStatic { - new (_arg:{bufferMarker:IMarker; displayBuffer: IDisplayBuffer}):IDisplayBufferMarker; - } + /** Represents the underlying git operations performed by Atom. */ + interface GitRepository { + // Lifecycle + /** Destroy this GitRepository object. */ + destroy(): void; - interface IDisplayBufferMarker extends Emissary.IEmitter, Emissary.ISubscriber { - constructor:IDisplayBufferMarkerStatic; - - id: number; - - bufferMarkerSubscription:any; - oldHeadBufferPosition:TextBuffer.IPoint; - oldHeadScreenPosition:TextBuffer.IPoint; - oldTailBufferPosition:TextBuffer.IPoint; - oldTailScreenPosition:TextBuffer.IPoint; - wasValid:boolean; - - bufferMarker: IMarker; - displayBuffer: IDisplayBuffer; - globalPauseCount:number; - globalQueuedEvents:any; - - subscriptions:Emissary.ISubscription[]; - subscriptionsByObject:any; // WeakMap - - copy(attributes?:any /* maybe IMarker */):IDisplayBufferMarker; - getScreenRange():TextBuffer.IRange; - setScreenRange(screenRange:any, options:any):any; - getBufferRange():TextBuffer.IRange; - setBufferRange(bufferRange:any, options:any):any; - getPixelRange():any; - getHeadScreenPosition():TextBuffer.IPoint; - setHeadScreenPosition(screenPosition:any, options:any):any; - getHeadBufferPosition():TextBuffer.IPoint; - setHeadBufferPosition(bufferPosition:any):any; - getTailScreenPosition():TextBuffer.IPoint; - setTailScreenPosition(screenPosition:any, options:any):any; - getTailBufferPosition():TextBuffer.IPoint; - setTailBufferPosition(bufferPosition:any):any; - plantTail():boolean; - clearTail():boolean; - hasTail():boolean; - isReversed():boolean; - isValid():boolean; - isDestroyed():boolean; - getAttributes():any; - setAttributes(attributes:any):any; - matchesAttributes(attributes:any):any; - destroy():any; - isEqual(other:IDisplayBufferMarker):boolean; - compare(other:IDisplayBufferMarker):boolean; - inspect():string; - destroyed():any; - notifyObservers(_arg:any):any; - } + /** Returns a boolean indicating if this repository has been destroyed. */ + isDestroyed(): boolean; - interface ITransaction { - // TBD - } + // Event Subscription + /** Invoke the given callback when this GitRepository's destroy() method is + * invoked. + */ + onDidDestroy(callback: () => void): EventKit.Disposable; - interface IMarker extends Emissary.IEmitter { - // Serializable.includeInto(Editor); - // Delegator.includeInto(Editor); + /** Invoke the given callback when a specific file's status has changed. When + * a file is updated, reloaded, etc, and the status changes, this will be fired. + */ + onDidChangeStatus(callback: (event: Events.RepoStatusChanged) => void): + EventKit.Disposable; - // TBD - } + /** Invoke the given callback when a multiple files' statuses have changed. */ + onDidChangeStatuses(callback: () => void): EventKit.Disposable; - interface ITaskStatic { - new(taskPath:any):ITask; - } + // Repository Details + /** A string indicating the type of version control system used by this repository. */ + getType(): "git"; + + /** Returns the string path of the repository. */ + getPath(): string; + + /** Returns the string working directory path of the repository. */ + getWorkingDirectory(): string; + + /** Returns true if at the root, false if in a subfolder of the repository. */ + isProjectAtRoot(): boolean; + + /** Makes a path relative to the repository's working directory. */ + relativize(): string; + + /** Returns true if the given branch exists. */ + hasBranch(branch: string): boolean; + + /** Retrieves a shortened version of the HEAD reference value. */ + getShortHead(path?: string): string; + + /** Is the given path a submodule in the repository? */ + isSubmodule(path: string): boolean; + + /** Returns the number of commits behind the current branch is from the its + * upstream remote branch. The default reference is the HEAD. + * @param reference The branch reference name. + * @param path The path in the repository to get this ifnromation for, only + * needed if the repository contains submodules. + * @return Returns the number of commits behind the current branch is from its + * upstream remote branch. + */ + getAheadBehindCount(reference: string, path?: string): { ahead: number, behind: number }; + + /** Get the cached ahead/behind commit counts for the current branch's + * upstream branch. + */ + getCachedUpstreamAheadBehindCount(path?: string): { ahead: number, behind: number }; + + /** Returns the git configuration value specified by the key. */ + getConfigValue(key: string, path?: string): string; + + /** Returns the origin url of the repository. */ + getOriginURL(path?: string): string; + + /** Returns the upstream branch for the current HEAD, or null if there is no + * upstream branch for the current HEAD. + */ + getUpstreamBranch(path?: string): string|null; + + /** Gets all the local and remote references. */ + getReferences(path?: string): { heads: string[], remotes: string[], tags: string[] }; + + /** Returns the current string SHA for the given reference. */ + getReferenceTarget(reference: string, path?: string): string; + + // Reading Status + /** Returns true if the given path is modified. */ + isPathModified(path: string): boolean; + + /** Returns true if the given path is new. */ + isPathNew(path: string): boolean; + + /** Is the given path ignored? */ + isPathIgnored(path: string): boolean; + + /** Get the status of a directory in the repository's working directory. */ + getDirectoryStatus(path: string): number; + + /** Get the status of a single path in the repository. */ + getPathStatus(path: string): number; + + /** Get the cached status for the given path. */ + getCachedPathStatus(path: string): number|null; + + /** Returns true if the given status indicates modification. */ + isStatusModified(status: number): boolean; + + /** Returns true if the given status indicates a new path. */ + isStatusNew(status: number): boolean; + + // Retrieving Diffs + /** Retrieves the number of lines added and removed to a path. + * This compares the working directory contents of the path to the HEAD version. + */ + getDiffStats(path: string): { added: number, deleted: number }; + + /** Retrieves the line diffs comparing the HEAD version of the given path + * and the given text. + */ + getLineDiffs(path: string, text: string): Array<{ oldStart: number, + newStart: number, oldLines: number, newLines: number }>; + + // Checking Out + /** Restore the contents of a path in the working directory and index to the + * version at HEAD. + */ + checkoutHead(path: string): boolean; + + /** Checks out a branch in your repository. */ + checkoutReference(reference: string, create: boolean): boolean; + } + + /** Represents a gutter within a TextEditor. */ + interface Gutter { + // Gutter Destruction + /** Destroys the gutter. */ + destroy(): void; + + // Event Subscription + /** Calls your callback when the gutter's visibility changes. */ + onDidChangeVisible(callback: (gutter: Gutter) => void): EventKit.Disposable; + + /** Calls your callback when the gutter is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + // Visibility + /** Hide the gutter. */ + hide(): void; + + /** Show the gutter. */ + show(): void; + + /** Determine whether the gutter is visible. */ + isVisible(): boolean; + + /** Add a decoration that tracks a DisplayMarker. When the marker moves, is + * invalidated, or is destroyed, the decoration will be updated to reflect + * the marker's state. + */ + decorateMarker(marker: TextBuffer.DisplayMarker, decorationParams: + Structures.DecorationProps): Decoration; + } + + /** History manager for remembering which projects have been opened. + * An instance of this class is always available as the atom.history global. + * The project history is used to enable the 'Reopen Project' menu. + */ + interface HistoryManager { + /** Obtain a list of previously opened projects. */ + getProjects(): HistoryProject[]; + + /** Clear all projects from the history. + * Note: This is not a privacy function - other traces will still exist, e.g. + * window state. + */ + clearProjects(): void; + + /** Invoke the given callback when the list of projects changes. */ + onDidChangeProjects(callback: (args: { reloaded: boolean }) => void): EventKit.Disposable; + } + + interface HistoryProject { + paths: string[]; + lastOpened: Date; + } + + /** Represents a decoration that applies to every marker on a given layer. Created via + * TextEditor::decorateMarkerLayer. + */ + interface LayerDecoration { + /** Destroys the decoration. */ + destroy(): void; + + /** Determine whether this decoration is destroyed. */ + isDestroyed(): boolean; + + /** Get this decoration's properties. */ + getProperties(): Structures.DecorationLayerProps; + + /** Set this decoration's properties. */ + setProperties(newProperties: Structures.DecorationLayerProps): void; + + /** Override the decoration properties for a specific marker. */ + setPropertiesForMarker(marker: TextBuffer.DisplayMarker|TextBuffer.Marker, + properties: Structures.DecorationLayerProps): void; + } + + /** Provides a registry for menu items that you'd like to appear in the application menu. */ + interface MenuManager { + /** Adds the given items to the application menu. */ + add(items: ReadonlyArray): EventKit.Disposable; + + /** Refreshes the currently visible menu. */ + update(): void; + } + + interface Model { + // Properties + alive: boolean; + + // Lifecycle + /** Destroys this Model. */ + destroy(): void; + + /** Returns whether or not this Model is alive. */ + isAlive(): boolean; + + /** Returns whether or not this Model has been destroyed. */ + isDestroyed(): boolean; + } + + /** A notification to the user containing a message and type. */ + interface Notification { + // Properties + dismissed: boolean; + displayed: boolean; + timestamp: Date; + + // Event Subscription + /** Invoke the given callback when the notification is dismissed. */ + onDidDismiss(callback: (notification: Notification) => void): EventKit.Disposable; + + /** Invoke the given callback when the notification is displayed. */ + onDidDisplay(callback: (notification: Notification) => void): EventKit.Disposable; + + // Methods + /** Returns the Notification's type. */ + getType(): string; + + /** Returns the Notification's message. */ + getMessage(): string; + + /** Dismisses the notification, removing it from the UI. Calling this + * programmatically will call all callbacks added via onDidDismiss. + */ + dismiss(): void; + } + + /** A notification manager used to create Notifications to be shown to the user. */ + interface NotificationManager { + // Properties + notifications: Notification[]; + + // Events + /** Invoke the given callback after a notification has been added. */ + onDidAddNotification(callback: (notification: Notification) => void): + EventKit.Disposable; + + // Adding Notifications + /** Add a success notification. */ + addSuccess(message: string, options?: Options.Notification): Notification; + + /** Add an informational notification. */ + addInfo(message: string, options?: Options.Notification): Notification; + + /** Add a warning notification. */ + addWarning(message: string, options?: Options.Notification): Notification; + + /** Add an error notification. */ + addError(message: string, options?: Options.ErrorNotification): Notification; + + /** Add a fatal error notification. */ + addFatalError(message: string, options?: Options.ErrorNotification): Notification; + + // Getting Notifications + /** Get all the notifications. */ + getNotifications(): Notification[]; + } + + /** Loads and activates a package's main module and resources such as stylesheets, + * keymaps, grammar, editor properties, and menus. + */ + interface Package { + // Properties + name: string; + bundledPackage: boolean; + path: string; + + // Event Subscription + /** Invoke the given callback when all packages have been activated. */ + onDidDeactivate(callback: () => void): EventKit.Disposable; + + // Native Module Compatibility + /** Are all native modules depended on by this package correctly compiled + * against the current version of Atom? + */ + isCompatible(): boolean; + + /** Rebuild native modules in this package's dependencies for the current + * version of Atom. + */ + rebuild(): Promise<{ code: number, stdout: string, stderr: string }>; + + /** If a previous rebuild failed, get the contents of stderr. */ + getBuildFailureOutput(): string|null; + } + + /** Package manager for coordinating the lifecycle of Atom packages. */ + interface PackageManager { + // Event Subscription + /** Invoke the given callback when all packages have been loaded. */ + onDidLoadInitialPackages(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when all packages have been activated. */ + onDidActivateInitialPackages(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when a package is activated. */ + onDidActivatePackage(callback: (package: Package) => void): EventKit.Disposable; + + /** Invoke the given callback when a package is deactivated. */ + onDidDeactivatePackage(callback: (package: Package) => void): EventKit.Disposable; + + /** Invoke the given callback when a package is loaded. */ + onDidLoadPackage(callback: (package: Package) => void): EventKit.Disposable; + + /** Invoke the given callback when a package is unloaded. */ + onDidUnloadPackage(callback: (package: Package) => void): EventKit.Disposable; + + // Package System Data + /** Get the path to the apm command. */ + getApmPath(): string; + + /** Get the paths being used to look for packages. */ + getPackageDirPaths(): string[]; + + // General Package Data + /** Resolve the given package name to a path on disk. */ + resolvePackagePath(name: string): string|undefined; + + /** Is the package with the given name bundled with Atom? */ + isBundledPackage(name: string): boolean; + + // Enabling and Disabling Packages + /** Enable the package with the given name. */ + enablePackage(name: string): Package|undefined; + + /** Disable the package with the given name. */ + disablePackage(name: string): Package|undefined; + + /** Is the package with the given name disabled? */ + isPackageDisabled(name: string): boolean; + + // Accessing Active Packages + /** Get an Array of all the active Packages. */ + getActivePackages(): Package[]; + + /** Get the active Package with the given name. */ + getActivePackage(name: string): Package|undefined; + + /** Is the Package with the given name active? */ + isPackageActive(name: string): boolean; + + /** Returns a boolean indicating whether package activation has occurred. */ + hasActivatedInitialPackages(): boolean; + + // Accessing Loaded Packages + /** Get an Array of all the loaded Packages. */ + getLoadedPackages(): Package[]; + + /** Get the loaded Package with the given name. */ + getLoadedPackage(name: string): Package|undefined; + + /** Is the package with the given name loaded? */ + isPackageLoaded(name: string): boolean; + + /** Returns a boolean indicating whether package loading has occurred. */ + hasLoadedInitialPackages(): boolean; + + // Accessing Available Packages + /** Returns an Array of strings of all the available package paths. */ + getAvailablePackagePaths(): string[]; + + /** Returns an Array of strings of all the available package names. */ + getAvailablePackageNames(): string[]; + + /** Returns an Array of strings of all the available package metadata. */ + getAvailablePackageMetadata(): string[]; + } + + /** A container for presenting content in the center of the workspace. */ + interface Pane { + // Event Subscription + /** Invoke the given callback when the pane resizes. */ + onDidChangeFlexScale(callback: (flexScale: number) => void): EventKit.Disposable; + + /** Invoke the given callback with the current and future values of ::getFlexScale. */ + observeFlexScale(callback: (flexScale: number) => void): EventKit.Disposable; + + /** Invoke the given callback when the pane is activated. */ + onDidActivate(callback: () => void): EventKit.Disposable; - interface ITask { - // TBD + /** Invoke the given callback before the pane is destroyed. */ + onWillDestroy(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when the pane is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when the value of the ::isActive property changes. */ + onDidChangeActive(callback: (active: boolean) => void): EventKit.Disposable; + + /** Invoke the given callback with the current and future values of the ::isActive + * property. + */ + observeActive(callback: (active: boolean) => void): EventKit.Disposable; + + /** Invoke the given callback when an item is added to the pane. */ + onDidAddItem(callback: (event: Events.PaneListItemShifted) => void): + EventKit.Disposable; + + /** Invoke the given callback when an item is removed from the pane. */ + onDidRemoveItem(callback: (event: Events.PaneListItemShifted) => void): + EventKit.Disposable; + + /** Invoke the given callback before an item is removed from the pane. */ + onWillRemoveItem(callback: (event: Events.PaneListItemShifted) => void): + EventKit.Disposable; + + /** Invoke the given callback when an item is moved within the pane. */ + onDidMoveItem(callback: (event: Events.PaneItemMoved) => void): + EventKit.Disposable; + + /** Invoke the given callback with all current and future items. */ + observeItems(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback when the value of ::getActiveItem changes. */ + onDidChangeActiveItem(callback: (activeItem: object) => void): EventKit.Disposable; + + /** Invoke the given callback when ::activateNextRecentlyUsedItem has been called, + * either initiating or continuing a forward MRU traversal of pane items. + */ + onChooseNextMRUItem(callback: (nextRecentlyUsedItem: object) => void): EventKit.Disposable; + + /** Invoke the given callback when ::activatePreviousRecentlyUsedItem has been called, + * either initiating or continuing a reverse MRU traversal of pane items. + */ + onChooseLastMRUItem(callback: (previousRecentlyUsedItem: object) => void): + EventKit.Disposable; + + /** Invoke the given callback when ::moveActiveItemToTopOfStack has been called, + * terminating an MRU traversal of pane items and moving the current active item + * to the top of the stack. Typically bound to a modifier (e.g. CTRL) key up event. + */ + onDoneChoosingMRUItem(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback with the current and future values of ::getActiveItem. */ + observeActiveItem(callback: (activeItem: object) => void): EventKit.Disposable; + + /** Invoke the given callback before items are destroyed. */ + onWillDestroyItem(callback: (event: Events.PaneListItemShifted) => void): + EventKit.Disposable; + + // Items + /** Get the items in this pane. */ + getItems(): object[]; + + /** Get the active pane item in this pane. */ + getActiveItem(): object; + + /** Return the item at the given index. */ + itemAtIndex(index: number): object|undefined; + + /** Makes the next item active. */ + activateNextItem(): void; + + /** Makes the previous item active. */ + activatePreviousItem(): void; + + /** Move the active tab to the right. */ + moveItemRight(): void; + + /** Move the active tab to the left. */ + moveItemLeft(): void; + + /** Get the index of the active item. */ + getActiveItemIndex(): number; + + /** Activate the item at the given index. */ + activateItemAtIndex(index: number): void; + + /** Make the given item active, causing it to be displayed by the pane's view. */ + activateItem(item: object, options?: { pending: boolean }): void; + + /** Add the given item to the pane. */ + addItem(item: object, options?: { index?: number, pending?: boolean }): object; + + /** Add the given items to the pane. */ + addItems(items: object[], index?: number): object[]; + + /** Move the given item to the given index. */ + moveItem(item: object, index: number): void; + + /** Move the given item to the given index on another pane. */ + moveItemToPane(item: object, pane: Pane, index: number): void; + + /** Destroy the active item and activate the next item. */ + destroyActiveItem(): void; + + /** Destroy the given item. */ + destroyItem(item: object, force?: boolean): void; + + /** Destroy all items. */ + destroyItems(): void; + + /** Destroy all items except for the active item. */ + destroyInactiveItems(): void; + + /** Save the active item. */ + saveActiveItem(): void; + + /** Prompt the user for a location and save the active item with the path + * they select. + */ + saveActiveItemAs(nextAction?: (error?: Error) => T): T|undefined; + + /** Save the given item. */ + saveItem(item: object, nextAction?: (error?: Error) => T): T|undefined; + + /** Prompt the user for a location and save the active item with the path + * they select. + */ + saveItemAs(item: object, nextAction?: (error?: Error) => T): T|undefined; + + /** Save all items. */ + saveItems(): void; + + /** Return the first item that matches the given URI or undefined if none exists. */ + itemForURI(uri: string): object|undefined; + + /** Activate the first item that matches the given URI. */ + activateItemForURI(uri: string): boolean; + + // Lifecycle + /** Determine whether the pane is active. */ + isActive(): boolean; + + /** Makes this pane the active pane, causing it to gain focus. */ + activate(): void; + + /** Close the pane and destroy all its items. */ + destroy(): void; + + /** Determine whether this pane has been destroyed. */ + isDestroyed(): boolean; + + // Splitting + /** Create a new pane to the left of this pane. */ + splitLeft(params?: { + items?: object[], + copyActiveItem?: boolean, + }): Pane; + + /** Create a new pane to the right of this pane. */ + splitRight(params?: { + items?: object[], + copyActiveItem?: boolean, + }): Pane; + + /** Creates a new pane above the receiver. */ + splitUp(params?: { + items?: object[], + copyActiveItem?: boolean, + }): Pane; + + /** Creates a new pane below the receiver. */ + splitDown(params?: { + items?: object[], + copyActiveItem?: boolean, + }): Pane; + } + + /** A container representing a panel on the edges of the editor window. You + * should not create a Panel directly, instead use Workspace::addTopPanel and + * friends to add panels. + */ + interface Panel { + visible: boolean; + + // Construction and Destruction + /** Destroy and remove this panel from the UI. */ + destroy(): void; + + // Event Subscription + /** Invoke the given callback when the pane hidden or shown. */ + onDidChangeVisible(callback: (visible: boolean) => void): EventKit.Disposable; + + /** Invoke the given callback when the pane is destroyed. */ + onDidDestroy(callback: (panel: Panel) => void): EventKit.Disposable; + + // Panel Details + /** Returns the panel's item. */ + getItem(): object; + + /** Returns a number indicating this panel's priority. */ + getPriority(): number; + + /** Returns a boolean true when the panel is visible. */ + isVisible(): boolean; + + /** Hide this panel. */ + hide(): void; + + /** Show this panel. */ + show(): void; + } + + /** Represents a project that's opened in Atom. */ + interface Project { + // Event Subscription + /** Invoke the given callback when the project paths change. */ + onDidChangePaths(callback: (projectPaths: string[]) => void): EventKit.Disposable; + + /** Invoke the given callback when a text buffer is added to the project. */ + onDidAddBuffer(callback: (buffer: TextBuffer.TextBuffer) => void): EventKit.Disposable; + + /** Invoke the given callback with all current and future text buffers in + * the project. + */ + observeBuffers(callback: (buffer: TextBuffer.TextBuffer) => void): EventKit.Disposable; + + // Accessing the Git Repository + /** Get an Array of GitRepositorys associated with the project's directories. */ + getRepositories(): GitRepository[]; + + /** Get the repository for a given directory asynchronously. */ + repositoryForDirectory(directory: PathWatcher.Directory): Promise; + + // Managing Paths + /** Get an Array of strings containing the paths of the project's directories. */ + getPaths(): string[]; + + /** Set the paths of the project's directories. */ + setPaths(projectPaths: string[]): void; + + /** Add a path to the project's list of root paths. */ + addPath(projectPath: string): void; + + /** Remove a path from the project's list of root paths. */ + removePath(projectPath: string): void; + + /** Get an Array of Directorys associated with this project. */ + getDirectories(): PathWatcher.Directory[]; + + /** Get the relative path from the project directory to the given path. */ + relativize(fullPath: string): string; + + /** Get the path to the project directory that contains the given path, and + * the relative path from that project directory to the given path. + */ + relativizePath(fullPath: string): [string|null, string]; + + /** Determines whether the given path (real or symbolic) is inside the + * project's directory. + */ + contains(pathToCheck: string): boolean; + } + + /** Wraps an Array of Strings. The Array describes a path from the root of the + * syntax tree to a token including all scope names for the entire path. + */ + interface ScopeDescriptor { + scopes: string[]; + + /** Returns all scopes for this descriptor. */ + getScopesArray(): string[]; + } + + /** Represents a selection in the TextEditor. */ + interface Selection { + // Event Subscription + /** Calls your callback when the selection was moved. */ + onDidChangeRange(callback: (event: Events.SelectionChanged) => void): + EventKit.Disposable; + + /** Calls your callback when the selection was destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + // Managing the selection range + /** Returns the screen Range for the selection. */ + getScreenRange(): TextBuffer.Range; + + /** Modifies the screen range for the selection. */ + setScreenRange(screenRange: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]], options?: + { preserveFolds?: boolean, autoscroll?: boolean }): void; + + /** Returns the buffer Range for the selection. */ + getBufferRange(): TextBuffer.Range; + + /** Modifies the buffer Range for the selection. */ + setBufferRange(bufferRange: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]], options?: + { preserveFolds?: boolean, autoscroll?: boolean }): void; + + /** Returns the starting and ending buffer rows the selection is highlighting. */ + getBufferRowRange(): [number, number]; + + // Info about the selection + /** Determines if the selection contains anything. */ + isEmpty(): boolean; + + /** Determines if the ending position of a marker is greater than the starting position. + * This can happen when, for example, you highlight text "up" in a TextBuffer. + */ + isReversed(): boolean; + + /** Returns whether the selection is a single line or not. */ + isSingleScreenLine(): boolean; + + /** Returns the text in the selection. */ + getText(): string; + + // NOTE: this calls into Range.intersectsWith(), which is one of the few functions + // that doesn't take a range-compatible range, despite what the API says. + /** Identifies if a selection intersects with a given buffer range. */ + intersectsBufferRange(bufferRange: TextBuffer.RangeLike): boolean; + + /** Identifies if a selection intersects with another selection. */ + intersectsWith(otherSelection: Selection): boolean; + + // Modifying the selected range + /** Clears the selection, moving the marker to the head. */ + clear(options?: { autoscroll?: boolean }): void; + + /** Selects the text from the current cursor position to a given screen position. */ + selectToScreenPosition(position: TextBuffer.PointLike|[number, number]): void; + + /** Selects the text from the current cursor position to a given buffer position. */ + selectToBufferPosition(position: TextBuffer.PointLike|[number, number]): void; + + /** Selects the text one position right of the cursor. */ + selectRight(columnCount?: number): void; + + /** Selects the text one position left of the cursor. */ + selectLeft(columnCount?: number): void; + + /** Selects all the text one position above the cursor. */ + selectUp(rowCount?: number): void; + + /** Selects all the text one position below the cursor. */ + selectDown(rowCount?: number): void; + + /** Selects all the text from the current cursor position to the top of the + * buffer. + */ + selectToTop(): void; + + /** Selects all the text from the current cursor position to the bottom of + * the buffer. + */ + selectToBottom(): void; + + /** Selects all the text in the buffer. */ + selectAll(): void; + + /** Selects all the text from the current cursor position to the beginning of + * the line. + */ + selectToBeginningOfLine(): void; + + /** Selects all the text from the current cursor position to the first character + * of the line. + */ + selectToFirstCharacterOfLine(): void; + + /** Selects all the text from the current cursor position to the end of the + * screen line. + */ + selectToEndOfLine(): void; + + /** Selects all the text from the current cursor position to the end of the + * buffer line. + */ + selectToEndOfBufferLine(): void; + + /** Selects all the text from the current cursor position to the beginning + * of the word. + */ + selectToBeginningOfWord(): void; + + /** Selects all the text from the current cursor position to the end of the word. */ + selectToEndOfWord(): void; + + /** Selects all the text from the current cursor position to the beginning of + * the next word. + */ + selectToBeginningOfNextWord(): void; + + /** Selects text to the previous word boundary. */ + selectToPreviousWordBoundary(): void; + + /** Selects text to the next word boundary. */ + selectToNextWordBoundary(): void; + + /** Selects text to the previous subword boundary. */ + selectToPreviousSubwordBoundary(): void; + + /** Selects text to the next subword boundary. */ + selectToNextSubwordBoundary(): void; + + /** Selects all the text from the current cursor position to the beginning of + * the next paragraph. + */ + selectToBeginningOfNextParagraph(): void; + + /** Selects all the text from the current cursor position to the beginning of + * the previous paragraph. + */ + selectToBeginningOfPreviousParagraph(): void; + + /** Modifies the selection to encompass the current word. */ + selectWord(): void; + + /** Expands the newest selection to include the entire word on which the + * cursors rests. + */ + expandOverWord(): void; + + /** Selects an entire line in the buffer. */ + selectLine(row: number): void; + + /** Expands the newest selection to include the entire line on which the cursor + * currently rests. + * It also includes the newline character. + */ + expandOverLine(): void; + + // Modifying the selected text + /** Replaces text at the current selection. */ + insertText(text: string, options?: Options.TextInsertion): void; + + /** Removes the first character before the selection if the selection is empty + * otherwise it deletes the selection. + */ + backspace(): void; + + /** Removes the selection or, if nothing is selected, then all characters from + * the start of the selection back to the previous word boundary. + */ + deleteToPreviousWordBoundary(): void; + + /** Removes the selection or, if nothing is selected, then all characters from + * the start of the selection up to the next word boundary. + */ + deleteToNextWordBoundary(): void; + + /** Removes from the start of the selection to the beginning of the current + * word if the selection is empty otherwise it deletes the selection. + */ + deleteToBeginningOfWord(): void; + + /** Removes from the beginning of the line which the selection begins on all + * the way through to the end of the selection. + */ + deleteToBeginningOfLine(): void; + + /** Removes the selection or the next character after the start of the selection + * if the selection is empty. + */ + delete(): void; + + /** If the selection is empty, removes all text from the cursor to the end of + * the line. If the cursor is already at the end of the line, it removes the following + * newline. If the selection isn't empty, only deletes the contents of the selection. + */ + deleteToEndOfLine(): void; + + /** Removes the selection or all characters from the start of the selection to + * the end of the current word if nothing is selected. + */ + deleteToEndOfWord(): void; + + /** Removes the selection or all characters from the start of the selection to + * the end of the current word if nothing is selected. + */ + deleteToBeginningOfSubword(): void; + + /** Removes the selection or all characters from the start of the selection to + * the end of the current word if nothing is selected. + */ + deleteToEndOfSubword(): void; + + /** Removes only the selected text. */ + deleteSelectedText(): void; + + /** Removes the line at the beginning of the selection if the selection is empty + * unless the selection spans multiple lines in which case all lines are removed. + */ + deleteLine(): void; + + /** Joins the current line with the one below it. Lines will be separated by a single space. + * If there selection spans more than one line, all the lines are joined together. + */ + joinLines(): void; + + /** Removes one level of indent from the currently selected rows. */ + outdentSelectedRows(): void; + + /** Sets the indentation level of all selected rows to values suggested by the + * relevant grammars. + */ + autoIndentSelectedRows(): void; + + /** Wraps the selected lines in comments if they aren't currently part of a comment. + * Removes the comment if they are currently wrapped in a comment. + */ + toggleLineComments(): void; + + /** Cuts the selection until the end of the screen line. */ + cutToEndOfLine(): void; + + /** Cuts the selection until the end of the buffer line. */ + cutToEndOfBufferLine(): void; + + /** Copies the selection to the clipboard and then deletes it. */ + cut(maintainClipboard?: boolean, fullLine?: boolean): void; + + /** Copies the current selection to the clipboard. */ + copy(maintainClipboard?: boolean, fullLine?: boolean): void; + + /** Creates a fold containing the current selection. */ + fold(): void; + + /** If the selection spans multiple rows, indent all of them. */ + indentSelectedRows(): void; + + // Managing multiple selections + /** Moves the selection down one row. */ + addSelectionBelow(): void; + + /** Moves the selection up one row. */ + addSelectionAbove(): void; + + /** Combines the given selection into this selection and then destroys the + * given selection. + */ + merge(otherSelection: Selection, options?: { preserveFolds?: boolean, + autoscroll?: boolean }): void; + + // Comparing to other selections + /** Compare this selection's buffer range to another selection's buffer range. + * See Range::compare for more details. + */ + compare(otherSelection: Selection): number; + } + + /** A singleton instance of this class available via atom.styles, which you can + * use to globally query and observe the set of active style sheets. + */ + interface StyleManager { + // Event Subscription + /** Invoke callback for all current and future style elements. */ + observeStyleElements(callback: (styleElement: Events.StyleElementObserved) => + void): EventKit.Disposable; + + /** Invoke callback when a style element is added. */ + onDidAddStyleElement(callback: (styleElement: Events.StyleElementObserved) => + void): EventKit.Disposable; + + /** Invoke callback when a style element is removed. */ + onDidRemoveStyleElement(callback: (styleElement: HTMLStyleElement) => void): + EventKit.Disposable; + + /** Invoke callback when an existing style element is updated. */ + onDidUpdateStyleElement(callback: (styleElement: Events.StyleElementObserved) => + void): EventKit.Disposable; + + // Reading Style Elements + /** Get all loaded style elements. */ + getStyleElements(): HTMLStyleElement[]; + + // Paths + /** Get the path of the user style sheet in ~/.atom. */ + getUserStyleSheetPath(): string; + } + + /** Run a node script in a separate process. */ + interface Task { + // NOTE: this is actually the best we can do here with the REST parameter + // for this appearing in the beginning of the parameter list, which isn't + // aligned with the ES6 spec. + /** Starts the task. + * Throws an error if this task has already been terminated or if sending a + * message to the child process fails. + */ + start(...args: any[]): void; + + /** Send message to the task. + * Throws an error if this task has already been terminated or if sending a + * message to the child process fails. + */ + send(message: string): void; + + /** Call a function when an event is emitted by the child process. */ + on(eventName: string, callback: (param: any) => void): EventKit.Disposable; + + /** Forcefully stop the running task. + * No more events are emitted once this method is called. + */ + terminate(): void; + + /** Cancel the running task and emit an event if it was canceled. */ + cancel(): boolean; + } + + /** This class represents all essential editing state for a single TextBuffer, + * including cursor and selection positions, folds, and soft wraps. + */ + interface TextEditor extends Model { + // Properties + id: number; + buffer: TextBuffer.TextBuffer; + element: HTMLElement; + + // Event Subscription + /** Calls your callback when the buffer's title has changed. */ + onDidChangeTitle(callback: (title: string) => void): EventKit.Disposable; + + /** Calls your callback when the buffer's path, and therefore title, has changed. */ + onDidChangePath(callback: (path: string) => void): EventKit.Disposable; + + /** Invoke the given callback synchronously when the content of the buffer + * changes. + */ + onDidChange(callback: (event: Events.EditorChanged[]) => void): + EventKit.Disposable; + + /** Invoke callback when the buffer's contents change. It is emit + * asynchronously 300ms after the last buffer change. This is a good place + * to handle changes to the buffer without compromising typing performance. + */ + onDidStopChanging(callback: (event: TextBuffer.Events.BufferStoppedChanging) => void): + EventKit.Disposable; + + /** Calls your callback when a Cursor is moved. If there are multiple cursors, + * your callback will be called for each cursor. + */ + onDidChangeCursorPosition(callback: (event: Events.CursorPositionChanged) => void): + EventKit.Disposable; + + /** Calls your callback when a selection's screen range changes. */ + onDidChangeSelectionRange(callback: (event: Events.SelectionChanged) => void): + EventKit.Disposable; + + /** Invoke the given callback after the buffer is saved to disk. */ + onDidSave(callback: (event: { path: string }) => void): EventKit.Disposable; + + /** Invoke the given callback when the editor is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + /** Retrieves the current TextBuffer. */ + getBuffer(): TextBuffer.TextBuffer; + + /** Calls your callback when a Gutter is added to the editor. Immediately calls + * your callback for each existing gutter. + */ + observeGutters(callback: (gutter: Gutter) => void): EventKit.Disposable; + + /** Calls your callback when a Gutter is added to the editor. */ + onDidAddGutter(callback: (gutter: Gutter) => void): EventKit.Disposable; + + /** Calls your callback when a Gutter is removed from the editor. */ + onDidRemoveGutter(callback: (name: string) => void): EventKit.Disposable; + + /** Calls your callback when soft wrap was enabled or disabled. */ + onDidChangeSoftWrapped(callback: (softWrapped: boolean) => void): EventKit.Disposable; + + /** Calls your callback when the buffer's encoding has changed. */ + onDidChangeEncoding(callback: (encoding: string) => void): EventKit.Disposable; + + /** Calls your callback when the grammar that interprets and colorizes the text + * has been changed. Immediately calls your callback with the current grammar. + */ + observeGrammar(callback: (grammar: FirstMate.Grammar) => void): EventKit.Disposable; + + /** Calls your callback when the grammar that interprets and colorizes the text + * has been changed. + */ + onDidChangeGrammar(callback: (grammar: FirstMate.Grammar) => void): EventKit.Disposable; + + /** Calls your callback when the result of ::isModified changes. */ + onDidChangeModified(callback: (modified: boolean) => void): EventKit.Disposable; + + /** Calls your callback when the buffer's underlying file changes on disk at a + * moment when the result of ::isModified is true. + */ + onDidConflict(callback: () => void): EventKit.Disposable; + + /** Calls your callback before text has been inserted. */ + onWillInsertText(callback: (event: { text: string, cancel(): void }) => void): + EventKit.Disposable; + + /** Calls your callback after text has been inserted. */ + onDidInsertText(callback: (event: { text: string }) => void): EventKit.Disposable; + + /** Calls your callback when a Cursor is added to the editor. Immediately calls + * your callback for each existing cursor. + */ + observeCursors(callback: (cursor: Cursor) => void): EventKit.Disposable; + + /** Calls your callback when a Cursor is added to the editor. */ + onDidAddCursor(callback: (cursor: Cursor) => void): EventKit.Disposable; + + /** Calls your callback when a Cursor is removed from the editor. */ + onDidRemoveCursor(callback: (cursor: Cursor) => void): EventKit.Disposable; + + /** Calls your callback when a Selection is added to the editor. Immediately + * calls your callback for each existing selection. + */ + observeSelections(callback: (selection: Selection) => void): EventKit.Disposable; + + /** Calls your callback when a Selection is added to the editor. */ + onDidAddSelection(callback: (selection: Selection) => void): EventKit.Disposable; + + /** Calls your callback when a Selection is removed from the editor. */ + onDidRemoveSelection(callback: (selection: Selection) => void): EventKit.Disposable; + + /** Calls your callback with each Decoration added to the editor. Calls your + * callback immediately for any existing decorations. + */ + observeDecorations(callback: (decoration: Decoration) => void): EventKit.Disposable; + + /** Calls your callback when a Decoration is added to the editor. */ + onDidAddDecoration(callback: (decoration: Decoration) => void): EventKit.Disposable; + + /** Calls your callback when a Decoration is removed from the editor. */ + onDidRemoveDecoration(callback: (decoration: Decoration) => void): EventKit.Disposable; + + /** Calls your callback when the placeholder text is changed. */ + onDidChangePlaceholderText(callback: (placeholderText: string) => void): EventKit.Disposable; + + // File Details + /** Get the editor's title for display in other parts of the UI such as the tabs. + * If the editor's buffer is saved, its title is the file name. If it is unsaved, + * its title is "untitled". + */ + getTitle(): string; + + /** Get unique title for display in other parts of the UI, such as the window title. + * If the editor's buffer is unsaved, its title is "untitled" If the editor's + * buffer is saved, its unique title is formatted as one of the following, + * + * "" when it is the only editing buffer with this file name. + * " — " when other buffers have this file name. + */ + getLongTitle(): string; + + /** Returns the string path of this editor's text buffer. */ + getPath(): string|undefined; + + /** Returns boolean true if this editor has been modified. */ + isModified(): boolean; + + /** Returns boolean true if this editor has no content. */ + isEmpty(): boolean; + + /** Returns the string character set encoding of this editor's text buffer. */ + getEncoding(): string; + + /** Set the character set encoding to use in this editor's text buffer. */ + setEncoding(encoding: string): void; + + // File Operations + /** Saves the editor's text buffer. + * See TextBuffer::save for more details. + */ + save(): void; + + /** Saves the editor's text buffer as the given path. + * See TextBuffer::saveAs for more details. + */ + saveAs(filePath: string): void; + + // Reading Text + /** Returns a string representing the entire contents of the editor. */ + getText(): string; + + /** Get the text in the given range in buffer coordinates. */ + getTextInBufferRange(range: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]]): string; + + /** Returns a number representing the number of lines in the buffer. */ + getLineCount(): number; + + /** Returns a number representing the number of screen lines in the editor. + * This accounts for folds. + */ + getScreenLineCount(): number; + + /** Returns a number representing the last zero-indexed buffer row number of + * the editor. + */ + getLastBufferRow(): number; + + /** Returns a number representing the last zero-indexed screen row number of + * the editor. + */ + getLastScreenRow(): number; + + /** Returns a string representing the contents of the line at the given + * buffer row. + */ + lineTextForBufferRow(bufferRow: number): string; + + /** Returns a string representing the contents of the line at the given + * screen row. + */ + lineTextForScreenRow(screenRow: number): string; + + /** Get the range of the paragraph surrounding the most recently added cursor. */ + getCurrentParagraphBufferRange(): TextBuffer.Range; + + // Mutating Text + /** Replaces the entire contents of the buffer with the given string. */ + setText(text: string): void; + + /** Set the text in the given Range in buffer coordinates. */ + setTextInBufferRange(range: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]], text: string, + options?: { normalizeLineEndings?: boolean, undo?: "skip" }): void; + + /* For each selection, replace the selected text with the given text. */ + insertText(text: string, options?: { select?: boolean, autoIndent?: boolean, + autoIndentNewline?: boolean, autoDecreaseIndent?: boolean, + normalizeLineEndings?: boolean, undo?: "skip" }): TextBuffer.Range|boolean; + + /** For each selection, replace the selected text with a newline. */ + insertNewline(): void; + + /** For each selection, if the selection is empty, delete the character following + * the cursor. Otherwise delete the selected text. + */ + delete(): void; + + /** For each selection, if the selection is empty, delete the character preceding + * the cursor. Otherwise delete the selected text. + */ + backspace(): void; + + /** Mutate the text of all the selections in a single transaction. + * All the changes made inside the given function can be reverted with a single + * call to ::undo. + */ + mutateSelectedText(fn: (selection: Selection, index: number) => void): void; + + /** For each selection, transpose the selected text. + * If the selection is empty, the characters preceding and following the cursor + * are swapped. Otherwise, the selected characters are reversed. + */ + transpose(): void; + + /** Convert the selected text to upper case. + * For each selection, if the selection is empty, converts the containing word + * to upper case. Otherwise convert the selected text to upper case. + */ + upperCase(): void; + + /** Convert the selected text to lower case. + * For each selection, if the selection is empty, converts the containing word + * to upper case. Otherwise convert the selected text to upper case. + */ + lowerCase(): void; + + /** Toggle line comments for rows intersecting selections. + * If the current grammar doesn't support comments, does nothing. + */ + toggleLineCommentsInSelection(): void; + + /** For each cursor, insert a newline at beginning the following line. */ + insertNewlineBelow(): void; + + /** For each cursor, insert a newline at the end of the preceding line. */ + insertNewlineAbove(): void; + + /** For each selection, if the selection is empty, delete all characters of the + * containing word that precede the cursor. Otherwise delete the selected text. + */ + deleteToBeginningOfWord(): void; + + /** Similar to ::deleteToBeginningOfWord, but deletes only back to the previous + * word boundary. + */ + deleteToPreviousWordBoundary(): void; + + /** Similar to ::deleteToEndOfWord, but deletes only up to the next word boundary. */ + deleteToNextWordBoundary(): void; + + /** For each selection, if the selection is empty, delete all characters of the + * containing subword following the cursor. Otherwise delete the selected text. + */ + deleteToBeginningOfSubword(): void; + + /** For each selection, if the selection is empty, delete all characters of the + * containing subword following the cursor. Otherwise delete the selected text. + */ + deleteToEndOfSubword(): void; + + /** For each selection, if the selection is empty, delete all characters of the + * containing line that precede the cursor. Otherwise delete the selected text. + */ + deleteToBeginningOfLine(): void; + + /** For each selection, if the selection is not empty, deletes the selection + * otherwise, deletes all characters of the containing line following the cursor. + * If the cursor is already at the end of the line, deletes the following newline. + */ + deleteToEndOfLine(): void; + + /** For each selection, if the selection is empty, delete all characters of the + * containing word following the cursor. Otherwise delete the selected text. + */ + deleteToEndOfWord(): void; + + /** Delete all lines intersecting selections. */ + deleteLine(): void; + + // History + /** Undo the last change. */ + undo(): void; + + /** Redo the last change. */ + redo(): void; + + /** Batch multiple operations as a single undo/redo step. + * Any group of operations that are logically grouped from the perspective of undoing + * and redoing should be performed in a transaction. If you want to abort the transaction, + * call ::abortTransaction to terminate the function's execution and revert any changes + * performed up to the abortion. + */ + transact(fn: () => void): void; + /** Batch multiple operations as a single undo/redo step. + * Any group of operations that are logically grouped from the perspective of undoing + * and redoing should be performed in a transaction. If you want to abort the transaction, + * call ::abortTransaction to terminate the function's execution and revert any changes + * performed up to the abortion. + */ + transact(groupingInterval: number, fn: () => void): void; + + /** Abort an open transaction, undoing any operations performed so far within the transaction. */ + abortTransaction(): void; + + /** Create a pointer to the current state of the buffer for use with ::revertToCheckpoint + * and ::groupChangesSinceCheckpoint. + */ + createCheckpoint(): number; + + /** Revert the buffer to the state it was in when the given checkpoint was created. + * The redo stack will be empty following this operation, so changes since the checkpoint + * will be lost. If the given checkpoint is no longer present in the undo history, no + * changes will be made to the buffer and this method will return false. + */ + revertToCheckpoint(checkpoint: number): boolean; + + /** Group all changes since the given checkpoint into a single transaction for purposes + * of undo/redo. + * If the given checkpoint is no longer present in the undo history, no grouping will be + * performed and this method will return false. + */ + groupChangesSinceCheckpoint(checkpoint: number): boolean; + + // TextEditor Coordinates + /** Convert a position in buffer-coordinates to screen-coordinates. */ + screenPositionForBufferPosition(bufferPosition: TextBuffer.PointLike|[number, number], + options?: { clipDirection?: "backward"|"forward"|"closest"}): TextBuffer.Point; + + /** Convert a position in screen-coordinates to buffer-coordinates. */ + bufferPositionForScreenPosition(bufferPosition: TextBuffer.PointLike|[number, number], + options?: { clipDirection?: "backward"|"forward"|"closest"}): TextBuffer.Point; + + /** Convert a range in buffer-coordinates to screen-coordinates. */ + screenRangeForBufferRange(bufferRange: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]]): TextBuffer.Range; + + /** Convert a range in screen-coordinates to buffer-coordinates. */ + bufferRangeForScreenRange(screenRange: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]]): TextBuffer.Range; + + /** Clip the given Point to a valid position in the buffer. */ + clipBufferPosition(bufferPosition: TextBuffer.PointLike|[number, number]): + TextBuffer.Point; + + /** Clip the start and end of the given range to valid positions in the buffer. + * See ::clipBufferPosition for more information. + */ + clipBufferRange(range: TextBuffer.RangeLike|[TextBuffer.PointLike, TextBuffer.PointLike]| + [TextBuffer.PointLike, [number, number]]|[[number, number], TextBuffer.PointLike]| + [[number, number], [number, number]]): TextBuffer.Range; + + /** Clip the given Point to a valid position on screen. */ + clipScreenPosition(screenPosition: TextBuffer.PointLike|[number, number], + options?: { clipDirection?: "backward"|"forward"|"closest"}): TextBuffer.Point; + + /** Clip the start and end of the given range to valid positions on screen. + * See ::clipScreenPosition for more information. + */ + clipScreenRange(range: TextBuffer.RangeLike|[TextBuffer.PointLike, TextBuffer.PointLike]| + [TextBuffer.PointLike, [number, number]]|[[number, number], TextBuffer.PointLike]| + [[number, number], [number, number]], options?: { clipDirection?: + "backward"|"forward"|"closest"}): TextBuffer.Range; + + // Decorations + /** Add a decoration that tracks a DisplayMarker. When the marker moves, is + * invalidated, or is destroyed, the decoration will be updated to reflect + * the marker's state. + */ + decorateMarker(marker: TextBuffer.DisplayMarker, decorationParams: + Structures.DecorationProps): Decoration; + + /** Add a decoration to every marker in the given marker layer. Can be used to + * decorate a large number of markers without having to create and manage many + * individual decorations. + */ + decorateMarkerLayer(markerLayer: TextBuffer.MarkerLayer|TextBuffer.DisplayMarkerLayer, + decorationParams: Structures.DecorationLayerProps): LayerDecoration; + + /** Get all decorations. */ + getDecorations(propertyFilter?: Structures.DecorationProps): Decoration[]; + + /** Get all decorations of type 'line'. */ + getLineDecorations(propertyFilter?: Structures.DecorationProps): Decoration[]; + + /** Get all decorations of type 'line-number'. */ + getLineNumberDecorations(propertyFilter?: Structures.DecorationProps): Decoration[]; + + /** Get all decorations of type 'highlight'. */ + getHighlightDecorations(propertyFilter?: Structures.DecorationProps): Decoration[]; + + /** Get all decorations of type 'overlay'. */ + getOverlayDecorations(propertyFilter?: Structures.DecorationProps): Decoration[]; + + // Markers + /** Create a marker on the default marker layer with the given range in buffer coordinates. + * This marker will maintain its logical location as the buffer is changed, so if you mark + * a particular word, the marker will remain over that word even if the word's location + * in the buffer changes. + */ + markBufferRange(range: TextBuffer.RangeLike|[TextBuffer.PointLike, TextBuffer.PointLike]| + [TextBuffer.PointLike, [number, number]]|[[number, number], TextBuffer.PointLike]| + [[number, number], [number, number]], properties?: { maintainHistory?: boolean, + reversed?: boolean, invalidate?: "never"|"surround"|"overlap"|"inside"|"touch" }): + TextBuffer.DisplayMarker; + + /** Create a marker on the default marker layer with the given range in screen coordinates. + * This marker will maintain its logical location as the buffer is changed, so if you mark + * a particular word, the marker will remain over that word even if the word's location in + * the buffer changes. + */ + markScreenRange(range: TextBuffer.RangeLike|[TextBuffer.PointLike, TextBuffer.PointLike]| + [TextBuffer.PointLike, [number, number]]|[[number, number], TextBuffer.PointLike]| + [[number, number], [number, number]], properties?: { maintainHistory?: boolean, + reversed?: boolean, invalidate?: "never"|"surround"|"overlap"|"inside"|"touch" }): + TextBuffer.DisplayMarker; + + /** Create a marker on the default marker layer with the given buffer position and no tail. + * To group multiple markers together in their own private layer, see ::addMarkerLayer. + */ + markBufferPosition(bufferPosition: TextBuffer.PointLike|[number, number], options?: + { invalidate?: "never"|"surround"|"overlap"|"inside"|"touch" }): + TextBuffer.DisplayMarker; + + /** Create a marker on the default marker layer with the given screen position and no tail. + * To group multiple markers together in their own private layer, see ::addMarkerLayer. + */ + markScreenPosition(screenPosition: TextBuffer.PointLike|[number, number], options?: + { invalidate?: "never"|"surround"|"overlap"|"inside"|"touch", clipDirection?: + "backward"|"forward"|"closest" }): TextBuffer.DisplayMarker; + + /** Find all DisplayMarkers on the default marker layer that match the given properties. + * + * This method finds markers based on the given properties. Markers can be associated + * with custom properties that will be compared with basic equality. In addition, there + * are several special properties that will be compared with the range of the markers + * rather than their properties. + */ + findMarkers(properties: TextBuffer.Options.FindDisplayMarker): TextBuffer.DisplayMarker[]; + + /** Create a marker layer to group related markers. */ + addMarkerLayer(options?: { + maintainHistory?: boolean, + persistent?: boolean, + }): TextBuffer.DisplayMarkerLayer; + + /** Get a DisplayMarkerLayer by id. */ + getMarkerLayer(id: number): TextBuffer.DisplayMarkerLayer|undefined; + + /** Get the default DisplayMarkerLayer. + * All marker APIs not tied to an explicit layer interact with this default layer. + */ + getDefaultMarkerLayer(): TextBuffer.DisplayMarkerLayer; + + /** Get the DisplayMarker on the default layer for the given marker id. */ + getMarker(id: number): TextBuffer.DisplayMarker; + + /** Get all DisplayMarkers on the default marker layer. Consider using ::findMarkers. */ + getMarkers(): TextBuffer.DisplayMarker[]; + + /** Get the number of markers in the default marker layer. */ + getMarkerCount(): number; + + // Cursors + /** Get the position of the most recently added cursor in buffer coordinates. */ + getCursorBufferPosition(): TextBuffer.Point; + + /** Get the position of all the cursor positions in buffer coordinates. */ + getCursorBufferPositions(): TextBuffer.Point[]; + + /** Move the cursor to the given position in buffer coordinates. + * If there are multiple cursors, they will be consolidated to a single cursor. + */ + setCursorBufferPosition(position: TextBuffer.PointLike|[number, number], options?: + { autoscroll?: boolean }): void; + + /** Get a Cursor at given screen coordinates Point. */ + getCursorAtScreenPosition(position: TextBuffer.PointLike|[number, number]): + Cursor|undefined; + + /** Get the position of the most recently added cursor in screen coordinates. */ + getCursorScreenPosition(): TextBuffer.Point; + + /** Get the position of all the cursor positions in screen coordinates. */ + getCursorScreenPositions(): TextBuffer.Point[]; + + /** Move the cursor to the given position in screen coordinates. + * If there are multiple cursors, they will be consolidated to a single cursor. + */ + setCursorScreenPosition(position: TextBuffer.PointLike|[number, number], + options?: { autoscroll?: boolean }): void; + + /** Add a cursor at the given position in buffer coordinates. */ + addCursorAtBufferPosition(bufferPosition: TextBuffer.PointLike|[number, number]): Cursor; + + /** Add a cursor at the position in screen coordinates. */ + addCursorAtScreenPosition(screenPosition: TextBuffer.PointLike|[number, number]): Cursor; + + /** Returns a boolean indicating whether or not there are multiple cursors. */ + hasMultipleCursors(): boolean; + + /** Move every cursor up one row in screen coordinates. */ + moveUp(lineCount?: number): void; + + /** Move every cursor down one row in screen coordinates. */ + moveDown(lineCount?: number): void; + + /** Move every cursor left one column. */ + moveLeft(columnCount?: number): void; + + /** Move every cursor right one column. */ + moveRight(columnCount?: number): void; + + /** Move every cursor to the beginning of its line in buffer coordinates. */ + moveToBeginningOfLine(): void; + + /** Move every cursor to the beginning of its line in screen coordinates. */ + moveToBeginningOfScreenLine(): void; + + /** Move every cursor to the first non-whitespace character of its line. */ + moveToFirstCharacterOfLine(): void; + + /** Move every cursor to the end of its line in buffer coordinates. */ + moveToEndOfLine(): void; + + /** Move every cursor to the end of its line in screen coordinates. */ + moveToEndOfScreenLine(): void; + + /** Move every cursor to the beginning of its surrounding word. */ + moveToBeginningOfWord(): void; + + /** Move every cursor to the end of its surrounding word. */ + moveToEndOfWord(): void; + + /** Move every cursor to the top of the buffer. + * If there are multiple cursors, they will be merged into a single cursor. + */ + moveToTop(): void; + + /** Move every cursor to the bottom of the buffer. + * If there are multiple cursors, they will be merged into a single cursor. + */ + moveToBottom(): void; + + /** Move every cursor to the beginning of the next word. */ + moveToBeginningOfNextWord(): void; + + /** Move every cursor to the previous word boundary. */ + moveToPreviousWordBoundary(): void; + + /** Move every cursor to the next word boundary. */ + moveToNextWordBoundary(): void; + + /** Move every cursor to the previous subword boundary. */ + moveToPreviousSubwordBoundary(): void; + + /** Move every cursor to the next subword boundary. */ + moveToNextSubwordBoundary(): void; + + /** Move every cursor to the beginning of the next paragraph. */ + moveToBeginningOfNextParagraph(): void; + + /** Move every cursor to the beginning of the previous paragraph. */ + moveToBeginningOfPreviousParagraph(): void; + + /** Returns the most recently added Cursor. */ + getLastCursor(): Cursor; + + /** Returns the word surrounding the most recently added cursor. */ + getWordUnderCursor(options?: { + wordRegex?: RegExp, + includeNonWordCharacters?: boolean, + allowPrevious?: boolean, + }): string; + + /** Get an Array of all Cursors. */ + getCursors(): Cursor[]; + + /** Get all Cursorss, ordered by their position in the buffer instead of the + * order in which they were added. + */ + getCursorsOrderedByBufferPosition(): Cursor[]; + + // Selections + /** Get the selected text of the most recently added selection. */ + getSelectedText(): string; + + /** Get the Range of the most recently added selection in buffer coordinates. */ + getSelectedBufferRange(): TextBuffer.Range; + + /** Get the Ranges of all selections in buffer coordinates. + * The ranges are sorted by when the selections were added. Most recent at the end. + */ + getSelectedBufferRanges(): TextBuffer.Range[]; + + /** Set the selected range in buffer coordinates. If there are multiple selections, + * they are reduced to a single selection with the given range. + */ + setSelectedBufferRange(bufferRange: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]], options?: + { reversed?: boolean, preserveFolds?: boolean}): void; + + /** Set the selected ranges in buffer coordinates. If there are multiple selections, + * they are replaced by new selections with the given ranges. + */ + setSelectedBufferRanges(bufferRanges: ReadonlyArray, + options?: { reversed?: boolean, preserveFolds?: boolean}): void; + + /** Get the Range of the most recently added selection in screen coordinates. */ + getSelectedScreenRange(): TextBuffer.Range; + + /** Get the Ranges of all selections in screen coordinates. + * The ranges are sorted by when the selections were added. Most recent at the end. + */ + getSelectedScreenRanges(): TextBuffer.Range[]; + + /** Set the selected range in screen coordinates. If there are multiple selections, + * they are reduced to a single selection with the given range. + */ + setSelectedScreenRange(screenRange: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]], options?: + { reversed?: boolean }): void; + + /** Set the selected ranges in screen coordinates. If there are multiple selections, + * they are replaced by new selections with the given ranges. + */ + setSelectedScreenRanges(screenRanges: ReadonlyArray, options?: { reversed?: boolean }): void; + + /** Add a selection for the given range in buffer coordinates. */ + addSelectionForBufferRange(bufferRange: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]], options?: + { reversed?: boolean, preserveFolds?: boolean }): Selection; + + /** Add a selection for the given range in screen coordinates. */ + addSelectionForScreenRange(screenRange: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]], options?: + { reversed?: boolean, preserveFolds?: boolean }): Selection; + + /** Select from the current cursor position to the given position in buffer coordinates. + * This method may merge selections that end up intesecting. + */ + selectToBufferPosition(position: TextBuffer.PointLike|[number, number]): void; + + /** Select from the current cursor position to the given position in screen coordinates. + * This method may merge selections that end up intesecting. + */ + selectToScreenPosition(position: TextBuffer.PointLike|[number, number]): void; + + /** Move the cursor of each selection one character upward while preserving the + * selection's tail position. + * This method may merge selections that end up intesecting. + */ + selectUp(rowCount?: number): void; + + /** Move the cursor of each selection one character downward while preserving + * the selection's tail position. + * This method may merge selections that end up intesecting. + */ + selectDown(rowCount?: number): void; + + /** Move the cursor of each selection one character leftward while preserving + * the selection's tail position. + * This method may merge selections that end up intesecting. + */ + selectLeft(columnCount?: number): void; + + /** Move the cursor of each selection one character rightward while preserving + * the selection's tail position. + * This method may merge selections that end up intesecting. + */ + selectRight(columnCount?: number): void; + + /** Select from the top of the buffer to the end of the last selection in the buffer. + * This method merges multiple selections into a single selection. + */ + selectToTop(): void; + + /** Selects from the top of the first selection in the buffer to the end of the buffer. + * This method merges multiple selections into a single selection. + */ + selectToBottom(): void; + + /** Select all text in the buffer. + * This method merges multiple selections into a single selection. + */ + selectAll(): void; + + /** Move the cursor of each selection to the beginning of its line while preserving + * the selection's tail position. + * This method may merge selections that end up intesecting. + */ + selectToBeginningOfLine(): void; + + /** Move the cursor of each selection to the first non-whitespace character of its + * line while preserving the selection's tail position. If the cursor is already + * on the first character of the line, move it to the beginning of the line. + * This method may merge selections that end up intersecting. + */ + selectToFirstCharacterOfLine(): void; + + /** Move the cursor of each selection to the end of its line while preserving the + * selection's tail position. + * This method may merge selections that end up intersecting. + */ + selectToEndOfLine(): void; + + /** Expand selections to the beginning of their containing word. + * Operates on all selections. Moves the cursor to the beginning of the containing + * word while preserving the selection's tail position. + */ + selectToBeginningOfWord(): void; + + /** Expand selections to the end of their containing word. + * Operates on all selections. Moves the cursor to the end of the containing word + * while preserving the selection's tail position. + */ + selectToEndOfWord(): void; + + /** For each cursor, select the containing line. + * This method merges selections on successive lines. + */ + selectLinesContainingCursors(): void; + + /** Select the word surrounding each cursor. */ + selectWordsContainingCursors(): void; + + /** For each selection, move its cursor to the preceding subword boundary while + * maintaining the selection's tail position. + * This method may merge selections that end up intersecting. + */ + selectToPreviousSubwordBoundary(): void; + + /** For each selection, move its cursor to the next subword boundary while maintaining + * the selection's tail position. + * This method may merge selections that end up intersecting. + */ + selectToNextSubwordBoundary(): void; + + /** For each selection, move its cursor to the preceding word boundary while + * maintaining the selection's tail position. + * This method may merge selections that end up intersecting. + */ + selectToPreviousWordBoundary(): void; + + /** For each selection, move its cursor to the next word boundary while maintaining + * the selection's tail position. + * This method may merge selections that end up intersecting. + */ + selectToNextWordBoundary(): void; + + /** Expand selections to the beginning of the next word. + * Operates on all selections. Moves the cursor to the beginning of the next word + * while preserving the selection's tail position. + */ + selectToBeginningOfNextWord(): void; + + /** Expand selections to the beginning of the next paragraph. + * Operates on all selections. Moves the cursor to the beginning of the next + * paragraph while preserving the selection's tail position. + */ + selectToBeginningOfNextParagraph(): void; + + /** Expand selections to the beginning of the next paragraph. + * Operates on all selections. Moves the cursor to the beginning of the next + * paragraph while preserving the selection's tail position. + */ + selectToBeginningOfPreviousParagraph(): void; + + /** Select the range of the given marker if it is valid. */ + selectMarker(marker: TextBuffer.DisplayMarker): TextBuffer.Range|undefined; + + /** Get the most recently added Selection. */ + getLastSelection(): Selection; + + /** Get current Selections. */ + getSelections(): Selection[]; + + /** Get all Selections, ordered by their position in the buffer instead of the + * order in which they were added. + */ + getSelectionsOrderedByBufferPosition(): Selection[]; + + // NOTE: this calls into Selection::intersectsBufferRange, which itself calls + // into Range::intersectsWith. Range::intersectsWith is one of the few functions + // which does NOT take a range-compatible array. + /** Determine if a given range in buffer coordinates intersects a selection. */ + selectionIntersectsBufferRange(bufferRange: TextBuffer.RangeLike): boolean; + + // Searching and Replacing + /** Scan regular expression matches in the entire buffer, calling the given + * iterator function on each match. + * + * ::scan functions as the replace method as well via the replace. + */ + scan(regex: RegExp, options: TextBuffer.Options.ScanContext, iterator: (params: + TextBuffer.Structures.ContextualBufferScanResult) => void): void; + /** Scan regular expression matches in the entire buffer, calling the given + * iterator function on each match. + * + * ::scan functions as the replace method as well via the replace. + */ + scan(regex: RegExp, iterator: (params: TextBuffer.Structures.BufferScanResult) => void): + void; + + /** Scan regular expression matches in a given range, calling the given iterator. + * function on each match. + */ + scanInBufferRange(regex: RegExp, range: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]], iterator: (params: + TextBuffer.Structures.BufferScanResult) => void): void; + + /** Scan regular expression matches in a given range in reverse order, calling the + * given iterator function on each match. + */ + backwardsScanInBufferRange(regex: RegExp, range: TextBuffer.RangeLike|[TextBuffer.PointLike, + TextBuffer.PointLike]|[TextBuffer.PointLike, [number, number]]|[[number, number], + TextBuffer.PointLike]|[[number, number], [number, number]], iterator: (params: + TextBuffer.Structures.BufferScanResult) => void): void; + + // Tab Behavior + /** Returns a boolean indicating whether softTabs are enabled for this editor. */ + getSoftTabs(): boolean; + + /** Enable or disable soft tabs for this editor. */ + setSoftTabs(softTabs: boolean): void; + + /** Toggle soft tabs for this editor. */ + toggleSoftTabs(): boolean; + + /** Get the on-screen length of tab characters. */ + getTabLength(): number; + + /** Set the on-screen length of tab characters. Setting this to a number will + * override the editor.tabLength setting. + */ + setTabLength(tabLength: number): void; + + /** Determine if the buffer uses hard or soft tabs. */ + usesSoftTabs(): boolean|undefined; + + /** Get the text representing a single level of indent. + * If soft tabs are enabled, the text is composed of N spaces, where N is the + * tab length. Otherwise the text is a tab character (\t). + */ + getTabText(): string; + + // Soft Wrap Behavior + /** Determine whether lines in this editor are soft-wrapped. */ + isSoftWrapped(): boolean; + + /** Enable or disable soft wrapping for this editor. */ + setSoftWrapped(softWrapped: boolean): boolean; + + /** Toggle soft wrapping for this editor. */ + toggleSoftWrapped(): boolean; + + /** Gets the column at which column will soft wrap. */ + getSoftWrapColumn(): number; + + // Indentation + /** Get the indentation level of the given buffer row. + * Determines how deeply the given row is indented based on the soft tabs and tab + * length settings of this editor. Note that if soft tabs are enabled and the tab + * length is 2, a row with 4 leading spaces would have an indentation level of 2. + */ + indentationForBufferRow(bufferRow: number): number; + + /** Set the indentation level for the given buffer row. + * Inserts or removes hard tabs or spaces based on the soft tabs and tab length settings + * of this editor in order to bring it to the given indentation level. Note that if soft + * tabs are enabled and the tab length is 2, a row with 4 leading spaces would have an + * indentation level of 2. + */ + setIndentationForBufferRow(bufferRow: number, newLevel: number, options?: + { preserveLeadingWhitespace?: boolean }): void; + + /** Indent rows intersecting selections by one level. */ + indentSelectedRows(): void; + + /** Outdent rows intersecting selections by one level. */ + outdentSelectedRows(): void; + + /** Get the indentation level of the given line of text. + * Determines how deeply the given line is indented based on the soft tabs and tab length + * settings of this editor. Note that if soft tabs are enabled and the tab length is 2, + * a row with 4 leading spaces would have an indentation level of 2. + */ + indentLevelForLine(line: string): number; + + /** Indent rows intersecting selections based on the grammar's suggested indent level. */ + autoIndentSelectedRows(): void; + + // Grammars + /** Get the current Grammar of this editor. */ + getGrammar(): FirstMate.Grammar; + + /** Set the current Grammar of this editor. + * Assigning a grammar will cause the editor to re-tokenize based on the new grammar. + */ + setGrammar(grammar: FirstMate.Grammar): void; + + // Managing Syntax Scopes + /** Returns a ScopeDescriptor that includes this editor's language. + * e.g. [".source.ruby"], or [".source.coffee"]. + */ + getRootScopeDescriptor(): ScopeDescriptor; + + /** Get the syntactic scopeDescriptor for the given position in buffer coordinates. */ + scopeDescriptorForBufferPosition(bufferPosition: TextBuffer.PointLike|[number, number]): + ScopeDescriptor; + + /** Get the range in buffer coordinates of all tokens surrounding the cursor + * that match the given scope selector. + */ + bufferRangeForScopeAtCursor(scopeSelector: string): TextBuffer.Range; + + /** Determine if the given row is entirely a comment. */ + isBufferRowCommented(bufferRow: number): boolean; + + // Clipboard Operations + /** For each selection, copy the selected text. */ + copySelectedText(): void; + + /** For each selection, cut the selected text. */ + cutSelectedText(): void; + + /** For each selection, replace the selected text with the contents of the clipboard. + * If the clipboard contains the same number of selections as the current editor, + * each selection will be replaced with the content of the corresponding clipboard + * selection text. + */ + pasteText(options?: Options.TextInsertion): void; + + /** For each selection, if the selection is empty, cut all characters of the + * containing screen line following the cursor. Otherwise cut the selected text. + */ + cutToEndOfLine(): void; + + /** For each selection, if the selection is empty, cut all characters of the + * containing buffer line following the cursor. Otherwise cut the selected text. + */ + cutToEndOfBufferLine(): void; + + // Folds + /** Fold the most recent cursor's row based on its indentation level. + * The fold will extend from the nearest preceding line with a lower indentation + * level up to the nearest following row with a lower indentation level. + */ + foldCurrentRow(): void; + + /** Unfold the most recent cursor's row by one level. */ + unfoldCurrentRow(): void; + + /** Fold the given row in buffer coordinates based on its indentation level. + * If the given row is foldable, the fold will begin there. Otherwise, it will + * begin at the first foldable row preceding the given row. + */ + foldBufferRow(bufferRow: number): void; + + /** Unfold all folds containing the given row in buffer coordinates. */ + unfoldBufferRow(bufferRow: number): void; + + /** For each selection, fold the rows it intersects. */ + foldSelectedLines(): void; + + /** Fold all foldable lines. */ + foldAll(): void; + + /** Unfold all existing folds. */ + unfoldAll(): void; + + /** Fold all foldable lines at the given indent level. */ + foldAllAtIndentLevel(level: number): void; + + /** Determine whether the given row in buffer coordinates is foldable. + * A foldable row is a row that starts a row range that can be folded. + */ + isFoldableAtBufferRow(bufferRow: number): boolean; + + /** Determine whether the given row in screen coordinates is foldable. + * A foldable row is a row that starts a row range that can be folded. + */ + isFoldableAtScreenRow(bufferRow: number): boolean; + + /** Fold the given buffer row if it isn't currently folded, and unfold it otherwise. */ + toggleFoldAtBufferRow(bufferRow: number): void; + + /** Determine whether the most recently added cursor's row is folded. */ + isFoldedAtCursorRow(): boolean; + + /** Determine whether the given row in buffer coordinates is folded. */ + isFoldedAtBufferRow(bufferRow: number): boolean; + + /** Determine whether the given row in screen coordinates is folded. */ + isFoldedAtScreenRow(screenRow: number): boolean; + + // Gutters + /** Add a custom Gutter. */ + addGutter(options: { + name: string, + priority?: number, + visible?: boolean, + }): Gutter; + + /** Get this editor's gutters. */ + getGutters(): Gutter[]; + + /** Get the gutter with the given name. */ + gutterWithName(name: string): Gutter|null; + + // Scrolling the TextEditor + /** Scroll the editor to reveal the most recently added cursor if it is off-screen. */ + scrollToCursorPosition(options?: { center?: boolean }): void; + + /** Scrolls the editor to the given buffer position. */ + scrollToBufferPosition(bufferPosition: TextBuffer.PointLike|[number, number], + options?: { center?: boolean }): void; + + /** Scrolls the editor to the given screen position. */ + scrollToScreenPosition(screenPosition: TextBuffer.PointLike|[number, number], + options?: { center?: boolean }): void; + + // TextEditor Rendering + /** Retrieves the rendered line height in pixels. */ + getLineHeightInPixels(): number; + + /** Retrieves the greyed out placeholder of a mini editor. */ + getPlaceholderText(): string; + + /** Set the greyed out placeholder of a mini editor. Placeholder text will be + * displayed when the editor has no content. + */ + setPlaceholderText(placeholderText: string): void; + } + + /** Experimental: This global registry tracks registered TextEditors. */ + interface TextEditorRegistry { + // Managing Text Editors + /** Remove all editors from the registry. */ + clear(): void; + + /** Register a TextEditor. */ + add(editor: TextEditor): EventKit.Disposable; + + /** Remove the given TextEditor from the registry. */ + remove(editor: TextEditor): boolean; + + /** Keep a TextEditor's configuration in sync with Atom's settings. */ + maintainConfig(editor: TextEditor): EventKit.Disposable; + + /** Set a TextEditor's grammar based on its path and content, and continue + * to update its grammar as gramamrs are added or updated, or the editor's + * file path changes. + */ + maintainGrammar(editor: TextEditor): EventKit.Disposable; + + /** Force a TextEditor to use a different grammar than the one that would + * otherwise be selected for it. + */ + setGrammarOverride(editor: TextEditor, scopeName: string): void; + + /** Retrieve the grammar scope name that has been set as a grammar override + * for the given TextEditor. + */ + getGrammarOverride(editor: TextEditor): string|null; + + /** Remove any grammar override that has been set for the given {TextEditor}. */ + clearGrammarOverride(editor: TextEditor): void; + + // Event Subscription + /** Invoke the given callback with all the current and future registered TextEditors. */ + observe(callback: (editor: TextEditor) => void): EventKit.Disposable; + } + + /** Handles loading and activating available themes. */ + interface ThemeManager { + // Event Subscription + /** Invoke callback when style sheet changes associated with updating the + * list of active themes have completed. + */ + onDidChangeActiveThemes(callback: () => void): EventKit.Disposable; + + // Accessing Loaded Themes + /** Returns an Array of strings of all the loaded theme names. */ + getLoadedThemeNames(): string[]|undefined; + + /** Returns an Array of all the loaded themes. */ + getLoadedThemes(): Package[]|undefined; + + // Accessing Active Themes + /** Returns an Array of strings all the active theme names. */ + getActiveThemeNames(): string[]|undefined; + + /** Returns an Array of all the active themes. */ + getActiveThemes(): Package[]|undefined; + + // Managing Enabled Themes + /** Get the enabled theme names from the config. */ + getEnabledThemeNames(): string[]; + } + + /** This tooltip class is derived from Bootstrap 3, but modified to not require + * jQuery, which is an expensive dependency we want to eliminate. + */ + interface Tooltip { + options: Options.Tooltip; + enabled: boolean; + timeout: number; + hoverState: "in"|"out"|null; + element: JQuery|HTMLElement; + + getTitle(): string; + getTooltipElement(): HTMLElement; + getArrowElement(): HTMLElement; + enable(): void; + disable(): void; + toggleEnabled(): void; + toggle(): void; + recalculatePosition(): void; + } + + /** Associates tooltips with HTML elements or selectors. */ + interface TooltipManager { + /** Add a tooltip to the given element. */ + add(target: JQuery|HTMLElement, options: { + title?: string, + html?: boolean, + item?: HTMLElement|{ element: HTMLElement }, + class?: string, + placement?: "top"|"bottom"|"left"|"right"|"auto"|(() => string), + trigger?: "click"|"hover"|"focus"|"manual", + delay?: { show: number, hide: number }, + keyBindingCommand?: string, + keyBindingTarget?: HTMLElement + } | { + title?: string|(() => string), + html?: boolean, + item?: HTMLElement|{ element: HTMLElement }, + class?: string, + placement?: "top"|"bottom"|"left"|"right"|"auto"|(() => string), + trigger?: "click"|"hover"|"focus"|"manual", + delay?: { show: number, hide: number }, + }): EventKit.Disposable; + + /** Find the tooltips that have been applied to the given element. */ + findTooltips(target: HTMLElement): Tooltip[]; + } + + /** ViewRegistry handles the association between model and view types in Atom. + * We call this association a View Provider. As in, for a given model, this class + * can provide a view via ::getView, as long as the model/view association was + * registered via ::addViewProvider. + */ + interface ViewRegistry { + /** Add a provider that will be used to construct views in the workspace's view + * layer based on model objects in its model layer. + */ + addViewProvider(createView: (model: object) => HTMLElement|undefined): EventKit.Disposable; + /** Add a provider that will be used to construct views in the workspace's view + * layer based on model objects in its model layer. + */ + addViewProvider(modelConstructor: { new (...args: any[]): T }, createView: + (instance: T) => HTMLElement|undefined): EventKit.Disposable; + + /** Get the view associated with an object in the workspace. */ + getView(obj: object): HTMLElement; + } + + /** Represents the state of the user interface for the entire window. */ + interface Workspace { + // Event Subscription + /** Invoke the given callback with all current and future text editors in + * the workspace. + */ + observeTextEditors(callback: (editor: TextEditor) => void): EventKit.Disposable; + + /** Invoke the given callback with all current and future panes items in the + * workspace. + */ + observePaneItems(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback when the active pane item changes. */ + onDidChangeActivePaneItem(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback when the active pane item stops changing. */ + onDidStopChangingActivePaneItem(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback when a text editor becomes the active text editor and + * when there is no longer an active text editor. + */ + onDidChangeActiveTextEditor(callback: (editor?: TextEditor) => void): EventKit.Disposable; + + /** Invoke the given callback with the current active pane item and with all + * future active pane items in the workspace. + */ + observeActivePaneItem(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback with the current active text editor (if any), with all + * future active text editors, and when there is no longer an active text editor. + */ + observeActiveTextEditor(callback: (editor?: TextEditor) => void): EventKit.Disposable; + + /** Invoke the given callback whenever an item is opened. Unlike ::onDidAddPaneItem, + * observers will be notified for items that are already present in the workspace + * when they are reopened. + */ + onDidOpen(callback: (event: Events.PaneItemOpened) => void): EventKit.Disposable; + + /** Invoke the given callback when a pane is added to the workspace. */ + onDidAddPane(callback: (event: { pane: Pane }) => void): EventKit.Disposable; + + /** Invoke the given callback before a pane is destroyed in the workspace. */ + onWillDestroyPane(callback: (event: { pane: Pane }) => void): EventKit.Disposable; + + /** Invoke the given callback when a pane is destroyed in the workspace. */ + onDidDestroyPane(callback: (event: { pane: Pane }) => void): EventKit.Disposable; + + /** Invoke the given callback with all current and future panes in the workspace. */ + observePanes(callback: (pane: Pane) => void): EventKit.Disposable; + + /** Invoke the given callback when the active pane changes. */ + onDidChangeActivePane(callback: (pane: Pane) => void): EventKit.Disposable; + + /** Invoke the given callback with the current active pane and when the + * active pane changes. + */ + observeActivePane(callback: (pane: Pane) => void): EventKit.Disposable; + + /** Invoke the given callback when a pane item is added to the workspace. */ + onDidAddPaneItem(callback: (event: Events.PaneItemObserved) => void): + EventKit.Disposable; + + /** Invoke the given callback when a pane item is about to be destroyed, + * before the user is prompted to save it. + */ + onWillDestroyPaneItem(callback: (event: Events.PaneItemObserved) => void): + EventKit.Disposable; + + /** Invoke the given callback when a pane item is destroyed. */ + onDidDestroyPaneItem(callback: (event: Events.PaneItemObserved) => void): + EventKit.Disposable; + + /** Invoke the given callback when a text editor is added to the workspace. */ + onDidAddTextEditor(callback: (event: Events.TextEditorObserved) => void): + EventKit.Disposable; + + // Opening + /** Opens the given URI in Atom asynchronously. If the URI is already open, + * the existing item for that URI will be activated. If no URI is given, or + * no registered opener can open the URI, a new empty TextEditor will be created. + */ + open(uri: string, options?: { + initialLine?: number, + initialColumn?: number, + split?: "left"|"right"|"up"|"down", + activatePane?: boolean, + activateItem?: boolean, + pending?: boolean, + searchAllPanes?: boolean, + location?: "left"|"right"|"bottom"|"center", + }): Promise; + /** Opens the given URI in Atom asynchronously. If the URI is already open, + * the existing item for that URI will be activated. If no URI is given, or + * no registered opener can open the URI, a new empty TextEditor will be created. + */ + open(): Promise; + + /** Search the workspace for items matching the given URI and hide them. + * Returns a boolean indicating whether any items were found (and hidden). + */ + hide(itemOrURI: object|string): boolean; + + /** Search the workspace for items matching the given URI. If any are found, + * hide them. Otherwise, open the URL. + * Returns a Promise that resolves when the item is shown or hidden. + */ + toggle(itemOrURI: object|string): Promise; + + /** Creates a new item that corresponds to the provided URI. + * If no URI is given, or no registered opener can open the URI, a new empty TextEditor + * will be created. + */ + createItemForURI(uri: string): Promise; + + /** Returns a boolean that is true if object is a TextEditor. */ + isTextEditor(object: object): boolean; + + /** Asynchronously reopens the last-closed item's URI if it hasn't already + * been reopened. + */ + reopenItem(): Promise; + + /** Register an opener for a URI. */ + addOpener(opener: (uri: string) => HTMLElement|{ getTitle(): string }|undefined): + EventKit.Disposable; + + /** Create a new text editor. */ + buildTextEditor(params: object): TextEditor; + + // Pane Items + /** Get all pane items in the workspace. */ + getPaneItems(): object[]; + + /** Get the active Pane's active item. */ + getActivePaneItem(): object; + + /** Get all text editors in the workspace. */ + getTextEditors(): TextEditor[]; + + /** Get the workspace center's active item if it is a TextEditor. */ + getActiveTextEditor(): TextEditor|undefined; + + // Panes + /** Get the most recently focused pane container. */ + getActivePaneContainer(): Dock|WorkspaceCenter; + + /** Get all panes in the workspace. */ + getPanes(): Pane[]; + + /** Get the active Pane. */ + getActivePane(): Pane; + + /** Make the next pane active. */ + activateNextPane(): boolean; + + /** Make the previous pane active. */ + activatePreviousPane(): boolean; + + /** Get the first pane container that contains an item with the given URI. */ + paneContainerForURI(uri: string): Dock|WorkspaceCenter|undefined; + + /** Get the first pane container that contains the given item. */ + paneContainerForItem(item: object): Dock|WorkspaceCenter|undefined; + + /** Get the first Pane with an item for the given URI. */ + paneForURI(uri: string): Pane|undefined; + + /** Get the Pane containing the given item. */ + paneForItem(item: object): Pane|undefined; + + // Pane Locations + /** Get the WorkspaceCenter at the center of the editor window. */ + getCenter(): WorkspaceCenter; + + /** Get the Dock to the left of the editor window. */ + getLeftDock(): Dock; + + /** Get the Dock to the right of the editor window. */ + getRightDock(): Dock; + + /** Get the Dock below the editor window. */ + getBottomDock(): Dock; + + /** Returns all Pane containers. */ + getPaneContainers(): [WorkspaceCenter, Dock, Dock, Dock]; + + // Panels + /** Get an Array of all the panel items at the bottom of the editor window. */ + getBottomPanels(): Panel[]; + + /** Adds a panel item to the bottom of the editor window. */ + addBottomPanel(options: { + item: object, + visible?: boolean, + priority?: number, + }): Panel; + + /** Get an Array of all the panel items to the left of the editor window. */ + getLeftPanels(): Panel[]; + + /** Adds a panel item to the left of the editor window. */ + addLeftPanel(options: { + item: object, + visible?: boolean, + priority?: number, + }): Panel; + + /** Get an Array of all the panel items to the right of the editor window. */ + getRightPanels(): Panel[]; + + /** Adds a panel item to the right of the editor window. */ + addRightPanel(options: { + item: object, + visible?: boolean, + priority?: number, + }): Panel; + + /** Get an Array of all the panel items at the top of the editor window. */ + getTopPanels(): Panel[]; + + /** Adds a panel item to the top of the editor window above the tabs. */ + addTopPanel(options: { + item: object, + visible?: boolean, + priority?: number + }): Panel; + + /** Get an Array of all the panel items in the header. */ + getHeaderPanels(): Panel[]; + + /** Adds a panel item to the header. */ + addHeaderPanel(options: { + item: object, + visible?: boolean, + priority?: number, + }): Panel; + + /** Get an Array of all the panel items in the footer. */ + getFooterPanels(): Panel[]; + + /** Adds a panel item to the footer. */ + addFooterPanel(options: { + item: object, + visible?: boolean, + priority?: number, + }): Panel; + + /** Get an Array of all the modal panel items. */ + getModalPanels(): Panel[]; + + /** Adds a panel item as a modal dialog. */ + addModalPanel(options: { + item: object, + visible?: boolean, + priority?: number, + }): Panel; + + /** Returns the Panel associated with the given item or null when the item + * has no panel. + */ + panelForItem(item: object): Panel|null; + + // Searching and Replacing + /** Performs a search across all files in the workspace. */ + scan(regex: RegExp, iterator: (result: Structures.ScandalResult) => void): + Structures.CancellablePromise; + /** Performs a search across all files in the workspace. */ + scan(regex: RegExp, options: Options.WorkspaceScan, iterator: + (result: Structures.ScandalResult) => void): Structures.CancellablePromise; + + /** Performs a replace across all the specified files in the project. */ + replace(regex: RegExp, replacementText: string, filePaths: ReadonlyArray, + iterator: (result: { filePath: string|undefined, replacements: number }) => void): + Promise; + } + + // https://github.com/atom/atom/blob/master/src/workspace-center.js + /** The central container for the editor window capable of holding items. */ + interface WorkspaceCenter { + // Event Subscription + /** Invoke the given callback with all current and future text editors in the + * workspace center. + */ + observeTextEditors(callback: (editor: TextEditor) => void): EventKit.Disposable; + + /** Invoke the given callback with all current and future panes items in the + * workspace center. + */ + observePaneItems(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback when the active pane item changes. */ + onDidChangeActivePaneItem(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback when the active pane item stops changing. */ + onDidStopChangingActivePaneItem(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback with the current active pane item and with all future + * active pane items in the workspace center. + */ + observeActivePaneItem(callback: (item: object) => void): EventKit.Disposable; + + /** Invoke the given callback when a pane is added to the workspace center. */ + onDidAddPane(callback: (event: { pane: Pane }) => void): EventKit.Disposable; + + /** Invoke the given callback before a pane is destroyed in the workspace center. */ + onWillDestroyPane(callback: (event: { pane: Pane }) => void): EventKit.Disposable; + + /** Invoke the given callback when a pane is destroyed in the workspace center. */ + onDidDestroyPane(callback: (event: { pane: Pane }) => void): EventKit.Disposable; + + /** Invoke the given callback with all current and future panes in the workspace center. */ + observePanes(callback: (pane: Pane) => void): EventKit.Disposable; + + /** Invoke the given callback when the active pane changes. */ + onDidChangeActivePane(callback: (pane: Pane) => void): EventKit.Disposable; + + /** Invoke the given callback with the current active pane and when the active pane changes. */ + observeActivePane(callback: (pane: Pane) => void): EventKit.Disposable; + + /** Invoke the given callback when a pane item is added to the workspace center. */ + onDidAddPaneItem(callback: (event: Events.PaneItemObserved) => void): + EventKit.Disposable; + + /** Invoke the given callback when a pane item is about to be destroyed, before the user + * is prompted to save it. + */ + onWillDestroyPaneItem(callback: (event: Events.PaneItemObserved) => void): + EventKit.Disposable; + + /** Invoke the given callback when a pane item is destroyed. */ + onDidDestroyPaneItem(callback: (event: Events.PaneItemObserved) => void): + EventKit.Disposable; + + /** Invoke the given callback when a text editor is added to the workspace center. */ + onDidAddTextEditor(callback: (event: Events.TextEditorObserved) => void): + EventKit.Disposable; + + // Pane Items + /** Get all pane items in the workspace center. */ + getPaneItems(): object[]; + + /** Get the active Pane's active item. */ + getActivePaneItem(): object|undefined; + + /** Get all text editors in the workspace center. */ + getTextEditors(): TextEditor[]; + + /** Get the active item if it is an TextEditor. */ + getActiveTextEditor(): TextEditor|undefined; + + /** Save all pane items. */ + saveAll(): void; + + // Panes + /** Get all panes in the workspace center. */ + getPanes(): Pane[]; + + /** Get the active Pane. */ + getActivePane(): Pane; + + /** Make the next pane active. */ + activateNextPane(): void; + + /** Make the previous pane active. */ + activatePreviousPane(): void; + + /** Retrieve the Pane associated with the given URI. */ + paneForURI(uri: string): Pane|undefined; + + /** Retrieve the Pane associated with the given item. */ + paneForItem(item: object): Pane|undefined; + + /** Destroy (close) the active pane. */ + destroyActivePane(): void; + } + } + + /** An amalgamation of all types used within the public Atom API. */ + namespace Atom { + /** Objects that appear as parameters to callbacks. */ + namespace Events { + // Atom Keymap ============================================================ + type FullKeybindingMatch = AtomKeymap.Events.FullKeybindingMatch; + type PartialKeybindingMatch = AtomKeymap.Events.PartialKeybindingMatch; + type FailedKeybindingMatch = AtomKeymap.Events.FailedKeybindingMatch; + type FailedKeymapFileRead = AtomKeymap.Events.FailedKeymapFileRead; + type KeymapLoaded = AtomKeymap.Events.KeymapLoaded; + type AddedKeystrokeResolver = AtomKeymap.Events.AddedKeystrokeResolver; + + // Path Watcher =========================================================== + type PathWatchErrorThrown = PathWatcher.Events.PathWatchErrorThrown; + type WatchedFilePathChanged = PathWatcher.Events.WatchedFilePathChanged; + + // Text Buffer ============================================================ + type BufferWatchError = TextBuffer.Events.BufferWatchError; + type FileSaved = TextBuffer.Events.FileSaved; + type MarkerChanged = TextBuffer.Events.MarkerChanged; + type BufferChanging = TextBuffer.Events.BufferChanging; + type BufferChanged = TextBuffer.Events.BufferChanged; + type BufferStoppedChanging = TextBuffer.Events.BufferStoppedChanging; + type DisplayMarkerChanged = TextBuffer.Events.DisplayMarkerChanged; + + // Core =================================================================== + type ExceptionThrown = AtomCore.Events.ExceptionThrown; + type PreventableExceptionThrown = AtomCore.Events.PreventableExceptionThrown; + type SelectionChanged = AtomCore.Events.SelectionChanged; + type PaneItemObserved = AtomCore.Events.PaneItemObserved; + type PaneItemOpened = AtomCore.Events.PaneItemOpened; + type EditorChanged = AtomCore.Events.EditorChanged; + type StyleElementObserved = AtomCore.Events.StyleElementObserved; + type TextEditorObserved = AtomCore.Events.TextEditorObserved; + type RepoStatusChanged = AtomCore.Events.RepoStatusChanged; + type PaneListItemShifted = AtomCore.Events.PaneListItemShifted; + type PaneItemMoved = AtomCore.Events.PaneItemMoved; + type CursorPositionChanged = AtomCore.Events.CursorPositionChanged; + type DecorationPropsChanged = AtomCore.Events.DecorationPropsChanged; + } + + /** Objects that appear as parameters to functions. */ + namespace Options { + // Atom Keymap ============================================================ + type BuildKeyEvent = AtomKeymap.Options.BuildKeyEvent; + + // First Mate ============================================================= + type Grammar = FirstMate.Options.Grammar; + + // Text Buffer ============================================================ + type BufferLoad = TextBuffer.Options.BufferLoad; + type CopyMarker = TextBuffer.Options.CopyMarker; + type FindMarker = TextBuffer.Options.FindMarker; + type FindDisplayMarker = TextBuffer.Options.FindDisplayMarker; + type ScanContext = TextBuffer.Options.ScanContext; + + // Core =================================================================== + type TextInsertion = AtomCore.Options.TextInsertion; + type Menu = AtomCore.Options.Menu; + type ContextMenu = AtomCore.Options.ContextMenu; + type SpawnProcess = AtomCore.Options.SpawnProcess; + type Process = AtomCore.Options.Process; + type NodeProcess = AtomCore.Options.NodeProcess; + type Notification = AtomCore.Options.Notification; + type ErrorNotification = AtomCore.Options.ErrorNotification; + type Tooltip = AtomCore.Options.Tooltip; + type WorkspaceScan = AtomCore.Options.WorkspaceScan; + } + + /** Data structures that are used within classes. */ + namespace Structures { + // First Mate ============================================================= + type GrammarToken = FirstMate.Structures.GrammarToken; + type TokenizeLineResult = FirstMate.Structures.TokenizeLineResult; + type GrammarRule = FirstMate.Structures.GrammarRule; + + // Text Buffer ============================================================ + type TextChange = TextBuffer.Structures.TextChange; + type BufferScanResult = TextBuffer.Structures.BufferScanResult; + type ContextualBufferScanResult = TextBuffer.Structures.ContextualBufferScanResult; + + // Core =================================================================== + type SharedDecorationProps = AtomCore.Structures.SharedDecorationProps; + type DecorationProps = AtomCore.Structures.DecorationProps; + type DecorationLayerProps = AtomCore.Structures.DecorationLayerProps; + type Invisibles = AtomCore.Structures.Invisibles; + type CancellablePromise = AtomCore.Structures.CancellablePromise; + type ScandalResult = AtomCore.Structures.ScandalResult; + type WindowLoadSettings = AtomCore.Structures.WindowLoadSettings; + } + + // Atom Keymap ============================================================== + /** This custom subclass of CustomEvent exists to provide the ::abortKeyBinding + * method, as well as versions of the ::stopPropagation methods that record the + * intent to stop propagation so event bubbling can be properly simulated for + * detached elements. + */ + type CommandEvent = AtomKeymap.CommandEvent; + + type KeyBinding = AtomKeymap.KeyBinding; + + /** Allows commands to be associated with keystrokes in a context-sensitive way. + * In Atom, you can access a global instance of this object via `atom.keymaps`. + */ + type KeymapManager = AtomKeymap.KeymapManager; + + // Event Kit ================================================================ + /** An object that aggregates multiple Disposable instances together into a + * single disposable, so they can all be disposed as a group. + */ + type CompositeDisposable = EventKit.CompositeDisposable; + + type DisposableLike = EventKit.DisposableLike; + + /** A handle to a resource that can be disposed. */ + type Disposable = EventKit.Disposable; + + /** Utility class to be used when implementing event-based APIs that allows + * for handlers registered via ::on to be invoked with calls to ::emit. + */ + type Emitter = EventKit.Emitter; + + // First Mate =============================================================== + /** Grammar that tokenizes lines of text. */ + type Grammar = FirstMate.Grammar; + + /** Instance side of GrammarRegistry class. */ + type GrammarRegistry = FirstMate.GrammarRegistry; + + type ScopeSelector = FirstMate.ScopeSelector; + + // Path Watcher ============================================================= + /** Represents a directory on disk that can be watched for changes. */ + type Directory = PathWatcher.Directory; + + /** Represents an individual file that can be watched, read from, and written to. */ + type File = PathWatcher.File; + + type PathWatcher = PathWatcher.PathWatcher; + + // Text Buffer ============================================================== + /** The interface that should be implemented for all "point-compatible" objects. */ + /** Represents a buffer annotation that remains logically stationary even as the + * buffer changes. This is used to represent cursors, folds, snippet targets, + * misspelled words, and anything else that needs to track a logical location + * in the buffer over time. + */ + type DisplayMarker = TextBuffer.DisplayMarker; + + /** Experimental: A container for a related set of markers at the DisplayLayer level. + * Wraps an underlying MarkerLayer on the TextBuffer. + * + * This API is experimental and subject to change on any release. + */ + type DisplayMarkerLayer = TextBuffer.DisplayMarkerLayer; + + /** Represents a buffer annotation that remains logically stationary even as + * the buffer changes. + */ + type Marker = TextBuffer.Marker; + + /** Experimental: A container for a related set of markers. */ + type MarkerLayer = TextBuffer.MarkerLayer; + + /** The interface that should be implemented for all "point-compatible" objects. */ + type PointLike = TextBuffer.PointLike; + + /** Represents a point in a buffer in row/column coordinates. */ + type Point = TextBuffer.Point; + + /** The interface that should be implemented for all "range-compatible" objects. */ + type RangeLike = TextBuffer.RangeLike; + + /** Represents a region in a buffer in row/column coordinates. */ + type Range = TextBuffer.Range; + + /** A mutable text container with undo/redo support and the ability to + * annotate logical regions in the text. + */ + type TextBuffer = TextBuffer.TextBuffer; + + // Atom ===================================================================== + /** Atom global for dealing with packages, themes, menus, and the window. + * An instance of this class is always available as the atom global. + */ + type AtomEnvironment = AtomCore.AtomEnvironment; + + /** A wrapper which provides standard error/output line buffering for + * Node's ChildProcess. + */ + type BufferedProcess = AtomCore.BufferedProcess; + + /** Like BufferedProcess, but accepts a Node script as the command to run. + * This is necessary on Windows since it doesn't support shebang #! lines. + */ + type BufferedNodeProcess = AtomCore.BufferedNodeProcess; + + /** Represents the clipboard used for copying and pasting in Atom. */ + type Clipboard = AtomCore.Clipboard; + + /** A simple color class returned from Config::get when the value at the key path is + * of type 'color'. + */ + type Color = AtomCore.Color; + + /** Used to access all of Atom's configuration details. */ + type Config = AtomCore.Config; + + /** Provides a registry for commands that you'd like to appear in the context menu. */ + type ContextMenuManager = AtomCore.ContextMenuManager; + + /** Associates listener functions with commands in a context-sensitive way + * using CSS selectors. + */ + type CommandRegistry = AtomCore.CommandRegistry; + + /** The Cursor class represents the little blinking line identifying where text + * can be inserted. + */ + type Cursor = AtomCore.Cursor; + + /** Represents a decoration that follows a DisplayMarker. A decoration is basically + * a visual representation of a marker. It allows you to add CSS classes to line + * numbers in the gutter, lines, and add selection-line regions around marked ranges + * of text. + */ + type Decoration = AtomCore.Decoration; + + type Deserializer = AtomCore.Deserializer; + + /** Manages the deserializers used for serialized state. */ + type DeserializerManager = AtomCore.DeserializerManager; + + /** A container at the edges of the editor window capable of holding items. */ + type Dock = AtomCore.Dock; + + /** Represents the underlying git operations performed by Atom. */ + type GitRepository = AtomCore.GitRepository; + + /** Represents a gutter within a TextEditor. */ + type Gutter = AtomCore.Gutter; + + /** History manager for remembering which projects have been opened. + * An instance of this class is always available as the atom.history global. + * The project history is used to enable the 'Reopen Project' menu. + */ + type HistoryManager = AtomCore.HistoryManager; + + type HistoryProject = AtomCore.HistoryProject; + + /** Represents a decoration that applies to every marker on a given layer. Created via + * TextEditor::decorateMarkerLayer. + */ + type LayerDecoration = AtomCore.LayerDecoration; + + /** Provides a registry for menu items that you'd like to appear in the application menu. */ + type MenuManager = AtomCore.MenuManager; + + type Model = AtomCore.Model; + + /** A notification to the user containing a message and type. */ + type Notification = AtomCore.Notification; + + /** A notification manager used to create Notifications to be shown to the user. */ + type NotificationManager = AtomCore.NotificationManager; + + /** Loads and activates a package's main module and resources such as stylesheets, + * keymaps, grammar, editor properties, and menus. + */ + type Package = AtomCore.Package; + + /** Package manager for coordinating the lifecycle of Atom packages. */ + type PackageManager = AtomCore.PackageManager; + + /** A container for presenting content in the center of the workspace. */ + type Pane = AtomCore.Pane; + + /** A container representing a panel on the edges of the editor window. You + * should not create a Panel directly, instead use Workspace::addTopPanel and + * friends to add panels. + */ + type Panel = AtomCore.Panel; + + /** Represents a project that's opened in Atom. */ + type Project = AtomCore.Project; + + /** Wraps an Array of Strings. The Array describes a path from the root of the + * syntax tree to a token including all scope names for the entire path. + */ + type ScopeDescriptor = AtomCore.ScopeDescriptor; + + /** Represents a selection in the TextEditor. */ + type Selection = AtomCore.Selection; + + /** A singleton instance of this class available via atom.styles, which you can + * use to globally query and observe the set of active style sheets. + */ + type StyleManager = AtomCore.StyleManager; + + /** Run a node script in a separate process. */ + type Task = AtomCore.Task; + + /** This class represents all essential editing state for a single TextBuffer, + * including cursor and selection positions, folds, and soft wraps. + */ + type TextEditor = AtomCore.TextEditor; + + /** Experimental: This global registry tracks registered TextEditors. */ + type TextEditorRegistry = AtomCore.TextEditorRegistry; + + /** Handles loading and activating available themes. */ + type ThemeManager = AtomCore.ThemeManager; + + type Tooltip = AtomCore.Tooltip; + + /** Associates tooltips with HTML elements or selectors. */ + type TooltipManager = AtomCore.TooltipManager; + + /** ViewRegistry handles the association between model and view types in Atom. + * We call this association a View Provider. As in, for a given model, this class + * can provide a view via ::getView, as long as the model/view association was + * registered via ::addViewProvider. + */ + type ViewRegistry = AtomCore.ViewRegistry; + + /** Represents the state of the user interface for the entire window. */ + type Workspace = AtomCore.Workspace; + + // https://github.com/atom/atom/blob/master/src/workspace-center.js + /** The central container for the editor window capable of holding items. */ + type WorkspaceCenter = AtomCore.WorkspaceCenter; } + + var atom: AtomCore.AtomEnvironment; } -declare var atom:AtomCore.IAtom; +export { CompositeDisposable, Disposable, Emitter } from "event-kit"; +export { File, Directory } from "pathwatcher"; -declare module "atom" { - import spacePen = require("space-pen"); - import Q = require("q"); +/** A wrapper which provides standard error/output line buffering for + * Node's ChildProcess. + */ +export const BufferedProcess: AtomCore.Statics.BufferedProcess; - var $:typeof spacePen.$; - var $$:typeof spacePen.$$; - var $$$:typeof spacePen.$$$; +/** Like BufferedProcess, but accepts a Node script as the command to run. + * This is necessary on Windows since it doesn't support shebang #! lines. + */ +export const BufferedNodeProcess: AtomCore.Statics.BufferedNodeProcess; - var BufferedNodeProcess:AtomCore.IBufferedNodeProcessStatic; - var BufferedProcess:AtomCore.IBufferedProcessStatic; - var Git:AtomCore.IGitStatic; - var Point:TextBuffer.IPointStatic; - var Range:TextBuffer.IRangeStatic; +/** Represents the underlying git operations performed by Atom. */ +export const GitRepository: AtomCore.Statics.GitRepository; - class View extends spacePen.View implements Emissary.ISubscriber { - // Subscriber.includeInto(spacePen.View); +/** A notification to the user containing a message and type. */ +export const Notification: AtomCore.Statics.Notification; - // inherit from Subscriber - subscribeWith(eventEmitter:any, methodName:string, args:any):any; +/** Represents a point in a buffer in row/column coordinates. */ +export const Point: TextBuffer.Statics.Point; - addSubscription(subscription:any):any; +/** Represents a region in a buffer in row/column coordinates. */ +export const Range: TextBuffer.Statics.Range; - subscribe(eventEmitterOrSubscription:any, ...args:any[]):any; +/** Run a node script in a separate process. */ +export const Task: AtomCore.Statics.Task; - subscribeToCommand(eventEmitter:any, ...args:any[]):any; +/** A mutable text container with undo/redo support and the ability to annotate + * logical regions in the text. + */ +export const TextBuffer: TextBuffer.Statics.TextBuffer; - unsubscribe(object?:any):any; - } - - class EditorView extends View { - static characterWidthCache:any; - static configDefaults:any; - static nextEditorId:number; - - static content(params:any):void; - - static classes(_arg?:{mini?:any}):string; - - vScrollMargin:number; - hScrollMargin:number; - lineHeight:any; - charWidth:any; - charHeight:any; - cursorViews:any[]; - selectionViews:any[]; - lineCache:any[]; - isFocused:any; - editor:AtomCore.IEditor; - attached:any; - lineOverdraw:number; - pendingChanges:any[]; - newCursors:any[]; - newSelections:any[]; - redrawOnReattach:any; - bottomPaddingInLines:number; - active:boolean; - - id:number; - - gutter:AtomCore.IGutterView; - overlayer:JQuery; - scrollView:JQuery; - renderedLines:JQuery; - underlayer:JQuery; - hiddenInput:JQuery; - verticalScrollbar:JQuery; - verticalScrollbarContent:JQuery; - - constructor(editor:AtomCore.IEditor); - - initialize(editorOrOptions:AtomCore.IEditor):void; // return type are same as editor method. - initialize(editorOrOptions?:{editor: AtomCore.IEditor; mini:any; placeholderText:any}):void; - - initialize(editorOrOptions:{}):void; // compatible for spacePen.View - - bindKeys():void; - - getEditor():AtomCore.IEditor; - - getText():string; - - setText(text:string):void; - - insertText(text:string, options?:any):TextBuffer.IRange[]; - - setHeightInLines(heightInLines:number):number; - - setWidthInChars(widthInChars:number):number; - - pageDown():void; - - pageUp():void; - - getPageRows():number; - - setShowInvisibles(showInvisibles:boolean):void; - - setInvisibles(invisibles:{ eol:string; space: string; tab: string; cr: string; }):void; - - setShowIndentGuide(showIndentGuide:boolean):void; - - setPlaceholderText(placeholderText:string):void; - - getPlaceholderText():string; - - checkoutHead():boolean; - - configure():Emissary.ISubscription; - - handleEvents():void; - - handleInputEvents():void; - - bringHiddenInputIntoView():JQuery; - - selectOnMousemoveUntilMouseup():any; - - afterAttach(onDom:any):any; - - edit(editor:AtomCore.IEditor):any; - - getModel():AtomCore.IEditor; - - setModel(editor:AtomCore.IEditor):any; - - showBufferConflictAlert(editor:AtomCore.IEditor):any; - - scrollTop(scrollTop:number, options?:any):any; - - scrollBottom(scrollBottom?:number):any; - - scrollLeft(scrollLeft?:number):number; - - scrollRight(scrollRight?:number):any; - - scrollToBottom():any; - - scrollToCursorPosition():any; - - scrollToBufferPosition(bufferPosition:any, options:any):any; - - scrollToScreenPosition(screenPosition:any, options:any):any; - - scrollToPixelPosition(pixelPosition:any, options:any):any; - - highlightFoldsContainingBufferRange(bufferRange:any):any; - - saveScrollPositionForEditor():any; - - toggleSoftTabs():any; - - toggleSoftWrap():any; - - calculateWidthInChars():number; - - calculateHeightInLines():number; - - getScrollbarWidth():number; - - setSoftWrap(softWrap:boolean):any; - - setFontSize(fontSize:number):any; - - getFontSize():number; - - setFontFamily(fontFamily?:string):any; - - getFontFamily():string; - - setLineHeight(lineHeight:number):any; - - redraw():any; - - splitLeft():any; - - splitRight():any; - - splitUp():any; - - splitDown():any; - - getPane():any; // return type are PaneView - - remove(selector:any, keepData:any):any; - - beforeRemove():any; - - getCursorView(index?:number):any; // return type are CursorView - - getCursorViews():any[]; // return type are CursorView[] - - addCursorView(cursor:any, options:any):any; // return type are CursorView - - removeCursorView(cursorView:any):any; - - getSelectionView(index?:number):any; // return type are SelectionView - - getSelectionViews():any[]; // return type are SelectionView[] - - addSelectionView(selection:any):any; - - removeSelectionView(selectionView:any):any; - - removeAllCursorAndSelectionViews():any[]; - - appendToLinesView(view:any):any; - - scrollVertically(pixelPosition:any, _arg:any):any; - - scrollHorizontally(pixelPosition:any):any; - - calculateDimensions():number; - - recalculateDimensions():any; - - updateLayerDimensions():any; - - isHidden():boolean; - - clearRenderedLines():void; - - resetDisplay():any; - - requestDisplayUpdate():any; - - updateDisplay(options?:any):any; - - updateCursorViews():any; - - shouldUpdateCursor(cursorView:any):any; - - updateSelectionViews():any[]; - - shouldUpdateSelection(selectionView:any):any; - - syncCursorAnimations():any[]; - - autoscroll(suppressAutoscroll?:any):any[]; - - updatePlaceholderText():any; - - updateRenderedLines(scrollViewWidth:any):any; - - computeSurroundingEmptyLineChanges(change:any):any; - - computeIntactRanges(renderFrom:any, renderTo:any):any; - - truncateIntactRanges(intactRanges:any, renderFrom:any, renderTo:any):any; - - clearDirtyRanges(intactRanges:any):any; - - clearLine(lineElement:any):any; - - fillDirtyRanges(intactRanges:any, renderFrom:any, renderTo:any):any; - - updatePaddingOfRenderedLines():any; - - getFirstVisibleScreenRow():number; - - getLastVisibleScreenRow():number; - - isScreenRowVisible():boolean; - - handleScreenLinesChange(change:any):any; - - buildLineElementForScreenRow(screenRow:any):any; - - buildLineElementsForScreenRows(startRow:any, endRow:any):any; - - htmlForScreenRows(startRow:any, endRow:any):any; - - htmlForScreenLine(screenLine:any, screenRow:any):any; - - buildIndentation(screenRow:any, editor:any):any; - - buildHtmlEndOfLineInvisibles(screenLine:any):any; - - getEndOfLineInvisibles(screenLine:any):any; - - lineElementForScreenRow(screenRow:any):any; - - toggleLineCommentsInSelection():any; - - pixelPositionForBufferPosition(position:any):any; - - pixelPositionForScreenPosition(position:any):any; - - positionLeftForLineAndColumn(lineElement:any, screenRow:any, screenColumn:any):any; - - measureToColumn(lineElement:any, tokenizedLine:any, screenColumn:any):any; - - getCharacterWidthCache(scopes:any, char:any):any; - - setCharacterWidthCache(scopes:any, char:any, val:any):any; - - clearCharacterWidthCache():any; - - pixelOffsetForScreenPosition(position:any):any; - - screenPositionFromMouseEvent(e:any):any; - - highlightCursorLine():any; - - copyPathToClipboard():any; - - buildLineHtml(_arg:any):any; - - updateScopeStack(line:any, scopeStack:any, desiredScopes:any):any; - - pushScope(line:any, scopeStack:any, scope:any):any; - - popScope(line:any, scopeStack:any):any; - - buildEmptyLineHtml(showIndentGuide:any, eolInvisibles:any, htmlEolInvisibles:any, indentation:any, editor:any, mini:any):any; - - replaceSelectedText(replaceFn:(str:string)=>string):any; - - consolidateSelections(e:any):any; - - logCursorScope():any; - - logScreenLines(start:any, end:any):any; - - logRenderedLines():any; - } - - class ScrollView extends View { - // TBD - } - - interface ISelectListItem { - /** e.g. application:about */ - eventName:string; - /** e.g. Application: About */ - eventDescription:string; - } - - class SelectListView extends View { - static content():any; - - maxItems:number; - scheduleTimeout:any; - inputThrottle:number; - cancelling:boolean; - items:any[]; - list:JQuery; - filterEditorView: JQuery; - - previouslyFocusedElement:JQuery; - - initialize():any; - - schedulePopulateList():number; - - setItems(items:any[]):any; - - setError(message?:string):any; - - setLoading(message?:string):any; - - getFilterQuery():string; - - populateList():any; - - getEmptyMessage(itemCount?:any, filteredItemCount?:any):string; - - setMaxItems(maxItems:number):void; - - selectPreviousItemView():any; - - selectNextItemView():any; - - selectItemView(view:any):any; - - scrollToItemView(view:any):any; - - getSelectedItemView():any; - - getSelectedItem():any; - - confirmSelection():any; - - viewForItem(item:any):JQuery|string|HTMLElement|View; // You must override this method! - confirmed(item:any):any; // You must override this method! - getFilterKey():any; - - focusFilterEditor():any; - - storeFocusedElement():any; - - restoreFocus():any; - - cancelled():any; - - cancel():any; - } - - class Disposable extends AtomCore.Disposable { } - class CompositeDisposable extends AtomCore.CompositeDisposable { } - - var WorkspaceView:AtomCore.IWorkspaceViewStatic; - - var Task:AtomCore.ITaskStatic; - var Workspace:AtomCore.IWorkspaceStatic; -} +/** This class represents all essential editing state for a single TextBuffer, + * including cursor and selection positions, folds, and soft wraps. + */ +export const TextEditor: AtomCore.Statics.TextEditor; diff --git a/types/atom/package.json b/types/atom/package.json new file mode 100644 index 0000000000..fe9d276dc5 --- /dev/null +++ b/types/atom/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "electron": "1.6.9" + } +} diff --git a/types/atom/services/index.d.ts b/types/atom/services/index.d.ts new file mode 100644 index 0000000000..33b85ff511 --- /dev/null +++ b/types/atom/services/index.d.ts @@ -0,0 +1,190 @@ +/* tslint:disable:no-unnecessary-qualifier */ +declare namespace Atom { + namespace Services { + /** Type definitions for autocomplete+ 2 */ + namespace Autocomplete { + /** Objects that appear as parameters to callbacks. */ + namespace Events { + /** The parameters passed into getSuggestions by Autocomplete+. */ + interface SuggestionsRequested { + /** The current TextEditor. */ + editor: Atom.TextEditor; + + /** The position of the cursor. */ + bufferPosition: Atom.Point; + + /** The scope descriptor for the current cursor position. */ + scopeDescriptor: Atom.ScopeDescriptor; + + /** The prefix for the word immediately preceding the current cursor position. */ + prefix: string; + + /** Whether the autocomplete request was initiated by the user. */ + activatedManually: boolean; + } + + /** The parameters passed into onDidInsertSuggestion by Autocomplete+. */ + interface SuggestionInserted { + editor: Atom.TextEditor; + triggerPosition: Atom.Point; + suggestion: TextSuggestion|SnippetSuggestion; + } + } + + /** An autocompletion suggestion for the user. + * Primary data type for the Atom Autocomplete+ service. + */ + interface Suggestion { + /** A string that will show in the UI for this suggestion. + * When not set, snippet || text is displayed. + */ + displayText?: string; + + /** The text immediately preceding the cursor, which will be replaced by the text. + * If not provided, the prefix passed into getSuggestions will be used. + */ + replacementPrefix?: string; + + /** The suggestion type. It will be converted into an icon shown against the suggestion. */ + type?: string; + + /** This is shown before the suggestion. Useful for return values. */ + leftLabel?: string; + + /** Use this instead of leftLabel if you want to use html for the left label. */ + leftLabelHTML?: string; + + /** An indicator (e.g. function, variable) denoting the "kind" of suggestion this represents. */ + rightLabel?: string; + + /** Use this instead of rightLabel if you want to use html for the right label. */ + rightLabelHTML?: string; + + /** Class name for the suggestion in the suggestion list. Allows you to style your suggestion + * via CSS, if desired. + */ + className?: string; + + /** If you want complete control over the icon shown against the suggestion. e.g. iconHTML: + * + */ + iconHTML?: string; + + /** A doc-string summary or short description of the suggestion. When specified, it will be + * displayed at the bottom of the suggestions list. + */ + description?: string; + + /** A url to the documentation or more information about this suggestion. When specified, + * a More.. link will be displayed in the description area. + */ + descriptionMoreURL?: string; + } + + interface TextSuggestion extends Suggestion { + /** The text which will be inserted into the editor, in place of the prefix. */ + text: string; + } + + interface SnippetSuggestion extends Suggestion { + /** A snippet string. This will allow users to tab through function arguments or other + * options. + */ + snippet: string; + } + + type Suggestions = Array; + + interface Provider { + /** Defines the scope selector(s) (can be comma-separated) for which your provider + * should receive suggestion requests. + */ + selector: string; + + /** Is called when a suggestion request has been dispatched by autocomplete+ to your + * provider. Return an array of suggestions (if any) in the order you would like them + * displayed to the user. Returning a Promise of an array of suggestions is also + * supported. + */ + getSuggestions(params: Events.SuggestionsRequested): Suggestions|Promise; + + /** Defines the scope selector(s) (can be comma-separated) for which your provider + * should not be used. + */ + disableForSelector?: string; + + /** A number to indicate its priority to be included in a suggestions request. + * The default provider has an inclusion priority of 0. Higher priority providers + * can suppress lower priority providers with excludeLowerPriority. + */ + inclusionPriority?: number; + + /** Will not use lower priority providers when this provider is used. */ + excludeLowerPriority?: boolean; + + /** A number to determine the sort order of suggestions. The default provider has + * an suggestion priority of 1. + */ + suggestionPriority?: number; + + /** Function that is called when a suggestion from your provider was inserted + * into the buffer. + */ + onDidInsertSuggestion?(params: Events.SuggestionInserted): void; + + /** Will be called if your provider is being destroyed by autocomplete+ */ + dispose?(): void; + } + } + + /** Type definitions for status-bar 1.8 */ + namespace StatusBar { + /** Objects that appear as parameters to functions. */ + namespace Options { + interface AddTile { + /** A DOM element, a jQuery object, or a model object for which a view provider + * has been registered in the the view registry. + */ + item: object; + + /** Determines the placement of the tile within the status bar. Lower priority + * will result in closer placement to the anchor. + */ + priority: number; + } + } + + interface Tile { + /** Retrieve the priority that was assigned to the Tile when it was created. */ + getPriority(): number; + + /** Retrieve the Tile's item. */ + getItem(): object; + + /** Remove the Tile from the status bar. */ + destroy(): void; + } + + interface StatusBar { + /** Add a tile to the left side of the status bar. Lower priority tiles are placed + * further to the left. + */ + addLeftTile(options: Options.AddTile): Tile; + + /** Add a tile to the right side of the status bar. Lower priority tiles are placed + * further to the right. + */ + addRightTile(options: Options.AddTile): Tile; + + /** Retrieve all of the tiles on the left side of the status bar. */ + getLeftTiles(): Tile[]; + + /** Retrieve all of the tiles on the right side of the status bar. */ + getRightTiles(): Tile[]; + } + + type Consumer = (statusBar: StatusBar) => void; + } + } +} +/* tslint:enable:no-unnecessary-qualifier */ diff --git a/types/atom/tsconfig.json b/types/atom/tsconfig.json index 6c1bb13aef..febacd8656 100644 --- a/types/atom/tsconfig.json +++ b/types/atom/tsconfig.json @@ -7,21 +7,18 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" ], - "paths": { - "q": [ "q/v0" ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "api-docs.d.ts", - "atom-tests.ts" + "atom-tests.ts", + "services/index.d.ts" ] -} \ No newline at end of file +} diff --git a/types/atom/tslint.json b/types/atom/tslint.json new file mode 100644 index 0000000000..a36bbd3600 --- /dev/null +++ b/types/atom/tslint.json @@ -0,0 +1,39 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // Custom rules. + "await-promise": [true, "CancellablePromise"], + "class-name": true, + "indent": [true, "tabs"], + "jsdoc-format": true, + "linebreak-style": [true, "LF"], + "max-line-length": [true, 100], + "no-any": false, + "quotemark": [true, "double", "avoid-escape"], + "trailing-comma": [true, { + "multiline": { "objects": "always", "arrays": "always", "functions": "never" }, + "singleline": { "objects": "never", "arrays": "never", "functions": "never" } + }], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-type", + "check-typecast", + "check-rest-spread", + "check-preblock" + ], + // Soon to be defaults. + "arrow-return-shorthand": [true, "multiline"], + "no-floating-promises": true, + "no-unbound-method": true, + "no-unsafe-any": true, + "number-literal-format": true, + "restrict-plus-operands": true, + "return-undefined": true, + "switch-final-break": true + } +} diff --git a/types/atom/api-docs.d.ts b/types/atom/v0/api-docs.d.ts similarity index 100% rename from types/atom/api-docs.d.ts rename to types/atom/v0/api-docs.d.ts diff --git a/types/atom/v0/atom-tests.ts b/types/atom/v0/atom-tests.ts new file mode 100644 index 0000000000..5987f4901d --- /dev/null +++ b/types/atom/v0/atom-tests.ts @@ -0,0 +1,70 @@ +import path = require("path"); +import _atom = require("atom"); + +import PathWatcher = require("pathwatcher"); +var File = PathWatcher.File; + +const jq: JQuery = $("selector"); + +class SampleView extends _atom.ScrollView { + + editorId:string; + file:PathWatcher.IFile; + editor:AtomCore.IEditor; + + static deserialize(state:any):SampleView { + return new SampleView(state); + } + + static content():any { + return this.div({class: 'sample native-key-bindings', tabindex: -1}); + } + + constructor(params:{editorId?:string; filePath?:string;} = {}) { + super(); + + this.editorId = params.editorId; + + if (this.editorId) { + this.resolveEditor(this.editorId); + } else { + this.file = new File(params.filePath); + } + } + + serialize() { + return { + deserializer: 'SampleView', + editorId: this.editorId + }; + } + + destroy() { + this.unsubscribe(); + } + + resolveEditor(editorId:string) { + var resolve = ()=> { + if (this.editor) { + jq.trigger("title-changed"); + } else { + var view = jq.parents('.pane').view(); + if (view) { + view.destroyItem(this); + } + } + }; + + if (atom.workspace) { + resolve(); + } else { + atom.packages.once("activated", ()=> { + resolve(); + }); + } + } +} + +atom.deserializers.add(SampleView); + +export = SampleView; diff --git a/types/atom/v0/index.d.ts b/types/atom/v0/index.d.ts new file mode 100644 index 0000000000..7dba05663c --- /dev/null +++ b/types/atom/v0/index.d.ts @@ -0,0 +1,1977 @@ +// Type definitions for Atom +// Project: https://atom.io/ +// Definitions by: vvakame , smhxx +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// +/// +/// +/// +/// +/// + +// Policy: this definition file only declare element related to `atom`. +// if js file include to another npm package (e.g. "space-pen", "mixto" and "emissary"). +// you should create a separate file. + +// API documentation : https://atom.io/docs/api/v1.20.1 + +interface Window { + atom: AtomCore.IAtom; + measure(description:string, fn:Function):any; // return fn result + profile(description:string, fn:Function):any; // return fn result +} + +declare namespace AtomCore { + + // https://atom.io/docs/v0.84.0/advanced/view-system + interface IWorkspaceViewStatic { + new ():IWorkspaceView; + version: number; + configDefaults:any; + content():any; + } + + interface Decoration { + destroy(): void; + } + + /** + * Represents a buffer annotation that remains logically stationary even as the buffer changes. This is used + * to represent cursors, folds, snippet targets, misspelled words, any anything else that needs to track a + * logical location in the buffer over time. + */ + interface Marker { + /** + * Destroys the marker, causing it to emit the 'destroyed' event. Once destroyed, a marker cannot be + * restored by undo/redo operations. + */ + destroy(): void; + + /** + * Gets the screen range of the display marker. + */ + getScreenRange(): Range; + } + + interface IWorkspaceView extends View { + // Delegator.includeInto(WorkspaceView); + + // delegate to model property's property + fullScreen:boolean; + + // delegate to model property's method + open(uri:string, options:any):Q.Promise; + openSync(uri:string, options?:any):any; + saveActivePaneItem():any; + saveActivePaneItemAs():any; + saveAll():void; + destroyActivePaneItem():any; + destroyActivePane():any; + increaseFontSize():void; + decreaseFontSize():void; + + // own property & methods + initialize(model:IWorkspace):any; + initialize(view:View, args:any):void; // do not use + model:IWorkspace; + panes: IPaneContainerView; + getModel():IWorkspace; + installShellCommands():any; + handleFocus():any; + afterAttach(onDom?:any):any; + confirmClose():boolean; + updateTitle():any; + setTitle(title:string):any; + getEditorViews():any[]; // atom.EditorView + prependToTop(element:any):any; + appendToTop(element:any):any; + prependToBottom(element:any):any; + appendToBottom(element:any):any; + prependToLeft(element:any):any; + appendToLeft(element:any):any; + prependToRight(element:any):any; + appendToRight(element:any):any; + getActivePaneView():IPaneView; + getActiveView():View; + focusPreviousPaneView():any; + focusNextPaneView():any; + focusPaneViewAbove():any; + focusPaneViewBelow():any; + focusPaneViewOnLeft():any; + focusPaneViewOnRight():any; + eachPaneView(callback:(paneView:IPaneView)=>any):{ off():any; }; + getPaneViews():IPaneView[]; + eachEditorView(callback:(editorView:any /* EditorView */)=>any):{ off():any; }; + beforeRemove():any; + + command(eventName:string, handler:Function):any; + command(eventName:string, selector:Function, handler:Function):any; + command(eventName:string, options:any, handler:Function):any; + command(eventName:string, selector:Function, options:any, handler:Function):any; + + statusBar:StatusBar.IStatusBarView; + } + + interface IPanes { + // TBD + } + + interface IPaneView { + // TBD + } + + interface IPaneContainerView { + // TBD + } + + interface ITreeView { + // TBD + } + + interface IGutterViewStatic { + new(): IGutterView; + content():any; + } + + interface IGutterView extends View { + firstScreenRow:any; + lastScreenRow:any; + initialize():void; + initialize(view:View, args:any):void; // do not use + afterAttach(onDom?:any):any; + beforeRemove():any; + handleMouseEvents(e:JQueryMouseEventObject):any; + getEditorView():any; /* EditorView */ + getEditor():IEditor; + getLineNumberElements():HTMLCollection; + getLineNumberElementsForClass(klass:string):NodeList; + getLineNumberElement(bufferRow:number):NodeList; + addClassToAllLines(klass:string):boolean; + removeClassFromAllLines(klass:string):boolean; + addClassToLine(bufferRow:number, klass:string):boolean; + removeClassFromLine(bufferRow:number, klass:string):boolean; + updateLineNumbers(changes:any[], startScreenRow?:number, endScreenRow?:number):any; + prependLineElements(lineElements:any):void; + appendLineElements(lineElements:any):void; + removeLineElements(numberOfElements:number):void; + buildLineElements(startScreenRow:any, endScreenRow:any):any; + buildLineElementsHtml(startScreenRow:any, endScreenRow:any):any; + updateFoldableClasses(changes:any[]):any; + removeLineHighlights():void; + addLineHighlight(row:number, emptySelection?:boolean):any; + highlightLines():boolean; + } + + interface ICommandRegistry { + add(target: string, commandName: Object, callback?: (event: any) => void): any; // selector:'atom-editor'|'atom-workspace' + findCommands(params: Object): Object[]; + dispatch(selector: any, name:string): void; + } + + interface ICommandPanel { + // TBD + } + + interface IDisplayBufferStatic { + new(_arg?:any):IDisplayBuffer; + } + + interface IDisplayBuffer /* extends Theorist.Model */ { + // Serializable.includeInto(Editor); + + constructor:IDisplayBufferStatic; + + verticalScrollMargin:number; + horizontalScrollMargin:number; + + declaredPropertyValues:any; + tokenizedBuffer: ITokenizedBuffer; + buffer: TextBuffer.ITextBuffer; + charWidthsByScope:any; + markers:{ [index:number]:IDisplayBufferMarker; }; + foldsByMarkerId:any; + maxLineLength:number; + screenLines:ITokenizedLine[]; + rowMap:any; // return type are RowMap + longestScreenRow:number; + subscriptions:Emissary.ISubscription[]; + subscriptionsByObject:any; // return type are WeakMap + behaviors:any; + subscriptionCounts:any; + eventHandlersByEventName:any; + pendingChangeEvent:any; + + softWrap:boolean; + + serializeParams():{id:number; softWrap:boolean; editorWidthInChars: number; scrollTop: number; scrollLeft: number; tokenizedBuffer: any; }; + deserializeParams(params:any):any; + copy():IDisplayBuffer; + updateAllScreenLines():any; + emitChanged(eventProperties:any, refreshMarkers?:boolean):any; + updateWrappedScreenLines():any; + setVisible(visible:any):any; + getVerticalScrollMargin():number; + setVerticalScrollMargin(verticalScrollMargin:number):number; + getHorizontalScrollMargin():number; + setHorizontalScrollMargin(horizontalScrollMargin:number):number; + getHeight():any; + setHeight(height:any):any; + getWidth():any; + setWidth(newWidth:any):any; + getScrollTop():number; + setScrollTop(scrollTop:number):number; + getScrollBottom():number; + setScrollBottom(scrollBottom:number):number; + getScrollLeft():number; + setScrollLeft(scrollLeft:number):number; + getScrollRight():number; + setScrollRight(scrollRight:number):number; + getLineHeight():any; + setLineHeight(lineHeight:any):any; + getDefaultCharWidth():any; + setDefaultCharWidth(defaultCharWidth:any):any; + getScopedCharWidth(scopeNames:any, char:any):any; + getScopedCharWidths(scopeNames:any):any; + setScopedCharWidth(scopeNames:any, char:any, width:any):any; + setScopedCharWidths(scopeNames:any, charWidths:any):any; + clearScopedCharWidths():any; + getScrollHeight():number; + getScrollWidth():number; + getVisibleRowRange():number[]; + intersectsVisibleRowRange(startRow:any, endRow:any):any; + selectionIntersectsVisibleRowRange(selection:any):any; + scrollToScreenRange(screenRange:any):any; + scrollToScreenPosition(screenPosition:any):any; + scrollToBufferPosition(bufferPosition:any):any; + pixelRectForScreenRange(screenRange:TextBuffer.IRange):any; + getTabLength():number; + setTabLength(tabLength:number):any; + setSoftWrap(softWrap:boolean):boolean; + getSoftWrap():boolean; + setEditorWidthInChars(editorWidthInChars:number):any; + getEditorWidthInChars():number; + getSoftWrapColumn():number; + lineForRow(row:number):any; + linesForRows(startRow:number, endRow:number):any; + getLines():any[]; + indentLevelForLine(line:any):any; + bufferRowsForScreenRows(startScreenRow:any, endScreenRow:any):any; + createFold(startRow:number, endRow:number):IFold; + isFoldedAtBufferRow(bufferRow:number):boolean; + isFoldedAtScreenRow(screenRow:number):boolean; + destroyFoldWithId(id:number):any; + unfoldBufferRow(bufferRow:number):any[]; + largestFoldStartingAtBufferRow(bufferRow:number):any; + foldsStartingAtBufferRow(bufferRow:number):any; + largestFoldStartingAtScreenRow(screenRow:any):any; + largestFoldContainingBufferRow(bufferRow:any):any; + outermostFoldsInBufferRowRange(startRow:any, endRow:any):any[]; + foldsContainingBufferRow(bufferRow:any):any[]; + screenRowForBufferRow(bufferRow:number):number; + lastScreenRowForBufferRow(bufferRow:number):number; + bufferRowForScreenRow(screenRow:number):number; + + screenRangeForBufferRange(bufferRange:TextBuffer.IPoint[]):TextBuffer.IRange; + + screenRangeForBufferRange(bufferRange:TextBuffer.IRange):TextBuffer.IRange; + + screenRangeForBufferRange(bufferRange:{start: TextBuffer.IPoint; end: TextBuffer.IPoint}):TextBuffer.IRange; + screenRangeForBufferRange(bufferRange:{start: number[]; end: TextBuffer.IPoint}):TextBuffer.IRange; + screenRangeForBufferRange(bufferRange:{start: {row:number; col:number;}; end: TextBuffer.IPoint}):TextBuffer.IRange; + + screenRangeForBufferRange(bufferRange:{start: TextBuffer.IPoint; end: number[]}):TextBuffer.IRange; + screenRangeForBufferRange(bufferRange:{start: number[]; end: number[]}):TextBuffer.IRange; + screenRangeForBufferRange(bufferRange:{start: {row:number; col:number;}; end: number[]}):TextBuffer.IRange; + + screenRangeForBufferRange(bufferRange:{start: TextBuffer.IPoint; end: {row:number; col:number;}}):TextBuffer.IRange; + screenRangeForBufferRange(bufferRange:{start: number[]; end: {row:number; col:number;}}):TextBuffer.IRange; + screenRangeForBufferRange(bufferRange:{start: {row:number; col:number;}; end: {row:number; col:number;}}):TextBuffer.IRange; + + bufferRangeForScreenRange(screenRange:TextBuffer.IPoint[]):TextBuffer.IRange; + + bufferRangeForScreenRange(screenRange:TextBuffer.IRange):TextBuffer.IRange; + + bufferRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: TextBuffer.IPoint}):TextBuffer.IRange; + bufferRangeForScreenRange(screenRange:{start: number[]; end: TextBuffer.IPoint}):TextBuffer.IRange; + bufferRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: TextBuffer.IPoint}):TextBuffer.IRange; + + bufferRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: number[]}):TextBuffer.IRange; + bufferRangeForScreenRange(screenRange:{start: number[]; end: number[]}):TextBuffer.IRange; + bufferRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: number[]}):TextBuffer.IRange; + + bufferRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: {row:number; col:number;}}):TextBuffer.IRange; + bufferRangeForScreenRange(screenRange:{start: number[]; end: {row:number; col:number;}}):TextBuffer.IRange; + bufferRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: {row:number; col:number;}}):TextBuffer.IRange; + + pixelRangeForScreenRange(screenRange:TextBuffer.IPoint[], clip?:boolean):TextBuffer.IRange; + + pixelRangeForScreenRange(screenRange:TextBuffer.IRange, clip?:boolean):TextBuffer.IRange; + + pixelRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: TextBuffer.IPoint}, clip?:boolean):TextBuffer.IRange; + pixelRangeForScreenRange(screenRange:{start: number[]; end: TextBuffer.IPoint}, clip?:boolean):TextBuffer.IRange; + pixelRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: TextBuffer.IPoint}, clip?:boolean):TextBuffer.IRange; + + pixelRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: number[]}, clip?:boolean):TextBuffer.IRange; + pixelRangeForScreenRange(screenRange:{start: number[]; end: number[]}, clip?:boolean):TextBuffer.IRange; + pixelRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: number[]}, clip?:boolean):TextBuffer.IRange; + + pixelRangeForScreenRange(screenRange:{start: TextBuffer.IPoint; end: {row:number; col:number;}}, clip?:boolean):TextBuffer.IRange; + pixelRangeForScreenRange(screenRange:{start: number[]; end: {row:number; col:number;}}, clip?:boolean):TextBuffer.IRange; + pixelRangeForScreenRange(screenRange:{start: {row:number; col:number;}; end: {row:number; col:number;}}, clip?:boolean):TextBuffer.IRange; + + pixelPositionForScreenPosition(screenPosition:TextBuffer.IPoint, clip?:boolean):TextBuffer.IPoint; + pixelPositionForScreenPosition(screenPosition:number[], clip?:boolean):TextBuffer.IPoint; + pixelPositionForScreenPosition(screenPosition:{row:number; col:number;}, clip?:boolean):TextBuffer.IPoint; + + screenPositionForPixelPosition(pixelPosition:any):TextBuffer.IPoint; + + pixelPositionForBufferPosition(bufferPosition:any):any; + getLineCount():number; + getLastRow():number; + getMaxLineLength():number; + screenPositionForBufferPosition(bufferPosition:any, options:any):any; + bufferPositionForScreenPosition(bufferPosition:any, options:any):any; + scopesForBufferPosition(bufferPosition:any):any; + bufferRangeForScopeAtPosition(selector:any, position:any):any; + tokenForBufferPosition(bufferPosition:any):any; + getGrammar():IGrammar; + setGrammar(grammar:IGrammar):any; + reloadGrammar():any; + clipScreenPosition(screenPosition:any, options:any):any; + findWrapColumn(line:any, softWrapColumn:any):any; + rangeForAllLines():TextBuffer.IRange; + getMarker(id:number):IDisplayBufferMarker; + getMarkers():IDisplayBufferMarker[]; + getMarkerCount():number; + markScreenRange(range:TextBuffer.IRange, ...args:any[]):IDisplayBufferMarker; + markBufferRange(range:TextBuffer.IRange, options?:any):IDisplayBufferMarker; + markScreenPosition(screenPosition:TextBuffer.IPoint, options?:any):IDisplayBufferMarker; + markBufferPosition(bufferPosition:TextBuffer.IPoint, options?:any):IDisplayBufferMarker; + destroyMarker(id:number):any; + findMarker(params?:any):IDisplayBufferMarker; + findMarkers(params?:any):IDisplayBufferMarker[]; + translateToBufferMarkerParams(params?:any):any; + findFoldMarker(attributes:any):IMarker; + findFoldMarkers(attributes:any):IMarker[]; + getFoldMarkerAttributes(attributes?:any):any; + pauseMarkerObservers():any; + resumeMarkerObservers():any; + refreshMarkerScreenPositions():any; + destroy():any; + logLines(start:number, end:number):any[]; + handleTokenizedBufferChange(tokenizedBufferChange:any):any; + updateScreenLines(startBufferRow:any, endBufferRow:any, bufferDelta?:number, options?:any):any; + buildScreenLines(startBufferRow:any, endBufferRow:any):any; + findMaxLineLength(startScreenRow:any, endScreenRow:any, newScreenLines:any):any; + handleBufferMarkersUpdated():any; + handleBufferMarkerCreated(marker:any):any; + createFoldForMarker(maker:any):IFold; + foldForMarker(marker:any):any; + } + + interface IViewRegistry { + getView(selector:any):any; + } + + interface ICursorStatic { + new (arg:{editor:IEditor; marker:IDisplayBufferMarker; id: number;}):ICursor; + } + + interface ScopeDescriptor { + scopes: string[]; + } + + interface ICursor /* extends Theorist.Model */ { + getScopeDescriptor(): ScopeDescriptor; + screenPosition:any; + bufferPosition:any; + goalColumn:any; + visible:boolean; + needsAutoscroll:boolean; + + editor:IEditor; + marker:IDisplayBufferMarker; + id: number; + + destroy():any; + changePosition(options:any, fn:Function):any; + getPixelRect():any; + setScreenPosition(screenPosition:any, options?:any):any; + getScreenPosition():TextBuffer.IPoint; + getScreenRange():TextBuffer.IRange; + setBufferPosition(bufferPosition:any, options?:any):any; + getBufferPosition():TextBuffer.IPoint; + autoscroll():any; + updateVisibility():any; + setVisible(visible:boolean):any; + isVisible():boolean; + wordRegExp(arg?:any):any; + isLastCursor():boolean; + isSurroundedByWhitespace():boolean; + isBetweenWordAndNonWord():boolean; + isInsideWord():boolean; + clearAutoscroll():void; + clearSelection():void; + getScreenRow():number; + getScreenColumn():number; + getBufferRow():number; + getBufferColumn():number; + getCurrentBufferLine():string; + moveUp(rowCount:number, arg?:any):any; + moveDown(rowCount:number, arg?:any):any; + moveLeft(arg?:any):any; + moveRight(arg?:any):any; + moveToTop():any; + moveToBottom():void; + moveToBeginningOfScreenLine():void; + moveToBeginningOfLine():void; + moveToFirstCharacterOfLine():void; + moveToEndOfScreenLine():void; + moveToEndOfLine():void; + moveToBeginningOfWord():void; + moveToEndOfWord():void; + moveToBeginningOfNextWord():void; + moveToPreviousWordBoundary():void; + moveToNextWordBoundary():void; + getBeginningOfCurrentWordBufferPosition(options?:any):TextBuffer.IPoint; + getPreviousWordBoundaryBufferPosition(options?:any):TextBuffer.IPoint; + getMoveNextWordBoundaryBufferPosition(options?:any):TextBuffer.IPoint; + getEndOfCurrentWordBufferPosition(options?:any):TextBuffer.IPoint; + getBeginningOfNextWordBufferPosition(options?:any):TextBuffer.IPoint; + getCurrentWordBufferRange(options?:any):TextBuffer.IPoint; + getCurrentLineBufferRange(options?:any):TextBuffer.IPoint; + getCurrentParagraphBufferRange():any; + getCurrentWordPrefix():string; + isAtBeginningOfLine():boolean; + getIndentLevel():number; + isAtEndOfLine():boolean; + getScopes():string[]; + hasPrecedingCharactersOnLine():boolean; + getMarker(): Marker; + } + + interface ILanguageMode { + // TBD + } + + interface ISelection { + // https://atom.io/docs/api/v1.7.3/Selection + + // Event Subscription + onDidChangeRange(callback: (event: { + oldBufferRange: TextBuffer.IRange; + oldScreenRange: TextBuffer.IRange; + newBufferRange: TextBuffer.IRange; + newScreenRange: TextBuffer.IRange; + selection: ISelection; + }) => {}): Disposable; + onDidDestroy(callback: () => {}): Disposable; + + // Managing the selection range + getScreenRange(): TextBuffer.IRange; + setScreenRange(screenRange: TextBuffer.IRange, options?: { + preserveFolds?: boolean; + autoscroll?: boolean; + }): void; + getBufferRange(): TextBuffer.IRange; + setBufferRange(bufferRange: TextBuffer.IRange, options?: { + preserveFolds?: boolean; + autoscroll?: boolean; + }): void; + getBufferRowRange(): [number]; + + // Info about the selection + isEmpty(): boolean; + isReversed(): boolean; + isSingleScreenLine(): boolean; + getText(): string; + intersectsBufferRange(bufferRange: TextBuffer.IRange): boolean; + intersectsWith(otherSelection: ISelection): boolean; + + // Modifying the selected range + clear(options?: {autoscroll?: boolean}): void; + selectToScreenPosition(position: any): void; + selectToBufferPosition(position: any): void; + selectRight(columnCount?: number): void; + selectLeft(columnCount?: number): void; + selectUp(rowCount: number): void; + selectDown(rowCount: number): void; + selectToTop(): void; + selectToBottom(): void; + selectAll(): void; + selectToBeginningOfLine(): void; + selectToFirstCharacterOfLine(): void; + selectToEndOfLine(): void; + selectToEndOfBufferLine(): void; + selectToBeginningOfWord(): void; + selectToEndOfWord(): void; + selectToBeginningOfNextWord(): void; + selectToPreviousWordBoundary(): void; + selectToNextWordBoundary(): void; + selectToPreviousSubwordBoundary(): void; + selectToNextSubwordBoundary(): void; + selectToBeginningOfNextParagraph(): void; + selectToBeginningOfPreviousParagraph(): void; + selectWord(): TextBuffer.IRange; + expandOverWord(): void; + selectLine(row?: number): void; + expandOverLine(): void; + + // Modifying the selected text + insertText(text: string, options?: { + select: boolean; + autoIndent: boolean; + autoIndentNewline: boolean; + autoDecreaseIndent: boolean; + normalizeLineEndings?: boolean; + undo?: 'skip'; + }): void; + backspace(): void; + deleteToPreviousWordBoundary(): void; + deleteToNextWordBoundary(): void; + deleteToBeginningOfWord(): void; + deleteToBeginningOfLine(): void; + delete(): void; + deleteToEndOfLine(): void; + deleteToEndOfWord(): void; + deleteToBeginningOfSubword(): void; + deleteToEndOfSubword(): void; + deleteSelectedText(): void; + deleteLine(): void; + joinLines(): void; + outdentSelectedRows(): void; + autoIndentSelectedRows(): void; + toggleLineComments(): void; + cutToEndOfLine(): void; + cutToEndOfBufferLine(): void; + cut(maintainClipboard?: boolean, fullLine?: boolean): void; + copy(maintainClipboard?: boolean, fullLine?: boolean): void; + fold(): void; + indentSelectedRows(): void; + + // Managing multiple selections + addSelectionBelow(): void; + addSelectionAbove(): void; + merge(otherSelection: ISelection, options?: { + preserveFolds?: boolean; + autoscroll?: boolean; + }): void; + + // Comparing to other selections + compare(otherSelection: ISelection): any; + } + + interface IDecorationParams { + id?: number; + class: string; + type: any /* string or string[] */; + } + + interface IDecorationStatic { + isType(decorationParams:IDecorationParams, type:any /* string or string[] */):boolean; + new (marker:IDisplayBufferMarker, displayBuffer:IDisplayBuffer, params: IDecorationParams): IDecoration; + } + + interface IDecoration extends Emissary.IEmitter { + marker: IDisplayBufferMarker; + displayBuffer: IDisplayBuffer; + params: IDecorationParams + id: number; + flashQueue: any[]; + isDestroyed: boolean; + + destroy():void; + update(newParams:IDecorationParams):void; + getMarker():IDisplayBufferMarker; + getParams():IDecorationParams; + isType(type:string):boolean; + matchesPattern(decorationPattern:{[key:string]:IDecorationParams;}):boolean; + flash(klass:string, duration?:number):void; + consumeNextFlash():any; + } + + interface IEditor { + // Serializable.includeInto(Editor); + // Delegator.includeInto(Editor); + + deserializing:boolean; + callDisplayBufferCreatedHook:boolean; + registerEditor:boolean; + buffer:TextBuffer.ITextBuffer; + languageMode: ILanguageMode; + cursors:ICursor[]; + selections: ISelection[]; + suppressSelectionMerging:boolean; + updateBatchDepth: number; + selectionFlashDuration: number; + softTabs: boolean; + displayBuffer: IDisplayBuffer; + + id:number; + behaviors:any; + declaredPropertyValues: any; + eventHandlersByEventName: any; + eventHandlersByNamespace: any; + lastOpened: number; + subscriptionCounts: any; + subscriptionsByObject: any; /* WeakMap */ + subscriptions: Emissary.ISubscription[]; + destroy():void; + + mini: any; + + serializeParams():{id:number; softTabs:boolean; scrollTop:number; scrollLeft:number; displayBuffer:any;}; + deserializeParams(params:any):any; + subscribeToBuffer():void; + subscribeToDisplayBuffer():void; + getViewClass():any; // return type are EditorView + destroyed():void; + isDestroyed():boolean; + copy():IEditor; + getTitle():string; + getLongTitle():string; + setVisible(visible:boolean):void; + setMini(mini:any):void; + setScrollTop(scrollTop:any):void; + getScrollTop():number; + setScrollLeft(scrollLeft:any):void; + getScrollLeft():number; + setEditorWidthInChars(editorWidthInChars:any):void; + getSoftWrapColumn():number; + getSoftTabs():boolean; + setSoftTabs(softTabs:boolean):void; + getSoftWrap():boolean; + setSoftWrap(softWrap:any):void; + getTabText():string; + getTabLength():number; + setTabLength(tabLength:any):void; + usesSoftTabs():boolean; + clipBufferPosition(bufferPosition:any):void; + clipBufferRange(range:any):void; + indentationForBufferRow(bufferRow:any):void; + setIndentationForBufferRow(bufferRow:any, newLevel:any, _arg:any):void; + indentLevelForLine(line:any):number; + buildIndentString(number:any):string; + save():void; + saveAs(filePath:any):void; + copyPathToClipboard():void; + getPath():string; + getText():string; + setText(text:any):void; + getTextInRange(range:any):any; + getLineCount():number; + getBuffer():TextBuffer.ITextBuffer; + getURI():string; + isBufferRowBlank(bufferRow:any):boolean; + isBufferRowCommented(bufferRow:any):void; + nextNonBlankBufferRow(bufferRow:any):void; + getEofBufferPosition():TextBuffer.IPoint; + getLastBufferRow():number; + bufferRangeForBufferRow(row:any, options:any):TextBuffer.IRange; + lineForBufferRow(row:number):string; + lineLengthForBufferRow(row:number):number; + scan():any; + scanInBufferRange():any; + backwardsScanInBufferRange():any; + isModified():boolean; + isEmpty():boolean; + shouldPromptToSave():boolean; + screenPositionForBufferPosition(bufferPosition:any, options?:any):TextBuffer.IPoint; + bufferPositionForScreenPosition(screenPosition:any, options?:any):TextBuffer.IPoint; + screenRangeForBufferRange(bufferRange:any):TextBuffer.IRange; + bufferRangeForScreenRange(screenRange:any):TextBuffer.IRange; + clipScreenPosition(screenPosition:any, options:any):TextBuffer.IRange; + lineForScreenRow(row:any):ITokenizedLine; + linesForScreenRows(start?:any, end?:any):ITokenizedLine[]; + getScreenLineCount():number; + getMaxScreenLineLength():number; + getLastScreenRow():number; + bufferRowsForScreenRows(startRow:any, endRow:any):any[]; + bufferRowForScreenRow(row:any):number; + scopesForBufferPosition(bufferPosition:any):string[]; + bufferRangeForScopeAtCursor(selector:string):any; + tokenForBufferPosition(bufferPosition:any):IToken; + getCursorScopes():string[]; + logCursorScope():void; + insertText(text:string, options?:any):TextBuffer.IRange[]; + insertNewline():TextBuffer.IRange[]; + insertNewlineBelow():TextBuffer.IRange[]; + insertNewlineAbove():any; + indent(options?:any):any; + backspace():any[]; + // deprecated backspaceToBeginningOfWord():any[]; + // deprecated backspaceToBeginningOfLine():any[]; + deleteToBeginningOfWord():any[]; + deleteToBeginningOfLine():any[]; + delete():any[]; + deleteToEndOfLine():any[]; + deleteToEndOfWord():any[]; + deleteLine():TextBuffer.IRange[]; + indentSelectedRows():TextBuffer.IRange[][]; + outdentSelectedRows():TextBuffer.IRange[][]; + toggleLineCommentsInSelection():TextBuffer.IRange[]; + autoIndentSelectedRows():TextBuffer.IRange[][]; + normalizeTabsInBufferRange(bufferRange:any):any; + cutToEndOfLine():boolean[]; + cutSelectedText():boolean[]; + copySelectedText():boolean[]; + pasteText(options?:any):TextBuffer.IRange[]; + undo():any[]; + redo():any[]; + foldCurrentRow():any; + unfoldCurrentRow():any[]; + foldSelectedLines():any[]; + foldAll():any[]; + unfoldAll():any[]; + foldAllAtIndentLevel(level:any):any; + foldBufferRow(bufferRow:any):any; + unfoldBufferRow(bufferRow:any):any; + isFoldableAtBufferRow(bufferRow:any):boolean; + isFoldableAtScreenRow(screenRow:any):boolean; + createFold(startRow:any, endRow:any):IFold; + destroyFoldWithId(id:any):any; + destroyFoldsIntersectingBufferRange(bufferRange:any):any; + toggleFoldAtBufferRow(bufferRow:any):any; + isFoldedAtCursorRow():boolean; + isFoldedAtBufferRow(bufferRow:any):boolean; + isFoldedAtScreenRow(screenRow:any):boolean; + largestFoldContainingBufferRow(bufferRow:any):boolean; + largestFoldStartingAtScreenRow(screenRow:any):any; + outermostFoldsInBufferRowRange(startRow:any, endRow:any):any[]; + moveLineUp():ISelection[]; + moveLineDown():ISelection[]; + duplicateLines():any[][]; + // duprecated duplicateLine():any[][]; + mutateSelectedText(fn:(selection:ISelection)=>any):any; + replaceSelectedText(options:any, fn:(selection:string)=>any):any; + decorationsForScreenRowRange(startScreenRow:any, endScreenRow:any):{[id:number]: IDecoration[]}; + decorateMarker(marker:IDisplayBufferMarker, decorationParams: {type:string; class: string;}):IDecoration; + decorationForId(id:number):IDecoration; + getMarker(id:number):IDisplayBufferMarker; + getMarkers():IDisplayBufferMarker[]; + findMarkers(...args:any[]):IDisplayBufferMarker[]; + markScreenRange(...args:any[]):IDisplayBufferMarker; + markBufferRange(...args:any[]):IDisplayBufferMarker; + markScreenPosition(...args:any[]):IDisplayBufferMarker; + markBufferPosition(...args:any[]):IDisplayBufferMarker; + destroyMarker(...args:any[]):boolean; + getMarkerCount():number; + hasMultipleCursors():boolean; + getCursors():ICursor[]; + getCursor():ICursor; + addCursorAtScreenPosition(screenPosition:any):ICursor; + addCursorAtBufferPosition(bufferPosition:any):ICursor; + addCursor(marker:any):ICursor; + removeCursor(cursor:any):ICursor[]; + addSelection(marker:any, options:any):ISelection; + addSelectionForBufferRange(bufferRange:any, options:any):ISelection; + setSelectedBufferRange(bufferRange:any, options:any):any; + setSelectedBufferRanges(bufferRanges:any, options:any):any; + removeSelection(selection:ISelection):any; + clearSelections():boolean; + consolidateSelections():boolean; + selectionScreenRangeChanged(selection:any):void; + getSelections():ISelection[]; + getSelection(index?:number):ISelection; + getLastSelection():ISelection; + getSelectionsOrderedByBufferPosition():ISelection[]; + getLastSelectionInBuffer():ISelection; + selectionIntersectsBufferRange(bufferRange:any):any; + setCursorScreenPosition(position:TextBuffer.IPoint, options?:any):any; + getCursorScreenPosition():TextBuffer.IPoint; + getCursorScreenRow():number; + setCursorBufferPosition(position:any, options?:any):any; + getCursorBufferPosition():TextBuffer.IPoint; + getSelectedScreenRange():TextBuffer.IRange; + getSelectedBufferRange():TextBuffer.IRange; + getSelectedBufferRanges():TextBuffer.IRange[]; + getSelectedText():string; + getTextInBufferRange(range:TextBuffer.IRange):string; + setTextInBufferRange(range:TextBuffer.IRange | any[], text:string):any; + getCurrentParagraphBufferRange():TextBuffer.IRange; + getWordUnderCursor(options?:any):string; + moveCursorUp(lineCount?:number):void; + moveCursorDown(lineCount?:number):void; + moveCursorLeft():void; + moveCursorRight():void; + moveCursorToTop():void; + moveCursorToBottom():void; + moveCursorToBeginningOfScreenLine():void; + moveCursorToBeginningOfLine():void; + moveCursorToFirstCharacterOfLine():void; + moveCursorToEndOfScreenLine():void; + moveCursorToEndOfLine():void; + moveCursorToBeginningOfWord():void; + moveCursorToEndOfWord():void; + moveCursorToBeginningOfNextWord():void; + moveCursorToPreviousWordBoundary():void; + moveCursorToNextWordBoundary():void; + moveCursorToBeginningOfNextParagraph():void; + moveCursorToBeginningOfPreviousParagraph():void; + moveToBottom():void; + scrollToCursorPosition(options:any):any; + pageUp():void; + pageDown():void; + selectPageUp():void; + selectPageDown():void; + getRowsPerPage():number; + moveCursors(fn:(cursor:ICursor)=>any):any; + cursorMoved(event:any):void; + selectToScreenPosition(position:TextBuffer.IPoint):any; + selectRight():ISelection[]; + selectLeft():ISelection[]; + selectUp(rowCount?:number):ISelection[]; + selectDown(rowCount?:number):ISelection[]; + selectToTop():ISelection[]; + selectAll():ISelection[]; + selectToBottom():ISelection[]; + selectToBeginningOfLine():ISelection[]; + selectToFirstCharacterOfLine():ISelection[]; + selectToEndOfLine():ISelection[]; + selectToPreviousWordBoundary():ISelection[]; + selectToNextWordBoundary():ISelection[]; + selectLine():ISelection[]; + selectLinesContainingCursors():ISelection[]; + addSelectionBelow():ISelection[]; + addSelectionAbove():ISelection[]; + splitSelectionsIntoLines():any[]; + transpose():TextBuffer.IRange[]; + upperCase():boolean[]; + lowerCase():boolean[]; + joinLines():any[]; + selectToBeginningOfWord():ISelection[]; + selectToEndOfWord():ISelection[]; + selectToBeginningOfNextWord():ISelection[]; + selectWord():ISelection[]; + selectToBeginningOfNextParagraph():ISelection[]; + selectToBeginningOfPreviousParagraph():ISelection[]; + selectMarker(marker:any):any; + mergeCursors():number[]; + expandSelectionsForward():any; + expandSelectionsBackward(fn:(selection:ISelection)=>any):ISelection[]; + finalizeSelections():boolean[]; + mergeIntersectingSelections():any; + preserveCursorPositionOnBufferReload():Emissary.ISubscription; + getGrammar(): IGrammar; + setGrammar(grammer:IGrammar):void; + reloadGrammar():any; + shouldAutoIndent():boolean; + shouldShowInvisibles():boolean; + updateInvisibles():void; + transact(fn:Function):any; + beginTransaction():ITransaction; + commitTransaction():any; + abortTransaction():any[]; + inspect():string; + logScreenLines(start:number, end:number):any[]; + handleTokenization():void; + handleGrammarChange():void; + handleMarkerCreated(marker:any):any; + getSelectionMarkerAttributes():{type: string; editorId: number; invalidate: string; }; + getVerticalScrollMargin():number; + setVerticalScrollMargin(verticalScrollMargin:number):void; + getHorizontalScrollMargin():number; + setHorizontalScrollMargin(horizontalScrollMargin:number):void; + getLineHeightInPixels():number; + setLineHeightInPixels(lineHeightInPixels:number):void; + batchCharacterMeasurement(fn:Function):void; + getScopedCharWidth(scopeNames:any, char:any):any; + setScopedCharWidth(scopeNames:any, char:any, width:any):any; + getScopedCharWidths(scopeNames:any):any; + clearScopedCharWidths():any; + getDefaultCharWidth():number; + setDefaultCharWidth(defaultCharWidth:number):void; + setHeight(height:number):void; + getHeight():number; + getClientHeight():number; + setWidth(width:number):void; + getWidth():number; + getScrollTop():number; + setScrollTop(scrollTop:number):void; + getScrollBottom():number; + setScrollBottom(scrollBottom:number):void; + getScrollLeft():number; + setScrollLeft(scrollLeft:number):void; + getScrollRight():number; + setScrollRight(scrollRight:number):void; + getScrollHeight():number; + getScrollWidth():number; + getVisibleRowRange():number; + intersectsVisibleRowRange(startRow:any, endRow:any):any; + selectionIntersectsVisibleRowRange(selection:any):any; + pixelPositionForScreenPosition(screenPosition:any):any; + pixelPositionForBufferPosition(bufferPosition:any):any; + screenPositionForPixelPosition(pixelPosition:any):any; + pixelRectForScreenRange(screenRange:any):any; + scrollToScreenRange(screenRange:any, options:any):any; + scrollToScreenPosition(screenPosition:any, options:any):any; + scrollToBufferPosition(bufferPosition:any, options:any):any; + horizontallyScrollable():any; + verticallyScrollable():any; + getHorizontalScrollbarHeight():any; + setHorizontalScrollbarHeight(height:any):any; + getVerticalScrollbarWidth():any; + setVerticalScrollbarWidth(width:any):any; + // deprecated joinLine():any; + + onDidChange(callback: Function): Disposable; + onDidDestroy(callback: Function): Disposable; + onDidStopChanging(callback: Function): Disposable; + onDidChangeCursorPosition(callback: Function): Disposable; + onDidSave(callback: (event: { path: string }) => void): Disposable; + + decorateMarker(marker: Marker, options: any): Decoration; + getLastCursor(): ICursor; + } + + interface IGrammar { + bundledPackage: boolean; + emitter: any; + fileTypes: [string]; + firstLineRegex: any; + foldingStopMarker: any; + includedGrammarScopes: [any]; + initialRule: any; + injectionSelector: any; + injections: any; + maxTokensPerLine: Number; + name: string; + packageName: string; + path: string; + rawPatterns: [any]; + rawRepository: any; + registration: Disposable; + registry: any; + repository: Object; + scopeName: string; + tokenizeLines: (text: string) => any; + // TBD + + } + + interface IGrammars { + grammarForScopeName(scope: string): IGrammar; + } + + interface IPane /* extends Theorist.Model */ { + itemForURI: (uri:string)=>IEditor; + items:any[]; + activeItem:any; + + serializeParams():any; + deserializeParams(params:any):any; + getViewClass():any; // return type are PaneView + isActive():boolean; + isDestroyed():boolean; + focus():void; + blur():void; + activate():void; + getPanes():IPane[]; + getItems():any[]; + getActiveItem():any; + getActiveEditor():any; + itemAtIndex(index:number):any; + activateNextItem():any; + activatePreviousItem():any; + getActiveItemIndex():number; + activateItemAtIndex(index:number):any; + activateItem(item:any):any; + addItem(item:any, index:number):any; + addItems(items:any[], index:number):any[]; + removeItem(item:any, destroying:any):void; + moveItem(item:any, newIndex:number):void; + moveItemToPane(item:any, pane:IPane, index:number):void; + destroyActiveItem():boolean; // always return false + destroyItem(item:any):boolean; + destroyItems():any[]; + destroyInactiveItems():any[]; + destroy():void; + destroyed():any[]; + promptToSaveItem(item:any):boolean; + saveActiveItem():void; + saveActiveItemAs():void; + saveItem(item:any, nextAction:Function):void; + saveItemAs(item:any, nextAction:Function):void; + saveItems():any[]; + activateItemForURI(uri:any):any; + copyActiveItem():void; + splitLeft(params:any):IPane; + splitRight(params:any):IPane; + splitUp(params:any):IPane; + splitDown(params:any):IPane; + split(orientation:string, side:string, params:any):IPane; + findLeftmostSibling():IPane; + findOrCreateRightmostSibling():IPane; + } + + // https://atom.io/docs/v0.84.0/advanced/serialization + interface ISerializationStatic { + deserialize(data:ISerializationInfo):T; + new (data:T): ISerialization; + } + + interface ISerialization { + serialize():ISerializationInfo; + } + + interface ISerializationInfo { + deserializer: string; + } + + interface IBrowserWindow { + getPosition():number[]; + getSize():number[]; + } + + interface IAtomWindowDimentions { + x:number; + y:number; + width:number; + height:number; + } + + interface IProjectStatic { + pathForRepositoryUrl(repoUrl:string):string; + + new (arg?:{path:any; buffers:any[];}):IProject; + } + + interface IProject /* extends Theorist.Model */ { + // Serializable.includeInto(Project); + + path:string; + /** deprecated */ + rootDirectory?:PathWatcher.IDirectory; + rootDirectories:PathWatcher.IDirectory[]; + + serializeParams():any; + deserializeParams(params:any):any; + destroyed():any; + destroyRepo():any; + destroyUnretainedBuffers():any; + getRepo():IGit; + getPath():string; + setPath(projectPath:string):any; + getRootDirectory():PathWatcher.IDirectory; + resolve(uri:string):string; + relativize(fullPath:string):string; + contains(pathToCheck:string):boolean; + open(filePath:string, options?:any):Q.Promise; + openSync(filePath:string, options?:any):IEditor; + getBuffers():TextBuffer.ITextBuffer; + isPathModified(filePath:string):boolean; + findBufferForPath(filePath:string):TextBuffer.ITextBuffer; + bufferForPathSync(filePath:string):TextBuffer.ITextBuffer; + bufferForPath(filePath:string):Q.Promise; + bufferForId(id:any):TextBuffer.ITextBuffer; + buildBufferSync(absoluteFilePath:string):TextBuffer.ITextBuffer; + buildBuffer(absoluteFilePath:string):Q.Promise; + addBuffer(buffer:TextBuffer.ITextBuffer, options?:any):any; + addBufferAtIndex(buffer:TextBuffer.ITextBuffer, index:number, options?:any):any; + scan(regex:any, options:any, iterator:any):Q.Promise; + replace(regex:any, replacementText:any, filePaths:any, iterator:any):Q.Promise; + buildEditorForBuffer(buffer:any, editorOptions:any):IEditor; + eachBuffer(...args:any[]):any; + + onDidChangePaths(callback: Function): Disposable; + } + + interface IWorkspaceStatic { + new():IWorkspace; + } + + interface IWorkspacePanelOptions{ + item:any; + visible?:boolean; + priority?:number; + } + + interface Panel{ + getItem():any; + getPriority():any; + isVisible():boolean; + show():void; + hide():void; + } + + interface IWorkspace { + addBottomPanel(options:IWorkspacePanelOptions):Panel; + addLeftPanel(options:IWorkspacePanelOptions):Panel; + addRightPanel(options:IWorkspacePanelOptions):Panel; + addTopPanel(options:IWorkspacePanelOptions):Panel; + addModalPanel(options:IWorkspacePanelOptions):Panel; + addOpener(opener: Function): any; + + deserializeParams(params:any):any; + serializeParams():{paneContainer:any;fullScreen:boolean;}; + eachEditor(callback: Function): void; + getTextEditors():IEditor[]; + open(uri:string, options:any):Q.Promise; + openLicense():void; + openSync(uri:string, options:any):any; + openUriInPane(uri: string, pane: any, options: any): Q.Promise; + observeTextEditors(callback: Function): Disposable; + reopenItemSync():any; + registerOpener(opener:(urlToOpen:string)=>any):void; + unregisterOpener(opener:Function):void; + getOpeners():any; + getActivePane(): IPane; + getActivePaneItem(): IPane; + getActiveTextEditor(): IEditor; + getPanes():any; + saveAll():void; + activateNextPane():any; + activatePreviousPane():any; + paneForURI: (uri:string) => IPane; + saveActivePaneItem():any; + saveActivePaneItemAs():any; + destroyActivePaneItem():any; + destroyActivePane():any; + getActiveEditor():IEditor; + increaseFontSize():void; + decreaseFontSize():void; + resetFontSize():void; + itemOpened(item:any):void; + onPaneItemDestroyed(item:any):void; + destroyed():void; + isTextEditor(object: any): boolean; + + onDidChangeActivePaneItem(item:any):Disposable; + } + + interface IAtomSettings { + appVersion: string; + bootstrapScript: string; + devMode: boolean; + initialPath: string; + pathToOpen: string; + resourcePath: string; + shellLoadTime: number; + windowState:string; + } + + interface IAtomState { + mode:string; + packageStates:any; + project:any; + syntax:any; + version:number; + windowDimensions:any; + workspace:any; + } + + interface IDeserializerManager { + deserializers:Function; + add:Function; + remove:Function; + deserialize:Function; + get:Function; + } + + interface IColorlike { + red: number; + green: number; + blue: number; + alpha: number; + } + + class Color { + public static parse(value:string): Color + public static parse(value:IColorlike): Color + public toHexString(): string + public toRGBAString(): string + } + + interface IConfigGetOptions { + sources?:Array; + excludeSources?:Array; + scope?:ScopeDescriptor; + } + + interface IConfigSetOptions { + scopeSelector?:string; + source?:string; + } + + interface IConfigObserveOptions { + scope?:ScopeDescriptor; + } + + interface IConfigChangeEvent { + newValue:T; + oldValue:T; + } + + type ConfigSetting = string | number | boolean | Color | IConfigArray | IConfigObject + + interface IConfigArray extends Array { } + + interface IConfigObject { [key: string]: ConfigSetting } + + interface IConfig { + get(keyPath:string, options?:IConfigGetOptions):ConfigSetting; + set(keyPath:string, value:ConfigSetting, options?:IConfigSetOptions):boolean; + unset(keyPath:string, options?:IConfigSetOptions):void; + observe(keyPath:string, options?:IConfigObserveOptions, callback?:(value:ConfigSetting) => void):Disposable; + onDidChange(keyPath?:string, options?:IConfigObserveOptions, callback?:(event:IConfigChangeEvent) => void):Disposable; + } + + interface IKeymapManager { + defaultTarget:HTMLElement; + // TBD + } + + interface IPackage { + mainModulePath: string; + mainModule: any; + enable(): void; + disable(): void; + isTheme(): boolean; + getType(): string; + getStylesheetType(): string; + load(): IPackage; + reset(): void; + activate(): Q.Promise; + activateNow(): void; + // TBD + } + + interface IPackageManager extends Emissary.IEmitter { + packageDirPaths:string[]; + loadedPackages:any; + activePackages:any; + packageStates:any; + packageActivators:any[]; + + getApmPath():string; + getPackageDirPaths():string; + getPackageState(name:string):any; + setPackageState(name:string, state:any):void; + enablePackage(name:string):any; + disablePackage(name:string):any; + activate():void; + registerPackageActivator(activator:any, types:any):void; + activatePackages(packages:any):void; + activatePackage(name:string):Q.Promise; + deactivatePackages():void; + deactivatePackage(name:string):void; + getActivePackages():any; + getActivePackage(name:string):any; + isPackageActive(name:string):boolean; + unobserveDisabledPackages():void; + observeDisabledPackages():void; + loadPackages():void; + loadPackage(nameOrPath:string):void; + unloadPackages():void; + unloadPackage(name:string):void; + getLoadedPackage(name:string):any; + isPackageLoaded(name:string):boolean; + getLoadedPackages():any; + getLoadedPackagesForTypes(types:any):any[]; + resolvePackagePath(name:string):string; + isPackageDisabled(name:string):boolean; + hasAtomEngine(packagePath:string):boolean; + isBundledPackage(name:string):boolean; + getPackageDependencies():any; + getAvailablePackagePaths():any[]; + getAvailablePackageNames():any[]; + getAvailablePackageMetadata():any[]; + } + + interface INotifications { + addInfo: Function; + addError: Function; + addSuccess: Function; + addWarning: Function; + } + + interface IThemeManager { + // TBD + } + + interface IContextMenuManager { + // TBD + } + + interface IMenuManager { + // TBD + } + + interface IClipboard { + write(text:string, metadata?:any):any; + read():string; + } + + interface ISyntax { + // TBD + } + + interface IWindowEventHandler { + // TBD + } + + interface IAtomStatic extends ISerializationStatic { + version: number; + loadSettings: IAtomSettings; + + /* Load or create the Atom environment in the given mode */ + loadOrCreate(mode:'editor'):IAtom; + /* Load or create the Atom environment in the given mode */ + loadOrCreate(mode:'spec'):IAtom; + /* Load or create the Atom environment in the given mode */ + loadOrCreate(mode:string):IAtom; + + loadState(mode:any):void; + getStatePath(mode:any):string; + getConfigDirPath():string; + getStorageDirPath():string; + getLoadSettings():IAtomSettings; + getCurrentWindow():IBrowserWindow; + getVersion():string; + isReleasedVersion():boolean; + + new(state:IAtomState):IAtom; + } + + class Disposable { + constructor(disposalAction:any) + static isDisposable(object: any): boolean + dispose():void + } + + class CompositeDisposable { + constructor(... disposables: Array) + clear():void + dispose():void + add(... disposables: Array): void + remove(disposable: Disposable): void + delete(disposable: Disposable): void + } + + // https://atom.io/docs/api/v0.106.0/api/classes/Atom.html + /* Global Atom class : instance members */ + interface IAtom { + constructor:IAtomStatic; + + state:IAtomState; + mode:string; + deserializers:IDeserializerManager; + config: IConfig; + commands: ICommandRegistry; + grammars: IGrammars; + keymaps: IKeymapManager; + keymap: IKeymapManager; + packages: IPackageManager; + themes: IThemeManager; + contextManu: IContextMenuManager; + menu: IMenuManager; + notifications: INotifications; // https://github.com/atom/notifications + clipboard:IClipboard; + syntax:ISyntax; + views: IViewRegistry; + windowEventHandler: IWindowEventHandler; + + // really exists? start + subscribe:Function; + unsubscribe:Function; + loadTime:number; + workspaceViewParentSelector:string; + + project: IProject; + workspaceView: IWorkspaceView; + workspace: IWorkspace; + // really exists? end + + initialize:Function; + // registerRepresentationClass:Function; + // registerRepresentationClasses:Function; + setBodyPlatformClass:Function; + getCurrentWindow():IBrowserWindow; + getWindowDimensions:Function; + setWindowDimensions:Function; + restoreWindowDimensions:Function; + storeWindowDimensions:Function; + getLoadSettings:Function; + deserializeProject: Function; + deserializeWorkspaceView:Function; + deserializePackageStates:Function; + deserializeEditorWindow:Function; + startEditorWindow:Function; + unloadEditorWindow:Function; + loadThemes:Function; + watchThemes:Function; + open:Function; + confirm:Function; + showSaveDialog:Function; + showSaveDialogSync:Function; + openDevTools:Function; + toggleDevTools:Function; + executeJavaScriptInDevTools:Function; + reload:Function; + focus:Function; + show:Function; + hide:Function; + setSize:Function; + setPosition:Function; + center:Function; + displayWindow:Function; + close:Function; + exit:Function; + inDevMode:Function; + inSpecMode:Function; + toggleFullScreen:Function; + setFullScreen:Function; + isFullScreen:Function; + getVersion:Function; + isReleasedVersion:Function; + getGitHubAuthTokenName:Function; + setGitHubAuthToken:Function; + getGitHubAuthToken:Function; + getConfigDirPath:Function; + saveSync:Function; + getWindowLoadTime():number; + crashMainProcess:Function; + crashRenderProcess:Function; + beep:Function; + getUserInitScriptPath:Function; + requireUserInitScript:Function; + requireWithGlobals:Function; + + services: any; // TODO: New services api + } + + interface IBufferedNodeProcessStatic { + new (arg:any):IBufferedNodeProcess; + } + + interface IBufferedNodeProcess extends IBufferedProcess { + } + + interface IBufferedProcessStatic { + new (arg:any):IBufferedProcess; + } + + interface IBufferedProcess { + process:Function; + killed:boolean; + + bufferStream:Function; + kill:Function; + } + + interface IGitStatic { + new(path:any, options:any):IGit; + } + + interface IGit { + } + + interface ITokenizedBuffer { + // TBD + } + + interface ITokenizedLine { + // TBD + } + + interface IToken { + // TBD + } + + interface IFoldStatic { + new (displayBuffer:IDisplayBuffer, marker:IMarker):IFold; + // TBD + } + + interface IFold { + id:number; + displayBuffer:IDisplayBuffer; + marker:IMarker; + + // TBD + } + + interface IDisplayBufferMarkerStatic { + new (_arg:{bufferMarker:IMarker; displayBuffer: IDisplayBuffer}):IDisplayBufferMarker; + } + + interface IDisplayBufferMarker extends Emissary.IEmitter, Emissary.ISubscriber { + constructor:IDisplayBufferMarkerStatic; + + id: number; + + bufferMarkerSubscription:any; + oldHeadBufferPosition:TextBuffer.IPoint; + oldHeadScreenPosition:TextBuffer.IPoint; + oldTailBufferPosition:TextBuffer.IPoint; + oldTailScreenPosition:TextBuffer.IPoint; + wasValid:boolean; + + bufferMarker: IMarker; + displayBuffer: IDisplayBuffer; + globalPauseCount:number; + globalQueuedEvents:any; + + subscriptions:Emissary.ISubscription[]; + subscriptionsByObject:any; // WeakMap + + copy(attributes?:any /* maybe IMarker */):IDisplayBufferMarker; + getScreenRange():TextBuffer.IRange; + setScreenRange(screenRange:any, options:any):any; + getBufferRange():TextBuffer.IRange; + setBufferRange(bufferRange:any, options:any):any; + getPixelRange():any; + getHeadScreenPosition():TextBuffer.IPoint; + setHeadScreenPosition(screenPosition:any, options:any):any; + getHeadBufferPosition():TextBuffer.IPoint; + setHeadBufferPosition(bufferPosition:any):any; + getTailScreenPosition():TextBuffer.IPoint; + setTailScreenPosition(screenPosition:any, options:any):any; + getTailBufferPosition():TextBuffer.IPoint; + setTailBufferPosition(bufferPosition:any):any; + plantTail():boolean; + clearTail():boolean; + hasTail():boolean; + isReversed():boolean; + isValid():boolean; + isDestroyed():boolean; + getAttributes():any; + setAttributes(attributes:any):any; + matchesAttributes(attributes:any):any; + destroy():any; + isEqual(other:IDisplayBufferMarker):boolean; + compare(other:IDisplayBufferMarker):boolean; + inspect():string; + destroyed():any; + notifyObservers(_arg:any):any; + } + + interface ITransaction { + // TBD + } + + interface IMarker extends Emissary.IEmitter { + // Serializable.includeInto(Editor); + // Delegator.includeInto(Editor); + + // TBD + } + + interface ITaskStatic { + new(taskPath:any):ITask; + } + + interface ITask { + // TBD + } +} + +declare var atom:AtomCore.IAtom; + +declare module "atom" { + import spacePen = require("space-pen"); + import Q = require("q"); + + var $:typeof spacePen.$; + var $$:typeof spacePen.$$; + var $$$:typeof spacePen.$$$; + + var BufferedNodeProcess:AtomCore.IBufferedNodeProcessStatic; + var BufferedProcess:AtomCore.IBufferedProcessStatic; + var Git:AtomCore.IGitStatic; + var Point:TextBuffer.IPointStatic; + var Range:TextBuffer.IRangeStatic; + + class View extends spacePen.View implements Emissary.ISubscriber { + // Subscriber.includeInto(spacePen.View); + + // inherit from Subscriber + subscribeWith(eventEmitter:any, methodName:string, args:any):any; + + addSubscription(subscription:any):any; + + subscribe(eventEmitterOrSubscription:any, ...args:any[]):any; + + subscribeToCommand(eventEmitter:any, ...args:any[]):any; + + unsubscribe(object?:any):any; + } + + class EditorView extends View { + static characterWidthCache:any; + static configDefaults:any; + static nextEditorId:number; + + static content(params:any):void; + + static classes(_arg?:{mini?:any}):string; + + vScrollMargin:number; + hScrollMargin:number; + lineHeight:any; + charWidth:any; + charHeight:any; + cursorViews:any[]; + selectionViews:any[]; + lineCache:any[]; + isFocused:any; + editor:AtomCore.IEditor; + attached:any; + lineOverdraw:number; + pendingChanges:any[]; + newCursors:any[]; + newSelections:any[]; + redrawOnReattach:any; + bottomPaddingInLines:number; + active:boolean; + + id:number; + + gutter:AtomCore.IGutterView; + overlayer:JQuery; + scrollView:JQuery; + renderedLines:JQuery; + underlayer:JQuery; + hiddenInput:JQuery; + verticalScrollbar:JQuery; + verticalScrollbarContent:JQuery; + + constructor(editor:AtomCore.IEditor); + + initialize(editorOrOptions:AtomCore.IEditor):void; // return type are same as editor method. + initialize(editorOrOptions?:{editor: AtomCore.IEditor; mini:any; placeholderText:any}):void; + + initialize(editorOrOptions:{}):void; // compatible for spacePen.View + + bindKeys():void; + + getEditor():AtomCore.IEditor; + + getText():string; + + setText(text:string):void; + + insertText(text:string, options?:any):TextBuffer.IRange[]; + + setHeightInLines(heightInLines:number):number; + + setWidthInChars(widthInChars:number):number; + + pageDown():void; + + pageUp():void; + + getPageRows():number; + + setShowInvisibles(showInvisibles:boolean):void; + + setInvisibles(invisibles:{ eol:string; space: string; tab: string; cr: string; }):void; + + setShowIndentGuide(showIndentGuide:boolean):void; + + setPlaceholderText(placeholderText:string):void; + + getPlaceholderText():string; + + checkoutHead():boolean; + + configure():Emissary.ISubscription; + + handleEvents():void; + + handleInputEvents():void; + + bringHiddenInputIntoView():JQuery; + + selectOnMousemoveUntilMouseup():any; + + afterAttach(onDom:any):any; + + edit(editor:AtomCore.IEditor):any; + + getModel():AtomCore.IEditor; + + setModel(editor:AtomCore.IEditor):any; + + showBufferConflictAlert(editor:AtomCore.IEditor):any; + + scrollTop(scrollTop:number, options?:any):any; + + scrollBottom(scrollBottom?:number):any; + + scrollLeft(scrollLeft?:number):number; + + scrollRight(scrollRight?:number):any; + + scrollToBottom():any; + + scrollToCursorPosition():any; + + scrollToBufferPosition(bufferPosition:any, options:any):any; + + scrollToScreenPosition(screenPosition:any, options:any):any; + + scrollToPixelPosition(pixelPosition:any, options:any):any; + + highlightFoldsContainingBufferRange(bufferRange:any):any; + + saveScrollPositionForEditor():any; + + toggleSoftTabs():any; + + toggleSoftWrap():any; + + calculateWidthInChars():number; + + calculateHeightInLines():number; + + getScrollbarWidth():number; + + setSoftWrap(softWrap:boolean):any; + + setFontSize(fontSize:number):any; + + getFontSize():number; + + setFontFamily(fontFamily?:string):any; + + getFontFamily():string; + + setLineHeight(lineHeight:number):any; + + redraw():any; + + splitLeft():any; + + splitRight():any; + + splitUp():any; + + splitDown():any; + + getPane():any; // return type are PaneView + + remove(selector:any, keepData:any):any; + + beforeRemove():any; + + getCursorView(index?:number):any; // return type are CursorView + + getCursorViews():any[]; // return type are CursorView[] + + addCursorView(cursor:any, options:any):any; // return type are CursorView + + removeCursorView(cursorView:any):any; + + getSelectionView(index?:number):any; // return type are SelectionView + + getSelectionViews():any[]; // return type are SelectionView[] + + addSelectionView(selection:any):any; + + removeSelectionView(selectionView:any):any; + + removeAllCursorAndSelectionViews():any[]; + + appendToLinesView(view:any):any; + + scrollVertically(pixelPosition:any, _arg:any):any; + + scrollHorizontally(pixelPosition:any):any; + + calculateDimensions():number; + + recalculateDimensions():any; + + updateLayerDimensions():any; + + isHidden():boolean; + + clearRenderedLines():void; + + resetDisplay():any; + + requestDisplayUpdate():any; + + updateDisplay(options?:any):any; + + updateCursorViews():any; + + shouldUpdateCursor(cursorView:any):any; + + updateSelectionViews():any[]; + + shouldUpdateSelection(selectionView:any):any; + + syncCursorAnimations():any[]; + + autoscroll(suppressAutoscroll?:any):any[]; + + updatePlaceholderText():any; + + updateRenderedLines(scrollViewWidth:any):any; + + computeSurroundingEmptyLineChanges(change:any):any; + + computeIntactRanges(renderFrom:any, renderTo:any):any; + + truncateIntactRanges(intactRanges:any, renderFrom:any, renderTo:any):any; + + clearDirtyRanges(intactRanges:any):any; + + clearLine(lineElement:any):any; + + fillDirtyRanges(intactRanges:any, renderFrom:any, renderTo:any):any; + + updatePaddingOfRenderedLines():any; + + getFirstVisibleScreenRow():number; + + getLastVisibleScreenRow():number; + + isScreenRowVisible():boolean; + + handleScreenLinesChange(change:any):any; + + buildLineElementForScreenRow(screenRow:any):any; + + buildLineElementsForScreenRows(startRow:any, endRow:any):any; + + htmlForScreenRows(startRow:any, endRow:any):any; + + htmlForScreenLine(screenLine:any, screenRow:any):any; + + buildIndentation(screenRow:any, editor:any):any; + + buildHtmlEndOfLineInvisibles(screenLine:any):any; + + getEndOfLineInvisibles(screenLine:any):any; + + lineElementForScreenRow(screenRow:any):any; + + toggleLineCommentsInSelection():any; + + pixelPositionForBufferPosition(position:any):any; + + pixelPositionForScreenPosition(position:any):any; + + positionLeftForLineAndColumn(lineElement:any, screenRow:any, screenColumn:any):any; + + measureToColumn(lineElement:any, tokenizedLine:any, screenColumn:any):any; + + getCharacterWidthCache(scopes:any, char:any):any; + + setCharacterWidthCache(scopes:any, char:any, val:any):any; + + clearCharacterWidthCache():any; + + pixelOffsetForScreenPosition(position:any):any; + + screenPositionFromMouseEvent(e:any):any; + + highlightCursorLine():any; + + copyPathToClipboard():any; + + buildLineHtml(_arg:any):any; + + updateScopeStack(line:any, scopeStack:any, desiredScopes:any):any; + + pushScope(line:any, scopeStack:any, scope:any):any; + + popScope(line:any, scopeStack:any):any; + + buildEmptyLineHtml(showIndentGuide:any, eolInvisibles:any, htmlEolInvisibles:any, indentation:any, editor:any, mini:any):any; + + replaceSelectedText(replaceFn:(str:string)=>string):any; + + consolidateSelections(e:any):any; + + logCursorScope():any; + + logScreenLines(start:any, end:any):any; + + logRenderedLines():any; + } + + class ScrollView extends View { + // TBD + } + + interface ISelectListItem { + /** e.g. application:about */ + eventName:string; + /** e.g. Application: About */ + eventDescription:string; + } + + class SelectListView extends View { + static content():any; + + maxItems:number; + scheduleTimeout:any; + inputThrottle:number; + cancelling:boolean; + items:any[]; + list:JQuery; + filterEditorView: JQuery; + + previouslyFocusedElement:JQuery; + + initialize():any; + + schedulePopulateList():number; + + setItems(items:any[]):any; + + setError(message?:string):any; + + setLoading(message?:string):any; + + getFilterQuery():string; + + populateList():any; + + getEmptyMessage(itemCount?:any, filteredItemCount?:any):string; + + setMaxItems(maxItems:number):void; + + selectPreviousItemView():any; + + selectNextItemView():any; + + selectItemView(view:any):any; + + scrollToItemView(view:any):any; + + getSelectedItemView():any; + + getSelectedItem():any; + + confirmSelection():any; + + viewForItem(item:any):JQuery|string|HTMLElement|View; // You must override this method! + confirmed(item:any):any; // You must override this method! + getFilterKey():any; + + focusFilterEditor():any; + + storeFocusedElement():any; + + restoreFocus():any; + + cancelled():any; + + cancel():any; + } + + class Disposable extends AtomCore.Disposable { } + class CompositeDisposable extends AtomCore.CompositeDisposable { } + + var WorkspaceView:AtomCore.IWorkspaceViewStatic; + + var Task:AtomCore.ITaskStatic; + var Workspace:AtomCore.IWorkspaceStatic; +} diff --git a/types/atom/v0/tsconfig.json b/types/atom/v0/tsconfig.json new file mode 100644 index 0000000000..11d6a6ea93 --- /dev/null +++ b/types/atom/v0/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "atom": [ "atom/v0" ], + "pathwatcher": [ "pathwatcher/v0" ], + "q": [ "q/v0" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "api-docs.d.ts", + "atom-tests.ts" + ] +} diff --git a/types/event-kit/.editorconfig b/types/event-kit/.editorconfig index 570211f898..2b997514d2 100644 --- a/types/event-kit/.editorconfig +++ b/types/event-kit/.editorconfig @@ -1,3 +1,3 @@ [*.ts] indent_style = tab -indent_size = 4 +indent_size = 2 diff --git a/types/event-kit/README.md b/types/event-kit/README.md new file mode 100644 index 0000000000..90835ef13e --- /dev/null +++ b/types/event-kit/README.md @@ -0,0 +1,22 @@ +## Event Kit Type Definitions + +TypeScript type definitions for [event-kit](https://github.com/atom/event-kit), which is published [under the same name](https://www.npmjs.com/package/event-kit) on NPM. + +### Usage Notes + +#### Exports + +The three classes exported from this module are: [CompositeDisposable](https://github.com/atom/event-kit/blob/master/src/composite-disposable.coffee), [Disposable](https://github.com/atom/event-kit/blob/master/src/disposable.coffee), and [Emitter](https://github.com/atom/event-kit/blob/master/src/emitter.coffee). + +```ts +import { CompositeDisposable, Disposable, Emitter } from "event-kit"; +let subscriptions = new CompositeDisposable(); +``` + +#### The EventKit Namespace + +All types used by "event-kit" can be referenced from the EventKit namespace. + +```ts +function example(disposable: EventKit.DisposableLike) {} +``` diff --git a/types/event-kit/event-kit-tests.ts b/types/event-kit/event-kit-tests.ts index 4b4a0d4e7c..41fa6ba22a 100644 --- a/types/event-kit/event-kit-tests.ts +++ b/types/event-kit/event-kit-tests.ts @@ -1,57 +1,83 @@ - - import { Disposable, CompositeDisposable, Emitter } from "event-kit"; -// Emitter +declare let bool: boolean; +declare let subscription: EventKit.Disposable; +declare let subscriptions: EventKit.CompositeDisposable; +declare let emitter: EventKit.Emitter; +// NPM Usage Tests ============================================================ class User { - private emitter: Emitter; + private readonly emitter: EventKit.Emitter; name: string; constructor() { this.emitter = new Emitter(); } - onDidChangeName(callback: (name: string) => void): Disposable { - return this.emitter.on('did-change-name', callback); + onDidChangeName(callback: (value: any) => void) { + return this.emitter.on("did-change-name", callback); } - setName(name: string): void { - if (this.name != name) { + setName(name: string) { + if (name !== this.name) { this.name = name; - this.emitter.emit('did-change-name', name); + this.emitter.emit("did-change-name", name); } + return name; } - destroy(): void { - this.emitter.clear(); + destroy() { this.emitter.dispose(); } } -// Disposable - -var disposable = new Disposable(() => { - // cleanup -}); -disposable.dispose(); - -var user = new User(); -var subscription = user.onDidChangeName((name: string) => { - console.log('User name change to: ' + name); -}); -if(Disposable.isDisposable(subscription)) {} +const user = new User(); +subscription = user.onDidChangeName(name => console.log("My name is #{name}")); subscription.dispose(); -// CompositeDisposable +// Disposable ================================================================= +bool = subscription.disposed; +if (subscription.disposalAction) subscription.disposalAction(); +subscription.dispose(); + +// CompositeDisposable ======================================================== +// Properties +bool = subscriptions.disposed; + +// Construction and Lifecycle +subscriptions = new CompositeDisposable(); +new CompositeDisposable(subscription); +new CompositeDisposable(subscription, subscription); +new CompositeDisposable({ dispose() {} }); -var subscriptions = new CompositeDisposable(); -subscriptions.add( - user.onDidChangeName((name: string) => { - console.log('subscriber #1'); - }), - user.onDidChangeName((name: string) => { - console.log('subscriber #2'); - }) -); subscriptions.dispose(); + +// Managing Disposables +subscriptions.add(subscription); +subscriptions.add( + subscription, + { dispose() {} } +); + +subscriptions.remove(subscription); +subscriptions.remove({ dispose() {} }); + +subscriptions.delete(subscription); +subscriptions.delete({ dispose() {} }); + +subscriptions.clear(); + +// Emitter ==================================================================== +bool = emitter.disposed; + +emitter.clear(); +emitter.dispose(); + +// Event Subscription +subscription = emitter.on("test-event", value => {}); +emitter.once("test-event", value => {}); +subscription = emitter.preempt("test-event", value => {}); + +// Event Emission +emitter.emit("test-event"); +emitter.emit("test-event", 42); diff --git a/types/event-kit/index.d.ts b/types/event-kit/index.d.ts index 74f270c40f..8ce9bd8fbe 100644 --- a/types/event-kit/index.d.ts +++ b/types/event-kit/index.d.ts @@ -1,91 +1,126 @@ -// Type definitions for event-kit v1.2.0 +// Type definitions for event-kit 2.x // Project: https://github.com/atom/event-kit -// Definitions by: Vadim Macagon +// Definitions by: GlenCFL // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -export = AtomEventKit; +declare global { + namespace EventKit { + /** The static side to each exported class. Should generally only be used internally. */ + namespace Statics { + /* tslint:disable:no-unnecessary-qualifier */ + /** The static side to the Disposable class. */ + interface Disposable { + /** Ensure that Object correctly implements the Disposable contract. */ + isDisposable(object: object): boolean; -declare namespace AtomEventKit { - interface IDisposable { - dispose(): void; + /** Construct a Disposable. */ + new (disposableAction?: () => void): EventKit.Disposable; + } + + /** The static side to the CompositeDisposable class. */ + interface CompositeDisposable { + /** Construct an instance, optionally with one or more disposables. */ + new (...disposables: DisposableLike[]): EventKit.CompositeDisposable; + } + + /** The static side to the Emitter class. */ + interface Emitter { + /** Construct an emitter. */ + new (): EventKit.Emitter; + } + /* tslint:enable:no-unnecessary-qualifier */ + } + + interface DisposableLike { + dispose(): void; + } + + /** A handle to a resource that can be disposed. */ + interface Disposable extends DisposableLike { + disposed: boolean; + + /** A callback which will be called within dispose(). */ + disposalAction?(): void; + + /** Perform the disposal action, indicating that the resource associated + * with this disposable is no longer needed. + */ + dispose(): void; + } + + /** An object that aggregates multiple Disposable instances together into a + * single disposable, so they can all be disposed as a group. + */ + interface CompositeDisposable extends DisposableLike { + disposed: boolean; + + /** Dispose all disposables added to this composite disposable. + * If this object has already been disposed, this method has no effect. + */ + dispose(): void; + + // Managing Disposables + /** Add disposables to be disposed when the composite is disposed. + * If this object has already been disposed, this method has no effect. + */ + add(...disposables: DisposableLike[]): void; + + /** Remove a previously added disposable. */ + remove(disposable: DisposableLike): void; + + /** Alias to CompositeDisposable::remove. */ + delete(disposable: DisposableLike): void; + + /** Clear all disposables. They will not be disposed by the next call to + * dispose. + */ + clear(): void; + } + + /** Utility class to be used when implementing event-based APIs that allows + * for handlers registered via ::on to be invoked with calls to ::emit. + */ + interface Emitter extends DisposableLike { + disposed: boolean; + + /** Clear out any existing subscribers. */ + clear(): void; + + /** Unsubscribe all handlers. */ + dispose(): boolean; + + // Event Subscription + /** Registers a handler to be invoked whenever the given event is emitted. */ + on(eventName: string, handler: (value: any) => void): Disposable; + + /** Register the given handler function to be invoked the next time an event + * with the given name is emitted via ::emit. + */ + once(eventName: string, handler: (value: any) => void): Disposable; + + /** Register the given handler function to be invoked before all other + * handlers existing at the time of subscription whenever events by the + * given name are emitted via ::emit. + */ + preempt(eventName: string, handler: (value: any) => void): Disposable; + + // Event Emission + /** Invoke handlers registered via ::on for the given event name. */ + emit(eventName: string, value?: any): void; + } } - - /** Static side of the Disposable class. */ - interface DisposableStatic { - prototype: Disposable; - new (disposalAction: Function): Disposable; - /** - * Ensure that Object correctly implements the Disposable. - */ - isDisposable(object: Object): boolean; - } - - /** Instance side of the Disposable class. */ - interface Disposable extends IDisposable { - disposed: boolean; - - constructor: DisposableStatic; - } - - /** A class that represent a handle to a resource that can be disposed. */ - var Disposable: DisposableStatic; - - /** Static side of the CompositeDisposable class. */ - interface CompositeDisposableStatic { - prototype: CompositeDisposable; - new (...disposables: IDisposable[]): CompositeDisposable; - } - - /** Instance side of the CompositeDisposable class. */ - interface CompositeDisposable extends IDisposable { - disposed: boolean; - - constructor: CompositeDisposableStatic; - add(...disposables: IDisposable[]): void; - remove(disposable: IDisposable): void; - clear(): void; - } - - /** - * A class that aggregates multiple [[Disposable]] instances together into a single disposable, - * so that they can all be disposed as a group. - */ - var CompositeDisposable: CompositeDisposableStatic; - - /** Static side of the Emitter class. */ - interface EmitterStatic { - prototype: Emitter; - new (): Emitter; - } - - /** Instance side of the Emitter class. */ - interface Emitter { - isDisposed: boolean; - - constructor: EmitterStatic; - /** - * Clear out any existing subscribers. - */ - clear(): void; - /** - * Unsubscribe all handlers. - */ - dispose(): void; - /** - * Registers a handler to be invoked whenever the given event is emitted. - * @return An object that will unregister the handler when disposed. - */ - on(eventName: string, handler: (value: any) => void, unshift?: boolean): Disposable; - /** - * Registers a handler to be invoked *before* all previously registered handlers for - * the given event. - * @return An object that will unregister the handler when disposed. - */ - preempt(eventName: string, handler: (value: any) => void): Disposable; - /** Invokes any registered handlers for the given event. */ - emit(eventName: string, value: any): void; - } - - /** A utility class for implementing event-based APIs. */ - var Emitter: EmitterStatic; } + +/** A handle to a resource that can be disposed. */ +export const Disposable: EventKit.Statics.Disposable; + +/** An object that aggregates multiple Disposable instances together into a + * single disposable, so they can all be disposed as a group. + */ +export const CompositeDisposable: EventKit.Statics.CompositeDisposable; + +/** Utility class to be used when implementing event-based APIs that allows + * for handlers registered via ::on to be invoked with calls to ::emit. + */ +export const Emitter: EventKit.Statics.Emitter; diff --git a/types/event-kit/tsconfig.json b/types/event-kit/tsconfig.json index 1682f77cb6..ec89f9ddb9 100644 --- a/types/event-kit/tsconfig.json +++ b/types/event-kit/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "event-kit-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/event-kit/tslint.json b/types/event-kit/tslint.json new file mode 100644 index 0000000000..10fd9f0654 --- /dev/null +++ b/types/event-kit/tslint.json @@ -0,0 +1,38 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // Custom rules. + "class-name": true, + "indent": [true, "tabs"], + "jsdoc-format": true, + "linebreak-style": [true, "LF"], + "max-line-length": [true, 100], + "no-any": false, + "quotemark": [true, "double", "avoid-escape"], + "trailing-comma": [true, { + "multiline": { "objects": "always", "arrays": "always", "functions": "never" }, + "singleline": { "objects": "never", "arrays": "never", "functions": "never" } + }], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-type", + "check-typecast", + "check-rest-spread", + "check-preblock" + ], + // Soon to be defaults. + "arrow-return-shorthand": [true, "multiline"], + "no-floating-promises": true, + "no-unbound-method": true, + "no-unsafe-any": true, + "number-literal-format": true, + "restrict-plus-operands": true, + "return-undefined": true, + "switch-final-break": true + } +} diff --git a/types/event-kit/v1/.editorconfig b/types/event-kit/v1/.editorconfig new file mode 100644 index 0000000000..570211f898 --- /dev/null +++ b/types/event-kit/v1/.editorconfig @@ -0,0 +1,3 @@ +[*.ts] +indent_style = tab +indent_size = 4 diff --git a/types/event-kit/v1/event-kit-tests.ts b/types/event-kit/v1/event-kit-tests.ts new file mode 100644 index 0000000000..4b4a0d4e7c --- /dev/null +++ b/types/event-kit/v1/event-kit-tests.ts @@ -0,0 +1,57 @@ + + +import { Disposable, CompositeDisposable, Emitter } from "event-kit"; + +// Emitter + +class User { + private emitter: Emitter; + name: string; + + constructor() { + this.emitter = new Emitter(); + } + + onDidChangeName(callback: (name: string) => void): Disposable { + return this.emitter.on('did-change-name', callback); + } + + setName(name: string): void { + if (this.name != name) { + this.name = name; + this.emitter.emit('did-change-name', name); + } + } + + destroy(): void { + this.emitter.clear(); + this.emitter.dispose(); + } +} + +// Disposable + +var disposable = new Disposable(() => { + // cleanup +}); +disposable.dispose(); + +var user = new User(); +var subscription = user.onDidChangeName((name: string) => { + console.log('User name change to: ' + name); +}); +if(Disposable.isDisposable(subscription)) {} +subscription.dispose(); + +// CompositeDisposable + +var subscriptions = new CompositeDisposable(); +subscriptions.add( + user.onDidChangeName((name: string) => { + console.log('subscriber #1'); + }), + user.onDidChangeName((name: string) => { + console.log('subscriber #2'); + }) +); +subscriptions.dispose(); diff --git a/types/event-kit/v1/index.d.ts b/types/event-kit/v1/index.d.ts new file mode 100644 index 0000000000..74f270c40f --- /dev/null +++ b/types/event-kit/v1/index.d.ts @@ -0,0 +1,91 @@ +// Type definitions for event-kit v1.2.0 +// Project: https://github.com/atom/event-kit +// Definitions by: Vadim Macagon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = AtomEventKit; + +declare namespace AtomEventKit { + interface IDisposable { + dispose(): void; + } + + /** Static side of the Disposable class. */ + interface DisposableStatic { + prototype: Disposable; + new (disposalAction: Function): Disposable; + /** + * Ensure that Object correctly implements the Disposable. + */ + isDisposable(object: Object): boolean; + } + + /** Instance side of the Disposable class. */ + interface Disposable extends IDisposable { + disposed: boolean; + + constructor: DisposableStatic; + } + + /** A class that represent a handle to a resource that can be disposed. */ + var Disposable: DisposableStatic; + + /** Static side of the CompositeDisposable class. */ + interface CompositeDisposableStatic { + prototype: CompositeDisposable; + new (...disposables: IDisposable[]): CompositeDisposable; + } + + /** Instance side of the CompositeDisposable class. */ + interface CompositeDisposable extends IDisposable { + disposed: boolean; + + constructor: CompositeDisposableStatic; + add(...disposables: IDisposable[]): void; + remove(disposable: IDisposable): void; + clear(): void; + } + + /** + * A class that aggregates multiple [[Disposable]] instances together into a single disposable, + * so that they can all be disposed as a group. + */ + var CompositeDisposable: CompositeDisposableStatic; + + /** Static side of the Emitter class. */ + interface EmitterStatic { + prototype: Emitter; + new (): Emitter; + } + + /** Instance side of the Emitter class. */ + interface Emitter { + isDisposed: boolean; + + constructor: EmitterStatic; + /** + * Clear out any existing subscribers. + */ + clear(): void; + /** + * Unsubscribe all handlers. + */ + dispose(): void; + /** + * Registers a handler to be invoked whenever the given event is emitted. + * @return An object that will unregister the handler when disposed. + */ + on(eventName: string, handler: (value: any) => void, unshift?: boolean): Disposable; + /** + * Registers a handler to be invoked *before* all previously registered handlers for + * the given event. + * @return An object that will unregister the handler when disposed. + */ + preempt(eventName: string, handler: (value: any) => void): Disposable; + /** Invokes any registered handlers for the given event. */ + emit(eventName: string, value: any): void; + } + + /** A utility class for implementing event-based APIs. */ + var Emitter: EmitterStatic; +} diff --git a/types/event-kit/v1/tsconfig.json b/types/event-kit/v1/tsconfig.json new file mode 100644 index 0000000000..d3cc578758 --- /dev/null +++ b/types/event-kit/v1/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "event-kit": [ "event-kit/v1" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "event-kit-tests.ts" + ] +} diff --git a/types/first-mate/.editorconfig b/types/first-mate/.editorconfig index 570211f898..2b997514d2 100644 --- a/types/first-mate/.editorconfig +++ b/types/first-mate/.editorconfig @@ -1,3 +1,3 @@ [*.ts] indent_style = tab -indent_size = 4 +indent_size = 2 diff --git a/types/first-mate/README.md b/types/first-mate/README.md new file mode 100644 index 0000000000..a022110aa3 --- /dev/null +++ b/types/first-mate/README.md @@ -0,0 +1,22 @@ +## First Mate Type Definitions + +TypeScript type definitions for [First Mate](https://github.com/atom/first-mate), which is published as "[first-mate](https://www.npmjs.com/package/first-mate)" on NPM. + +### Usage Notes + +#### Exports + +The three classes exported from this module are: [Grammar](https://github.com/atom/first-mate/blob/master/src/grammar.coffee), [GrammarRegistry](https://github.com/atom/first-mate/blob/master/src/grammar-registry.coffee), and [ScopeSelector](https://github.com/atom/first-mate/blob/master/src/scope-selector.coffee). + +```ts +import { Grammar, GrammarRegistry, ScopeSelector } from "first-mate"; +let selector = new ScopeSelector("a | b"); +``` + +#### The FirstMate Namespace + +Many of the types used by First Mate can be referenced from the FirstMate namespace. + +```ts +function example(tokens: FirstMate.Tokens[]) {} +``` diff --git a/types/first-mate/first-mate-tests.ts b/types/first-mate/first-mate-tests.ts index 1f7fe0fc76..b0fd70d4e2 100644 --- a/types/first-mate/first-mate-tests.ts +++ b/types/first-mate/first-mate-tests.ts @@ -1,10 +1,93 @@ +import { GrammarRegistry, Grammar, ScopeSelector } from "first-mate"; +declare let subscription: EventKit.Disposable; +declare let grammar: FirstMate.Grammar; +declare let grammars: FirstMate.Grammar[]; -import { GrammarRegistry, Grammar, IToken } from "first-mate"; +// NPM Examples =============================================================== +const selector = new ScopeSelector("a | b"); +selector.matches(["c"]); // # false +selector.matches(["a"]); // # true -var registry = new GrammarRegistry({ maxTokensPerLine: 100 }); -var grammar = registry.loadGrammarSync('javascript.json'); -var result = grammar.tokenizeLine('var text = "hello world";'); +const registry = new GrammarRegistry(); +grammar = registry.loadGrammarSync("./spec/fixtures/javascript.json"); +const { line, tags } = grammar.tokenizeLine("var offset = 3;"); +// Convert compact tags representation into convenient, space-inefficient tokens. +const tokens = registry.decodeTokens(line, tags); +for (const { value, scopes } of tokens) { + console.log(`Token text: '${value}' with scopes: ${scopes}`); +} + +// General Usage ============================================================== +let str: string; + +new GrammarRegistry({ maxTokensPerLine: 100 }); +registry.loadGrammarSync("javascript.json"); +const result = grammar.tokenizeLine('var text = "hello world";'); result.tokens.forEach((token) => { - console.log("Token text: '" + token.value + "' with scopes: " + token.scopes); + console.log(`Token text: '${token.value}' with scopes: ${token.scopes}`); +}); + +new ScopeSelector("source.file"); +let prefix = selector.getPrefix("test"); +if (prefix) { + str = prefix.charAt(0); +} +prefix = selector.getPrefix(["test", "test"]); + +str = selector.toCssSelector(); +str = selector.toCssSyntaxSelector(); + +// Grammar ==================================================================== +subscription = grammar.onDidUpdate(() => {}); + +const tokenizeLinesResult = grammar.tokenizeLines("Test String"); +for (const tokenizedLine of tokenizeLinesResult) { + for (const token of tokenizedLine) { + token.scopes; + token.value; + } +} + +grammar.tokenizeLine("Test String"); +const tokenizeLineResult = grammar.tokenizeLine("Test String", null, false); +tokenizeLineResult.line; +tokenizeLineResult.tags; +tokenizeLineResult.tokens; +grammar.tokenizeLine("Test String", tokenizeLineResult.ruleStack); +grammar.tokenizeLine("Test String", tokenizeLineResult.ruleStack, false); + +// Grammar Registry =========================================================== +// Event Subscription +subscription = registry.onDidAddGrammar(grammar => grammar.name); +subscription = registry.onDidUpdateGrammar(grammar => grammar.name); + +// Managing Grammars +grammars = registry.getGrammars(); + +let potentialGrammar = registry.grammarForScopeName("scope.test"); +if (potentialGrammar) grammar = potentialGrammar; + +subscription = registry.addGrammar(grammar); + +potentialGrammar = registry.removeGrammarForScopeName("scope.test"); + +grammar = registry.readGrammarSync("/test/path"); + +registry.readGrammar("/test/path", (error, grammar) => { + if (grammar) { + grammar.name; + } else { + if (error) error.name; + } +}); + +grammar = registry.loadGrammarSync("/test/path"); + +registry.loadGrammar("/test/path", (error, grammar) => { + if (grammar) { + grammar.name; + } else { + if (error) error.name; + } }); diff --git a/types/first-mate/index.d.ts b/types/first-mate/index.d.ts index 8087fe06f4..0986b80aa5 100644 --- a/types/first-mate/index.d.ts +++ b/types/first-mate/index.d.ts @@ -1,107 +1,258 @@ -// Type definitions for first-mate v4.1.7 +// Type definitions for first-mate 7.x // Project: https://github.com/atom/first-mate/ -// Definitions by: Vadim Macagon +// Definitions by: GlenCFL // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// -import * as AtomEventKit from "event-kit"; -export = AtomFirstMate; +declare global { + /** TextMate helpers. */ + namespace FirstMate { + /** Objects that appear as parameters to functions. */ + namespace Options { + interface Grammar { + name?: string; + fileTypes?: ReadonlyArray; + scopeName?: string; + foldingStopMarker?: string; + maxTokensPerLine?: number; + maxLineLength?: number; -declare namespace AtomFirstMate { - type Disposable = AtomEventKit.Disposable; + injections?: any; + injectionSelector?: any; + patterns?: ReadonlyArray; + repository?: object; + firstLineMatch?: any; + } + } - interface IToken { - value: string; - scopes: string[]; + /** The static side to each exported class. Should generally only be used internally. */ + namespace Statics { + /* tslint:disable:no-unnecessary-qualifier */ + /** The static side to the Grammar class. */ + interface Grammar { + new (registry: FirstMate.GrammarRegistry, options?: FirstMate.Options.Grammar): + FirstMate.Grammar; + } + + /** The static side to the GrammarRegistry class. */ + interface GrammarRegistry { + new (options?: { maxTokensPerLine?: number, maxLineLength?: number }): + FirstMate.GrammarRegistry; + } + + /** The static side to the ScopeSelector class. */ + interface ScopeSelector { + /** Create a new scope selector. + * @param source The string to parse as a scope selector. + * @return A newly constructed ScopeSelector. + */ + new (source: string): FirstMate.ScopeSelector; + } + /* tslint:enable:no-unnecessary-qualifier */ + } + + /** Data structures that are used within classes. */ + namespace Structures { + interface GrammarToken { + value: string; + scopes: string[]; + } + + /** Result returned by `Grammar.tokenizeLine`. */ + interface TokenizeLineResult { + /** The string of text that was tokenized. */ + line: string; + + /** An array of integer scope ids and strings. Positive ids indicate the + * beginning of a scope, and negative tags indicate the end. To resolve ids + * to scope names, call {GrammarRegistry::scopeForId} with the absolute + * value of the id. + */ + tags: Array; + + /** This is a dynamic property. Invoking it will incur additional overhead, + * but will automatically translate the `tags` into token objects with `value` + * and `scopes` properties. + */ + tokens: GrammarToken[]; + + /** An array of rules representing the tokenized state at the end of the line. + * These should be passed back into this method when tokenizing the next line + * in the file. + */ + ruleStack: GrammarRule[]; + } + + interface GrammarRule { + // https://github.com/atom/first-mate/blob/v7.0.7/src/rule.coffee + // This is private. Don't go down the rabbit hole. + rule: object; + scopeName: string; + contentScopeName: string; + } + } + + /** Grammar that tokenizes lines of text. */ + interface Grammar { + name: string; + fileTypes: string[]; + scopeName: string; + maxTokensPerLine: number; + maxLineLength: number; + + // Event Subscription + onDidUpdate(callback: () => void): EventKit.Disposable; + + // Tokenizing + /** Tokenize all lines in the given text. + * @param text A string containing one or more lines. + * @return An array of token arrays for each line tokenized. + */ + tokenizeLines(text: string): Structures.GrammarToken[][]; + + /** Tokenizes the line of text. + * @param line A string of text to tokenize. + * @param ruleStack An optional array of rules previously returned from this + * method. This should be null when tokenizing the first line in the file. + * @param firstLine A optional boolean denoting whether this is the first line + * in the file which defaults to `false`. + * @return An object representing the result of the tokenize. + */ + tokenizeLine(line: string, ruleStack?: null, firstLine?: boolean): + Structures.TokenizeLineResult; + /** Tokenizes the line of text. + * @param line A string of text to tokenize. + * @param ruleStack An optional array of rules previously returned from this + * method. This should be null when tokenizing the first line in the file. + * @param firstLine A optional boolean denoting whether this is the first line + * in the file which defaults to `false`. + * @return An object representing the result of the tokenize. + */ + tokenizeLine(line: string, ruleStack: Structures.GrammarRule[], firstLine?: false): + Structures.TokenizeLineResult; + } + + /** Instance side of GrammarRegistry class. */ + interface GrammarRegistry { + maxTokensPerLine: number; + maxLineLength: number; + + // Event Subscription + /** Invoke the given callback when a grammar is added to the registry. + * @param callback The callback to be invoked whenever a grammar is added. + * @return A Disposable on which `.dispose()` can be called to unsubscribe. + */ + onDidAddGrammar(callback: (grammar: Grammar) => void): EventKit.Disposable; + + /** Invoke the given callback when a grammar is updated due to a grammar it + * depends on being added or removed from the registry. + * @param callback The callback to be invoked whenever a grammar is updated. + * @return A Disposable on which `.dispose()` can be called to unsubscribe. + */ + onDidUpdateGrammar(callback: (grammar: Grammar) => void): EventKit.Disposable; + + // Managing Grammars + /** Get all the grammars in this registry. + * @return A non-empty array of Grammar instances. + */ + getGrammars(): Grammar[]; + + /** Get a grammar with the given scope name. + * @param scopeName A string such as `source.js`. + * @return A Grammar or undefined. + */ + grammarForScopeName(scopeName: string): Grammar|undefined; + + /** Add a grammar to this registry. + * A 'grammar-added' event is emitted after the grammar is added. + * @param grammar The Grammar to add. This should be a value previously returned + * from ::readGrammar or ::readGrammarSync. + * @return Returns a Disposable on which `.dispose()` can be called to remove + * the grammar. + */ + addGrammar(grammar: Grammar): EventKit.Disposable; + + /** Remove the given grammar from this registry. + * @param grammar The grammar to remove. This should be a grammar previously + * added to the registry from ::addGrammar. + */ + removeGrammar(grammar: Grammar): void; + + /** Remove the grammar with the given scope name. + * @param scopeName A string such as `source.js`. + * @return Returns the removed Grammar or undefined. + */ + removeGrammarForScopeName(scopeName: string): Grammar|undefined; + + /** Read a grammar synchronously but don't add it to the registry. + * @param grammarPath The absolute file path to a grammar. + * @return The newly loaded Grammar. + */ + readGrammarSync(grammarPath: string): Grammar; + + /** Read a grammar asynchronously but don't add it to the registry. + * @param grammarPath The absolute file path to the grammar. + * @param callback The function to be invoked once the Grammar has been read in. + */ + readGrammar(grammarPath: string, callback: (error: Error|null, grammar?: Grammar) => + void): void; + + /** Read a grammar synchronously and add it to this registry. + * @param grammarPath The absolute file path to the grammar. + * @return The newly loaded Grammar. + */ + loadGrammarSync(grammarPath: string): Grammar; + + /** Read a grammar asynchronously and add it to the registry. + * @param grammarPath The absolute file path to the grammar. + * @param callback The function to be invoked once the Grammar has been read in + * and added to the registry. + */ + loadGrammar(grammarPath: string, callback: (error: Error|null, grammar?: Grammar) => + void): void; + + /** Convert compact tags representation into convenient, space-inefficient tokens. + * @param lineText The text of the tokenized line. + * @param tags The tags returned from a call to Grammar::tokenizeLine(). + * @return An array of Token instances decoded from the given tags. + */ + decodeTokens(lineText: string, tags: Array): Structures.GrammarToken[]; + } + + interface ScopeSelector { + /** Check if this scope selector matches the scopes. + * @param scopes A single scope or an array of them to be compared against. + * @return A boolean indicating whether or not this ScopeSelector matched. + */ + matches(scopes: string|ReadonlyArray): boolean; + + /** Gets the prefix of this scope selector. + * @param scopes The scopes to match a prefix against. + * @return The matching prefix, if there is one. + */ + getPrefix(scopes: string|ReadonlyArray): string|undefined; + + /** Convert this TextMate scope selector to a CSS selector. + * @return A string with the CSSSelector representation of this ScopeSelector. + */ + toCssSelector(): string; + + /** Convert this TextMate scope selector to a CSS selector, prefixing scopes + * with `syntax--`. + * @return A string with the syntax-specific CSSSelector representation of this + * ScopeSelector. + */ + toCssSyntaxSelector(): string; + } } +} - /** Result returned by `Grammar.tokenizeLine`. */ - interface TokenizeLineResult { - /** Text that was tokenized. */ - line: string; - tags: any[]; - /** - * This is a dynamic property that will only be available if `Grammar.tokenizeLine` was called - * with `compatibilityMode` set to `true` (the default). - */ - tokens?: IToken[]; - /** - * The tokenized state at the end of the line. This should be passed back into `tokenizeLine` - * when tokenizing the next line in the file/buffer. - */ - ruleStack: Rule[] - } +/** Registry containing one or more grammars. */ +export const GrammarRegistry: FirstMate.Statics.GrammarRegistry; - /** Instance side of Rule class. */ - interface Rule { - } +export const ScopeSelector: FirstMate.Statics.ScopeSelector; - /** Static side of Grammar class. */ - interface GrammarStatic { - prototype: Grammar; - new (registry: GrammarRegistry, options?: any): Grammar; - } - - /** Instance side of Grammar class. */ - interface Grammar { - constructor: GrammarStatic; - onDidUpdate(callback: Function): Disposable; - /** - * Tokenizes all lines in a string. - * - * @param text A string containing one or more lines. - * @return An array of token arrays, one token array per line. - */ - tokenizeLines(text: string): Array>; - /** - * Tokenizes a line of text. - * - * @param line Text to be tokenized. - * @param firstLine Indicates whether `line` is the first line in the file/buffer, - * defaults to `false`. - * @param compatibilityMode `true` by default. - * @return An object containing tokens for the given line. - */ - tokenizeLine( - line: string, ruleStack?: Rule[], firstLine?: boolean, compatibilityMode?: boolean - ): TokenizeLineResult; - } - - /** Grammar that tokenizes lines of text. */ - var Grammar: GrammarStatic; - - /** Static side of GrammarRegistry class. */ - interface GrammarRegistryStatic { - prototype: GrammarRegistry; - new (options?: { maxTokensPerLine: number }): GrammarRegistry; - } - - /** Instance side of GrammarRegistry class. */ - interface GrammarRegistry { - constructor: GrammarRegistryStatic; - - // Event Subscription - - onDidAddGrammar(callback: (grammar: Grammar) => void): Disposable; - onDidUpdateGrammar(callback: (grammar: Grammar) => void): Disposable; - - // Managing Grammars - - getGrammars(): Grammar[]; - grammarForScopeName(scopeName: string): Grammar; - addGrammar(grammar: Grammar): Disposable; - removeGrammarForScopeName(scopeName: string): Grammar; - readGrammarSync(grammarPath: string): Grammar; - readGrammar(grammarPath: string, callback: (error: Error, grammar: Grammar) => void): void; - loadGrammarSync(grammarPath: string): Grammar; - loadGrammar(grammarPath: string, callback: (error: Error, grammar: Grammar) => void): void; - grammarOverrideForPath(filePath: string): Grammar; - setGrammarOverrideForPath(filePath: string, scopeName: string): Grammar; - clearGrammarOverrides(): void; - selectGrammar(filePath: string, fileContents: string): Grammar; - } - - /** Registry containing one or more grammars. */ - var GrammarRegistry: GrammarRegistryStatic; -} \ No newline at end of file +/** Grammar that tokenizes lines of text. */ +export const Grammar: FirstMate.Statics.Grammar; diff --git a/types/first-mate/tsconfig.json b/types/first-mate/tsconfig.json index b8ae8bf954..edba8406ca 100644 --- a/types/first-mate/tsconfig.json +++ b/types/first-mate/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "first-mate-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/first-mate/tslint.json b/types/first-mate/tslint.json new file mode 100644 index 0000000000..22fcf73c1c --- /dev/null +++ b/types/first-mate/tslint.json @@ -0,0 +1,39 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // Custom rules. + "class-name": true, + "indent": [true, "tabs"], + "jsdoc-format": true, + "linebreak-style": [true, "LF"], + "max-line-length": [true, 100], + "quotemark": [true, "double", "avoid-escape"], + "trailing-comma": [true, { + "multiline": { "objects": "always", "arrays": "always", "functions": "never" }, + "singleline": { "objects": "never", "arrays": "never", "functions": "never" } + }], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-type", + "check-typecast", + "check-rest-spread", + "check-preblock" + ], + // TODO + "no-any": false, + // Soon to be defaults. + "arrow-return-shorthand": [true, "multiline"], + "no-floating-promises": true, + "no-unbound-method": true, + "no-unsafe-any": true, + "number-literal-format": true, + "restrict-plus-operands": true, + "return-undefined": true, + "switch-final-break": true + } +} diff --git a/types/first-mate/v4/.editorconfig b/types/first-mate/v4/.editorconfig new file mode 100644 index 0000000000..570211f898 --- /dev/null +++ b/types/first-mate/v4/.editorconfig @@ -0,0 +1,3 @@ +[*.ts] +indent_style = tab +indent_size = 4 diff --git a/types/first-mate/v4/first-mate-tests.ts b/types/first-mate/v4/first-mate-tests.ts new file mode 100644 index 0000000000..1f7fe0fc76 --- /dev/null +++ b/types/first-mate/v4/first-mate-tests.ts @@ -0,0 +1,10 @@ + + +import { GrammarRegistry, Grammar, IToken } from "first-mate"; + +var registry = new GrammarRegistry({ maxTokensPerLine: 100 }); +var grammar = registry.loadGrammarSync('javascript.json'); +var result = grammar.tokenizeLine('var text = "hello world";'); +result.tokens.forEach((token) => { + console.log("Token text: '" + token.value + "' with scopes: " + token.scopes); +}); diff --git a/types/first-mate/v4/index.d.ts b/types/first-mate/v4/index.d.ts new file mode 100644 index 0000000000..81b7d96c04 --- /dev/null +++ b/types/first-mate/v4/index.d.ts @@ -0,0 +1,105 @@ +// Type definitions for first-mate v4.1.7 +// Project: https://github.com/atom/first-mate/ +// Definitions by: Vadim Macagon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as AtomEventKit from "event-kit"; +export = AtomFirstMate; + +declare namespace AtomFirstMate { + type Disposable = AtomEventKit.Disposable; + + interface IToken { + value: string; + scopes: string[]; + } + + /** Result returned by `Grammar.tokenizeLine`. */ + interface TokenizeLineResult { + /** Text that was tokenized. */ + line: string; + tags: any[]; + /** + * This is a dynamic property that will only be available if `Grammar.tokenizeLine` was called + * with `compatibilityMode` set to `true` (the default). + */ + tokens?: IToken[]; + /** + * The tokenized state at the end of the line. This should be passed back into `tokenizeLine` + * when tokenizing the next line in the file/buffer. + */ + ruleStack: Rule[] + } + + /** Instance side of Rule class. */ + interface Rule { + } + + /** Static side of Grammar class. */ + interface GrammarStatic { + prototype: Grammar; + new (registry: GrammarRegistry, options?: any): Grammar; + } + + /** Instance side of Grammar class. */ + interface Grammar { + constructor: GrammarStatic; + onDidUpdate(callback: Function): Disposable; + /** + * Tokenizes all lines in a string. + * + * @param text A string containing one or more lines. + * @return An array of token arrays, one token array per line. + */ + tokenizeLines(text: string): Array>; + /** + * Tokenizes a line of text. + * + * @param line Text to be tokenized. + * @param firstLine Indicates whether `line` is the first line in the file/buffer, + * defaults to `false`. + * @param compatibilityMode `true` by default. + * @return An object containing tokens for the given line. + */ + tokenizeLine( + line: string, ruleStack?: Rule[], firstLine?: boolean, compatibilityMode?: boolean + ): TokenizeLineResult; + } + + /** Grammar that tokenizes lines of text. */ + var Grammar: GrammarStatic; + + /** Static side of GrammarRegistry class. */ + interface GrammarRegistryStatic { + prototype: GrammarRegistry; + new (options?: { maxTokensPerLine: number }): GrammarRegistry; + } + + /** Instance side of GrammarRegistry class. */ + interface GrammarRegistry { + constructor: GrammarRegistryStatic; + + // Event Subscription + + onDidAddGrammar(callback: (grammar: Grammar) => void): Disposable; + onDidUpdateGrammar(callback: (grammar: Grammar) => void): Disposable; + + // Managing Grammars + + getGrammars(): Grammar[]; + grammarForScopeName(scopeName: string): Grammar; + addGrammar(grammar: Grammar): Disposable; + removeGrammarForScopeName(scopeName: string): Grammar; + readGrammarSync(grammarPath: string): Grammar; + readGrammar(grammarPath: string, callback: (error: Error, grammar: Grammar) => void): void; + loadGrammarSync(grammarPath: string): Grammar; + loadGrammar(grammarPath: string, callback: (error: Error, grammar: Grammar) => void): void; + grammarOverrideForPath(filePath: string): Grammar; + setGrammarOverrideForPath(filePath: string, scopeName: string): Grammar; + clearGrammarOverrides(): void; + selectGrammar(filePath: string, fileContents: string): Grammar; + } + + /** Registry containing one or more grammars. */ + var GrammarRegistry: GrammarRegistryStatic; +} diff --git a/types/first-mate/v4/tsconfig.json b/types/first-mate/v4/tsconfig.json new file mode 100644 index 0000000000..62bbc43837 --- /dev/null +++ b/types/first-mate/v4/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "event-kit": [ "event-kit/v1" ], + "first-mate": [ "first-mate/v4" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "first-mate-tests.ts" + ] +} diff --git a/types/pathwatcher/.editorconfig b/types/pathwatcher/.editorconfig new file mode 100644 index 0000000000..2b997514d2 --- /dev/null +++ b/types/pathwatcher/.editorconfig @@ -0,0 +1,3 @@ +[*.ts] +indent_style = tab +indent_size = 2 diff --git a/types/pathwatcher/README.md b/types/pathwatcher/README.md new file mode 100644 index 0000000000..81cacbc752 --- /dev/null +++ b/types/pathwatcher/README.md @@ -0,0 +1,28 @@ +## Path Watcher Node Type Definitions + +TypeScript type definitions for [Path Watcher Node], which is published as "[pathwatcher](https://www.npmjs.com/package/pathwatcher)" on NPM. + +### Usage Notes + +#### Exports + +The two classes exported from this module are: [File](https://github.com/atom/node-pathwatcher/blob/master/src/file.coffee) and [Directory](https://github.com/atom/node-pathwatcher/blob/master/src/directory.coffee). + +```ts +import { File, Directory } from "text-buffer"; +``` + +Additionally, the following functions are exported as well: +```ts +watch(): PathWatcher.PathWatcher; +closeAllWatchers(): void; +getWatchedPaths(): string[]; +``` + +#### The PathWatcher Namespace + +All types used by Path Watcher can be referenced from the PathWatcher namespace. + +```ts +function example(file: PathWatcher.File) {} +``` diff --git a/types/pathwatcher/index.d.ts b/types/pathwatcher/index.d.ts index b1135c384c..b3d99b81ef 100644 --- a/types/pathwatcher/index.d.ts +++ b/types/pathwatcher/index.d.ts @@ -1,88 +1,240 @@ -// Type definitions for pathwatcher +// Type definitions for pathwatcher 8.x // Project: https://github.com/atom/node-pathwatcher -// Definitions by: vvakame +// Definitions by: GlenCFL // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// +/// -import { EventEmitter } from "events"; -import * as Q from "q"; +declare global { + namespace PathWatcher { + /** Objects that appear as parameters to callbacks. */ + namespace Events { + interface PathWatchErrorThrown { + /** The error object. */ + error: Error; -export as namespace PathWatcher; + /** Call this function to indicate you have handled the error. + * The error will not be thrown if this function is called. + */ + handle(): void; + } -export interface IFileStatic { - new (path:string, symlink?:boolean):IFile; + interface WatchedFilePathChanged { + event: string; + newFilePath: string; + } + } + + /** The static side to each exported class. Should generally only be used internally. */ + namespace Statics { + /* tslint:disable:no-unnecessary-qualifier */ + /** The static side to the File class. */ + interface File { + /** Configures a new File instance, no files are accessed. */ + new (filePath: string, symlink?: boolean): PathWatcher.File; + } + + /** The static side to the Directory class. */ + interface Directory { + /** Configures a new Directory instance, no files are accessed. */ + new (directoryPath: string, symlink?: boolean): PathWatcher.Directory; + } + /* tslint:enable:no-unnecessary-qualifier */ + } + + /** Represents an individual file that can be watched, read from, and written to. */ + interface File { + // Properties + realPath: string|null; + path: string; + symlink: boolean; + + // Construction + /** Creates the file on disk that corresponds to ::getPath() if no such file + * already exists. + */ + create(): Promise; + + // Event Subscription + /** Invoke the given callback when the file's contents change. */ + onDidChange(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when the file's path changes. */ + onDidRename(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when the file is deleted. */ + onDidDelete(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when there is an error with the watch. When + * your callback has been invoked, the file will have unsubscribed from the + * file watches. + */ + onWillThrowWatchError(callback: (errorObject: Events.PathWatchErrorThrown) => + void): EventKit.Disposable; + + // File Metadata + /** Returns a boolean, always true. */ + isFile(): boolean; + + /** Returns a boolean, always false. */ + isDirectory(): boolean; + + /** Returns a boolean indicating whether or not this is a symbolic link. */ + isSymbolicLink(): boolean; + + /** Returns a promise that resolves to a boolean, true if the file exists, + * false otherwise. + */ + exists(): Promise; + + /** Returns a boolean, true if the file exists, false otherwise. */ + existsSync(): boolean; + + /** Get the SHA-1 digest of this file. */ + getDigest(): Promise; + + /** Get the SHA-1 digest of this file. */ + getDigestSync(): string; + + /** Sets the file's character set encoding name. */ + setEncoding(encoding: string): void; + + /** Returns the string encoding name for this file (default: "utf8"). */ + getEncoding(): string; + + // Managing Paths + /** Returns the string path for the file. */ + getPath(): string; + + /** Returns this file's completely resolved string path. */ + getRealPathSync(): string; + + /** Returns a promise that resolves to the file's completely resolved + * string path. + */ + getRealPath(): Promise; + + /** Return the string filename without any directory information. */ + getBaseName(): string; + + // Traversing + /** Return the Directory that contains this file. */ + getParent(): Directory; + + // Reading and Writing + /** Reads the contents of the file. */ + read(flushCache?: boolean): Promise; + + /** Returns a stream to read the content of the file. */ + createReadStream(): NodeJS.ReadableStream; + + /** Overwrites the file with the given text. */ + write(text: string): Promise; + + /** Returns a stream to write content to the file. */ + createWriteStream(): NodeJS.WritableStream; + + /** Overwrites the file with the given text. */ + writeSync(text: string): undefined; + } + + /** Represents a directory on disk that can be watched for changes. */ + interface Directory { + // Properties + realPath: string|null; + path: string; + symlink: boolean; + + // Construction + /** Creates the directory on disk that corresponds to ::getPath() if no such + * directory already exists. + */ + create(mode?: number): Promise; + + // Event Subscription + /** Invoke the given callback when the directory's contents change. */ + onDidChange(callback: () => void): EventKit.Disposable; + + // Directory Metadata + /** Returns a boolean, always false. */ + isFile(): boolean; + + /** Returns a roolean, always true. */ + isDirectory(): boolean; + + /** Returns a boolean indicating whether or not this is a symbolic link. */ + isSymbolicLink(): boolean; + + /** Returns a promise that resolves to a boolean, true if the directory\ + * exists, false otherwise. + */ + exists(): Promise; + + /** Returns a boolean, true if the directory exists, false otherwise. */ + existsSync(): boolean; + + /** Return a boolean, true if this Directory is the root directory of the + * filesystem, or false if it isn't. + */ + isRoot(): boolean; + + // Managing Paths + /** This may include unfollowed symlinks or relative directory entries. + * Or it may be fully resolved, it depends on what you give it. + */ + getPath(): string; + + /** All relative directory entries are removed and symlinks are resolved to + * their final destination. + */ + getRealPathSync(): string; + + /** Returns the string basename of the directory. */ + getBaseName(): string; + + /** Returns the relative string path to the given path from this directory. */ + relativize(fullPath: string): string; + + // Traversing + /** Traverse to the parent directory. */ + getParent(): Directory; + + /** Traverse within this Directory to a child File. This method doesn't actually + * check to see if the File exists, it just creates the File object. + */ + getFile(filename: string): File; + + /** Traverse within this a Directory to a child Directory. This method doesn't actually + * check to see if the Directory exists, it just creates the Directory object. + */ + getSubdirectory(dirname: string): Directory; + + /** Reads file entries in this directory from disk synchronously. */ + getEntriesSync(): Array; + + /** Reads file entries in this directory from disk asynchronously. */ + getEntries(callback: (error: Error, entries: Array) => void): void; + + /** Determines if the given path (real or symbolic) is inside this directory. This + * method does not actually check if the path exists, it just checks if the path + * is under this directory. + */ + contains(pathToCheck: string): boolean; + } + + interface PathWatcher { + onDidChange(callback: (change: Events.WatchedFilePathChanged) => void): EventKit.Disposable; + + close(): void; + } + } } -export interface IFile { - realPath:string; - path:string; - symlink:boolean; - cachedContents:string; - digest:string; - - handleEventSubscriptions():void; - setPath(path:string):void; - getPath():string; - getRealPathSync():string; - getBaseName():string; - write(text:string):void; - readSync(flushCache:boolean):string; - read(flushCache?:boolean): Promise; - // exists():boolean; - existsSync():boolean; - setDigest(contents:string):void; - getDigest():string; - writeFileWithPrivilegeEscalationSync (filePath:string, text:string):void; - handleNativeChangeEvent(eventType:string, eventPath:string):void; - detectResurrectionAfterDelay():void; - detectResurrection():void; - subscribeToNativeChangeEvents():void; - unsubscribeFromNativeChangeEvents():void; -} - -export interface IDirectoryStatic { - new (path:string, symlink?:boolean):IDirectory; -} - -export interface IDirectory { - realPath:string; - path:string; - symlink:boolean; - - getBaseName():string; - getPath():void; - getRealPathSync():string; - contains(pathToCheck:string):boolean; - relativize(fullPath:string):string; - getEntriesSync():any[]; // return type are {File | Directory}[] - getEntries(callback:Function):void; - subscribeToNativeChangeEvents():void; - unsubscribeFromNativeChangeEvents():void; - isPathPrefixOf(prefix:string, fullPath:string):boolean; -} - -export interface IHandleWatcher extends EventEmitter { - onEvent(event:any, filePath:any, oldFilePath:any):any; - start():void; - closeIfNoListener():void; - close():void; -} - -export interface IPathWatcher { - isWatchingParent:boolean; - path:any; - handleWatcher:IHandleWatcher; - - close():void; -} - -export function watch(path:string, callback:Function):IPathWatcher; - -export function closeAllWatchers():void; - -export function getWatchedPaths():string[]; - -export var File: IFileStatic; -export var Directory: IDirectoryStatic; +export let File: PathWatcher.Statics.File; +export let Directory: PathWatcher.Statics.Directory; +export function watch(): PathWatcher.PathWatcher; +export function closeAllWatchers(): void; +export function getWatchedPaths(): string[]; diff --git a/types/pathwatcher/pathwatcher-tests.ts b/types/pathwatcher/pathwatcher-tests.ts index 0e080abbfd..b4144ebd3d 100644 --- a/types/pathwatcher/pathwatcher-tests.ts +++ b/types/pathwatcher/pathwatcher-tests.ts @@ -1,10 +1,108 @@ +import { File, Directory } from "pathwatcher"; +let bool: boolean; +let str: string; +let sub: EventKit.Disposable; -import pathwatcher = require("pathwatcher"); -var File = pathwatcher.File; +let file: PathWatcher.File; +let dir: PathWatcher.Directory; -var filePath: string; -var file = new File(filePath); +// File ======================================================================= +// Construction +file = new File("Test.file"); +new File("Test.file", false); -pathwatcher.watch(filePath, ()=>{ -}); +async function fileCreation() { + bool = await file.create(); +} + +// Event Subscription +sub = file.onDidChange(() => {}); +sub = file.onDidRename(() => {}); +sub = file.onDidDelete(() => {}); +sub = file.onWillThrowWatchError(() => {}); + +// File Metadata +bool = file.isFile(); +bool = file.isDirectory(); +bool = file.isSymbolicLink(); + +async function fileExists() { + bool = await file.exists(); +} + +bool = file.existsSync(); + +async function getFileDigest() { + str = await file.getDigest(); +} + +str = file.getDigestSync(); +file.setEncoding("utf8"); +str = file.getEncoding(); + +// Managing Paths +str = file.getPath(); +str = file.getRealPathSync(); + +async function getFileRealPath() { + str = await file.getRealPath(); +} + +str = file.getBaseName(); + +// Traversing +dir = file.getParent(); + +// Reading and Writing +async function readFile() { + str = await file.read(); +} + +file.createReadStream(); + +async function writeFile() { + await file.write("Test"); +} + +file.createWriteStream(); +file.writeSync("Test"); + +// Directory ================================================================== +// Construction +dir = new Directory("Test.file"); +new Directory("Test.file", true); + +async function createDirectory() { + bool = await dir.create(); + bool = await dir.create(0o0777); +} + +// Event Subscription +sub = dir.onDidChange(() => {}); + +// Directory Metadata +bool = dir.isFile(); +bool = dir.isDirectory(); +bool = dir.isSymbolicLink(); + +async function directoryExists() { + bool = await dir.exists(); +} + +bool = dir.existsSync(); +bool = dir.isRoot(); + +// Managing Paths +str = dir.getPath(); +str = dir.getRealPathSync(); +str = dir.getBaseName(); +dir.relativize("Test.file") ; + +// Traversing +dir = dir.getParent(); +file = dir.getFile("Test.file"); +dir = dir.getSubdirectory("Test"); +dir.getEntriesSync(); +dir.getEntries((error, entries) => {}); +bool = dir.contains("Test.file"); diff --git a/types/pathwatcher/tsconfig.json b/types/pathwatcher/tsconfig.json index 00b8e7052f..cd2b999654 100644 --- a/types/pathwatcher/tsconfig.json +++ b/types/pathwatcher/tsconfig.json @@ -6,14 +6,11 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" ], - "paths": { - "q": [ "q/v0" ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -22,4 +19,4 @@ "index.d.ts", "pathwatcher-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/pathwatcher/tslint.json b/types/pathwatcher/tslint.json new file mode 100644 index 0000000000..cd8f17056a --- /dev/null +++ b/types/pathwatcher/tslint.json @@ -0,0 +1,38 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // Custom rules. + "class-name": true, + "indent": [true, "tabs"], + "jsdoc-format": true, + "linebreak-style": [true, "LF"], + "max-line-length": [true, 100], + "quotemark": [true, "double", "avoid-escape"], + "trailing-comma": [true, { + "multiline": { "objects": "always", "arrays": "always", "functions": "never" }, + "singleline": { "objects": "never", "arrays": "never", "functions": "never" } + }], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-type", + "check-typecast", + "check-rest-spread", + "check-preblock" + ], + // Soon to be defaults. + "arrow-return-shorthand": [true, "multiline"], + "no-any": true, + "no-floating-promises": true, + "no-unbound-method": true, + "no-unsafe-any": true, + "number-literal-format": true, + "restrict-plus-operands": true, + "return-undefined": true, + "switch-final-break": true + } +} diff --git a/types/pathwatcher/v0/index.d.ts b/types/pathwatcher/v0/index.d.ts new file mode 100644 index 0000000000..b1135c384c --- /dev/null +++ b/types/pathwatcher/v0/index.d.ts @@ -0,0 +1,88 @@ +// Type definitions for pathwatcher +// Project: https://github.com/atom/node-pathwatcher +// Definitions by: vvakame +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { EventEmitter } from "events"; +import * as Q from "q"; + +export as namespace PathWatcher; + +export interface IFileStatic { + new (path:string, symlink?:boolean):IFile; +} + +export interface IFile { + realPath:string; + path:string; + symlink:boolean; + cachedContents:string; + digest:string; + + handleEventSubscriptions():void; + setPath(path:string):void; + getPath():string; + getRealPathSync():string; + getBaseName():string; + write(text:string):void; + readSync(flushCache:boolean):string; + read(flushCache?:boolean): Promise; + // exists():boolean; + existsSync():boolean; + setDigest(contents:string):void; + getDigest():string; + writeFileWithPrivilegeEscalationSync (filePath:string, text:string):void; + handleNativeChangeEvent(eventType:string, eventPath:string):void; + detectResurrectionAfterDelay():void; + detectResurrection():void; + subscribeToNativeChangeEvents():void; + unsubscribeFromNativeChangeEvents():void; +} + +export interface IDirectoryStatic { + new (path:string, symlink?:boolean):IDirectory; +} + +export interface IDirectory { + realPath:string; + path:string; + symlink:boolean; + + getBaseName():string; + getPath():void; + getRealPathSync():string; + contains(pathToCheck:string):boolean; + relativize(fullPath:string):string; + getEntriesSync():any[]; // return type are {File | Directory}[] + getEntries(callback:Function):void; + subscribeToNativeChangeEvents():void; + unsubscribeFromNativeChangeEvents():void; + isPathPrefixOf(prefix:string, fullPath:string):boolean; +} + +export interface IHandleWatcher extends EventEmitter { + onEvent(event:any, filePath:any, oldFilePath:any):any; + start():void; + closeIfNoListener():void; + close():void; +} + +export interface IPathWatcher { + isWatchingParent:boolean; + path:any; + handleWatcher:IHandleWatcher; + + close():void; +} + +export function watch(path:string, callback:Function):IPathWatcher; + +export function closeAllWatchers():void; + +export function getWatchedPaths():string[]; + +export var File: IFileStatic; +export var Directory: IDirectoryStatic; + diff --git a/types/pathwatcher/v0/pathwatcher-tests.ts b/types/pathwatcher/v0/pathwatcher-tests.ts new file mode 100644 index 0000000000..0e080abbfd --- /dev/null +++ b/types/pathwatcher/v0/pathwatcher-tests.ts @@ -0,0 +1,10 @@ + + +import pathwatcher = require("pathwatcher"); +var File = pathwatcher.File; + +var filePath: string; +var file = new File(filePath); + +pathwatcher.watch(filePath, ()=>{ +}); diff --git a/types/pathwatcher/v0/tsconfig.json b/types/pathwatcher/v0/tsconfig.json new file mode 100644 index 0000000000..e6020a4021 --- /dev/null +++ b/types/pathwatcher/v0/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "pathwatcher": [ "pathwatcher/v0" ], + "q": [ "q/v0" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pathwatcher-tests.ts" + ] +} diff --git a/types/status-bar/README.md b/types/status-bar/README.md new file mode 100644 index 0000000000..91b72cc583 --- /dev/null +++ b/types/status-bar/README.md @@ -0,0 +1 @@ +***NOTE:*** *This package is deprecated and new versions have been merged into [`@types/atom`](https://www.npmjs.com/package/@types/atom). The most recent version can be accessed as part of the `Atom.Services` namespace.* diff --git a/types/status-bar/index.d.ts b/types/status-bar/index.d.ts index 4c471503a7..116e045dbe 100644 --- a/types/status-bar/index.d.ts +++ b/types/status-bar/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.3 /// -/// +/// declare namespace StatusBar { interface IStatusBarViewStatic { diff --git a/types/status-bar/tsconfig.json b/types/status-bar/tsconfig.json index 9fe41d5d67..2e4701e660 100644 --- a/types/status-bar/tsconfig.json +++ b/types/status-bar/tsconfig.json @@ -12,9 +12,6 @@ "typeRoots": [ "../" ], - "paths": { - "q": [ "q/v0" ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -23,4 +20,4 @@ "index.d.ts", "status-bar-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/text-buffer/.editorconfig b/types/text-buffer/.editorconfig new file mode 100644 index 0000000000..2b997514d2 --- /dev/null +++ b/types/text-buffer/.editorconfig @@ -0,0 +1,3 @@ +[*.ts] +indent_style = tab +indent_size = 2 diff --git a/types/text-buffer/README.md b/types/text-buffer/README.md new file mode 100644 index 0000000000..f4d852a5e5 --- /dev/null +++ b/types/text-buffer/README.md @@ -0,0 +1,31 @@ +## TextBuffer Type Definitions + +TypeScript type definitions for [TextBuffer](https://github.com/atom/text-buffer), which is published as "[text-buffer](https://www.npmjs.com/package/text-buffer)" on NPM. + +### Usage Notes + +#### Exports + +This module has a single entity as its export: the [TextBuffer](https://github.com/atom/text-buffer/blob/master/src/text-buffer.coffee) class. The require syntax is typically used to import modules like this. + +```ts +import TextBuffer = require("text-buffer"); +``` + +#### Point and Range + +Both the Point class and the Range class are anchored onto the TextBuffer class as static properties, allowing construction of both despite TextBuffer being the singular export. + +```ts +import TextBuffer = require("text-buffer"); +let point = new TextBuffer.Point(0, 0); +let range = new TextBuffer.Range([0, 0], [1, 4]); +``` + +#### The TextBuffer Namespace + +The three primary classes of TextBuffer are Point, Range, and TextBuffer, yet there are many other types passed around and used by it. Many of the types used by TextBuffer can be referenced from the TextBuffer namespace. + +```ts +function example(marker: TextBuffer.Marker) {} +``` diff --git a/types/text-buffer/index.d.ts b/types/text-buffer/index.d.ts index e3200a7aff..663d62914c 100644 --- a/types/text-buffer/index.d.ts +++ b/types/text-buffer/index.d.ts @@ -1,302 +1,1414 @@ -// Type definitions for text-buffer +// Type definitions for text-buffer 13.x // Project: https://github.com/atom/text-buffer -// Definitions by: vvakame +// Definitions by: GlenCFL // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.2 -/// -/// +/// +/// -declare namespace TextBuffer { +declare global { + namespace TextBuffer { + /** Objects that appear as parameters to callbacks. */ + namespace Events { + interface BufferWatchError { + /** The error object. */ + error: Error; - interface IPointStatic { - new (row?:number, column?:number):IPoint; + /** Call this function to indicate you have handled the error. + * The error will not be thrown if this function is called. + */ + handle(): void; + } - fromObject(point:IPoint, copy?:boolean):IPoint; - fromObject(object:number[]):IPoint; - fromObject(object:{row:number; column:number;}):IPoint; + interface FileSaved { + /** The path to which the buffer was saved. */ + path: string; + } - min(point1:IPoint, point2:IPoint):IPoint; - min(point1:number[], point2:IPoint):IPoint; - min(point1:{row:number; column:number;}, point2:IPoint):IPoint; + interface MarkerChanged { + /** Point representing the former head position. */ + oldHeadPosition: Point; - min(point1:IPoint, point2:number[]):IPoint; - min(point1:number[], point2:number[]):IPoint; - min(point1:{row:number; column:number;}, point2:number[]):IPoint; + /** Point representing the new head position. */ + newHeadPosition: Point; - min(point1:IPoint, point2:{row:number; column:number;}):IPoint; - min(point1:number[], point2:{row:number; column:number;}):IPoint; - min(point1:{row:number; column:number;}, point2:{row:number; column:number;}):IPoint; - } + /** Point representing the former tail position. */ + oldTailPosition: Point; - interface IPoint { - constructor: IPointStatic; + /** Point representing the new tail position. */ + newTailPosition: Point; - row:number; - column:number; + /** Boolean indicating whether the marker was valid before the change. */ + wasValid: boolean; - copy():IPoint; - freeze():IPoint; + /** Boolean indicating whether the marker is now valid. */ + isValid: boolean; - translate(delta:IPoint):IPoint; - translate(delta:number[]):IPoint; - translate(delta:{row:number; column:number;}):IPoint; + /** Boolean indicating whether the marker had a tail before the change. */ + hadTail: boolean; - add(other:IPoint):IPoint; - add(other:number[]):IPoint; - add(other:{row:number; column:number;}):IPoint; + /** Boolean indicating whether the marker now has a tail. */ + hasTail: boolean; - splitAt(column:number):IPoint[]; - compare(other:IPoint):number; - isEqual(other:IPoint):boolean; - isLessThan(other:IPoint):boolean; - isLessThanOrEqual(other:IPoint):boolean; - isGreaterThan(other:IPoint):boolean; - isGreaterThanOrEqual(other:IPoint):boolean; - toArray():number[]; - serialize():number[]; - } + /** -DEPRECATED- Object containing the marker's custom properties before the change. + * @deprecated + */ + oldProperties: object; - interface IRangeStatic { - deserialize(array:IPoint[]):IRange; + /** -DEPRECATED- Object containing the marker's custom properties after the change. + * @deprecated + */ + newProperties: object; - fromObject(object:IPoint[]):IRange; + /** Boolean indicating whether this change was caused by a textual + * change to the buffer or whether the marker was manipulated directly + * via its public API. + */ + textChanged: boolean; + } - fromObject(object:IRange, copy?:boolean):IRange; + interface DisplayMarkerChanged { + /** Point representing the former head buffer position. */ + oldHeadBufferPosition: Point; - fromObject(object:{start: IPoint; end: IPoint}):IRange; - fromObject(object:{start: number[]; end: IPoint}):IRange; - fromObject(object:{start: {row:number; column:number;}; end: IPoint}):IRange; + /** Point representing the new head buffer position. */ + newHeadBufferPosition: Point; - fromObject(object:{start: IPoint; end: number[]}):IRange; - fromObject(object:{start: number[]; end: number[]}):IRange; - fromObject(object:{start: {row:number; column:number;}; end: number[]}):IRange; + // Point representing the former tail buffer position. */ + oldTailBufferPosition: Point; - fromObject(object:{start: IPoint; end: {row:number; column:number;}}):IRange; - fromObject(object:{start: number[]; end: {row:number; column:number;}}):IRange; - fromObject(object:{start: {row:number; column:number;}; end: {row:number; column:number;}}):IRange; + /** Point representing the new tail buffer position. */ + newTailBufferPosition: Point; - fromText(point:IPoint, text:string):IRange; - fromText(point:number[], text:string):IRange; - fromText(point:{row:number; column:number;}, text:string):IRange; - fromText(text:string):IRange; + /** Point representing the former head screen position. */ + oldHeadScreenPosition: Point; - fromPointWithDelta(startPoint:IPoint, rowDelta:number, columnDelta:number):IRange; - fromPointWithDelta(startPoint:number[], rowDelta:number, columnDelta:number):IRange; - fromPointWithDelta(startPoint:{row:number; column:number;}, rowDelta:number, columnDelta:number):IRange; + /** Point representing the new head screen position. */ + newHeadScreenPosition: Point; - new(point1:IPoint, point2:IPoint):IRange; - new(point1:number[], point2:IPoint):IRange; - new(point1:{row:number; column:number;}, point2:IPoint):IRange; + /** Point representing the former tail screen position. */ + oldTailScreenPosition: Point; - new(point1:IPoint, point2:number[]):IRange; - new(point1:number[], point2:number[]):IRange; - new(point1:{row:number; column:number;}, point2:number[]):IRange; + /** Point representing the new tail screen position. */ + newTailScreenPosition: Point; - new(point1:IPoint, point2:{row:number; column:number;}):IRange; - new(point1:number[], point2:{row:number; column:number;}):IRange; - new(point1:{row:number; column:number;}, point2:{row:number; column:number;}):IRange; - } + /** Boolean indicating whether the marker was valid before the change. */ + wasValid: boolean; - interface IRange { - constructor:IRangeStatic; + /** Boolean indicating whether the marker is now valid. */ + isValid: boolean; - start: IPoint; - end: IPoint; + /** Boolean indicating whether the marker had a tail before the change. */ + hadTail: boolean; - serialize():number[][]; - copy():IRange; - freeze():IRange; - isEqual(other:IRange):boolean; - isEqual(other:IPoint[]):boolean; + /** Boolean indicating whether the marker now has a tail */ + hasTail: boolean; - compare(object:IPoint[]):number; + /** -DEPRECATED- Object containing the marker's custom properties before the change. + * @deprecated + */ + oldProperties: object; - compare(object:{start: IPoint; end: IPoint}):number; - compare(object:{start: number[]; end: IPoint}):number; - compare(object:{start: {row:number; column:number;}; end: IPoint}):number; + /** -DEPRECATED- Object containing the marker's custom properties after the change. + * @deprecated + */ + newProperties: object; - compare(object:{start: IPoint; end: number[]}):number; - compare(object:{start: number[]; end: number[]}):number; - compare(object:{start: {row:number; column:number;}; end: number[]}):number; + /** Boolean indicating whether this change was caused by a textual change to the + * buffer or whether the marker was manipulated directly via its public API. + */ + textChanged: boolean; + } - compare(object:{start: IPoint; end: {row:number; column:number;}}):number; - compare(object:{start: number[]; end: {row:number; column:number;}}):number; - compare(object:{start: {row:number; column:number;}; end: {row:number; column:number;}}):number; + interface BufferChanging { + /** Range of the old text. */ + oldRange: Range; + } - isSingleLine():boolean; - coversSameRows(other:IRange):boolean; + interface BufferChanged { + /** Range of the old text. */ + oldRange: Range; - add(object:IPoint[]):IRange; + /** Range of the new text. */ + newRange: Range; - add(object:{start: IPoint; end: IPoint}):IRange; - add(object:{start: number[]; end: IPoint}):IRange; - add(object:{start: {row:number; column:number;}; end: IPoint}):IRange; + /** String containing the text that was replaced. */ + oldText: string; - add(object:{start: IPoint; end: number[]}):IRange; - add(object:{start: number[]; end: number[]}):IRange; - add(object:{start: {row:number; column:number;}; end: number[]}):IRange; + /** String containing the text that was inserted. */ + newText: string; + } - add(object:{start: IPoint; end: {row:number; column:number;}}):IRange; - add(object:{start: number[]; end: {row:number; column:number;}}):IRange; - add(object:{start: {row:number; column:number;}; end: {row:number; column:number;}}):IRange; + interface BufferStoppedChanging { + changes: Structures.TextChange[]; + } + } - translate(startPoint:IPoint, endPoint:IPoint):IRange; - translate(startPoint:IPoint):IRange; + /** Objects that appear as parameters to functions. */ + namespace Options { + interface BufferLoad { + /** The file's encoding. */ + encoding?: string; - intersectsWith(otherRange:IRange):boolean; - containsRange(otherRange:IRange, exclusive:boolean):boolean; + /** A function that returns a boolean indicating whether the buffer should + * be destroyed if its file is deleted. + */ + shouldDestroyOnFileDelete?(): boolean; + } - containsPoint(point:IPoint, exclusive:boolean):boolean; - containsPoint(point:number[], exclusive:boolean):boolean; - containsPoint(point:{row:number; column:number;}, exclusive:boolean):boolean; + interface FindMarker { + /** Only include markers that start at the given Point. */ + startPosition?: PointLike|[number, number]; - intersectsRow(row:number):boolean; - intersectsRowRange(startRow:number, endRow:number):boolean; - union(otherRange:IRange):IRange; - isEmpty():boolean; - toDelta():IPoint; - getRowCount():number; - getRows():number[]; - } + /** Only include markers that end at the given Point. */ + endPosition?: PointLike|[number, number]; - interface IHistory { - // TBD - } + /** Only include markers that start inside the given Range. */ + startsInRange?: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]; - interface IMarkerManager { - // TBD - } + /** Only include markers that end inside the given Range. */ + endsInRange?: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]; - interface IMarker { - // TBD - } + /** Only include markers that contain the given Point, inclusive. */ + containsPoint?: PointLike|[number, number]; - interface IBufferPatch { - // TBD - } + /** Only include markers that contain the given Range, inclusive. */ + containsRange?: RangeLike|[PointLike, PointLike]| + [PointLike, [number, number]]|[[number, number], PointLike]| + [[number, number], [number, number]]; - interface ITextBufferStatic { - Point: IPointStatic; - Range: IRangeStatic; - newlineRegex:any; + /** Only include markers that start at the given row number. */ + startRow?: number; - new (text:string): ITextBuffer; - new (params:any): ITextBuffer; - } + /** Only include markers that end at the given row number. */ + endRow?: number; - interface ITextBuffer extends Emissary.IEmitter, Emissary.ISubscriber { - // Delegator.includeInto(TextBuffer); - // Serializable.includeInto(TextBuffer); + /** Only include markers that intersect the given row number. */ + intersectsRow?: number; + } - cachedText:string; - stoppedChangingDelay:number; - stoppedChangingTimeout:any; - cachedDiskContents:string; - conflict:boolean; - file:any; // pathwatcher.IFile - refcount:number; + interface FindDisplayMarker { + /** Only include markers starting at this Point in buffer coordinates. */ + startBufferPosition?: PointLike|[number, number]; - lines:string[]; - lineEndings:string[]; - offsetIndex:any; // span-skip-list.SpanSkipList - history:IHistory; - markers:IMarkerManager; - loaded:boolean; - digestWhenLastPersisted:string; - modifiedWhenLastPersisted:boolean; - useSerializedText:boolean; + /** Only include markers ending at this Point in buffer coordinates. */ + endBufferPosition?: PointLike|[number, number]; - deserializeParams(params:any):any; - serializeParams():any; + /** Only include markers starting at this Point in screen coordinates. */ + startScreenPosition?: PointLike|[number, number]; - getText():string; - getLines():string; - isEmpty():boolean; - getLineCount():number; - getLastRow():number; - lineForRow(row:number):string; - getLastLine():string; - lineEndingForRow(row:number):string; - lineLengthForRow(row:number):number; - setText(text:string):IRange; - setTextViaDiff(text:any):any[]; - setTextInRange(range:IRange, text:string, normalizeLineEndings?:boolean):IRange; - insert(position:IPoint, text:string, normalizeLineEndings?:boolean):IRange; - append(text:string, normalizeLineEndings?:boolean):IRange; - delete(range:IRange):IRange; - deleteRow(row:number):IRange; - deleteRows(startRow:number, endRow:number):IRange; - buildPatch(oldRange:IRange, newText:string, normalizeLineEndings?:boolean):IBufferPatch; - applyPatch(patch:IBufferPatch):any; - getTextInRange(range:IRange):string; - clipRange(range:IRange):IRange; - clipPosition(position:IPoint):IPoint; - getFirstPosition():IPoint; - getEndPosition():IPoint; - getRange():IRange; - rangeForRow(row:number, includeNewline?:boolean):IRange; - characterIndexForPosition(position:IPoint):number; - positionForCharacterIndex(offset:number):IPoint; - getMaxCharacterIndex():number; - loadSync():ITextBuffer; - load():Promise; - finishLoading():ITextBuffer; - handleTextChange(event:any):any; - destroy():any; - isAlive():boolean; - isDestroyed():boolean; - isRetained():boolean; - retain():ITextBuffer; - release():ITextBuffer; - subscribeToFile():any; - hasMultipleEditors():boolean; - reload():any; - updateCachedDiskContentsSync():string; - updateCachedDiskContents():Promise; - getBaseName():string; - getPath():string; - getUri():string; - setPath(filePath:string):any; - save():void; - saveAs(filePath:string):any; - isModified():boolean; - isInConflict():boolean; - destroyMarker(id:any):any; - matchesInCharacterRange(regex:any, startIndex:any, endIndex:any):any[]; - scan(regex:any, iterator:any):any; - backwardsScan(regex:any, iterator:any):any; - replace(regex:any, replacementText:any):any; - scanInRange(regex:any, range:any, iterator:any, reverse:any):any; - backwardsScanInRange(regex:any, range:any, iterator:any):any; - isRowBlank(row:number):boolean; - previousNonBlankRow(startRow:number):number; - nextNonBlankRow(startRow:number):number; - usesSoftTabs():boolean; - cancelStoppedChangingTimeout():any; - scheduleModifiedEvents():any; - emitModifiedStatusChanged(modifiedStatus:any):any; - logLines(start:number, end:number):void; + /** Only include markers ending at this Point in screen coordinates. */ + endScreenPosition?: PointLike|[number, number]; - // delegate to history property - undo():any; - redo():any; - transact(fn:Function):any; - beginTransaction():any; - commitTransaction():any; - abortTransaction():any; - clearUndoStack():any; + /** Only include markers starting inside this Range in buffer coordinates. */ + startsInBufferRange?: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]; - // delegate to markers property - markRange(range:any, properties:any):any; - markPosition(range:any, properties:any):any; - getMarker(id:number):IMarker; - getMarkers():IMarker[]; - getMarkerCount():number; + /** Only include markers ending inside this Range in buffer coordinates. */ + endsInBufferRange?: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]; + + /** Only include markers starting inside this Range in screen coordinates. */ + startsInScreenRange?: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]; + + /** Only include markers ending inside this Range in screen coordinates. */ + endsInScreenRange?: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]; + + /** Only include markers starting at this row in buffer coordinates. */ + startBufferRow?: number; + + /** Only include markers ending at this row in buffer coordinates. */ + endBufferRow?: number; + + /** Only include markers starting at this row in screen coordinates. */ + startScreenRow?: number; + + /** Only include markers ending at this row in screen coordinates. */ + endScreenRow?: number; + + /** Only include markers intersecting this Array of [startRow, endRow] in + * buffer coordinates. + */ + intersectsBufferRowRange?: [number, number]; + + /** Only include markers intersecting this Array of [startRow, endRow] in + * screen coordinates. + */ + intersectsScreenRowRange?: [number, number]; + + /** Only include markers containing this Range in buffer coordinates. */ + containsBufferRange?: RangeLike|[PointLike, PointLike]| + [PointLike, [number, number]]|[[number, number], PointLike]| + [[number, number], [number, number]]; + + /** Only include markers containing this Point in buffer coordinates. */ + containsBufferPosition?: PointLike|[number, number]; + + /** Only include markers contained in this Range in buffer coordinates. */ + containedInBufferRange?: RangeLike|[PointLike, PointLike]| + [PointLike, [number, number]]|[[number, number], PointLike]| + [[number, number], [number, number]]; + + /** Only include markers contained in this Range in screen coordinates. */ + containedInScreenRange?: RangeLike|[PointLike, PointLike]| + [PointLike, [number, number]]|[[number, number], PointLike]| + [[number, number], [number, number]]; + + /** Only include markers intersecting this Range in buffer coordinates. */ + intersectsBufferRange?: RangeLike|[PointLike, PointLike]| + [PointLike, [number, number]]|[[number, number], PointLike]| + [[number, number], [number, number]]; + + /** Only include markers intersecting this Range in screen coordinates. */ + intersectsScreenRange?: RangeLike|[PointLike, PointLike]| + [PointLike, [number, number]]|[[number, number], PointLike]| + [[number, number], [number, number]]; + } + + interface CopyMarker { + /** Whether or not the marker should be tailed. */ + tailed?: boolean; + + /** Creates the marker in a reversed orientation. */ + reversed?: boolean; + + /** Determines the rules by which changes to the buffer invalidate the marker. */ + invalidate?: "never"|"surround"|"overlap"|"inside"|"touch"; + + /** Indicates whether insertions at the start or end of the marked range should + * be interpreted as happening outside the marker. + */ + exclusive?: boolean; + + /** -DEPRECATED- Custom properties to be associated with the marker. */ + properties?: object; + } + + interface ScanContext { + /** The number of lines before the matched line to include in the results object. */ + leadingContextLineCount?: number; + + /** The number of lines after the matched line to include in the results object. */ + trailingContextLineCount?: number; + } + } + + /** The static side to each exported class. Should generally only be used internally. */ + namespace Statics { + /* tslint:disable:no-unnecessary-qualifier */ + /** The static side to the Point class. */ + interface Point { + /** Create a Point from an array containing two numbers representing the + * row and column. + */ + fromObject(object: [number, number]): TextBuffer.Point; + + /** Create a Point from an existing object which implements PointLike. */ + fromObject(object: TextBuffer.PointLike, copy?: boolean): TextBuffer.Point; + + /** Construct a Point object */ + new (row?: number, column?: number): TextBuffer.Point; + + /** Returns the given Point that is earlier in the buffer. */ + min(point1: TextBuffer.PointLike|[number, number], point2: TextBuffer.PointLike| + [number, number]): TextBuffer.Point; + } + + /** The static side to the Range class. */ + interface Range { + /** Convert any range-compatible object to a Range. */ + fromObject(object: TextBuffer.RangeLike|[TextBuffer.PointLike, TextBuffer.PointLike]| + [TextBuffer.PointLike, [number, number]]|[[number, number], TextBuffer.PointLike]| + [[number, number], [number, number]], copy?: boolean): TextBuffer.Range; + + /** Construct a Range object. */ + new (pointA?: TextBuffer.PointLike|[number, number], pointB?: TextBuffer.PointLike| + [number, number]): TextBuffer.Range; + + /** Call this with the result of Range::serialize to construct a new Range. */ + deserialize(array: object): TextBuffer.Range; + } + + /** The static side to the TextBuffer class. */ + interface TextBuffer { + Point: TextBuffer.Statics.Point; + Range: TextBuffer.Statics.Range; + + /** Create a new buffer with the given starting text. */ + new (text: string): TextBuffer.TextBuffer; + /** Create a new buffer with the given params. */ + new (params?: { + /** The initial string text of the buffer. */ + text?: string + /** A function that returns a Boolean indicating whether the buffer should + * be destroyed if its file is deleted. + */ + shouldDestroyOnFileDelete?(): boolean + }): TextBuffer.TextBuffer; + + /** Create a new buffer backed by the given file path. */ + load(source: string, params?: TextBuffer.Options.BufferLoad): + Promise; + + /** Create a new buffer backed by the given file path. For better performance, + * use TextBuffer.load instead. + */ + loadSync(filePath: string, params?: TextBuffer.Options.BufferLoad): + TextBuffer.TextBuffer; + + /** Restore a TextBuffer based on an earlier state created using the TextBuffer::serialize + * method. + */ + deserialize(params: object): Promise; + } + /* tslint:enable:no-unnecessary-qualifier */ + } + + /** Data structures that are used within classes. */ + namespace Structures { + interface TextChange { + newExtent: Point; + oldExtent: Point; + newRange: Range; + oldRange: Range; + newText: string; + oldText: string; + start: Point; + } + + interface BufferScanResult { + buffer: TextBuffer; + lineText: string; + match: RegExpExecArray; + matchText: string; + range: Range; + replace(replacementText: string): void; + stop(): void; + stopped: boolean; + } + + interface ContextualBufferScanResult extends BufferScanResult { + leadingContextLines: string[]; + trailingContextLines: string[]; + } + } + + /** The interface that should be implemented for all "point-compatible" objects. */ + interface PointLike { + /** A zero-indexed number representing the row of the Point. */ + row: number; + + /** A zero-indexed number representing the column of the Point. */ + column: number; + } + + /** Represents a point in a buffer in row/column coordinates. */ + interface Point extends PointLike { + // Properties + /** A zero-indexed number representing the row of the Point. */ + row: number; + + /** A zero-indexed number representing the column of the Point. */ + column: number; + + // Construction + /** Returns a new Point with the same row and column. */ + copy(): Point; + + /** Returns a new Point with the row and column negated. */ + negate(): Point; + + // Comparison + /** Compare another Point to this Point instance. + * Returns -1 if this point precedes the argument. + * Returns 0 if this point is equivalent to the argument. + * Returns 1 if this point follows the argument. + */ + compare(other: PointLike|[number, number]): number; + + /** Returns a boolean indicating whether this point has the same row and + * column as the given Point. + */ + isEqual(other: PointLike|[number, number]): boolean; + + /** Returns a Boolean indicating whether this point precedes the given Point. */ + isLessThan(other: PointLike|[number, number]): boolean; + + /** Returns a Boolean indicating whether this point precedes or is equal to + * the given Point. + */ + isLessThanOrEqual(other: PointLike|[number, number]): boolean; + + /** Returns a Boolean indicating whether this point follows the given Point. */ + isGreaterThan(other: PointLike|[number, number]): boolean; + + /** Returns a Boolean indicating whether this point follows or is equal to + * the given Point. + */ + isGreaterThanOrEqual(other: PointLike|[number, number]): boolean; + + // Operations + /** Makes this point immutable and returns itself. */ + freeze(): Readonly; + + /** Build and return a new point by adding the rows and columns of the + * given point. + */ + translate(other: PointLike|[number, number]): Point; + + /** Build and return a new Point by traversing the rows and columns + * specified by the given point. + */ + traverse(other: PointLike|[number, number]): Point; + + /** Returns an array of this point's row and column. */ + toArray(): [number, number]; + + /** Returns an array of this point's row and column. */ + serialize(): [number, number]; + + /** Returns a string representation of the point. */ + toString(): string; + } + + /** The interface that should be implemented for all "range-compatible" objects. */ + interface RangeLike { + /** A Point representing the start of the Range. */ + start: PointLike; + + /** A Point representing the end of the Range. */ + end: PointLike; + } + + /** Represents a region in a buffer in row/column coordinates. */ + interface Range extends RangeLike { + // Properties + /** A Point representing the start of the Range. */ + start: PointLike; + + /** A Point representing the end of the Range. */ + end: PointLike; + + // Construction + /** Returns a new range with the same start and end positions. */ + copy(): Range; + + /** Returns a new range with the start and end positions negated. */ + negate(): Range; + + // Serialization and Deserialization + /** Returns a plain javascript object representation of the range. */ + serialize(): number[][]; + + // Range Details + /** Is the start position of this range equal to the end position? */ + isEmpty(): boolean; + + /** Returns a boolean indicating whether this range starts and ends on the + * same row. + */ + isSingleLine(): boolean; + + /** Get the number of rows in this range. */ + getRowCount(): number; + + /** Returns an array of all rows in the range. */ + getRows(): number[]; + + // Operations + /** Freezes the range and its start and end point so it becomes immutable + * and returns itself. + */ + freeze(): Readonly; + + // NOTE: this function doesn't actually take a range-compatible parameter. + /** Returns a new range that contains this range and the given range. */ + union(other: RangeLike): Range; + + /** Build and return a new range by translating this range's start and end + * points by the given delta(s). + */ + translate(startDelta: PointLike|[number, number], endDelta?: PointLike| + [number, number]): Range; + + /** Build and return a new range by traversing this range's start and end + * points by the given delta. + */ + traverse(delta: PointLike|[number, number]): Range; + + // Comparison + /** Compare two Ranges. + * Returns -1 if this range starts before the argument or contains it. + * Returns 0 if this range is equivalent to the argument. + * Returns 1 if this range starts after the argument or is contained by it. + */ + compare(otherRange: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]): number; + + /** Returns a Boolean indicating whether this range has the same start and + * end points as the given Range. + */ + isEqual(otherRange: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]): boolean; + + // NOTE: this function doesn't actually take a range-compatible parameter. + /** Returns a Boolean indicating whether this range starts and ends on the + * same row as the argument. + */ + coversSameRows(otherRange: RangeLike): boolean; + + // NOTE: this function doesn't actually take a range-compatible parameter. + /** Determines whether this range intersects with the argument. */ + intersectsWith(otherRange: RangeLike, exclusive?: boolean): boolean; + + /** Returns a boolean indicating whether this range contains the given range. */ + containsRange(otherRange: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]], exclusive?: + boolean): boolean; + + /** Returns a boolean indicating whether this range contains the given point. */ + containsPoint(point: PointLike|[number, number], exclusive?: boolean): boolean; + + /** Returns a boolean indicating whether this range intersects the given + * row number. + */ + intersectsRow(row: number): boolean; + + /** Returns a boolean indicating whether this range intersects the row range + * indicated by the given startRow and endRow numbers. + */ + intersectsRowRange(startRow: number, endRow: number): boolean; + + // Conversion + /** Returns a string representation of the range. */ + toString(): string; + } + + /** Represents a buffer annotation that remains logically stationary even as + * the buffer changes. + */ + interface Marker { + // Properties + id: number; + tailed: boolean; + reversed: boolean; + valid: boolean; + invalidate: string; + properties: object; + + // Lifecycle + /** Creates and returns a new Marker with the same properties as this + * marker. + */ + copy(options?: Options.CopyMarker): Marker; + + /** Destroys the marker, causing it to emit the "destroyed" event. */ + destroy(): void; + + // Event Subscription + /** Invoke the given callback when the marker is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when the state of the marker changes. */ + onDidChange(callback: (event: Events.MarkerChanged) => void): + EventKit.Disposable; + + // Marker Details + /** Returns the current range of the marker. The range is immutable. */ + getRange(): Range; + + /** Returns a point representing the marker's current head position. */ + getHeadPosition(): Point; + + /** Returns a point representing the marker's current tail position. */ + getTailPosition(): Point; + + /** Returns a point representing the start position of the marker, which + * could be the head or tail position, depending on its orientation. + */ + getStartPosition(): Point; + + /** Returns a point representing the end position of the marker, which + * could be the head or tail position, depending on its orientation. + */ + getEndPosition(): Point; + + /** Returns a boolean indicating whether the head precedes the tail. */ + isReversed(): boolean; + + /** Returns a boolean indicating whether the marker has a tail. */ + hasTail(): boolean; + + /** Is the marker valid? */ + isValid(): boolean; + + /** Is the marker destroyed? */ + isDestroyed(): boolean; + + /** Returns a boolean indicating whether changes that occur exactly at + * the marker's head or tail cause it to move. + */ + isExclusive(): boolean; + + /** Get the invalidation strategy for this marker. */ + getInvalidationStrategy(): string; + + // Mutating Markers + /** Sets the range of the marker. + * Returns a boolean indicating whether or not the marker was updated. + */ + setRange(range: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]], params?: { + reversed?: boolean, exclusive?: boolean }): boolean; + + /** Sets the head position of the marker. + * Returns a boolean indicating whether or not the marker was updated. + */ + setHeadPosition(position: PointLike|[number, number]): boolean; + + /** Sets the tail position of the marker. + * Returns a boolean indicating whether or not the marker was updated. + */ + setTailPosition(position: PointLike|[number, number]): boolean; + + /** Removes the marker's tail. + * Returns a boolean indicating whether or not the marker was updated. + */ + clearTail(): boolean; + + /** Plants the marker's tail at the current head position. + * Returns a boolean indicating whether or not the marker was updated. + */ + plantTail(): boolean; + + // Comparison + /** Returns a boolean indicating whether this marker is equivalent to + * another marker, meaning they have the same range and options. + */ + isEqual(other: Marker): boolean; + + /** Compares this marker to another based on their ranges. + * Returns "-1" if this marker precedes the argument. + * Returns "0" if this marker is equivalent to the argument. + * Returns "1" if this marker follows the argument. + */ + compare(other: Marker): number; + } + + /** Experimental: A container for a related set of markers. */ + interface MarkerLayer { + // Lifecycle + /** Create a copy of this layer with markers in the same state and locations. */ + copy(): MarkerLayer; + + /** Destroy this layer. */ + destroy(): boolean; + + /** Remove all markers from this layer. */ + clear(): void; + + /** Determine whether this layer has been destroyed. */ + isDestroyed(): boolean; + + // Querying + /** Get an existing marker by its id. */ + getMarker(id: number): Marker|undefined; + + /** Get all existing markers on the marker layer. */ + getMarkers(): Marker[]; + + /** Get the number of markers in the marker layer. */ + getMarkerCount(): number; + + /** Find markers in the layer conforming to the given parameters. */ + findMarkers(params: Options.FindMarker): Marker[]; + + // Marker Creation + /** Create a marker with the given range. */ + markRange(range: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]], options?: + { reversed?: boolean, invalidate?: "never"|"surround"|"overlap"|"inside"|"touch", + exclusive?: boolean }): Marker; + + /** Create a marker at with its head at the given position with no tail. */ + markPosition(position: PointLike|[number, number], options?: { + invalidate?: "never"|"surround"|"overlap"|"inside"|"touch", + exclusive?: boolean + }): Marker; + + // Event Subscription + /** Subscribe to be notified asynchronously whenever markers are created, + * updated, or destroyed on this layer. + */ + onDidUpdate(callback: () => void): EventKit.Disposable; + + /** Subscribe to be notified synchronously whenever markers are created on + * this layer. + */ + onDidCreateMarker(callback: (marker: Marker) => void): EventKit.Disposable; + + /** Subscribe to be notified synchronously when this layer is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + } + + /** A mutable text container with undo/redo support and the ability to + * annotate logical regions in the text. + */ + interface TextBuffer { + // Properties + file: PathWatcher.File; + lines: string[]; + lineEndings: string[]; + stoppedChangingDelay: number; + conflict: boolean; + loaded: boolean; + destroyed: boolean; + refcount: number; + id: string; + + /** Schedules a 'did-stop-changing' emission. The event will be emitted between + * now and TextBuffer::stoppedChangingDelay milliseconds in the future. + */ + debouncedEmitDidStopChangingEvent(): void; + + // Lifecycle + /** Destroys the buffer, emitting the 'did-destroy' prior to doing so. */ + destroy(): void; + + /** Returns whether or not the given buffer is alive. */ + isAlive(): boolean; + + /** Returns whether or not the given buffer has been destroyed. */ + isDestroyed(): boolean; + + /** Returns whether or not this text buffer is currently retained. */ + isRetained(): boolean; + + /** Retains the text buffer, preventing its destruction via TextBuffer::release. */ + retain(): TextBuffer; + + /** Release the text buffer, destroying it if there are no other retainers. */ + release(): TextBuffer; + + // Event Subscription + /** Invoke the given callback synchronously before the content of the buffer + * changes. + */ + onWillChange(callback: (event: Events.BufferChanging) => void): + EventKit.Disposable; + + /** Invoke the given callback synchronously when the content of the buffer + * changes. You should probably not be using this in packages. + */ + onDidChange(callback: (event: Events.BufferChanged) => void): + EventKit.Disposable; + + /** Invoke the given callback synchronously when a transaction finishes with + * a list of all the changes in the transaction. + */ + onDidChangeText(callback: (event: Events.BufferStoppedChanging) => void): + EventKit.Disposable; + + /** Invoke the given callback asynchronously following one or more changes after + * ::getStoppedChangingDelay milliseconds elapse without an additional change. + */ + onDidStopChanging(callback: (event: Events.BufferStoppedChanging) => void): + EventKit.Disposable; + + /** Invoke the given callback when the in-memory contents of the buffer become + * in conflict with the contents of the file on disk. + */ + onDidConflict(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback if the value of ::isModified changes. */ + onDidChangeModified(callback: (modified: boolean) => void): + EventKit.Disposable; + + /** Invoke the given callback when all marker ::onDidChange observers have been + * notified following a change to the buffer. + */ + onDidUpdateMarkers(callback: () => void): EventKit.Disposable; + + onDidCreateMarker(callback: (marker: Marker) => void): + EventKit.Disposable; + + /** Invoke the given callback when the value of ::getPath changes. */ + onDidChangePath(callback: (path: string) => void): EventKit.Disposable; + + /** Invoke the given callback when the value of ::getEncoding changes. */ + onDidChangeEncoding(callback: (encoding: string) => void): + EventKit.Disposable; + + /** Invoke the given callback before the buffer is saved to disk. */ + onWillSave(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback after the buffer is saved to disk. */ + onDidSave(callback: (event: Events.FileSaved) => void): + EventKit.Disposable; + + /** Invoke the given callback after the file backing the buffer is deleted. */ + onDidDelete(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback before the buffer is reloaded from the contents + * of its file on disk. + */ + onWillReload(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback after the buffer is reloaded from the contents + * of its file on disk. + */ + onDidReload(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when the buffer is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + /** Invoke the given callback when there is an error in watching the file. */ + onWillThrowWatchError(callback: (errorObject: Events.BufferWatchError) => + void): EventKit.Disposable; + + /** Get the number of milliseconds that will elapse without a change before + * ::onDidStopChanging observers are invoked following a change. + */ + getStoppedChangingDelay(): number; + + /** Performs the necessary work, then emits the 'did-stop-changing' event. */ + emitDidStopChangingEvent(): void; + + // File Details + /** Determine if the in-memory contents of the buffer differ from its contents + * on disk. + * If the buffer is unsaved, always returns true unless the buffer is empty. + */ + isModified(): boolean; + + /** Determine if the in-memory contents of the buffer conflict with the on-disk + * contents of its associated file. + */ + isInConflict(): boolean; + + /** Get the path of the associated file. */ + getPath(): string|undefined; + + /** Set the path for the buffer's associated file. */ + setPath(filePath: string): void; + + /** Sets the character set encoding for this buffer. */ + setEncoding(encoding: string): void; + + /** Returns the string encoding of this buffer. */ + getEncoding(): string; + + /** Get the path of the associated file. */ + getUri(): string; + + /** Identifies if the buffer belongs to multiple editors. */ + hasMultipleEditors(): boolean; + + // Reading Text + /** Determine whether the buffer is empty. */ + isEmpty(): boolean; + + /** Get the entire text of the buffer. */ + getText(): string; + + /** Get the text in a range. */ + getTextInRange(range: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]): string; + + /** Get the text of all lines in the buffer, without their line endings. */ + getLines(): string[]; + + /** Get the text of the last line of the buffer, without its line ending. */ + getLastLine(): string; + + /** Get the text of the line at the given row, without its line ending. */ + lineForRow(row: number): string|undefined; + + /** Get the line ending for the given 0-indexed row. */ + lineEndingForRow(row: number): string|undefined; + + /** Get the length of the line for the given 0-indexed row, without its line + * ending. + */ + lineLengthForRow(row: number): number; + + /** Determine if the given row contains only whitespace. */ + isRowBlank(row: number): boolean; + + /** Given a row, find the first preceding row that's not blank. + * Returns a number or null if there's no preceding non-blank row. + */ + previousNonBlankRow(startRow: number): number|null; + + /** Given a row, find the next row that's not blank. + * Returns a number or null if there's no next non-blank row. + */ + nextNonBlankRow(startRow: number): number|null; + + // Mutating Text + /** Replace the entire contents of the buffer with the given text. */ + setText(text: string): Range; + + /** Replace the current buffer contents by applying a diff based on the + * given text. + */ + setTextViaDiff(text: string): void; + + /** Set the text in the given range. */ + setTextInRange(range: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]], text: string, + options?: { normalizeLineEndings?: boolean, undo?: "skip" }): Range; + + /** Insert text at the given position. */ + insert(position: PointLike|[number, number], text: string, options?: { + normalizeLineEndings?: boolean, + undo?: "skip" + }): Range; + + /** Append text to the end of the buffer. */ + append(text: string, options?: { + normalizeLineEndings?: boolean, + undo?: "skip" + }): Range; + + /** Delete the text in the given range. */ + delete(range: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]): Range; + + /** Delete the line associated with a specified row. */ + deleteRow(row: number): Range; + + /** Delete the lines associated with the specified row range. */ + deleteRows(startRow: number, endRow: number): Range; + + // Markers + /** Create a layer to contain a set of related markers. */ + addMarkerLayer(options?: { + maintainHistory?: boolean, + persistent?: boolean + }): MarkerLayer; + + /** Get a MarkerLayer by id. + * Returns a MarkerLayer or `` if no layer exists with the given id. + */ + getMarkerLayer(id: string): MarkerLayer|undefined; + + /** Get the default MarkerLayer. */ + getDefaultMarkerLayer(): MarkerLayer; + + /** Create a marker with the given range in the default marker layer. */ + markRange(range: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]], properties?: + { reversed?: boolean, invalidate?: "never"|"surround"|"overlap"|"inside"|"touch", + exclusive?: boolean }): Marker; + + /** Create a marker at the given position with no tail in the default marker layer. */ + markPosition(position: PointLike|[number, number], options?: { + invalidate?: "never"|"surround"|"overlap"|"inside"|"touch", + exclusive?: boolean + }): Marker; + + /** Get all existing markers on the default marker layer. */ + getMarkers(): Marker[]; + + /** Get an existing marker by its id from the default marker layer. */ + getMarker(id: number): Marker; + + /** Find markers conforming to the given parameters in the default marker layer. */ + findMarkers(params: Options.FindMarker): Marker[]; + + /** Get the number of markers in the default marker layer. */ + getMarkerCount(): number; + + // History + /** Undo the last operation. If a transaction is in progress, aborts it. */ + undo(): boolean; + + /** Redo the last operation. */ + redo(): boolean; + + /** Batch multiple operations as a single undo/redo step. */ + transact(groupingInterval: number, fn: () => T): T; + transact(fn: () => T): T; + + /** Call within a transaction to terminate the function's execution and + * revert any changes performed up to the abortion. + */ + abortTransaction(): void; + + /** Clear the undo stack. When calling this method within a transaction, + * the ::onDidChangeText event will not be triggered because the information + * describing the changes is lost. + */ + clearUndoStack(): void; + + /** Create a pointer to the current state of the buffer for use with + * ::revertToCheckpoint and ::groupChangesSinceCheckpoint. + */ + createCheckpoint(): number; + + /** Revert the buffer to the state it was in when the given checkpoint was created. + * Returns a boolean indicating whether the operation succeeded. + */ + revertToCheckpoint(checkpoint: number): boolean; + + /** Group all changes since the given checkpoint into a single transaction for + * purposes of undo/redo. + * Returns a boolean indicating whether the operation succeeded. + */ + groupChangesSinceCheckpoint(checkpoint: number): boolean; + + /** Returns a list of changes since the given checkpoint. + * If the given checkpoint is no longer present in the undo history, this method + * will return an empty Array. + */ + getChangesSinceCheckpoint(checkpoint: number): Array<{ + /** A Point representing where the change started. */ + start: Point, + + /** A Point representing the replaced extent. */ + oldExtent: Point, + + /** A Point representing the replacement extent. */ + newExtent: Point, + + /** A String representing the replacement text. */ + newText: string + }>; + + // Search and Replace + /** Scan regular expression matches in the entire buffer, calling the given + * iterator function on each match. + */ + scan(regex: RegExp, iterator: (params: Structures.BufferScanResult) => void): void; + /** Scan regular expression matches in the entire buffer, calling the given + * iterator function on each match. + */ + scan(regex: RegExp, options: Options.ScanContext, iterator: (params: + Structures.ContextualBufferScanResult) => void): void; + + /** Scan regular expression matches in the entire buffer in reverse order, + * calling the given iterator function on each match. + */ + backwardsScan(regex: RegExp, iterator: (params: Structures.BufferScanResult) => void): + void; + /** Scan regular expression matches in the entire buffer in reverse order, + * calling the given iterator function on each match. + */ + backwardsScan(regex: RegExp, options: Options.ScanContext, iterator: (params: + Structures.ContextualBufferScanResult) => void): void; + + /** Scan regular expression matches in a given range , calling the given + * iterator function on each match. + */ + scanInRange(regex: RegExp, range: RangeLike|[PointLike, PointLike]|[PointLike, + [number, number]]|[[number, number], PointLike]|[[number, number], [number, number]], + iterator: (params: Structures.BufferScanResult) => void): void; + /** Scan regular expression matches in a given range , calling the given + * iterator function on each match. + */ + scanInRange(regex: RegExp, range: RangeLike|[PointLike, PointLike]|[PointLike, + [number, number]]|[[number, number], PointLike]|[[number, number], [number, number]], + options: Options.ScanContext, iterator: (params: + Structures.ContextualBufferScanResult) => void): void; + + /** Scan regular expression matches in a given range in reverse order, + * calling the given iterator function on each match. + */ + backwardsScanInRange(regex: RegExp, range: RangeLike|[PointLike, PointLike]|[PointLike, + [number, number]]|[[number, number], PointLike]|[[number, number], [number, number]], + iterator: (params: Structures.BufferScanResult) => void): void; + /** Scan regular expression matches in a given range in reverse order, + * calling the given iterator function on each match. + */ + backwardsScanInRange(regex: RegExp, range: RangeLike|[PointLike, PointLike]|[PointLike, + [number, number]]|[[number, number], PointLike]|[[number, number], [number, number]], + options: Options.ScanContext, iterator: (params: + Structures.ContextualBufferScanResult) => void): void; + + /** Replace all regular expression matches in the entire buffer. */ + replace(regex: RegExp, replacementText: string): number; + + // Buffer Range Details + /** Get the range spanning from [0, 0] to ::getEndPosition. */ + getRange(): Range; + + /** Get the number of lines in the buffer. */ + getLineCount(): number; + + /** Get the last 0-indexed row in the buffer. */ + getLastRow(): number; + + /** Get the first position in the buffer, which is always [0, 0]. */ + getFirstPosition(): Point; + + /** Get the maximal position in the buffer, where new text would be appended. */ + getEndPosition(): Point; + + /** Get the length of the buffer in characters. */ + getMaxCharacterIndex(): number; + + /** Get the range for the given row. */ + rangeForRow(row: number, includeNewline: boolean): Range; + + /** Convert a position in the buffer in row/column coordinates to an absolute + * character offset, inclusive of line ending characters. + */ + characterIndexForPosition(position: Point|[number, number]): number; + + /** Convert an absolute character offset, inclusive of newlines, to a position + * in the buffer in row/column coordinates. + */ + positionForCharacterIndex(offset: number): Point; + + /** Clip the given range so it starts and ends at valid positions. */ + clipRange(range: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]]): Range; + + /** Clip the given point so it is at a valid position in the buffer. */ + clipPosition(position: PointLike|[number, number]): Point; + + // Buffer Operations + /** Save the buffer. */ + save(): Promise; + + /** Save the buffer at a specific path. */ + saveAs(filePath: string): Promise; + + /** Reload the buffer's contents from disk. */ + reload(): void; + } + + /** Represents a buffer annotation that remains logically stationary even as the + * buffer changes. This is used to represent cursors, folds, snippet targets, + * misspelled words, and anything else that needs to track a logical location + * in the buffer over time. + */ + interface DisplayMarker { + // Construction and Destruction + /** Destroys the marker, causing it to emit the 'destroyed' event. Once destroyed, + * a marker cannot be restored by undo/redo operations. + */ + destroy(): void; + + /** Creates and returns a new DisplayMarker with the same properties as this marker. */ + copy(options?: Options.CopyMarker): DisplayMarker; + + // Event Subscription + /** Invoke the given callback when the state of the marker changes. */ + onDidChange(callback: (event: Events.DisplayMarkerChanged) => void): + EventKit.Disposable; + + /** Invoke the given callback when the marker is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + // TextEditorMarker Details + /** Returns a boolean indicating whether the marker is valid. Markers can be + * invalidated when a region surrounding them in the buffer is changed. + */ + isValid(): boolean; + + /** Returns a boolean indicating whether the marker has been destroyed. A marker + * can be invalid without being destroyed, in which case undoing the invalidating + * operation would restore the marker. + */ + isDestroyed(): boolean; + + /** Returns a boolean indicating whether the head precedes the tail. */ + isReversed(): boolean; + + /** Returns a boolean indicating whether changes that occur exactly at the marker's + * head or tail cause it to move. + */ + isExclusive(): boolean; + + /** Get the invalidation strategy for this marker. + * Valid values include: never, surround, overlap, inside, and touch. + */ + getInvalidationStrategy(): string; + + /** Returns an Object containing any custom properties associated with the marker. */ + getProperties(): object; + + /** Merges an Object containing new properties into the marker's existing properties. */ + setProperties(properties: object): void; + + /** Returns whether this marker matches the given parameters. */ + matchesProperties(attributes: Options.FindDisplayMarker): boolean; + + // Comparing to other markers + /** Compares this marker to another based on their ranges. */ + compare(other: DisplayMarker): number; + + /** Returns a boolean indicating whether this marker is equivalent to another + * marker, meaning they have the same range and options. + */ + isEqual(other: DisplayMarker): boolean; + + // Managing the marker's range + /** Gets the buffer range of this marker. */ + getBufferRange(): Range; + + /** Gets the screen range of this marker. */ + getScreenRange(): Range; + + /** Modifies the buffer range of this marker. */ + setBufferRange(bufferRange: RangeLike|[PointLike, PointLike]|[PointLike, + [number, number]]|[[number, number], PointLike]|[[number, number], [number, number]], + properties?: { reversed: boolean }): void; + + /** Modifies the screen range of this marker. */ + setScreenRange(screenRange: RangeLike|[PointLike, PointLike]|[PointLike, + [number, number]]|[[number, number], PointLike]|[[number, number], [number, number]], + options?: { reversed?: boolean, clipDirection?: "backward"|"forward"|"closest" }): void; + + /** Retrieves the screen position of the marker's start. This will always be + * less than or equal to the result of DisplayMarker::getEndScreenPosition. + */ + getStartScreenPosition(options?: { clipDirection: "backward"|"forward"|"closest" }): + Point; + + /** Retrieves the screen position of the marker's end. This will always be + * greater than or equal to the result of DisplayMarker::getStartScreenPosition. + */ + getEndScreenPosition(options?: { clipDirection: "backward"|"forward"|"closest" }): + Point; + + /** Retrieves the buffer position of the marker's head. */ + getHeadBufferPosition(): Point; + + /** Sets the buffer position of the marker's head. */ + setHeadBufferPosition(bufferPosition: PointLike|[number, number]): void; + + /** Retrieves the screen position of the marker's head. */ + getHeadScreenPosition(options?: { clipDirection: "backward"|"forward"|"closest" }): + Point; + + /** Sets the screen position of the marker's head. */ + setHeadScreenPosition(screenPosition: PointLike|[number, number], options?: + { clipDirection: "backward"|"forward"|"closest" }): void; + + /** Retrieves the buffer position of the marker's tail. */ + getTailBufferPosition(): Point; + + /** Sets the buffer position of the marker's tail. */ + setTailBufferPosition(bufferPosition: PointLike|[number, number]): void; + + /** Retrieves the screen position of the marker's tail. */ + getTailScreenPosition(options?: { clipDirection: "backward"|"forward"|"closest" }): + Point; + + /** Sets the screen position of the marker's tail. */ + setTailScreenPosition(screenPosition: PointLike|[number, number], options?: + { clipDirection: "backward"|"forward"|"closest" }): void; + + /** Retrieves the buffer position of the marker's start. This will always be less + * than or equal to the result of DisplayMarker::getEndBufferPosition. + */ + getStartBufferPosition(): Point; + + /** Retrieves the buffer position of the marker's end. This will always be greater + * than or equal to the result of DisplayMarker::getStartBufferPosition. + */ + getEndBufferPosition(): Point; + + /** Returns a boolean indicating whether the marker has a tail. */ + hasTail(): boolean; + + /** Plants the marker's tail at the current head position. After calling the + * marker's tail position will be its head position at the time of the call, + * regardless of where the marker's head is moved. + */ + plantTail(): void; + + /** Removes the marker's tail. After calling the marker's head position will be + * reported as its current tail position until the tail is planted again. + */ + clearTail(): void; + } + + /** Experimental: A container for a related set of markers at the DisplayLayer level. + * Wraps an underlying MarkerLayer on the TextBuffer. + * + * This API is experimental and subject to change on any release. + */ + interface DisplayMarkerLayer { + // Lifecycle + /** Destroy this layer. */ + destroy(): void; + + /** Destroy all markers in this layer. */ + clear(): void; + + /** Determine whether this layer has been destroyed. */ + isDestroyed(): boolean; + + // Event Subscription + /** Subscribe to be notified synchronously when this layer is destroyed. */ + onDidDestroy(callback: () => void): EventKit.Disposable; + + /** Subscribe to be notified asynchronously whenever markers are created, updated, + * or destroyed on this layer. Prefer this method for optimal performance when + * interacting with layers that could contain large numbers of markers. + */ + onDidUpdate(callback: () => void): EventKit.Disposable; + + /** Subscribe to be notified synchronously whenever markers are created on this + * layer. Avoid this method for optimal performance when interacting with layers + * that could contain large numbers of markers. + */ + onDidCreateMarker(callback: (marker: DisplayMarker|Marker) => void): EventKit.Disposable; + + // Marker creation + /** Create a marker with the given screen range. */ + markScreenRange(range: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]], options?: + { reversed?: boolean, invalidate?: "never"|"surround"|"overlap"|"inside"|"touch", + exclusive?: boolean, clipDirection?: "backward"|"forward"|"closest" }): DisplayMarker; + + /** Create a marker on this layer with its head at the given screen position + * and no tail. + */ + markScreenPosition(screenPosition: PointLike|[number, number], options?: { + invalidate?: "never"|"surround"|"overlap"|"inside"|"touch", exclusive?: boolean, + clipDirection?: "backward"|"forward"|"closest" }): DisplayMarker; + + /** Create a marker with the given buffer range. */ + markBufferRange(range: RangeLike|[PointLike, PointLike]|[PointLike, [number, number]]| + [[number, number], PointLike]|[[number, number], [number, number]], options?: { + reversed?: boolean, invalidate?: "never"|"surround"|"overlap"|"inside"|"touch", + exclusive?: boolean }): DisplayMarker; + + /** Create a marker on this layer with its head at the given buffer position and no tail. */ + markBufferPosition(bufferPosition: PointLike|[number, number], options?: { invalidate?: + "never"|"surround"|"overlap"|"inside"|"touch", exclusive?: boolean }): DisplayMarker; + + // Querying + /** Get an existing marker by its id. */ + getMarker(id: number): DisplayMarker; + + /** Get all markers in the layer. */ + getMarkers(): DisplayMarker[]; + + /** Get the number of markers in the marker layer. */ + getMarkerCount(): number; + + /** Find markers in the layer conforming to the given parameters. + * + * This method finds markers based on the given properties. Markers can be associated + * with custom properties that will be compared with basic equality. In addition, + * there are several special properties that will be compared with the range of the + * markers rather than their properties. + */ + findMarkers(properties: Options.FindDisplayMarker): DisplayMarker[]; + } } } -declare module "text-buffer" { - var _: TextBuffer.ITextBufferStatic; - export = _; -} +declare let tb: TextBuffer.Statics.TextBuffer; +export = tb; diff --git a/types/text-buffer/text-buffer-tests.ts b/types/text-buffer/text-buffer-tests.ts index 5b79f711cb..4594ac4c41 100644 --- a/types/text-buffer/text-buffer-tests.ts +++ b/types/text-buffer/text-buffer-tests.ts @@ -1,19 +1,807 @@ +import TextBuffer = require("text-buffer"); +import * as ImportTest from "text-buffer"; +declare let obj: object; +declare let bool: boolean; +declare let num: number; +declare let nums: number[]; +declare let str: string; +declare let strs: string[]; -declare var Point: TextBuffer.IPointStatic; +declare let buffer: TextBuffer.TextBuffer; +declare let displayMarker: TextBuffer.DisplayMarker; +declare let displayMarkers: TextBuffer.DisplayMarker[]; +declare let displayMarkerLayer: TextBuffer.DisplayMarkerLayer; +declare let marker: TextBuffer.Marker; +declare let markers: TextBuffer.Marker[]; +declare let markerLayer: TextBuffer.MarkerLayer; +declare let sub: EventKit.Disposable; -var pointA = new Point(1, 2); -pointA.row; -pointA.column; +// Point ====================================================================== +let point = new TextBuffer.Point(42, 42); +new TextBuffer.Point(); +new TextBuffer.Point(42); -var pointB = Point.fromObject({row: 2, column: 3}); -var pointC = Point.min(pointA, pointB); +// Properties +num = point.row; +num = point.column; -declare var TRange: TextBuffer.IRangeStatic; +// Construction +point = TextBuffer.Point.fromObject({ row: 42, column: 42 }, true); +point = point.copy(); +point = point.negate(); -var rangeA = new TRange(pointA, pointB); +// Comparison +point = TextBuffer.Point.min(point, point); +TextBuffer.Point.min([0, 0], [0, 0]); +TextBuffer.Point.min(point, [0, 0]); +TextBuffer.Point.min([0, 0], point); -declare var TextBufferStatic: TextBuffer.ITextBufferStatic; +num = point.compare(point); +point.compare([0, 0]); -var textBuffer = new TextBufferStatic("Hello, world!"); -textBuffer.getLineCount(); +bool = point.isEqual(point); +point.isEqual([0, 0]); + +bool = point.isLessThan(point); +point.isLessThan([0, 0]); + +bool = point.isLessThanOrEqual(point); +point.isLessThanOrEqual([0, 0]); + +bool = point.isGreaterThan(point); +point.isGreaterThan([0, 0]); + +bool = point.isGreaterThanOrEqual(point); +point.isGreaterThanOrEqual([0, 0]); + +// Operations +const frozenPoint: Readonly = point.freeze(); + +point = point.translate(point); +point.translate([0, 0]); + +point = point.traverse(point); +point.traverse([0, 0]); + +// Conversion +point.toArray(); +point.serialize(); +str = point.toString(); + +// Range ====================================================================== +let range = new TextBuffer.Range(point, point); +new TextBuffer.Range([0, 0], [0, 0]); +new TextBuffer.Range(point, [0, 0]); +new TextBuffer.Range([0, 0], point); + +// Properties +range.start; +range.end; + +// Construction +range = TextBuffer.Range.fromObject({ start: point, end: point}, true); +TextBuffer.Range.fromObject([point, point]); +TextBuffer.Range.fromObject([[0, 0], [0, 0]]); +TextBuffer.Range.fromObject([point, [0, 0]]); +TextBuffer.Range.fromObject([[0, 0], point]); + +range = range.copy(); +range = range.negate(); + +// Serialization and Deserialization +range = TextBuffer.Range.deserialize({}); +range.serialize(); + +// TextBuffer.Range Details +bool = range.isEmpty(); +bool = range.isSingleLine(); +num = range.getRowCount(); +nums = range.getRows(); + +// Operations +const frozenRange: Readonly = range.freeze(); +range = range.union(range); + +range = range.translate(point); +range.translate([0, 0]); +range.translate(point, point); +range.translate([0, 0], point); +range.translate(point, [0, 0]); +range.translate([0, 0], [0, 0]); + +range = range.traverse(point); +range.traverse([0, 0]); + +// Comparison +num = range.compare(range); +range.compare([point, point]); +range.compare([point, [0, 0]]); +range.compare([[0, 0], point]); +range.compare([[0, 0], [0, 0]]); + +bool = range.isEqual(range); +range.isEqual([point, point]); +range.isEqual([point, [0, 0]]); +range.isEqual([[0, 0], point]); +range.isEqual([[0, 0], [0, 0]]); + +bool = range.coversSameRows(range); + +bool = range.intersectsWith(range); +range.intersectsWith(range, true); + +bool = range.containsRange(range); +range.containsRange([point, point]); +range.containsRange([point, [0, 0]]); +range.containsRange([[0, 0], point]); +range.containsRange([[0, 0], [0, 0]]); +range.containsRange(range, true); +range.containsRange([point, point], false); +range.containsRange([point, [0, 0]], false); +range.containsRange([[0, 0], point], false); +range.containsRange([[0, 0], [0, 0]], false); + +bool = range.containsPoint(point); +range.containsPoint([0, 0]); +range.containsPoint(point, true); +range.containsPoint([0, 0], false); + +bool = range.intersectsRow(42); +bool = range.intersectsRowRange(42, 42); + +// Conversion +str = range.toString(); + +// TextBuffer ================================================================= +const shouldDestroyOnFileDelete = () => false; + +buffer = new TextBuffer("test"); +new TextBuffer(); +new TextBuffer({ text: "Test" }); +new TextBuffer({ shouldDestroyOnFileDelete }); +new TextBuffer({ text: "Test", shouldDestroyOnFileDelete }); + +async function bufferLoadFile() { + buffer = await TextBuffer.load("Test.file"); + buffer = await TextBuffer.load("Test.file", { encoding: "utf8" }); + buffer = await TextBuffer.load("Test.file", { shouldDestroyOnFileDelete }); + buffer = await TextBuffer.load("Test.file", { encoding: "utf8", shouldDestroyOnFileDelete }); +} + +buffer = TextBuffer.loadSync("Test.file"); +TextBuffer.loadSync("Test.file", { encoding: "utf8" }); +TextBuffer.loadSync("Test.file", { shouldDestroyOnFileDelete }); +TextBuffer.loadSync("Test.file", { encoding: "uft8", shouldDestroyOnFileDelete }); + +async function deserializeBuffer() { + buffer = await TextBuffer.deserialize({}); +} + +// Event Subscription +sub = buffer.onWillChange(() => void {}); +sub = buffer.onDidChange(() => void {}); +sub = buffer.onDidChangeText(() => void {}); + +sub = buffer.onDidStopChanging((event): void => { + for (const change of event.changes) { + change.newExtent; + } +}); + +sub = buffer.onDidConflict(() => void {}); +sub = buffer.onDidChangeModified(() => void {}); +sub = buffer.onDidUpdateMarkers(() => void {}); +sub = buffer.onDidCreateMarker(() => void {}); + +sub = buffer.onDidChangePath((path): void => { + str = path; +}); + +sub = buffer.onDidChangeEncoding(() => void {}); +sub = buffer.onWillSave(() => void {}); +sub = buffer.onDidSave(() => void {}); +sub = buffer.onDidDelete(() => void {}); +sub = buffer.onWillReload(() => void {}); +sub = buffer.onDidReload(() => void {}); +sub = buffer.onDidDestroy(() => void {}); +sub = buffer.onWillThrowWatchError(() => void {}); + +const stoppedChangingDelay = buffer.getStoppedChangingDelay(); + +// File Details +bool = buffer.isModified(); +bool = buffer.isInConflict(); + +const path = buffer.getPath(); +if (path) { + str = path.substr(0, 42); +} + +buffer.setPath("Test.file"); +buffer.setEncoding("utf8"); +str = buffer.getEncoding(); +str = buffer.getUri(); + +// Reading Text +bool = buffer.isEmpty(); +str = buffer.getText(); + +str = buffer.getTextInRange(range); +str = buffer.getTextInRange([point, point]); +str = buffer.getTextInRange([[0, 0], [0, 0]]); +str = buffer.getTextInRange([point, [0, 0]]); +str = buffer.getTextInRange([[0, 0], point]); + +strs = buffer.getLines(); +str = buffer.getLastLine(); + +const rowText = buffer.lineForRow(42); +if (rowText) { + str = rowText; +} + +const lineEnding = buffer.lineEndingForRow(42); +if (lineEnding) { + str = lineEnding; +} + +num = buffer.lineLengthForRow(42); +bool = buffer.isRowBlank(42); + +const prevRow = buffer.previousNonBlankRow(42); +if (prevRow) { + num = prevRow; +} + +const nextRow = buffer.nextNonBlankRow(42); +if (nextRow) { + num = nextRow; +} + +// Mutating Text +range = buffer.setText("Test"); +buffer.setTextViaDiff("Test"); + +range = buffer.setTextInRange(range, "Test"); +range = buffer.setTextInRange([point, point], "Test"); +range = buffer.setTextInRange([[0, 0], [0, 0]], "Test"); +range = buffer.setTextInRange([point, [0, 0]], "Test"); +range = buffer.setTextInRange([[0, 0], point], "Test"); +range = buffer.setTextInRange(range, "Test", { normalizeLineEndings: true }); +range = buffer.setTextInRange(range, "Test", { undo: "skip" }); +range = buffer.setTextInRange(range, "Test", { normalizeLineEndings: true, undo: "skip" }); +range = buffer.setTextInRange([[0, 0], [0, 0]], "Test", { undo: "skip" }); + +range = buffer.insert(point, "Test"); +buffer.insert([0, 0], "Test"); +buffer.insert(point, "Test", { normalizeLineEndings: true }); +buffer.insert(point, "Test", { undo: "skip" }); +buffer.insert(point, "Test", { normalizeLineEndings: true, undo: "skip" }); +buffer.insert([0, 0], "Test", { undo: "skip" }); + +range = buffer.append("Test"); +buffer.append("Test", { normalizeLineEndings: true }); +buffer.append("Test", { undo: "skip" }); +buffer.append("Test", { normalizeLineEndings: true, undo: "skip" }); + +range = buffer.delete(range); +buffer.delete([point, point]); +buffer.delete([[0, 0], [0, 0]]); +buffer.delete([point, [0, 0]]); +buffer.delete([[0, 0], point]); + +range = buffer.deleteRow(42); +range = buffer.deleteRows(42, 42); + +// Markers +markerLayer = buffer.addMarkerLayer(); +buffer.addMarkerLayer({ maintainHistory: true }); +buffer.addMarkerLayer({ persistent: true }); +buffer.addMarkerLayer({ maintainHistory: true, persistent: true }); + +const testMarkerLayer = buffer.getMarkerLayer("Test"); +if (testMarkerLayer) { + markerLayer = testMarkerLayer; +} + +markerLayer = buffer.getDefaultMarkerLayer(); + +marker = buffer.markRange(range); +buffer.markRange([point, point]); +buffer.markRange([[0, 0], [0, 0]]); +buffer.markRange([point, [0, 0]]); +buffer.markRange([[0, 0], point]); +buffer.markRange(range, { exclusive: true}); +buffer.markRange(range, { invalidate: "surround" }); +buffer.markRange(range, { reversed: true }); +buffer.markRange(range, { exclusive: true, invalidate: "surround", reversed: true }); +buffer.markRange([point, point], { exclusive: true }); + +marker = buffer.markPosition(point); +buffer.markPosition([0, 0]); +buffer.markPosition(point, { exclusive: true }); +buffer.markPosition(point, { invalidate: "never" }); +buffer.markPosition(point, { exclusive: true, invalidate: "surround" }); +buffer.markPosition([0, 0], { exclusive: true }); + +markers = buffer.getMarkers(); +marker = buffer.getMarker(42); + +markers = buffer.findMarkers({ + startPosition: point, + endPosition: point, + startsInRange: range, + endsInRange: range, + containsPoint: point, + containsRange: range, + startRow: num, + endRow: num, + intersectsRow: num, +}); +markers = buffer.findMarkers({ startsInRange: [point, point] }); +markers = buffer.findMarkers({ startsInRange: [point, [0, 0]] }); +markers = buffer.findMarkers({ startsInRange: [[0, 0], point] }); +markers = buffer.findMarkers({ startsInRange: [[0, 0], [0, 0]] }); + +num = buffer.getMarkerCount(); + +// History +bool = buffer.undo(); +bool = buffer.redo(); + +num = buffer.transact(500, (): number => 42); + +buffer.clearUndoStack(); +num = buffer.createCheckpoint(); +bool = buffer.revertToCheckpoint(42); +bool = buffer.groupChangesSinceCheckpoint(42); +buffer.getChangesSinceCheckpoint(42); + +// Search And Replace +buffer.scan(/r^Test/, (): void => {}); +buffer.scan(/r^Test/, (params) => { + num = params.match.index; + str = params.matchText; + range = params.range; + params.replace("Test"); + params.stop(); +}); +buffer.scan(/r^Test/, { + leadingContextLineCount: 5, + trailingContextLineCount: 5, +}, (params) => { + strs = params.leadingContextLines; + strs = params.trailingContextLines; +}); + +buffer.backwardsScan(/r^Test/, (): void => {}); +buffer.backwardsScan(/r^Test/, (params) => { + num = params.match.index; + str = params.matchText; + range = params.range; + params.replace("Test"); + params.stop(); +}); +buffer.backwardsScan(/r^Test/, { + leadingContextLineCount: 5, + trailingContextLineCount: 5, +}, (params) => { + strs = params.leadingContextLines; + strs = params.trailingContextLines; +}); + +buffer.scanInRange(/r^Test/, range, (): void => {}); +buffer.scanInRange(/r^Test/, range, (params) => { + num = params.match.index; + str = params.matchText; + range = params.range; + params.replace("Test"); + params.stop(); +}); +buffer.scanInRange(/r^Test/, range, { + leadingContextLineCount: 5, + trailingContextLineCount: 5, +}, (params) => { + strs = params.leadingContextLines; + strs = params.trailingContextLines; +}); +buffer.scanInRange(/r^Test/, [point, point], (): void => {}); +buffer.scanInRange(/r^Test/, [[0, 0], [0, 0]], (): void => {}); +buffer.scanInRange(/r^Test/, [point, [0, 0]], (): void => {}); +buffer.scanInRange(/r^Test/, [[0, 0], point], (): void => {}); +buffer.scanInRange(/r^Test/, [[0, 0], [0, 0]], { trailingContextLineCount: 42 }, + (): void => {}); + +buffer.backwardsScanInRange(/r^Test/, range, (): void => {}); +buffer.backwardsScanInRange(/r^Test/, range, (params) => { + num = params.match.index; + str = params.matchText; + range = params.range; + params.replace("Test"); + params.stop(); +}); +buffer.backwardsScanInRange(/r^Test/, range, { + leadingContextLineCount: 5, + trailingContextLineCount: 5, +}, (params) => { + strs = params.leadingContextLines; + strs = params.trailingContextLines; +}); +buffer.backwardsScanInRange(/r^Test/, [point, point], (): void => {}); +buffer.backwardsScanInRange(/r^Test/, [[0, 0], [0, 0]], (): void => {}); +buffer.backwardsScanInRange(/r^Test/, [point, [0, 0]], (): void => {}); +buffer.backwardsScanInRange(/r^Test/, [[0, 0], point], (): void => {}); +buffer.backwardsScanInRange(/r^Test/, [[0, 0], [0, 0]], { trailingContextLineCount: 42 }, + (): void => {}); + +num = buffer.replace(/r^Test/, "Test"); + +// Buffer TextBuffer.Range Details +range = buffer.getRange(); +num = buffer.getLineCount(); +num = buffer.getLastRow(); +point = buffer.getFirstPosition(); +point = buffer.getEndPosition(); +num = buffer.getMaxCharacterIndex(); +range = buffer.rangeForRow(42, true); +num = buffer.characterIndexForPosition(point); +point = buffer.positionForCharacterIndex(42); + +range = buffer.clipRange(range); +range = buffer.clipRange([point, point]); +range = buffer.clipRange([point, [0, 0]]); +range = buffer.clipRange([[0, 0], point]); +range = buffer.clipRange([[0, 0], [0, 0]]); + +point = buffer.clipPosition(point); +point = buffer.clipPosition([0, 0]); + +// Buffer Operations +async function saveBuffer() { + await buffer.save(); + await buffer.saveAs("Test.file"); +} + +buffer.reload(); + +// Marker ===================================================================== +// Properties +num = marker.id; +bool = marker.tailed; +bool = marker.reversed; +bool = marker.valid; +str = marker.invalidate; + +// Lifecycle +marker = marker.copy({ + tailed: true, + reversed: true, + invalidate: "surround", + exclusive: false, + properties: { custom: "prop" }, +}); + +marker.destroy(); + +// Event Subscription +sub = marker.onDidDestroy(() => {}); + +sub = marker.onDidChange(event => { + event.oldHeadPosition; + event.newHeadPosition; + event.oldTailPosition; + event.newTailPosition; + event.wasValid; + event.isValid; + event.hadTail; + event.hasTail; + event.oldProperties; + event.newProperties; + event.textChanged; +}); + +// Marker Details +range = marker.getRange(); +point = marker.getHeadPosition(); +point = marker.getTailPosition(); +point = marker.getStartPosition(); +point = marker.getEndPosition(); +bool = marker.isReversed(); +bool = marker.hasTail(); +bool = marker.isValid(); +bool = marker.isDestroyed(); +bool = marker.isExclusive(); +str = marker.getInvalidationStrategy(); + +// Mutating Markers +bool = marker.setRange(range); +bool = marker.setRange([point, point]); +bool = marker.setRange([point, [0, 0]]); +bool = marker.setRange([[0, 0], point]); +bool = marker.setRange([[0, 0], [0, 0]]); +bool = marker.setRange([point, point], { exclusive: false }); +bool = marker.setRange(range, { exclusive: true, reversed: false }); + +bool = marker.setHeadPosition(point); +bool = marker.setHeadPosition([0, 0]); + +bool = marker.setTailPosition(point); +bool = marker.setTailPosition([0, 0]); + +bool = marker.clearTail(); +bool = marker.plantTail(); + +// Comparison +bool = marker.isEqual(marker); +num = marker.compare(marker); + +// MarkerLayer ================================================================ +// Lifecycle +markerLayer = markerLayer.copy(); +bool = markerLayer.destroy(); +markerLayer.clear(); +bool = markerLayer.isDestroyed(); + +// Querying +const potentialMarker = markerLayer.getMarker(42); +if (potentialMarker) marker = potentialMarker; + +markers = markerLayer.getMarkers(); +num = markerLayer.getMarkerCount(); + +markers = markerLayer.findMarkers({ + startPosition: point, + endPosition: point, + startsInRange: range, + endsInRange: range, + containsPoint: point, + containsRange: range, + startRow: num, + endRow: num, + intersectsRow: num, +}); +markers = markerLayer.findMarkers({ containsRange: [point, point] }); +markers = markerLayer.findMarkers({ containsRange: [point, [0, 0]] }); +markers = markerLayer.findMarkers({ containsRange: [[0, 0], point] }); +markers = markerLayer.findMarkers({ containsRange: [[0, 0], [0, 0]] }); + +// Marker creation +marker = markerLayer.markRange(range); +marker = markerLayer.markRange([point, point]); +marker = markerLayer.markRange([point, [0, 0]]); +marker = markerLayer.markRange([[0, 0], point]); +marker = markerLayer.markRange([[0, 0], [0, 0]]); +marker = markerLayer.markRange(range, { exclusive: true }); +marker = markerLayer.markRange([point, point], { invalidate: "never" }); +marker = markerLayer.markRange(range, { + exclusive: false, invalidate: "surround", reversed: false, +}); + +marker = markerLayer.markPosition(point); +marker = markerLayer.markPosition([0, 0]); +marker = markerLayer.markPosition(point, { exclusive: false }); +marker = markerLayer.markPosition([0, 0], { invalidate: "inside" }); +marker = markerLayer.markPosition(point, { exclusive: true, invalidate: "surround" }); + +// Event subscription +sub = markerLayer.onDidUpdate(() => {}); +sub = markerLayer.onDidCreateMarker(marker => marker.id); +sub = markerLayer.onDidDestroy(() => {}); + +// DisplayMarker ============================================================== +// Construction and Destruction +displayMarker.destroy(); + +displayMarker = displayMarker.copy(); +displayMarker = displayMarker.copy({}); +displayMarker = displayMarker.copy({ + tailed: true, + reversed: false, + invalidate: "never", + exclusive: false, + properties: { deprecated: "property" }, +}); + +// Event Subscription +sub = displayMarker.onDidChange((event) => { event.hasTail; }); +sub = displayMarker.onDidDestroy(() => {}); + +// TextEditorMarker Details +bool = displayMarker.isValid(); +bool = displayMarker.isDestroyed(); +bool = displayMarker.isReversed(); +bool = displayMarker.isExclusive(); +str = displayMarker.getInvalidationStrategy(); +obj = displayMarker.getProperties(); +displayMarker.setProperties(obj); + +bool = displayMarker.matchesProperties({ + startBufferPosition: point, + endBufferPosition: point, + startScreenPosition: point, + endScreenPosition: point, + startsInBufferRange: range, + endsInBufferRange: range, + startsInScreenRange: range, + endsInScreenRange: range, + startBufferRow: num, + endBufferRow: num, + startScreenRow: num, + endScreenRow: num, + intersectsBufferRowRange: [num, num], + intersectsScreenRowRange: [num, num], + containsBufferRange: range, + containsBufferPosition: point, + containedInBufferRange: range, + containedInScreenRange: range, + intersectsBufferRange: range, + intersectsScreenRange: range, +}); +bool = displayMarker.matchesProperties({ + intersectsBufferRange: [point, point], +}); +bool = displayMarker.matchesProperties({ + intersectsBufferRange: [point, [0, 0]], +}); +bool = displayMarker.matchesProperties({ + intersectsBufferRange: [[0, 0], point], +}); +bool = displayMarker.matchesProperties({ + intersectsBufferRange: [[0, 0], [0, 0]], +}); + +// Comparing to other markers +num = displayMarker.compare(displayMarker); +bool = displayMarker.isEqual(displayMarker); + +// Managing the marker's range +range = displayMarker.getBufferRange(); +range = displayMarker.getScreenRange(); + +displayMarker.setBufferRange(range); +displayMarker.setBufferRange([point, point]); +displayMarker.setBufferRange([point, [0, 0]]); +displayMarker.setBufferRange([[0, 0], point]); +displayMarker.setBufferRange([[0, 0], [0, 0]]); +displayMarker.setBufferRange(range, { reversed: true }); + +displayMarker.setScreenRange(range); +displayMarker.setScreenRange([point, point]); +displayMarker.setScreenRange([point, [0, 0]]); +displayMarker.setScreenRange([[0, 0], point]); +displayMarker.setScreenRange([[0, 0], [0, 0]]); +displayMarker.setScreenRange(range, { reversed: false }); + +point = displayMarker.getStartScreenPosition(); +point = displayMarker.getStartScreenPosition({ clipDirection: "backward" }); + +point = displayMarker.getEndScreenPosition(); +point = displayMarker.getEndScreenPosition({ clipDirection: "forward" }); + +// Extended Methods +point = displayMarker.getHeadBufferPosition(); +displayMarker.setHeadBufferPosition(point); + +displayMarker.getHeadScreenPosition(); +displayMarker.getHeadScreenPosition({ clipDirection: "closest" }); + +displayMarker.setHeadScreenPosition(point); +displayMarker.setHeadScreenPosition([0, 0]); +displayMarker.setHeadScreenPosition(point, { clipDirection: "backward" }); + +point = displayMarker.getTailBufferPosition(); + +displayMarker.setTailBufferPosition(point); +displayMarker.setTailBufferPosition([0, 0]); + +point = displayMarker.getTailScreenPosition(); +point = displayMarker.getTailScreenPosition({ clipDirection: "forward" }); + +displayMarker.setTailScreenPosition(point); +displayMarker.setTailScreenPosition([0, 0]); +displayMarker.setTailScreenPosition(point, { clipDirection: "closest" }); + +point = displayMarker.getStartBufferPosition(); +point = displayMarker.getEndBufferPosition(); +bool = displayMarker.hasTail(); +displayMarker.plantTail(); +displayMarker.clearTail(); + +// DisplayMarkerLayer ========================================================= +// Lifecycle +displayMarkerLayer.destroy(); +displayMarkerLayer.clear(); +bool = displayMarkerLayer.isDestroyed(); + +// Event Subscription +sub = displayMarkerLayer.onDidDestroy(() => {}); +sub = displayMarkerLayer.onDidUpdate(() => {}); +sub = displayMarkerLayer.onDidCreateMarker((marker) => { marker.isReversed(); }); + +// Marker creation +displayMarker = displayMarkerLayer.markScreenRange(range); +displayMarker = displayMarkerLayer.markScreenRange(range, {}); +displayMarker = displayMarkerLayer.markScreenRange(range, { clipDirection: "forward" }); +displayMarker = displayMarkerLayer.markScreenRange(range, { exclusive: true }); +displayMarker = displayMarkerLayer.markScreenRange(range, { invalidate: "never" }); +displayMarker = displayMarkerLayer.markScreenRange(range, { reversed: true }); +displayMarker = displayMarkerLayer.markScreenRange(range, { clipDirection: "backward", + exclusive: false, invalidate: "overlap", reversed: false }); +displayMarker = displayMarkerLayer.markScreenRange([point, point]); +displayMarker = displayMarkerLayer.markScreenRange([point, [0, 0]]); +displayMarker = displayMarkerLayer.markScreenRange([[0, 0], point]); +displayMarker = displayMarkerLayer.markScreenRange([[0, 0], [0, 0]]); +displayMarker = displayMarkerLayer.markScreenRange([[0, 0], point], { reversed: true }); + +displayMarker = displayMarkerLayer.markScreenPosition(point); +displayMarker = displayMarkerLayer.markScreenPosition(point, {}); +displayMarker = displayMarkerLayer.markScreenPosition(point, { clipDirection: "forward" }); +displayMarker = displayMarkerLayer.markScreenPosition(point, { exclusive: true }); +displayMarker = displayMarkerLayer.markScreenPosition(point, { invalidate: "never" }); +displayMarker = displayMarkerLayer.markScreenPosition(point, { clipDirection: "backward", + exclusive: false, invalidate: "overlap" }); +displayMarker = displayMarkerLayer.markScreenPosition([0, 0]); +displayMarker = displayMarkerLayer.markScreenPosition([0, 0], { exclusive: false }); + +displayMarker = displayMarkerLayer.markBufferRange(range); +displayMarker = displayMarkerLayer.markBufferRange(range, {}); +displayMarker = displayMarkerLayer.markBufferRange(range, { invalidate: "inside" }); +displayMarker = displayMarkerLayer.markBufferRange(range, { exclusive: true }); +displayMarker = displayMarkerLayer.markBufferRange(range, { reversed: true }); +displayMarker = displayMarkerLayer.markBufferRange(range, { exclusive: false, + invalidate: "overlap", reversed: false }); +displayMarker = displayMarkerLayer.markBufferRange([point, point]); +displayMarker = displayMarkerLayer.markBufferRange([point, [0, 0]]); +displayMarker = displayMarkerLayer.markBufferRange([[0, 0], point]); +displayMarker = displayMarkerLayer.markBufferRange([[0, 0], [0, 0]]); +displayMarker = displayMarkerLayer.markBufferRange([[0, 0], point], { reversed: true }); + +displayMarker = displayMarkerLayer.markBufferPosition(point); +displayMarker = displayMarkerLayer.markBufferPosition(point, {}); +displayMarker = displayMarkerLayer.markBufferPosition(point, { exclusive: true }); +displayMarker = displayMarkerLayer.markBufferPosition(point, { invalidate: "never" }); +displayMarker = displayMarkerLayer.markBufferPosition(point, { exclusive: false, + invalidate: "overlap" }); +displayMarker = displayMarkerLayer.markBufferPosition([0, 0]); +displayMarker = displayMarkerLayer.markBufferPosition([0, 0], { exclusive: false }); + +// Querying +displayMarker = displayMarkerLayer.getMarker(42); +displayMarkers = displayMarkerLayer.getMarkers(); +num = displayMarkerLayer.getMarkerCount(); + +displayMarkers = displayMarkerLayer.findMarkers({ + startBufferPosition: point, + endBufferPosition: point, + startScreenPosition: point, + endScreenPosition: point, + startsInBufferRange: range, + endsInBufferRange: range, + startsInScreenRange: range, + endsInScreenRange: range, + startBufferRow: num, + endBufferRow: num, + startScreenRow: num, + endScreenRow: num, + intersectsBufferRowRange: [num, num], + intersectsScreenRowRange: [num, num], + containsBufferRange: range, + containsBufferPosition: point, + containedInBufferRange: range, + containedInScreenRange: range, + intersectsBufferRange: range, + intersectsScreenRange: range, +}); +displayMarkers = displayMarkerLayer.findMarkers({ + intersectsScreenRange: [point, point], +}); +displayMarkers = displayMarkerLayer.findMarkers({ + intersectsScreenRange: [point, [0, 0]], +}); +displayMarkers = displayMarkerLayer.findMarkers({ + intersectsScreenRange: [[0, 0], point], +}); +displayMarkers = displayMarkerLayer.findMarkers({ + intersectsScreenRange: [[0, 0], [0, 0]], +}); diff --git a/types/text-buffer/tsconfig.json b/types/text-buffer/tsconfig.json index ebee922349..cdb73c99ce 100644 --- a/types/text-buffer/tsconfig.json +++ b/types/text-buffer/tsconfig.json @@ -7,14 +7,11 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" ], - "paths": { - "q": [ "q/v0" ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -23,4 +20,4 @@ "index.d.ts", "text-buffer-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/text-buffer/tslint.json b/types/text-buffer/tslint.json new file mode 100644 index 0000000000..cd8f17056a --- /dev/null +++ b/types/text-buffer/tslint.json @@ -0,0 +1,38 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // Custom rules. + "class-name": true, + "indent": [true, "tabs"], + "jsdoc-format": true, + "linebreak-style": [true, "LF"], + "max-line-length": [true, 100], + "quotemark": [true, "double", "avoid-escape"], + "trailing-comma": [true, { + "multiline": { "objects": "always", "arrays": "always", "functions": "never" }, + "singleline": { "objects": "never", "arrays": "never", "functions": "never" } + }], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-type", + "check-typecast", + "check-rest-spread", + "check-preblock" + ], + // Soon to be defaults. + "arrow-return-shorthand": [true, "multiline"], + "no-any": true, + "no-floating-promises": true, + "no-unbound-method": true, + "no-unsafe-any": true, + "number-literal-format": true, + "restrict-plus-operands": true, + "return-undefined": true, + "switch-final-break": true + } +} diff --git a/types/text-buffer/v0/index.d.ts b/types/text-buffer/v0/index.d.ts new file mode 100644 index 0000000000..6d171e622c --- /dev/null +++ b/types/text-buffer/v0/index.d.ts @@ -0,0 +1,301 @@ +// Type definitions for text-buffer +// Project: https://github.com/atom/text-buffer +// Definitions by: vvakame +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +declare namespace TextBuffer { + + interface IPointStatic { + new (row?:number, column?:number):IPoint; + + fromObject(point:IPoint, copy?:boolean):IPoint; + fromObject(object:number[]):IPoint; + fromObject(object:{row:number; column:number;}):IPoint; + + min(point1:IPoint, point2:IPoint):IPoint; + min(point1:number[], point2:IPoint):IPoint; + min(point1:{row:number; column:number;}, point2:IPoint):IPoint; + + min(point1:IPoint, point2:number[]):IPoint; + min(point1:number[], point2:number[]):IPoint; + min(point1:{row:number; column:number;}, point2:number[]):IPoint; + + min(point1:IPoint, point2:{row:number; column:number;}):IPoint; + min(point1:number[], point2:{row:number; column:number;}):IPoint; + min(point1:{row:number; column:number;}, point2:{row:number; column:number;}):IPoint; + } + + interface IPoint { + constructor: IPointStatic; + + row:number; + column:number; + + copy():IPoint; + freeze():IPoint; + + translate(delta:IPoint):IPoint; + translate(delta:number[]):IPoint; + translate(delta:{row:number; column:number;}):IPoint; + + add(other:IPoint):IPoint; + add(other:number[]):IPoint; + add(other:{row:number; column:number;}):IPoint; + + splitAt(column:number):IPoint[]; + compare(other:IPoint):number; + isEqual(other:IPoint):boolean; + isLessThan(other:IPoint):boolean; + isLessThanOrEqual(other:IPoint):boolean; + isGreaterThan(other:IPoint):boolean; + isGreaterThanOrEqual(other:IPoint):boolean; + toArray():number[]; + serialize():number[]; + } + + interface IRangeStatic { + deserialize(array:IPoint[]):IRange; + + fromObject(object:IPoint[]):IRange; + + fromObject(object:IRange, copy?:boolean):IRange; + + fromObject(object:{start: IPoint; end: IPoint}):IRange; + fromObject(object:{start: number[]; end: IPoint}):IRange; + fromObject(object:{start: {row:number; column:number;}; end: IPoint}):IRange; + + fromObject(object:{start: IPoint; end: number[]}):IRange; + fromObject(object:{start: number[]; end: number[]}):IRange; + fromObject(object:{start: {row:number; column:number;}; end: number[]}):IRange; + + fromObject(object:{start: IPoint; end: {row:number; column:number;}}):IRange; + fromObject(object:{start: number[]; end: {row:number; column:number;}}):IRange; + fromObject(object:{start: {row:number; column:number;}; end: {row:number; column:number;}}):IRange; + + fromText(point:IPoint, text:string):IRange; + fromText(point:number[], text:string):IRange; + fromText(point:{row:number; column:number;}, text:string):IRange; + fromText(text:string):IRange; + + fromPointWithDelta(startPoint:IPoint, rowDelta:number, columnDelta:number):IRange; + fromPointWithDelta(startPoint:number[], rowDelta:number, columnDelta:number):IRange; + fromPointWithDelta(startPoint:{row:number; column:number;}, rowDelta:number, columnDelta:number):IRange; + + new(point1:IPoint, point2:IPoint):IRange; + new(point1:number[], point2:IPoint):IRange; + new(point1:{row:number; column:number;}, point2:IPoint):IRange; + + new(point1:IPoint, point2:number[]):IRange; + new(point1:number[], point2:number[]):IRange; + new(point1:{row:number; column:number;}, point2:number[]):IRange; + + new(point1:IPoint, point2:{row:number; column:number;}):IRange; + new(point1:number[], point2:{row:number; column:number;}):IRange; + new(point1:{row:number; column:number;}, point2:{row:number; column:number;}):IRange; + } + + interface IRange { + constructor:IRangeStatic; + + start: IPoint; + end: IPoint; + + serialize():number[][]; + copy():IRange; + freeze():IRange; + isEqual(other:IRange):boolean; + isEqual(other:IPoint[]):boolean; + + compare(object:IPoint[]):number; + + compare(object:{start: IPoint; end: IPoint}):number; + compare(object:{start: number[]; end: IPoint}):number; + compare(object:{start: {row:number; column:number;}; end: IPoint}):number; + + compare(object:{start: IPoint; end: number[]}):number; + compare(object:{start: number[]; end: number[]}):number; + compare(object:{start: {row:number; column:number;}; end: number[]}):number; + + compare(object:{start: IPoint; end: {row:number; column:number;}}):number; + compare(object:{start: number[]; end: {row:number; column:number;}}):number; + compare(object:{start: {row:number; column:number;}; end: {row:number; column:number;}}):number; + + isSingleLine():boolean; + coversSameRows(other:IRange):boolean; + + add(object:IPoint[]):IRange; + + add(object:{start: IPoint; end: IPoint}):IRange; + add(object:{start: number[]; end: IPoint}):IRange; + add(object:{start: {row:number; column:number;}; end: IPoint}):IRange; + + add(object:{start: IPoint; end: number[]}):IRange; + add(object:{start: number[]; end: number[]}):IRange; + add(object:{start: {row:number; column:number;}; end: number[]}):IRange; + + add(object:{start: IPoint; end: {row:number; column:number;}}):IRange; + add(object:{start: number[]; end: {row:number; column:number;}}):IRange; + add(object:{start: {row:number; column:number;}; end: {row:number; column:number;}}):IRange; + + translate(startPoint:IPoint, endPoint:IPoint):IRange; + translate(startPoint:IPoint):IRange; + + intersectsWith(otherRange:IRange):boolean; + containsRange(otherRange:IRange, exclusive:boolean):boolean; + + containsPoint(point:IPoint, exclusive:boolean):boolean; + containsPoint(point:number[], exclusive:boolean):boolean; + containsPoint(point:{row:number; column:number;}, exclusive:boolean):boolean; + + intersectsRow(row:number):boolean; + intersectsRowRange(startRow:number, endRow:number):boolean; + union(otherRange:IRange):IRange; + isEmpty():boolean; + toDelta():IPoint; + getRowCount():number; + getRows():number[]; + } + + interface IHistory { + // TBD + } + + interface IMarkerManager { + // TBD + } + + interface IMarker { + // TBD + } + + interface IBufferPatch { + // TBD + } + + interface ITextBufferStatic { + Point: IPointStatic; + Range: IRangeStatic; + newlineRegex:any; + + new (text:string): ITextBuffer; + new (params:any): ITextBuffer; + } + + interface ITextBuffer extends Emissary.IEmitter, Emissary.ISubscriber { + // Delegator.includeInto(TextBuffer); + // Serializable.includeInto(TextBuffer); + + cachedText:string; + stoppedChangingDelay:number; + stoppedChangingTimeout:any; + cachedDiskContents:string; + conflict:boolean; + file:any; // pathwatcher.IFile + refcount:number; + + lines:string[]; + lineEndings:string[]; + offsetIndex:any; // span-skip-list.SpanSkipList + history:IHistory; + markers:IMarkerManager; + loaded:boolean; + digestWhenLastPersisted:string; + modifiedWhenLastPersisted:boolean; + useSerializedText:boolean; + + deserializeParams(params:any):any; + serializeParams():any; + + getText():string; + getLines():string; + isEmpty():boolean; + getLineCount():number; + getLastRow():number; + lineForRow(row:number):string; + getLastLine():string; + lineEndingForRow(row:number):string; + lineLengthForRow(row:number):number; + setText(text:string):IRange; + setTextViaDiff(text:any):any[]; + setTextInRange(range:IRange, text:string, normalizeLineEndings?:boolean):IRange; + insert(position:IPoint, text:string, normalizeLineEndings?:boolean):IRange; + append(text:string, normalizeLineEndings?:boolean):IRange; + delete(range:IRange):IRange; + deleteRow(row:number):IRange; + deleteRows(startRow:number, endRow:number):IRange; + buildPatch(oldRange:IRange, newText:string, normalizeLineEndings?:boolean):IBufferPatch; + applyPatch(patch:IBufferPatch):any; + getTextInRange(range:IRange):string; + clipRange(range:IRange):IRange; + clipPosition(position:IPoint):IPoint; + getFirstPosition():IPoint; + getEndPosition():IPoint; + getRange():IRange; + rangeForRow(row:number, includeNewline?:boolean):IRange; + characterIndexForPosition(position:IPoint):number; + positionForCharacterIndex(offset:number):IPoint; + getMaxCharacterIndex():number; + loadSync():ITextBuffer; + load():Promise; + finishLoading():ITextBuffer; + handleTextChange(event:any):any; + destroy():any; + isAlive():boolean; + isDestroyed():boolean; + isRetained():boolean; + retain():ITextBuffer; + release():ITextBuffer; + subscribeToFile():any; + hasMultipleEditors():boolean; + reload():any; + updateCachedDiskContentsSync():string; + updateCachedDiskContents():Promise; + getBaseName():string; + getPath():string; + getUri():string; + setPath(filePath:string):any; + save():void; + saveAs(filePath:string):any; + isModified():boolean; + isInConflict():boolean; + destroyMarker(id:any):any; + matchesInCharacterRange(regex:any, startIndex:any, endIndex:any):any[]; + scan(regex:any, iterator:any):any; + backwardsScan(regex:any, iterator:any):any; + replace(regex:any, replacementText:any):any; + scanInRange(regex:any, range:any, iterator:any, reverse:any):any; + backwardsScanInRange(regex:any, range:any, iterator:any):any; + isRowBlank(row:number):boolean; + previousNonBlankRow(startRow:number):number; + nextNonBlankRow(startRow:number):number; + usesSoftTabs():boolean; + cancelStoppedChangingTimeout():any; + scheduleModifiedEvents():any; + emitModifiedStatusChanged(modifiedStatus:any):any; + logLines(start:number, end:number):void; + + // delegate to history property + undo():any; + redo():any; + transact(fn:Function):any; + beginTransaction():any; + commitTransaction():any; + abortTransaction():any; + clearUndoStack():any; + + // delegate to markers property + markRange(range:any, properties:any):any; + markPosition(range:any, properties:any):any; + getMarker(id:number):IMarker; + getMarkers():IMarker[]; + getMarkerCount():number; + } +} + +declare module "text-buffer" { + var _: TextBuffer.ITextBufferStatic; + export = _; +} diff --git a/types/text-buffer/v0/text-buffer-tests.ts b/types/text-buffer/v0/text-buffer-tests.ts new file mode 100644 index 0000000000..5b79f711cb --- /dev/null +++ b/types/text-buffer/v0/text-buffer-tests.ts @@ -0,0 +1,19 @@ + + +declare var Point: TextBuffer.IPointStatic; + +var pointA = new Point(1, 2); +pointA.row; +pointA.column; + +var pointB = Point.fromObject({row: 2, column: 3}); +var pointC = Point.min(pointA, pointB); + +declare var TRange: TextBuffer.IRangeStatic; + +var rangeA = new TRange(pointA, pointB); + +declare var TextBufferStatic: TextBuffer.ITextBufferStatic; + +var textBuffer = new TextBufferStatic("Hello, world!"); +textBuffer.getLineCount(); diff --git a/types/text-buffer/v0/tsconfig.json b/types/text-buffer/v0/tsconfig.json new file mode 100644 index 0000000000..3acf4b7176 --- /dev/null +++ b/types/text-buffer/v0/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "text-buffer": [ "text-buffer/v0" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "text-buffer-tests.ts" + ] +} From 9a30fc6a19e09fee6a9536517b0ae0717c33046f Mon Sep 17 00:00:00 2001 From: Kevin Greene <30637378+kevin-greene-ck@users.noreply.github.com> Date: Mon, 2 Oct 2017 10:42:40 -0700 Subject: [PATCH 28/67] [thrift] Update Thrift types for completeness and correctness (#20088) * [thrift] Update Thrift types for completeness and correctness * This adds all of the missing public exports from "thrift" * Correct error in evernote using import * as Thrift from 'thrift'. This should be import { Thrift } from 'thrift'. They were using Thrift.TException which is not exported from the top level of 'thrift'. It is nested in the Thrift namespace. * [thrift] Add WSConnection to Thrift types * [thrift] Loosen types for transport constructors * Transports will create Buffers if their constructors do not receive them. * [thrift] Removing some ugly interface constructors in favor of classes * [thrift] ConnectOptions should take a constructor for transport and protocol * Adding tests for the above --- types/evernote/index.d.ts | 3 +- types/evernote/tsconfig.json | 3 +- types/thrift/index.d.ts | 599 +++++++++++++++++++++++++++++++++-- types/thrift/thrift-tests.ts | 132 +++++++- types/thrift/tsconfig.json | 3 +- 5 files changed, 702 insertions(+), 38 deletions(-) diff --git a/types/evernote/index.d.ts b/types/evernote/index.d.ts index 65765259c3..a6bff784ab 100644 --- a/types/evernote/index.d.ts +++ b/types/evernote/index.d.ts @@ -2,8 +2,9 @@ // Project: https://www.npmjs.com/package/evernote // Definitions by: Zachary Collins // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -import * as Thrift from 'thrift'; +import { Thrift } from 'thrift'; declare namespace Evernote { interface Callback { diff --git a/types/evernote/tsconfig.json b/types/evernote/tsconfig.json index ee72e55520..ecf7678a0d 100644 --- a/types/evernote/tsconfig.json +++ b/types/evernote/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/thrift/index.d.ts b/types/thrift/index.d.ts index ed3fb13659..f31fdb129e 100644 --- a/types/thrift/index.d.ts +++ b/types/thrift/index.d.ts @@ -1,42 +1,585 @@ // Type definitions for thrift 0.10 // Project: https://www.npmjs.com/package/thrift // Definitions by: Kamek +// Kevin Greene // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -export as namespace Thrift; +/// -export class TException {} +import * as net from 'net'; +import * as http from 'http'; +import * as tls from 'tls'; -/** - * Protocols and Transports - */ -export class TBufferedTransport {} -export class TXHRTransport {} -export class TJSONProtocol {} -export class TBinaryProtocol {} +// Thrift re-exports node-int64 and Q +import Int64 = require('node-int64'); +export { Int64 as Int64 }; +import Q = require('q'); +export { Q as Q }; -/** - * Server side - */ -export interface ThriftServer { - listen(port: number): any; +export interface TMap { + ktype: Thrift.Type; + vtype: Thrift.Type; + size: number; } -export function createServer(generatedService: any, serviceMethods: any): ThriftServer; - -/** - * Client side - */ -export type ConnexionEvent = 'open' | 'message' | 'close' | 'error'; - -export interface ClientConnectionParams { - transport: TJSONProtocol | TBinaryProtocol; - protocol: TBufferedTransport | TXHRTransport; +export interface TMessage { + fname: string; + mtype: Thrift.MessageType; + rseqid: number; } -export interface ClientConnection { - on(event: ConnexionEvent, callback: (...args: any[]) => void): void; +export interface TField { + fname: string; + ftype: Thrift.Type; + fid: number; } -export function createConnection(host: string, port: number, params: ClientConnectionParams): ClientConnection; -export function createClient(generatedService: any, connection: {}): any; +export interface TList { + etype: Thrift.Type; + size: number; +} + +export interface TSet { + etype: Thrift.Type; + size: number; +} + +export interface TStruct { + fname: string; +} + +export interface TTransport { + commitPosition(): void; + rollbackPosition(): void; + isOpen(): boolean; + open(): boolean; + close(): boolean; + setCurrSeqId(seqId: number): void; + ensureAvailable(len: number): void; + read(len: number): Buffer; + readByte(): number; + readI16(): number; + readI32(): number; + readDouble(): number; + readString(): string; + write(buf: Buffer | string): void; + flush(): void; +} + +export interface TProtocol { + flush(): void; + writeMessageBegin(name: string, type: Thrift.MessageType, seqid: number): void; + writeMessageEnd(): void; + writeStructBegin(name: string): void; + writeStructEnd(): void; + writeFieldBegin(name: string, type: Thrift.Type, id: number): void; + writeFieldEnd(): void; + writeFieldStop(): void; + writeMapBegin(ktype: Thrift.Type, vtype: Thrift.Type, size: number): void; + writeMapEnd(): void; + writeListBegin(etype: Thrift.Type, size: number): void; + writeListEnd(): void; + writeSetBegin(etype: Thrift.Type, size: number): void; + writeSetEnd(): void; + writeBool(bool: boolean): void; + writeByte(b: number): void; + writeI16(i16: number): void; + writeI32(i32: number): void; + writeI64(i64: number | Int64): void; + writeDouble(dbl: number): void; + writeString(arg: string | Buffer): void; + writeBinary(arg: string | Buffer): void; + readMessageBegin(): TMessage; + readMessageEnd(): void; + readStructBegin(): TStruct; + readStructEnd(): void; + readFieldBegin(): TField; + readFieldEnd(): void; + readMapBegin(): TMap; + readMapEnd(): void; + readListBegin(): TList; + readListEnd(): void; + readSetBegin(): TSet; + readSetEnd(): void; + readBool(): boolean; + readByte(): number; + readI16(): number; + readI32(): number; + readI64(): Int64; + readDouble(): number; + readBinary(): Buffer; + readString(): string; + getTransport(): TTransport; + skip(type: Thrift.Type): void; +} + +export interface SeqId2Service { + [seqid: number]: string; +} + +export class Connection extends NodeJS.EventEmitter { + seqId2Service: SeqId2Service; + connection: net.Socket; + ssl: boolean; + options: ConnectOptions; + transport: TTransport; + protocol: TProtocol; + offline_queue: Buffer[]; + connected: boolean; + constructor(stream: net.Socket, options?: ConnectOptions); + end(): void; + destroy(): void; + initialize_retry_vars(): void; + write(data: Buffer): void; + connection_gone(): void; +} + +export class HttpConnection extends NodeJS.EventEmitter { + options: ConnectOptions; + host: string; + port: number; + https: boolean; + transport: TTransport; + protocol: TProtocol; + constructor(host: string, port: number, options?: ConnectOptions); + responseCallback(response: http.IncomingMessage): void; + write(data: Buffer): void; +} + +export class XHRConnection extends NodeJS.EventEmitter { + seqId2Service: SeqId2Service; + options: ConnectOptions; + wpos: number; + rpos: number; + useCORS: boolean; + send_buf: string; + recv_buf: string; + transport: TTransport; + protocol: TProtocol; + headers: http.OutgoingHttpHeaders; + constructor(host: string, port: number, options?: ConnectOptions); + getXmlHttpRequestObject(): XMLHttpRequest; + flush(): void; + setRecvBuffer(buf: string): void; + isOpen(): boolean; + open(): void; + close(): void; + read(len: number): string; + readAll(): string; + write(buf: string): void; + getSendBuffer(): string; +} + +export interface WSOptions { + host: string; + port: number; + path: string; + headers: http.OutgoingHttpHeaders; +} + +export class WSConnection extends NodeJS.EventEmitter { + seqId2Service: SeqId2Service; + options: ConnectOptions; + host: string; + port: number; + secure: boolean; + transport: TTransport; + protocol: TProtocol; + path: string; + send_pending: Buffer[]; + wsOptions: WSOptions; + constructor(host: string, port: number, options?: ConnectOptions); + isOpen(): boolean; + open(): void; + close(): void; + uri(): string; + write(data: Buffer): void; +} + +export class Multiplexer { + createClient(serviceName: string, client: TClientConstructor, connection: Connection): TClient; +} + +export class MultiplexedProcessor { + constructor(stream?: any, options?: any); + process(input: TProtocol, output: TProtocol): void; +} + +export type TTransportCallback = + (msg?: Buffer, seqid?: number) => void; + +export interface ServiceMap { + [uri: string]: ServerOptions; +} + +export interface ServiceOptions { + transport?: TTransportConstructor; + protocol?: TProtocolConstructor; + processor?: { new (handler: THandler): TProcessor }; + handler?: THandler; +} + +export interface ServerOptions extends ServiceOptions { + cors?: string[]; + files?: string; + headers?: http.IncomingHttpHeaders; + services?: ServiceMap; + tls?: tls.TlsOptions; +} + +export interface ConnectOptions { + transport?: TTransportConstructor; + protocol?: TProtocolConstructor; + path?: string; + headers?: http.OutgoingHttpHeaders; + https?: boolean; + debug?: boolean; + max_attempts?: number; + retry_max_delay?: number; + connect_timeout?: number; + timeout?: number; + nodeOptions?: http.ClientRequestArgs; +} + +export interface WSConnectOptions { + transport?: TTransportConstructor; + protocol?: TProtocolConstructor; + path?: string; + headers?: http.OutgoingHttpHeaders; + secure?: boolean; + wsOptions?: WSOptions; +} + +export type TClientConstructor = + { new (output: TTransport, pClass: { new (trans: TTransport): TProtocol }): TClient; } | + { Client: { new (output: TTransport, pClass: { new (trans: TTransport): TProtocol }): TClient; } }; + +export type TProcessorConstructor = + { new (handler: THandler): TProcessor } | + { Processor: { new (handler: THandler): TProcessor }}; + +export interface WebServerOptions { + services: { + [path: string]: { + processor: TProcessorConstructor; + handler: THandler; + } + }; +} + +export function createConnection(host: string | undefined, port: number, options?: ConnectOptions): Connection; +export function createSSLConnection(host: string | undefined, port: number, options?: ConnectOptions): Connection; +export function createHttpConnection(host: string | undefined, port: number, options?: ConnectOptions): HttpConnection; +export function createXHRConnection(host: string | undefined, port: number, options?: ConnectOptions): XHRConnection; +export function createWSConnectin(host: string | undefined, port: number, options?: WSConnectOptions): WSConnection; + +export function createXHRClient( + client: TClientConstructor, + connection: XHRConnection +): TClient; + +export function createHttpClient( + client: TClientConstructor, + connection: HttpConnection +): TClient; + +export function createWSClient( + client: TClientConstructor, + connection: WSConnection +): TClient; + +export function createStdIOClient( + client: TClientConstructor, + connection: Connection +): TClient; + +export function createClient( + client: TClientConstructor, + connection: Connection +): TClient; + +// THandler is going to be a hash of user-defined functions for prcessing RPC calls +export function createServer( + processor: TProcessorConstructor, + handler: THandler, + options?: ServerOptions +): http.Server | tls.Server; + +// tslint:disable-next-line no-unnecessary-generics +export function createWebServer(options: WebServerOptions): http.Server | tls.Server; + +export class TBufferedTransport implements TTransport { + constructor(buffer: Buffer | undefined, callback: TTransportCallback); + static receiver(callback: (trans: TBufferedTransport, seqid: number) => void, seqid: number): (data: Buffer) => void; + commitPosition(): void; + rollbackPosition(): void; + isOpen(): boolean; + open(): boolean; + close(): boolean; + setCurrSeqId(seqId: number): void; + ensureAvailable(len: number): void; + read(len: number): Buffer; + readByte(): number; + readI16(): number; + readI32(): number; + readDouble(): number; + readString(): string; + write(buf: Buffer | string): void; + flush(): void; +} + +export class TFramedTransport implements TTransport { + constructor(buffer: Buffer | undefined, callback: TTransportCallback); + static receiver(callback: (trans: TFramedTransport, seqid: number) => void, seqid: number): (data: Buffer) => void; + commitPosition(): void; + rollbackPosition(): void; + isOpen(): boolean; + open(): boolean; + close(): boolean; + setCurrSeqId(seqId: number): void; + ensureAvailable(len: number): void; + read(len: number): Buffer; + readByte(): number; + readI16(): number; + readI32(): number; + readDouble(): number; + readString(): string; + write(buf: Buffer | string): void; + flush(): void; +} + +export interface TTransportConstructor { + new (buffer: Buffer | undefined, callback: TTransportCallback): TTransport; +} + +export class TBinaryProtocol implements TProtocol { + constructor(trans: TTransport, strictRead?: boolean, strictWrite?: boolean); + flush(): void; + writeMessageBegin(name: string, type: Thrift.MessageType, seqid: number): void; + writeMessageEnd(): void; + writeStructBegin(name: string): void; + writeStructEnd(): void; + writeFieldBegin(name: string, type: Thrift.Type, id: number): void; + writeFieldEnd(): void; + writeFieldStop(): void; + writeMapBegin(ktype: Thrift.Type, vtype: Thrift.Type, size: number): void; + writeMapEnd(): void; + writeListBegin(etype: Thrift.Type, size: number): void; + writeListEnd(): void; + writeSetBegin(etype: Thrift.Type, size: number): void; + writeSetEnd(): void; + writeBool(bool: boolean): void; + writeByte(b: number): void; + writeI16(i16: number): void; + writeI32(i32: number): void; + writeI64(i64: number | Int64): void; + writeDouble(dbl: number): void; + writeString(arg: string | Buffer): void; + writeBinary(arg: string | Buffer): void; + readMessageBegin(): TMessage; + readMessageEnd(): void; + readStructBegin(): TStruct; + readStructEnd(): void; + readFieldBegin(): TField; + readFieldEnd(): void; + readMapBegin(): TMap; + readMapEnd(): void; + readListBegin(): TList; + readListEnd(): void; + readSetBegin(): TSet; + readSetEnd(): void; + readBool(): boolean; + readByte(): number; + readI16(): number; + readI32(): number; + readI64(): Int64; + readDouble(): number; + readBinary(): Buffer; + readString(): string; + getTransport(): TTransport; + skip(type: Thrift.Type): void; +} + +export class TJSONProtocol implements TProtocol { + constructor(trans: TTransport); + flush(): void; + writeMessageBegin(name: string, type: Thrift.MessageType, seqid: number): void; + writeMessageEnd(): void; + writeStructBegin(name: string): void; + writeStructEnd(): void; + writeFieldBegin(name: string, type: Thrift.Type, id: number): void; + writeFieldEnd(): void; + writeFieldStop(): void; + writeMapBegin(ktype: Thrift.Type, vtype: Thrift.Type, size: number): void; + writeMapEnd(): void; + writeListBegin(etype: Thrift.Type, size: number): void; + writeListEnd(): void; + writeSetBegin(etype: Thrift.Type, size: number): void; + writeSetEnd(): void; + writeBool(bool: boolean): void; + writeByte(b: number): void; + writeI16(i16: number): void; + writeI32(i32: number): void; + writeI64(i64: number | Int64): void; + writeDouble(dbl: number): void; + writeString(arg: string | Buffer): void; + writeBinary(arg: string | Buffer): void; + readMessageBegin(): TMessage; + readMessageEnd(): void; + readStructBegin(): TStruct; + readStructEnd(): void; + readFieldBegin(): TField; + readFieldEnd(): void; + readMapBegin(): TMap; + readMapEnd(): void; + readListBegin(): TList; + readListEnd(): void; + readSetBegin(): TSet; + readSetEnd(): void; + readBool(): boolean; + readByte(): number; + readI16(): number; + readI32(): number; + readI64(): Int64; + readDouble(): number; + readBinary(): Buffer; + readString(): string; + getTransport(): TTransport; + skip(type: Thrift.Type): void; +} + +export class TCompactProtocol implements TProtocol { + constructor(trans: TTransport); + flush(): void; + writeMessageBegin(name: string, type: Thrift.MessageType, seqid: number): void; + writeMessageEnd(): void; + writeStructBegin(name: string): void; + writeStructEnd(): void; + writeFieldBegin(name: string, type: Thrift.Type, id: number): void; + writeFieldEnd(): void; + writeFieldStop(): void; + writeMapBegin(ktype: Thrift.Type, vtype: Thrift.Type, size: number): void; + writeMapEnd(): void; + writeListBegin(etype: Thrift.Type, size: number): void; + writeListEnd(): void; + writeSetBegin(etype: Thrift.Type, size: number): void; + writeSetEnd(): void; + writeBool(bool: boolean): void; + writeByte(b: number): void; + writeI16(i16: number): void; + writeI32(i32: number): void; + writeI64(i64: number | Int64): void; + writeDouble(dbl: number): void; + writeString(arg: string | Buffer): void; + writeBinary(arg: string | Buffer): void; + readMessageBegin(): TMessage; + readMessageEnd(): void; + readStructBegin(): TStruct; + readStructEnd(): void; + readFieldBegin(): TField; + readFieldEnd(): void; + readMapBegin(): TMap; + readMapEnd(): void; + readListBegin(): TList; + readListEnd(): void; + readSetBegin(): TSet; + readSetEnd(): void; + readBool(): boolean; + readByte(): number; + readI16(): number; + readI32(): number; + readI64(): Int64; + readDouble(): number; + readBinary(): Buffer; + readString(): string; + getTransport(): TTransport; + skip(type: Thrift.Type): void; +} + +export interface TProtocolConstructor { + new (trans: TTransport, strictRead?: boolean, strictWrite?: boolean): TProtocol; +} + +// thrift.js +export namespace Thrift { + enum Type { + STOP = 0, + VOID = 1, + BOOL = 2, + BYTE = 3, + I08 = 3, + DOUBLE = 4, + I16 = 6, + I32 = 8, + I64 = 10, + STRING = 11, + UTF7 = 11, + STRUCT = 12, + MAP = 13, + SET = 14, + LIST = 15, + UTF8 = 16, + UTF16 = 17 + } + + enum MessageType { + CALL = 1, + REPLY = 2, + EXCEPTION = 3, + ONEWAY = 4 + } + + class TException extends Error { + name: string; + message: string; + + constructor(message: string); + + getMessage(): string; + } + + enum TApplicationExceptionType { + UNKNOWN = 0, + UNKNOWN_METHOD = 1, + INVALID_MESSAGE_TYPE = 2, + WRONG_METHOD_NAME = 3, + BAD_SEQUENCE_ID = 4, + MISSING_RESULT = 5, + INTERNAL_ERROR = 6, + PROTOCOL_ERROR = 7, + INVALID_TRANSFORM = 8, + INVALID_PROTOCOL = 9, + UNSUPPORTED_CLIENT_TYPE = 10 + } + + class TApplicationException extends TException { + message: string; + code: number; + + constructor(type?: TApplicationExceptionType, message?: string); + read(input: TProtocol): void; + write(output: TProtocol): void; + getCode(): number; + } + + enum TProtocolExceptionType { + UNKNOWN = 0, + INVALID_DATA = 1, + NEGATIVE_SIZE = 2, + SIZE_LIMIT = 3, + BAD_VERSION = 4, + NOT_IMPLEMENTED = 5, + DEPTH_LIMIT = 6 + } + + class TProtocolException implements Error { + name: string; + message: string; + type: TProtocolExceptionType; + + constructor(type: TProtocolExceptionType, message: string); + } + + function objectLength(obj: any): number; +} diff --git a/types/thrift/thrift-tests.ts b/types/thrift/thrift-tests.ts index 98d3ab89a2..7e47f2cf6b 100644 --- a/types/thrift/thrift-tests.ts +++ b/types/thrift/thrift-tests.ts @@ -1,10 +1,128 @@ -import * as Thrift from 'thrift'; +import { + createConnection, + createServer, + createClient, + Thrift, + TBinaryProtocol, + TBufferedTransport, + TProtocol, + TTransport, + TTransportCallback, + Int64, + TMessage, + TStruct, + TField, + TSet, + TList, + TMap, +} from 'thrift'; -const fakeGeneratedService: any = {}; -const fakeServiceMethods: any = {}; -const fakeConnectionParams: any = {}; +interface MockServiceHandlers { + ping(): string; +} -Thrift.createServer(fakeGeneratedService, fakeServiceMethods); +class MockProcessor { + constructor() {} +} -const clientConnection = Thrift.createConnection('0.0.0.0', 1234, fakeConnectionParams); -Thrift.createClient(fakeGeneratedService, clientConnection); +class MockClient { + constructor() {} +} + +const mockServiceHandlers: MockServiceHandlers = { + ping(): string { + return 'ok'; + } +}; + +const mockGeneratedService = { + Client: MockClient, + Processor: MockProcessor +}; + +createServer(mockGeneratedService, mockServiceHandlers); + +const clientConnection = createConnection('0.0.0.0', 1234, { + transport: TBufferedTransport, + protocol: TBinaryProtocol +}); +createClient(mockGeneratedService, clientConnection); + +const mockBuffer: Buffer = Buffer.alloc(8); + +const mockCallback: TTransportCallback = (msg: Buffer, seq: number): void => {}; + +const mockTransport: TTransport = new TBufferedTransport(mockBuffer, mockCallback); + +const mockProtocol: TProtocol = new TBinaryProtocol(mockTransport); + +// Test utility types +const len: number = Thrift.objectLength({}); + +// Test transport types +const pI16: number = mockTransport.readI16(); +const pI32: number = mockTransport.readI32(); +const pDouble: number = mockTransport.readDouble(); +const pByte: number = mockTransport.readByte(); +const pString: string = mockTransport.readString(); +const isOpen: boolean = mockTransport.isOpen(); +const open: boolean = mockTransport.open(); +const close: boolean = mockTransport.close(); + +mockTransport.write(mockBuffer); +mockTransport.write('test'); +mockTransport.flush(); +mockTransport.setCurrSeqId(1); +mockTransport.ensureAvailable(10); +mockTransport.commitPosition(); +mockTransport.rollbackPosition(); + +// Test protocol types +mockProtocol.flush(); +mockProtocol.writeMessageBegin('test', Thrift.MessageType.CALL, 1); +mockProtocol.writeMessageEnd(); +mockProtocol.writeStructBegin('test'); +mockProtocol.writeStructEnd(); +mockProtocol.writeFieldBegin('test', Thrift.Type.BOOL, 1); +mockProtocol.writeFieldEnd(); +mockProtocol.writeFieldStop(); +mockProtocol.writeMapBegin(Thrift.Type.STRING, Thrift.Type.I64, 1); +mockProtocol.writeMapEnd(); +mockProtocol.writeListBegin(Thrift.Type.STRING, 10); +mockProtocol.writeListEnd(); +mockProtocol.writeSetBegin(Thrift.Type.I32, 10); +mockProtocol.writeSetEnd(); +mockProtocol.writeBool(true); +mockProtocol.writeByte(1); +mockProtocol.writeI16(16); +mockProtocol.writeI32(32); +mockProtocol.writeI64(64); +mockProtocol.writeI64(new Int64('0xff')); +mockProtocol.writeDouble(42); +mockProtocol.writeString('test'); +mockProtocol.writeString(new Buffer('test')); +mockProtocol.writeBinary('test'); +mockProtocol.writeBinary(new Buffer('test')); + +const message: TMessage = mockProtocol.readMessageBegin(); +mockProtocol.readMessageEnd(); +const struct: TStruct = mockProtocol.readStructBegin(); +mockProtocol.readStructEnd(); +const field: TField = mockProtocol.readFieldBegin(); +mockProtocol.readFieldEnd(); +const map: TMap = mockProtocol.readMapBegin(); +mockProtocol.readMapEnd(); +const list: TList = mockProtocol.readListBegin(); +mockProtocol.readListEnd(); +const set: TSet = mockProtocol.readSetBegin(); +mockProtocol.readSetEnd(); +const bool: boolean = mockProtocol.readBool(); +const byte: number = mockProtocol.readByte(); +const tI16: number = mockProtocol.readI16(); +const tI32: number = mockProtocol.readI32(); +const tI64: Int64 = mockProtocol.readI64(); +const tDouble: number = mockProtocol.readDouble(); +const tBinary: Buffer = mockProtocol.readBinary(); +const tString: string = mockProtocol.readString(); +const tTrans: TTransport = mockProtocol.getTransport(); +mockProtocol.skip(Thrift.Type.STRUCT); diff --git a/types/thrift/tsconfig.json b/types/thrift/tsconfig.json index 29562363f2..9f258d3831 100644 --- a/types/thrift/tsconfig.json +++ b/types/thrift/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From efdab6c1d9548de0a95847f5360cb21290442f3f Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Tue, 3 Oct 2017 02:43:17 +0900 Subject: [PATCH 29/67] PDFKit: complete interface of color / winding-rule (#20069) - add 2 color forms: [R, G, B] or [C, M, Y, K] - constrain possible value of winding rule - add missing overloads of fill / fillAndStroke --- types/pdfkit/index.d.ts | 22 ++++++++++++++++------ types/pdfkit/pdfkit-tests.ts | 5 +++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/types/pdfkit/index.d.ts b/types/pdfkit/index.d.ts index 053aa7f029..90079efc0e 100644 --- a/types/pdfkit/index.d.ts +++ b/types/pdfkit/index.d.ts @@ -58,9 +58,16 @@ declare namespace PDFKit.Mixins { textAnnotation(x: number, y: number, w: number, h: number, text: string, option?: AnnotationOption): TDocument; } + // The color forms accepted by PDFKit: + // example: "red" [R, G, B] [C, M, Y, K] + type ColorValue = string | PDFGradient | [number, number, number] | [number, number, number, number]; + + // The winding / filling rule accepted by PDFKit: + type RuleValue = "even-odd" | "evenodd" | "non-zero" | "nonzero"; + interface PDFColor { - fillColor(color: string|PDFGradient, opacity?: number): TDocument; - strokeColor(color: string, opacity?: number): TDocument; + fillColor(color: ColorValue, opacity?: number): TDocument; + strokeColor(color: ColorValue, opacity?: number): TDocument; opacity(opacity: number): TDocument; fillOpacity(opacity: number): TDocument; strokeOpacity(opacity: number): TDocument; @@ -166,10 +173,13 @@ declare namespace PDFKit.Mixins { circle(x: number, y: number, raduis: number): TDocument; polygon(...points: number[][]): TDocument; path(path: string): TDocument; - fill(color: string|PDFKit.PDFGradient, rule?: string): TDocument; - stroke(color?: string|PDFKit.PDFGradient): TDocument; - fillAndStroke(fillColor: string, strokeColor?: string, rule?: string): TDocument; - clip(rule?: string): TDocument; + fill(color?: ColorValue, rule?: RuleValue): TDocument; + fill(rule: RuleValue): TDocument; + stroke(color?: ColorValue): TDocument; + fillAndStroke(fillColor?: ColorValue, strokeColor?: ColorValue, rule?: RuleValue): TDocument; + fillAndStroke(fillColor: ColorValue, rule?: RuleValue): TDocument; + fillAndStroke(rule: RuleValue): TDocument; + clip(rule?: RuleValue): TDocument; transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): TDocument; translate(x: number, y: number): TDocument; rotate(angle: number, options?: { origin?: number[] }): TDocument; diff --git a/types/pdfkit/pdfkit-tests.ts b/types/pdfkit/pdfkit-tests.ts index 57aff702da..72358ed5e2 100644 --- a/types/pdfkit/pdfkit-tests.ts +++ b/types/pdfkit/pdfkit-tests.ts @@ -44,6 +44,8 @@ doc.moveTo(0,20) .lineTo(100,160) .quadraticCurveTo(130,200,150,120) .lineTo(400,90) + .strokeColor([255, 0, 0], 1) + .strokeColor([255, 0, 0]) .stroke(); //SVG Paths @@ -80,6 +82,9 @@ var grad = doc.linearGradient(50, 0, 150, 100) doc.rect(50, 0, 100, 100) .fill(grad); +doc.rect(150, 0, 25, 25) +.fill(); + doc.circle(100, 50, 50).dash(5, { space: 10 }).stroke(); From 819ca3d98f3649b762378b1fd2852913c1aa3477 Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Tue, 3 Oct 2017 05:06:59 +1100 Subject: [PATCH 30/67] Add zapier-platform-core 3.1 (#20123) --- types/zapier-platform-core/index.d.ts | 114 ++++++++++++++++++ types/zapier-platform-core/tsconfig.json | 22 ++++ types/zapier-platform-core/tslint.json | 1 + .../zapier-platform-core-tests.ts | 93 ++++++++++++++ 4 files changed, 230 insertions(+) create mode 100644 types/zapier-platform-core/index.d.ts create mode 100644 types/zapier-platform-core/tsconfig.json create mode 100644 types/zapier-platform-core/tslint.json create mode 100644 types/zapier-platform-core/zapier-platform-core-tests.ts diff --git a/types/zapier-platform-core/index.d.ts b/types/zapier-platform-core/index.d.ts new file mode 100644 index 0000000000..0bea385f05 --- /dev/null +++ b/types/zapier-platform-core/index.d.ts @@ -0,0 +1,114 @@ +// Type definitions for zapier-platform-core 3.1 +// Project: https://github.com/zapier/zapier-platform-core +// Definitions by: Bradley Ayers +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +import * as http from "http"; + +export const version: string; + +export interface HttpRequestOptions { + url?: string; + method?: "POST" | "GET" | "OPTIONS" | "HEAD" | "DELETE" | "PATCH"; + body?: string | Buffer | NodeJS.ReadableStream | object | null; + headers?: { [name: string]: string }; + json?: object | any[] | null; + params?: object; + form?: object | null; + raw?: boolean; + redirect?: "manual" | "error" | "follow"; + follow?: number; + compress?: boolean; + agent?: http.Agent | null; + timeout?: number; + size?: number; +} + +export interface HttpResponse { + status: number; + content: string | Buffer; + json: object | undefined | Promise; + body?: NodeJS.ReadableStream; + headers: { [key: string]: string }; + getHeader(key: string): string | undefined; + throwForStatus(): void; + request: HttpRequestOptions; +} + +export class HaltedError extends Error {} +export class ExpiredAuthError extends Error {} +export class RefreshAuthError extends Error {} + +export interface Z { + request(options: HttpRequestOptions): Promise; + request(url: string, options?: HttpRequestOptions): Promise; + JSON: typeof JSON; + console: Console; + hash(alg: string, data: string): any; + errors: { + RefreshAuthError: { + new (message?: string): HaltedError; + new (message?: string): ExpiredAuthError; + new (message?: string): RefreshAuthError; + }; + }; +} + +export interface AuthData { + access_token: string; + refresh_token?: string; +} + +export interface Bundle { + authData: AuthData; + inputData: InputData; +} + +export interface AuthorizeUrlBundle { + inputData: InputData; +} + +export interface GetAccessTokenBundle { + inputData: InputData & { + code: string; + }; +} + +export interface RefreshAccessTokenBundle { + inputData: InputData; + authData: AuthData; +} + +export interface OAuth2Authentication { + type: "oauth2"; + connectionLabel: string; + oauth2Config: { + authorizeUrl: + | string + | (( + z: Z, + bundle: AuthorizeUrlBundle + ) => string | Promise) + | HttpRequestOptions; + getAccessToken: + | (( + z: Z, + bundle: GetAccessTokenBundle + ) => AuthData | Promise) + | HttpRequestOptions; + refreshAccessToken?: + | (( + z: Z, + bundle: RefreshAccessTokenBundle + ) => AuthData | Promise) + | HttpRequestOptions; + autoRefresh: boolean; + scope?: string; + }; + test: + | ((z: Z, bundle: Bundle) => boolean | Promise) + | { url: string }; +} diff --git a/types/zapier-platform-core/tsconfig.json b/types/zapier-platform-core/tsconfig.json new file mode 100644 index 0000000000..3755a7ac9a --- /dev/null +++ b/types/zapier-platform-core/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", + "zapier-platform-core-tests.ts" + ] +} diff --git a/types/zapier-platform-core/tslint.json b/types/zapier-platform-core/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/zapier-platform-core/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/zapier-platform-core/zapier-platform-core-tests.ts b/types/zapier-platform-core/zapier-platform-core-tests.ts new file mode 100644 index 0000000000..76592204ae --- /dev/null +++ b/types/zapier-platform-core/zapier-platform-core-tests.ts @@ -0,0 +1,93 @@ +import { OAuth2Authentication } from "zapier-platform-core"; + +const BASE_URL = "http://example.com"; +const OAUTH2_CLIENT_ID = "12345"; +const OAUTH2_CLIENT_SECRET = "abcdef"; + +const authentication: OAuth2Authentication = { + type: "oauth2", + connectionLabel: "User account", + oauth2Config: { + authorizeUrl: `${BASE_URL}/oauth2/authorize`, + + getAccessToken: async (z, bundle) => { + const response = await z.request(`${BASE_URL}/oauth2/access`, { + method: "POST", + body: { + code: bundle.inputData.code, + client_id: OAUTH2_CLIENT_ID, + client_secret: OAUTH2_CLIENT_SECRET, + grant_type: "authorization_code" + } + }); + + if (response.status !== 200) { + throw new Error( + "Unable to fetch access token: " + response.content + ); + } + + if (typeof response.content !== "string") { + throw new Error( + `Unable to response content, expected string but got ${typeof response.content}.` + ); + } + + const result = z.JSON.parse(response.content); + return { + access_token: result.access_token, + refresh_token: result.refresh_token + }; + }, + + refreshAccessToken: async (z, bundle) => { + if (!bundle.authData.refresh_token) { + throw new Error( + "Required `bundle.authData.refresh_token` field missing." + ); + } + + const response = await z.request(`${BASE_URL}/oauth2/refresh`, { + method: "POST", + body: { + refresh_token: bundle.authData.refresh_token, + client_id: OAUTH2_CLIENT_ID, + client_secret: OAUTH2_CLIENT_SECRET, + grant_type: "refresh_token" + } + }); + + if (response.status !== 200) { + throw new Error( + "Unable to fetch access token: " + response.content + ); + } + + if (typeof response.content !== "string") { + throw new Error( + `Unable to response content, expected string but got ${typeof response.content}.` + ); + } + + const result = z.JSON.parse(response.content); + return { + access_token: result.access_token, + refresh_token: bundle.authData.refresh_token + }; + }, + + autoRefresh: true, + + scope: "read,write" + }, + + test: async z => { + const response = await z.request(`${BASE_URL}/oauth2/test`); + + if (response.status === 401) { + throw new Error("The access token you supplied is not valid"); + } + + return true; + } +}; From c9c62c89b96833082354bd821189b8137fa43fbc Mon Sep 17 00:00:00 2001 From: Jay Anslow Date: Mon, 2 Oct 2017 19:07:27 +0100 Subject: [PATCH 31/67] Add `react-treeview` types (#20121) --- types/react-treeview/index.d.ts | 23 ++++++++++++++++++ types/react-treeview/react-treeview-tests.tsx | 11 +++++++++ types/react-treeview/tsconfig.json | 24 +++++++++++++++++++ types/react-treeview/tslint.json | 1 + 4 files changed, 59 insertions(+) create mode 100644 types/react-treeview/index.d.ts create mode 100644 types/react-treeview/react-treeview-tests.tsx create mode 100644 types/react-treeview/tsconfig.json create mode 100644 types/react-treeview/tslint.json diff --git a/types/react-treeview/index.d.ts b/types/react-treeview/index.d.ts new file mode 100644 index 0000000000..64690dc361 --- /dev/null +++ b/types/react-treeview/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for react-treeview 0.4 +// Project: https://github.com/chenglou/react-treeview +// Definitions by: Jay Anslow +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Component, HTMLAttributes } from 'react'; + +declare namespace TreeView { + interface TreeProps extends HTMLAttributes { + collapsed?: boolean; + defaultCollapsed?: boolean; + nodeLabel: React.ReactNode; + itemClassName?: string; + treeViewClassName?: string; + childrenClassName?: string; + } +} + +declare class TreeView extends Component { +} + +export = TreeView; diff --git a/types/react-treeview/react-treeview-tests.tsx b/types/react-treeview/react-treeview-tests.tsx new file mode 100644 index 0000000000..8edb180b92 --- /dev/null +++ b/types/react-treeview/react-treeview-tests.tsx @@ -0,0 +1,11 @@ +import * as React from "react"; +import TreeView = require("react-treeview"); + +const label =
A label
; + +const elem1: JSX.Element = undefined}> +
Entry
+ +
Nested Entry
+
+
; diff --git a/types/react-treeview/tsconfig.json b/types/react-treeview/tsconfig.json new file mode 100644 index 0000000000..62a6f93cbe --- /dev/null +++ b/types/react-treeview/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-treeview-tests.tsx" + ] +} diff --git a/types/react-treeview/tslint.json b/types/react-treeview/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-treeview/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c56a4da185a80480fbd0824d3b9d6170b6eb6933 Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Tue, 3 Oct 2017 05:08:22 +1100 Subject: [PATCH 32/67] Add apollo-codegen (#20119) --- types/apollo-codegen/apollo-codegen-tests.ts | 30 +++++++++++++++ types/apollo-codegen/index.d.ts | 40 ++++++++++++++++++++ types/apollo-codegen/tsconfig.json | 22 +++++++++++ types/apollo-codegen/tslint.json | 1 + 4 files changed, 93 insertions(+) create mode 100644 types/apollo-codegen/apollo-codegen-tests.ts create mode 100644 types/apollo-codegen/index.d.ts create mode 100644 types/apollo-codegen/tsconfig.json create mode 100644 types/apollo-codegen/tslint.json diff --git a/types/apollo-codegen/apollo-codegen-tests.ts b/types/apollo-codegen/apollo-codegen-tests.ts new file mode 100644 index 0000000000..38d9733faf --- /dev/null +++ b/types/apollo-codegen/apollo-codegen-tests.ts @@ -0,0 +1,30 @@ +import { + downloadSchema, + generate, + introspectSchema, + printSchema +} from "apollo-codegen"; + +async function main() { + await downloadSchema( + "http://example.com/graphql", + "schema.json", + {}, + false, + "POST" + ); + + generate(["input.ts"], "schema.json", "types.ts", "typescript", "gql", { + passthroughCustomScalars: false, + customScalarsPrefix: "S", + addTypename: false, + namespace: "", + operationIdsPath: null, + generateOperationIds: false, + mergeInFieldsFromFragmentSpreads: false + }); + + await introspectSchema("schema.json", "schema.gql"); + + await printSchema("schema.in", "schema.out"); +} diff --git a/types/apollo-codegen/index.d.ts b/types/apollo-codegen/index.d.ts new file mode 100644 index 0000000000..a506f7475e --- /dev/null +++ b/types/apollo-codegen/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for apollo-codegen 0.16 +// Project: https://github.com/apollographql/apollo-codegen +// Definitions by: Bradley Ayers +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export function downloadSchema( + url: string, + outputPath: string, + additionalHeaders: { [name: string]: string }, + insecure: boolean, + method: string +): Promise; + +export function introspectSchema( + schemaPath: string, + outputPath: string +): Promise; + +export function printSchema( + schemaPath: string, + outputPath: string +): Promise; + +export function generate( + inputPaths: string[], + schemaPath: string, + outputPath: string, + target: "json" | "swift" | "ts" | "typescript" | "flow" | "scala", + tagName: string, + options: { + passthroughCustomScalars: boolean; + customScalarsPrefix: string; + addTypename: boolean; + namespace: string; + operationIdsPath: string | null; + generateOperationIds: boolean; + mergeInFieldsFromFragmentSpreads: boolean; + } +): void; diff --git a/types/apollo-codegen/tsconfig.json b/types/apollo-codegen/tsconfig.json new file mode 100644 index 0000000000..cc7c69d4f6 --- /dev/null +++ b/types/apollo-codegen/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", + "apollo-codegen-tests.ts" + ] +} diff --git a/types/apollo-codegen/tslint.json b/types/apollo-codegen/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/apollo-codegen/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e7b3ad2f1cd5b344f0511887f6a73ecb12450825 Mon Sep 17 00:00:00 2001 From: Cassey Lottman Date: Mon, 2 Oct 2017 13:09:01 -0500 Subject: [PATCH 33/67] Add missing pie chart options to Chartist (#20118) * add missing pie chart options to Chartist * missing comment * update donutwidth * add to maintainers * modify the right file * add back candle chart * fix spacing? * fix export --- types/chartist/index.d.ts | 261 ++++++++++++++++++++------------------ 1 file changed, 139 insertions(+), 122 deletions(-) diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index e1d4cba452..3eb5e07973 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Chartist v0.9.6 +// Type definitions for Chartist v0.9.7 // Project: https://github.com/gionkunz/chartist-js -// Definitions by: Matt Gibbs , Simon Pfeifer +// Definitions by: Matt Gibbs , Simon Pfeifer , Cassey Lottman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Chartist { @@ -187,11 +187,17 @@ declare namespace Chartist { * If specified the donut CSS classes will be used and strokes will be drawn instead of pie slices. */ donut?: boolean; + + /** + * If specified the donut segments will be drawn as shapes instead of strokes. + */ + donutSolid?: boolean; /** - * Specify the donut stroke width, currently done in javascript for convenience. + * Specify the donut stroke width, currently done in javascript for convenience. May move to CSS styles in the future. + * This option can be set as number or string to specify a relative width (i.e. 100 or '30%'). */ - donutWidth?: number; + donutWidth?: number | string; /** * Specify if a label should be shown or not @@ -217,6 +223,16 @@ declare namespace Chartist { * Label direction can be 'neutral', 'explode' or 'implode'. Default is 'neutral'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center. */ labelDirection?: string; + + /** + * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. + */ + reverseData?: boolean; + + /** + * If true empty values will be ignored to avoid drawing unncessary slices and labels + */ + ignoreEmptyValues?: boolean; } interface IChartPadding { @@ -357,123 +373,124 @@ declare namespace Chartist { end?: string; } - interface ICandleChartOptions extends IChartOptions { - - /** - * Options for X-Axis - */ - axisX?: ICandleChartAxis; - - /** - * Options for Y-Axis - */ - axisY?: ICandleChartAxis; - - /** - * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') - */ - width?: number | string; - - /** - * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') - */ - height?: number | string; - - /** - * Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value - */ - hight?: number | string; - - /** - * Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value - */ - low?: number | string; - - /** - * Width of candle body in pixel (IMO is 2 px best minimum value) - */ - candleWidth?: number | string; - - /** - * Width of candle wick in pixel (IMO is 1 px best minimum value) - */ - candleWickWidth?: number | string; - - /** - * Use calculated x-axis step length, depending on the number of quotes to display, as candle width. Otherwise the candleWidth is being used. - */ - useStepLengthAsCandleWidth?: boolean | string; - - /** - * Use 1/3 of candle body width as width for the candle wick, otherwise the candleWickWidth is being used. - */ - useOneThirdAsCandleWickWidth?: boolean | string; - - /** - * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} - */ - chartPadding?: IChartPadding | number; - - /** - * When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawn correctly you might need to add chart padding or offset the last label with a draw event handler. - */ - fullWidth?: boolean | string; - - /** - * Override the class names that get used to generate the SVG structure of the chart - */ - classNames?: ICandleChartClasses; - } - - interface ICandleChartAxis { - /** - * The offset of the chart drawing area to the border of the container - */ - offset?: number; - /** - * Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis. - */ - position?: string; - /** - * Allows you to correct label positioning on this axis by positive or negative x and y offset. - */ - labelOffset?: { - x?: number; - y?: number; - }; - /** - * If labels should be shown or not - */ - showLabel?: boolean; - /** - * If the axis grid should be drawn or not - */ - showGrid?: boolean; - /** - * Interpolation function that allows you to intercept the value from the axis label - */ - labelInterpolationFnc?: Function; - /** - * Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here. - */ - type?: any; - } - - interface ICandleChartClasses { - chart?: string; - label?: string; - labelGroup?: string; - series?: string; - candlePositive?: string; - candleNegative?: string, - grid?: string, - gridGroup?: string, - gridBackground?: string, - vertical?: string, - horizontal?: string, - start?: string, - end?: string, - } + interface ICandleChartOptions extends IChartOptions { + + /** + * Options for X-Axis + */ + axisX?: ICandleChartAxis; + + /** + * Options for Y-Axis + */ + axisY?: ICandleChartAxis; + + /** + * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') + */ + width?: number | string; + + /** + * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') + */ + height?: number | string; + + /** + * Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value + */ + hight?: number | string; + + /** + * Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value + */ + low?: number | string; + + /** + * Width of candle body in pixel (IMO is 2 px best minimum value) + */ + candleWidth?: number | string; + + /** + * Width of candle wick in pixel (IMO is 1 px best minimum value) + */ + candleWickWidth?: number | string; + + /** + * Use calculated x-axis step length, depending on the number of quotes to display, as candle width. Otherwise the candleWidth is being used. + */ + useStepLengthAsCandleWidth?: boolean | string; + + /** + * Use 1/3 of candle body width as width for the candle wick, otherwise the candleWickWidth is being used. + */ + useOneThirdAsCandleWickWidth?: boolean | string; + + /** + * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} + */ + chartPadding?: IChartPadding | number; + + /** + * When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawncorrectly you might need to add chart padding or offset the last label with a draw event handler. + */ + fullWidth?: boolean | string; + + /** + * Override the class names that get used to generate the SVG structure of the chart + */ + classNames?: ICandleChartClasses; + } + + interface ICandleChartAxis { + /** + * The offset of the chart drawing area to the border of the container + */ + offset?: number; + /** + * Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis. + */ + position?: string; + /** + * Allows you to correct label positioning on this axis by positive or negative x and y offset. + */ + labelOffset?: { + x?: number; + y?: number; + }; + /** + * If labels should be shown or not + */ + showLabel?: boolean; + /** + * If the axis grid should be drawn or not + */ + showGrid?: boolean; + /** + * Interpolation function that allows you to intercept the value from the axis label + */ + labelInterpolationFnc?: Function; + /** + * Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here. + */ + type?: any; + } + + interface ICandleChartClasses { + chart?: string; + label?: string; + labelGroup?: string; + series?: string; + candlePositive?: string; + candleNegative?: string, + grid?: string, + gridGroup?: string, + gridBackground?: string, + vertical?: string, + horizontal?: string, + start?: string, + end?: string, + } + interface ChartistSvgStatic { new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg; @@ -682,4 +699,4 @@ declare namespace Chartist { declare var Chartist: Chartist.ChartistStatic; export = Chartist; -export as namespace Chartist; +export as namespace Chartist; \ No newline at end of file From f3bcbc1a9d74e70c74c1a2d9cf63958f3f0f2973 Mon Sep 17 00:00:00 2001 From: Shenghan Gao Date: Mon, 2 Oct 2017 11:09:16 -0700 Subject: [PATCH 34/67] fix a type on amqp (#20091) --- types/amqp/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/amqp/index.d.ts b/types/amqp/index.d.ts index ea7d6bcc65..374a03322b 100644 --- a/types/amqp/index.d.ts +++ b/types/amqp/index.d.ts @@ -90,7 +90,7 @@ export interface ConnectionOptions { url?: string; port?: number; login?: string; - passowrd?: string; + password?: string; connectionTimeout?: number; authMechanism?: string; vhost?: string; From 06354d63821770b5b3df03afb177fdb46c7235b4 Mon Sep 17 00:00:00 2001 From: Alessandro Vergani Date: Mon, 2 Oct 2017 20:29:52 +0200 Subject: [PATCH 35/67] Add restling support (#20187) --- types/restling/index.d.ts | 232 +++++++++++++++++++++++++++++++ types/restling/restling-tests.ts | 40 ++++++ types/restling/tsconfig.json | 22 +++ types/restling/tslint.json | 1 + 4 files changed, 295 insertions(+) create mode 100644 types/restling/index.d.ts create mode 100644 types/restling/restling-tests.ts create mode 100644 types/restling/tsconfig.json create mode 100644 types/restling/tslint.json diff --git a/types/restling/index.d.ts b/types/restling/index.d.ts new file mode 100644 index 0000000000..02a083078a --- /dev/null +++ b/types/restling/index.d.ts @@ -0,0 +1,232 @@ +// Type definitions for restling 0.9 +// Project: https://github.com/lucasfeliciano/restling +// Definitions by: Alessandro vergani +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as Promise from "bluebird"; +import * as Restler from "restler"; +import { ServerResponse } from "http"; + +/** + * Create a DELETE request. + * @param {string} url A url address. + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function del(url: string, options?: RestlingOptions): Promise; + +/** + * Create a GET request. + * @param {string} url A url address. + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function get(url: string, options?: RestlingOptions): Promise; + +/** + * Create a HEAD request. + * @param {string} url A url address. + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function head(url: string, options?: RestlingOptions): Promise; + +/** + * Send json data via GET method. + * @param {string} url A url address. + * @param {any} data JSON body + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function json(url: string, data?: any, options?: RestlingOptions, method?: string): Promise; + +/** + * Create a PATCH request. + * @param {string} url A url address. + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function patch(url: string, options?: RestlingOptions): Promise; + +/** + * Send json data via PATCH method. + * @param {string} url A url address. + * @param {any} data JSON body + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function patchJson(url: string, data?: any, options?: RestlingOptions): Promise; + +/** + * Create a POST request. + * @param {string} url A url address. + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function post(url: string, options?: RestlingOptions): Promise; + +/** + * Send json data via POST method. + * @param {string} url A url address. + * @param {any} data JSON body + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function postJson(url: string, data?: any, options?: RestlingOptions): Promise; + +/** + * Create a PUT request. + * @param {string} url A url address. + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function put(url: string, options?: RestlingOptions): Promise; + +/** + * Send json data via PUT method. + * @param {string} url A url address. + * @param {any} data JSON body + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function putJson(url: string, data?: any, options?: RestlingOptions): Promise; + +/** + * Create a request. + * @param {string} url A url address. + * @param {RestlingOptions} options Options. + * @return {Promise} Result. + */ +export function request(url: string, options?: RestlingOptions): Promise; + +export function settleAsync(requests: [{ url: string, options?: RestlingOptions }]): Promise<[RestlingResult]>; +export function settleAsync(requests: { [key: string]: { url: string, options?: RestlingOptions } }): Promise<{ [key: string]: RestlingResult }>; + +export function allAsync(requests: [{ url: string, options?: RestlingOptions }]): Promise<[RestlingResult]>; +export function allAsync(requests: { [key: string]: { url: string, options?: RestlingOptions } }): Promise<{ [key: string]: RestlingResult }>; + +/** + * Interface for the result. + * @interface + */ +export interface RestlingResult { + data?: any; + response?: ServerResponse; +} + +/** + * Interface for the header. + * @interface + */ +export interface RestlerOptionsHeader { + [headerName: string]: string; +} + +/** + * Interface for restler options. + * @interface + */ +export interface RestlingOptions { + /** + * OAuth Bearer Token. + * @type {string} + */ + accessToken?: string; + + /** + * HTTP Agent instance to use. If not defined globalAgent will be used. If false opts out of connection pooling with an Agent, defaults request to Connection: close. + * @type {any} + */ + agent?: any; + + /** + * A http.Client instance if you want to reuse or implement some kind of connection pooling. + * @type {any} + */ + client?: any; + + /** + * Data to be added to the body of the request. + * @type {any} + */ + data?: any; + + /** + * Encoding of the response body + * @type {string} + */ + decoding?: string; + + /** + * Encoding of the request body. + * @type {string} + */ + encoding?: string; + + /** + * If set will recursively follow redirects. + * @type {boolean} + */ + followRedirects?: boolean; + + /** + * A hash of HTTP headers to be sent. + * @type {RestlerOptionsHeader} + */ + headers?: RestlerOptionsHeader; + + /** + * Request method + * @type {string} + */ + method?: string; + + /** + * If set the data passed will be formatted as multipart/form-encoded. + * @type {boolean} + */ + multipart?: boolean; + + /** + * A function that will be called on the returned data. Use any of predefined restler.parsers. + * @type {any} + */ + parser?: any; + + /** + * Basic auth password. + * @type {string} + */ + password?: string; + + /** + * Query string variables as a javascript object, will override the querystring in the URL. + * @type {any} + */ + query?: any; + + /** + * If true, the server certificate is verified against the list of supplied CAs. + * An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. + * @type {boolean} + */ + rejectUnauthorized?: boolean; + + /** + * Emit the timeout event when the response does not return within the said value (in ms). + * @type {number} + */ + timeout?: number; + + /** + * Basic auth username. + * @type {string} + */ + username?: string; + + /** + * Options for xml2js. + * @type {any} + */ + xml2js?: any; +} diff --git a/types/restling/restling-tests.ts b/types/restling/restling-tests.ts new file mode 100644 index 0000000000..143633bdad --- /dev/null +++ b/types/restling/restling-tests.ts @@ -0,0 +1,40 @@ +import * as rest from "restling"; + +rest.request("http://localhost").then(console.log); +rest.request("http://localhost", { agent: "test", timeout: 5000 }).then(console.log); + +rest.del("http://localhost", { agent: "test", timeout: 5000 }).then(console.log); + +rest.get("http://localhost", { agent: "test", timeout: 5000 }).then(console.log); + +rest.head("http://localhost", { agent: "test", timeout: 5000 }).then(console.log); + +rest.patch("http://localhost", { agent: "test", timeout: 5000 }).then(console.log); + +rest.post("http://localhost", { agent: "test", timeout: 5000 }).then(console.log); + +rest.put("http://localhost", { agent: "test", timeout: 5000 }).then(console.log); + +rest.patchJson("http://localhost", { num: 100, str: "string" }, { agent: "test", timeout: 5000 }).then(console.log); + +rest.postJson("http://localhost", { num: 100, str: "string" }, { agent: "test", timeout: 5000 }).then(console.log); + +rest.putJson("http://localhost", { num: 100, str: "string" }, { agent: "test", timeout: 5000 }).then(console.log); + +rest.settleAsync([ + { url: "http://localhost" }, + { url: "http://localhost" } +]).then(console.log); +rest.settleAsync({ + r1: { url: "http://localhost" }, + r2: { url: "http://localhost" } +}).then(console.log); + +rest.allAsync([ + { url: "http://localhost" }, + { url: "http://localhost" } +]).then(console.log); +rest.allAsync({ + r1: { url: "http://localhost" }, + r2: { url: "http://localhost" } +}).then(console.log); diff --git a/types/restling/tsconfig.json b/types/restling/tsconfig.json new file mode 100644 index 0000000000..d36e06acab --- /dev/null +++ b/types/restling/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", + "restling-tests.ts" + ] +} diff --git a/types/restling/tslint.json b/types/restling/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/restling/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 86c522c132a9f3da11afd86092aa8c666f24aece Mon Sep 17 00:00:00 2001 From: Matt Perry Date: Mon, 2 Oct 2017 14:34:10 -0400 Subject: [PATCH 36/67] Add type definition for react-truncate (#20181) --- types/react-truncate/index.d.ts | 16 +++++++++++++ types/react-truncate/react-truncate-tests.tsx | 18 +++++++++++++++ types/react-truncate/tsconfig.json | 23 +++++++++++++++++++ types/react-truncate/tslint.json | 1 + 4 files changed, 58 insertions(+) create mode 100644 types/react-truncate/index.d.ts create mode 100644 types/react-truncate/react-truncate-tests.tsx create mode 100644 types/react-truncate/tsconfig.json create mode 100644 types/react-truncate/tslint.json diff --git a/types/react-truncate/index.d.ts b/types/react-truncate/index.d.ts new file mode 100644 index 0000000000..5200016dec --- /dev/null +++ b/types/react-truncate/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for react-truncate 2.1 +// Project: https://github.com/One-com/react-truncate +// Definitions by: Matt Perry +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; + +export interface TruncateProps extends React.HTMLProps { + lines?: number | false; + ellipsis?: React.ReactNode; + onTruncate?(isTruncated: boolean): void; +} + +declare class Truncate extends React.Component { } +export default Truncate; diff --git a/types/react-truncate/react-truncate-tests.tsx b/types/react-truncate/react-truncate-tests.tsx new file mode 100644 index 0000000000..c73d5a2ad7 --- /dev/null +++ b/types/react-truncate/react-truncate-tests.tsx @@ -0,0 +1,18 @@ +import * as React from 'react'; +import Truncate from 'react-truncate'; + +const TruncateTest: React.SFC = _ => ( +
+ + Test string + + + isTruncated} className="testClass"> +
Test string
+
+ + Read more} id="identifier"> +
Test string
+
+
+); diff --git a/types/react-truncate/tsconfig.json b/types/react-truncate/tsconfig.json new file mode 100644 index 0000000000..51227d4e80 --- /dev/null +++ b/types/react-truncate/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "jsx": "react", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-truncate-tests.tsx" + ] +} diff --git a/types/react-truncate/tslint.json b/types/react-truncate/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-truncate/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 31cc4f3c73390ac8783f806ef15455f0c2c00149 Mon Sep 17 00:00:00 2001 From: "Anders E. Andersen" Date: Mon, 2 Oct 2017 20:35:22 +0200 Subject: [PATCH 37/67] @types/node-red New set of types for Node-RED node creation api. (#20167) * Basic node creation api * Tests and fixes * Minor linting fix --- types/node-red/index.d.ts | 206 +++++++++++++++++++++++++++++++ types/node-red/node-red-tests.ts | 33 +++++ types/node-red/tsconfig.json | 22 ++++ types/node-red/tslint.json | 1 + 4 files changed, 262 insertions(+) create mode 100644 types/node-red/index.d.ts create mode 100644 types/node-red/node-red-tests.ts create mode 100644 types/node-red/tsconfig.json create mode 100644 types/node-red/tslint.json diff --git a/types/node-red/index.d.ts b/types/node-red/index.d.ts new file mode 100644 index 0000000000..8b19d451e0 --- /dev/null +++ b/types/node-red/index.d.ts @@ -0,0 +1,206 @@ +// Type definitions for node-red 0.17 +// Project: http://nodered.org +// Definitions by: Anders E. Andersen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import EventEmitter = require('events'); + +/** + * Node-RED node creation api. + */ +export interface Red { + /** Node lifecycle management api. Used by all nodes. */ + nodes: Nodes; + log: any; + settings: any; + events: any; + util: any; + /** Returns the version of the running Node-RED environment. */ + version(): string; +} + +/** + * Node base type. + * + * See the Nodes interfaces registerType() method for information about + * declaring node constructors in typescript. + * + * The id, type and name properties are available after the + * call to RED.nodes.createNode(). + */ +export interface Node extends EventEmitter, NodeProperties { + updateWires(wires: any): void; + context(): any; + close(removed: any): void; + /** + * Send one or more messages to multiple downstream nodes. + * It is possible to send multiple messages to any + * one node by sending an array to the node instead + * of a single message. + * @param msg - array of messages and/or message bundle arrays. + */ + send(msg: any[]): void; + /** + * Send a message to the downstream node. If msg is null or + * undefined, no message is sent. + * @param msg - optional message to send. + */ + send(msg?: any): void; + /** + * Send a message to this node. + * @param msg - optional message to send. + */ + receive(msg: any): void; + /** + * Log an log-level event. Used for mundane events + * that are part of the normal functioning of the + * node. + * @param msg - message to log. + */ + log(msg: any): void; + /** + * Log a warn-level event. For important events + * that the user should be made aware of. + * @param msg - message to log. + */ + warn(msg: any): void; + /** + * Log an error-level event. To trigger catch nodes on + * the workflow call the function with msg set to the + * original message. + * @param logMessage - description of the error. + * @param msg - optional payload that caused the error. + */ + error(logMessage: any, msg?: any): void; + /** + * Log a debug-level event. Use this is for logging + * internal detail not needed for normal operation. + * @param msg - message to log. + */ + debug(msg: any): void; + /** + * Log a trace-level event. Even more internal details than + * debug-level. + * @param msg - message to log. + */ + trace(msg: any): void; + metric(eventname?: any, msg?: any, metricValue?: any): void; + /** + * Set or clear node status. + * + * For more info see: https://nodered.org/docs/creating-nodes/status + * @param status - the status to set or an empty object to clear the + * node status. + */ + status(status: NodeStatus | ClearNodeStatus): void; +} + +/** + * Contains the user selected property values + * for the node. + * + * This object is also known as the node's definition + * object. + */ +export interface NodeProperties { + /** This node's unique identifier. */ + id: NodeId; + /** The type name for this node. */ + type: NodeType; + /** + * The UI visible name for this node. Many nodes + * allow the user to pick the name and provide + * a fallback name, if they leave it blank. + */ + name: string; +} + +/** Unique node identifier. */ +export type NodeId = string; +/** Node type name. */ +export type NodeType = string; + +/** Node status icon color choices. */ +export type StatusFill = "red" | "green" | "yellow" | "blue" | "grey"; +/** Node status icon shape choices. */ +export type StatusShape = "ring" | "dot"; + +/** + * Object used to set the nodes status flag. + */ +export interface NodeStatus { + /** Selects the icon color. */ + fill: StatusFill; + /** Selects either ring or dot shape. */ + shape: StatusShape; + /** Status label. */ + text: string; +} + +/** Fancy definition that matches an empty object. */ +export interface ClearNodeStatus { + fill?: undefined; + shape?: undefined; + text?: undefined; +} + +export interface Nodes { + /** + * Node constructor functions must call this to + * finish setting up the node. Among other things + * it adds the node credentials, which are stored + * outside the flow. + * + * @param node - the node object under construction. + * @param props - the node's properties object, aka. + * the node instance definition. + */ + createNode(node: Node, props: NodeProperties): void; + /** + * Get a node by NodeID. + * + * If your node uses a configuration + * node, this call is used to get access to the running + * instance. + * @param id - the id of the node. + * @return - the node matching the given id. + */ + getNode(id: NodeId): Node; + eachNode(callback: (node: Node) => any): void; + /** + * Adds a set of credentials for the given node id. + * @param id the node id for the credentials + * @param creds an object of credential key/value pairs + */ + addCredentials(id: NodeId, creds: object): void; + /** + * Gets the credentials for the given node id. + * @param id the node id for the credentials + * @return the credentials + */ + getCredentials(id: NodeId): object; + /** + * Deletes the credentials for the given node id. + * @param id the node id for the credentials + */ + deleteCredentials(id: NodeId): void; + /** + * Registers a node constructor. + * + * Node constructors should be declared as functions with an explicit this + * argument of a type descending from the Node interface. You can extend + * the NodeProperties interface also, to add your node's properties. + * + * Example, using in-line declaration: + * + * RED.nodes.registerType('my-node', function(this: MyNode, props: MyProperties) + * => { RED.nodes.createNode(this, props); ... }, { ... }); + * @param type - the string type name + * @param constructor - the constructor function for this node type + * @param opts - optional additional options for the node + */ + registerType(type: string, constructor: (props: NodeProperties) => any, opts?: any): void; +} diff --git a/types/node-red/node-red-tests.ts b/types/node-red/node-red-tests.ts new file mode 100644 index 0000000000..94031db2fb --- /dev/null +++ b/types/node-red/node-red-tests.ts @@ -0,0 +1,33 @@ +import * as nodered from 'node-red'; + +interface MyFantasticNode extends nodered.Node { + myStrProp: string; + myNmbProp: number; + someResource: any; +} + +interface MyFantasticProps extends nodered.NodeProperties { + config: nodered.NodeId; +} + +export = (RED: nodered.Red) => { + RED.nodes.registerType('my-fantastic-node', function(this: MyFantasticNode, props: MyFantasticProps) { + RED.nodes.createNode(this, props); + const config = RED.nodes.getNode(props.config); + this.log('Something fantastic happened.'); + this.warn('Something exceptional happened.'); + this.error('Something disastrous happened when I tried to process this.', { payload: 'Cookies' }); + this.debug('A behind the scenes look.'); + this.trace('A look behind the scenes, under the floor.'); + this.status({ fill: 'red', shape: 'dot', text: 'status' }); + this.status({}); + this.send({ payload: 'Milk' }); + this.send([[ + { payload: 'FirstMessageFirstNode' }, + { payload: 'SecondMessageFirstNode' }, + ], { payload: "MessageSecondNode" }]); + this.on('close', () => { + this.someResource.close(); + }); + }); +}; diff --git a/types/node-red/tsconfig.json b/types/node-red/tsconfig.json new file mode 100644 index 0000000000..06c4329f93 --- /dev/null +++ b/types/node-red/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", + "node-red-tests.ts" + ] +} diff --git a/types/node-red/tslint.json b/types/node-red/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/node-red/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 354d5b31f35902a3c953cc859adcc2c0f370281e Mon Sep 17 00:00:00 2001 From: Samer Albahra Date: Mon, 2 Oct 2017 13:51:21 -0500 Subject: [PATCH 38/67] Add typing for LocalizeJS Library (#20098) * Add typing for LocalizeJS This adds the library typings for LocalizeJS * Add private to `package.json` for Travis testing * Remove conflicting files from typing * Fix all lint errors * Rename `LocalizeJS` to `LocalizeJS Library` --- types/localizejs-library/index.d.ts | 225 ++++++++++++++++++ .../localizejs-library-tests.ts | 3 + types/localizejs-library/tsconfig.json | 22 ++ types/localizejs-library/tslint.json | 1 + 4 files changed, 251 insertions(+) create mode 100644 types/localizejs-library/index.d.ts create mode 100644 types/localizejs-library/localizejs-library-tests.ts create mode 100644 types/localizejs-library/tsconfig.json create mode 100644 types/localizejs-library/tslint.json diff --git a/types/localizejs-library/index.d.ts b/types/localizejs-library/index.d.ts new file mode 100644 index 0000000000..17d75bce31 --- /dev/null +++ b/types/localizejs-library/index.d.ts @@ -0,0 +1,225 @@ +// Type definitions for LocalizeJS Library 1.0 +// Project: https://help.localizejs.com/docs/library-api +// Definitions by: Samer Albahra +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace LocalizeJS.Context { + interface Options { + /** + * Required. Your project key. + */ + key: string; + + /** + * Language to translate your website to. + */ + targetLanguage: string; + + /** + * Defaults to false. If true, Localize will translate your website to the last selected language on subsequent page views. + */ + rememberLanguage: boolean; + + /** + * Defaults to true. If true, translations will be fetched from Localize if not bootstrapped. + */ + fetchTranslations: boolean; + + /** + * Defaults to true. If true, unrecognized phrases will be added to your Localize account. Disable this in development. + */ + saveNewPhrases: boolean; + + /** + * Defaults to true. If true, "alt" attributes will be translated. + */ + translateAlt: boolean; + + /** + * Defaults to false. Set to true to prefetch all active languages, or pass a language code or an array of codes to. + */ + prefetch: boolean; + + /** + * Array of class names for which Localize will ignore. + */ + blockedClasses: string[]; + + /** + * Array of class names for which Localize will translate. If you use this option, Localize will only translate content + * contained in these classes and will ignore all other content in the body of the page. + */ + translateClasses: string[]; + + /** + * Defaults to true. Automatically default the page language to the user's preferred language. The first path segment + * in the URL is used to check to detect the language, ie. www.localize.com/fr. If no language dictionary exists for that + * segment then the language setting in their browser is used. + */ + autodetectLanguage: boolean; + + /** + * Defaults to false. When true, Localize will attempt to translate the entire body of the page. + * If false, Localize will only translate content contained with a "localizejs" class name. + */ + translateBody: boolean; + + /** + * The default language your website will be in when no language has been selected. Defaults to the source language of your website. + */ + defaultLanguage: string; + + /** + * The base path will be stripped from the URL of the phrase as seen in the "Filter by pages" feature. + */ + basePath: string; + + /** + * Defaults to true. If true, the of the page will translate. + */ + translateTitle: boolean; + + /** + * Defaults to false. Allows users to turn on meta tag translation. This optimizes your site for SEO. + */ + translateMetaTags: boolean; + + /** + * Defaults to false. If true, Localize will detect phrases only when the page is not translated. + * Please contact support@localizejs.com prior to updating this option. + */ + saveNewPhrasesFromSource: boolean; + + /** + * Defaults to false. Automatically translate content that is added dynamically to your webpage. + * For example, if your webpage dynamically adds html into the source of the page, our library + * will translate it once the translations have been generated. Behind the scenes this means the + * dictionary file with all your translated content is available for use with Localize.translate(). + * However, translations are not generated instantly, so use with our library event updatedDictionary is recommended. + */ + retranslateOnNewPhrases: boolean; + + /** + * Defaults to false. If true, the Localize library will not send additional metadata to our servers. + * This metadata includes the surrounding HTML of the phrases detected on your website. + */ + enhancedContentSecurity: boolean; + + /** + * Defaults to false. If true, the Localize library will pick up phrases in the <time> elements. + */ + translateTimeElement: boolean; + + /** + * Defaults to false. If true, the Localize library will pick up numbers as phrases. + */ + translateNumbers: boolean; + } +} + +declare var Localize: { + /** + * Initializes LocalizeJS with the supplied options. + * @param options An object containing the supplied options. + */ + initialize(options: LocalizeJS.Context.Options): void; + + /** + * Translates the page into the given language. + * @param language Required. Language codes can be found on your Languages page. + */ + setLanguage(language: string): void + + /** + * Returns the current language of the page. If a language hasn't been set, source is returned. + */ + getLanguage(): string + + /** + * Returns the visitor's list of preferred languages, based on the browser's "accept-language" header. + * @param callback Required. + */ + detectLanguage(callback: () => void): void + + /** + * Returns all available languages for the project. + * @param callback Required. + */ + getAvailableLanguages(callback: () => void): void + + /** + * Translates text or text within html. + * + * If the Localize.translate() input is a string, instances of %{variable} will be replaced with the given value in the variables object. + * You may also use HTML <var> tags in the string + * + * If the active language is the source language of the page, Localize.translate will return the untranslated phrase. + * Localize.translate can be used with or without a callback. We highly recommend using the callback approach if you're calling + * Localize.translate in the first 10 seconds of page load to ensure that the latest translations are available. The callback will + * allow the translation to delay until translations have been fully loaded into the browser. If the translations are already + * loaded, the callback is executed immediately. + * + * @param input Required. Can be text, html or native DOM elements + * @param variables Optional. Object of variables that will be replaced in the input, if it's a string + * @param callback Optional. Callback will trigger once translations have been fetched from Localize. + */ + translate(input: string, variables?: any, callback?: () => void): void + + /** + * Translates all text on the page + */ + translatePage(): void + + /** + * Untranslates all text on the page + */ + untranslatePage(): void + + /** + * Untranslates a specified element on the page. Use Localize.untranslatePage() if untranslating the whole page. + * @param element Required. A DOM node to untranslate + */ + untranslate(element: string): void + + /** + * Bootstrapping translations enables your app to translate without fetching translations remotely from Localizejs.com + * @param translations Required. Generate properly formatted translations on your Languages page + */ + bootstrap(translations: any): void + + /** + * Speed up language switching by prefetching + * @param languages Required. Accepts a string or an array or languages (ex. 'zh-CN') + */ + prefetch(languages: string|string[]): void + + /** + * Saves the phrase, if unrecognized, to your Localize project. Useful for ensuring rarely printed text + * (ie. an obscure error message) is translated. Returns the phrase it was passed. + * @param phrase Required. A string or an array of strings + */ + phrase(phrase: string|string[]): string|string[] + + /** + * Attach an event handler to Localize events. + * @param eventName Required. Name of event to bind to. Can optionally be namespaced: "setLanguage.ns" + * @param fn Required. Event handler. + */ + on(eventName: "initialize" | "setLanguage" | "pluralize" | "translate" | "untranslatePage" | "updatedDictionary", fn: () => void): void + + /** + * Remove an event handler. + * @param eventName Required. Name of event to unbind to. Can optionally be namespaced: "setLanguage.ns" + * @param fn Optional. The () => void to unbind from the event. + */ + on(eventName: "initialize" | "setLanguage" | "pluralize" | "translate" | "untranslatePage" | "updatedDictionary", fn?: () => void): void + + /** + * Returns exchange rate for provided currencies. + * + * @param fromCurrency Required. The default source currency, to be converted from. + * @param toCurrency Required. The new currency, to be converted to. + * @param callback Required. Receives err and rateData arguments. + */ + getExchangeRate(fromCurrency: string, toCurrency: string, callback: () => void): void +}; diff --git a/types/localizejs-library/localizejs-library-tests.ts b/types/localizejs-library/localizejs-library-tests.ts new file mode 100644 index 0000000000..8566b984b5 --- /dev/null +++ b/types/localizejs-library/localizejs-library-tests.ts @@ -0,0 +1,3 @@ +const current = Localize.getLanguage(); + +Localize.setLanguage(current); diff --git a/types/localizejs-library/tsconfig.json b/types/localizejs-library/tsconfig.json new file mode 100644 index 0000000000..0dfeec7c44 --- /dev/null +++ b/types/localizejs-library/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", + "localizejs-library-tests.ts" + ] +} diff --git a/types/localizejs-library/tslint.json b/types/localizejs-library/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/localizejs-library/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f12f41e198cdf329025be54337459ad7d61c90a5 Mon Sep 17 00:00:00 2001 From: Matt Traynham <skitch920@gmail.com> Date: Mon, 2 Oct 2017 15:14:44 -0400 Subject: [PATCH 39/67] Add dts-generator types (#20137) --- types/dts-generator/dts-generator-tests.ts | 3 + types/dts-generator/index.d.ts | 86 ++++++++++++++++++++++ types/dts-generator/tsconfig.json | 22 ++++++ types/dts-generator/tslint.json | 1 + 4 files changed, 112 insertions(+) create mode 100644 types/dts-generator/dts-generator-tests.ts create mode 100644 types/dts-generator/index.d.ts create mode 100644 types/dts-generator/tsconfig.json create mode 100644 types/dts-generator/tslint.json diff --git a/types/dts-generator/dts-generator-tests.ts b/types/dts-generator/dts-generator-tests.ts new file mode 100644 index 0000000000..76e37dc802 --- /dev/null +++ b/types/dts-generator/dts-generator-tests.ts @@ -0,0 +1,3 @@ +import dtsGenerator = require('dts-generator'); + +dtsGenerator({name: 'foo', out: 'bar'}); diff --git a/types/dts-generator/index.d.ts b/types/dts-generator/index.d.ts new file mode 100644 index 0000000000..9de25e1f91 --- /dev/null +++ b/types/dts-generator/index.d.ts @@ -0,0 +1,86 @@ +// Type definitions for dts-generator 2.1 +// Project: https://github.com/SitePen/dts-generator#readme +// Definitions by: Matt Traynham <https://github.com/mtraynham> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import ts = require('typescript'); +import Bluebird = require('bluebird'); + +export = dtsGenerator; + +declare function dtsGenerator(options: dtsGenerator.DtsGeneratorOptions): Bluebird<void>; + +declare namespace dtsGenerator { + interface ResolveModuleIdParams { + /** The identifier of the module being declared in the generated d.ts */ + currentModuleId: string; + } + + interface ResolveModuleImportParams { + /** The identifier of the module currently being imported in the generated d.ts */ + importedModuleId: string; + + /** The identifier of the enclosing module currently being declared in the generated d.ts */ + currentModuleId: string; + + /** True if the imported module id is declared as a module in the input files. */ + isDeclaredExternalModule: boolean; + } + + interface DtsGeneratorOptions { + /** + * The base directory for the package being bundled. Any dependencies discovered outside this directory will be excluded + * from the bundle. + * Note this is no longer the preferred way to configure dts-generator, please see project. + */ + baseDir?: string; + /** + * A list of glob patterns, relative to baseDir, that should be excluded from the bundle. + * Use the --exclude flag one or more times on the command-line. Defaults to [ "node_modules\/**\/*.d.ts" ]. + */ + exclude?: string[]; + /** + * A list of external module reference paths that should be inserted as reference comments. + * Use the --extern flag one or more times on the command-line. + */ + externs?: string[]; + /** + * A list of external @types package dependencies that should be inserted as reference comments. + * Use the --types flag one or more times on the command-line. + */ + types?: string[]; + /** A list of files from the baseDir to bundle. */ + files?: string[]; + /** The end-of-line character that should be used when outputting code. Defaults to os.EOL. */ + eol?: string; + /** The character(s) that should be used to indent the declarations in the output. Defaults to \t. */ + indent?: string; + /** The module ID that should be used as the exported value of the package’s “main” module. */ + main?: string; + /** The type of module resolution to use when generating the bundle. */ + moduleResolution?: ts.ModuleResolutionKind; + /** The name of the package. Used to determine the correct exported package name for modules. */ + name: string; + /** The filename where the generated bundle will be created. */ + out: string; + /** + * The base directory for the project being bundled. It is assumed that this directory contains a + * tsconfig.json which will be parsed to determine the files that should be bundled as well as + * other configuration information like target + */ + project?: string; + /** The target environment for generated code. Defaults to ts.ScriptTarget.Latest. */ + target?: ts.ScriptTarget; + /** + * An optional callback provided by the invoker to customize the declared module ids the output d.ts files. + * @see {@link https://github.com/SitePen/dts-generator/blob/master/docs/resolving-module-ids.md Resolving Module Ids} + */ + resolveModuleId?(params: ResolveModuleIdParams): string; + /** + * An optional callback provided by the invoker to customize the imported module ids in the output d.ts files. + * @see {@link https://github.com/SitePen/dts-generator/blob/master/docs/resolving-module-ids.md Resolving Module Ids} + */ + resolveModuleImport?(params: ResolveModuleImportParams): string; + } +} diff --git a/types/dts-generator/tsconfig.json b/types/dts-generator/tsconfig.json new file mode 100644 index 0000000000..b1fa8686f2 --- /dev/null +++ b/types/dts-generator/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", + "dts-generator-tests.ts" + ] +} diff --git a/types/dts-generator/tslint.json b/types/dts-generator/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dts-generator/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ab5cdaf0ac46a34f2a0ca2c75a75b1151d09c79a Mon Sep 17 00:00:00 2001 From: smhxx <captaintrek@gmail.com> Date: Mon, 2 Oct 2017 14:18:17 -0500 Subject: [PATCH 40/67] Add type definitions for atom/node-oniguruma (oniguruma on npm) (#20149) --- types/oniguruma/index.d.ts | 166 +++++++++++++++++++++++++++++ types/oniguruma/oniguruma-tests.ts | 84 +++++++++++++++ types/oniguruma/tsconfig.json | 23 ++++ types/oniguruma/tslint.json | 1 + 4 files changed, 274 insertions(+) create mode 100644 types/oniguruma/index.d.ts create mode 100644 types/oniguruma/oniguruma-tests.ts create mode 100644 types/oniguruma/tsconfig.json create mode 100644 types/oniguruma/tslint.json diff --git a/types/oniguruma/index.d.ts b/types/oniguruma/index.d.ts new file mode 100644 index 0000000000..4734ae39ee --- /dev/null +++ b/types/oniguruma/index.d.ts @@ -0,0 +1,166 @@ +// Type definitions for oniguruma 7.0 +// Project: http://atom.github.io/node-oniguruma +// Definitions by: smhxx <https://github.com/smhxx> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** An (error, match) callback function to be invoked after an asynchronous + * search operation is completed. The type of T varies slightly based on the + * method being called. + */ +export type Callback<T> = (error: Error, match: T) => void; + +/** An object representing a range within a search string, corresponding to + * either a full-string match, or a capturing group within a match. + */ +export interface CaptureIndex { + /** The index of the capturing group, or 0 for a full-string match */ + index: number; + /** The position in the search string where the capture begins */ + start: number; + /** The position in the search string where the capture ends */ + end: number; + /** The total character length of the capture */ + length: number; +} + +/** An object representing one successful regex match between a pattern and a + * search string. + */ +export interface Match { + /** The index of the best pattern match */ + index: number; + /** An array holding all of the captures (full match + capturing groups) */ + captureIndices: CaptureIndex[]; +} + +/** An object representing a single regex pattern, which can be used to + * interrogate strings for matches against that pattern. + */ +export class OnigRegExp { + /** Create a new regex with the given pattern + * @param pattern A string pattern + */ + constructor(pattern: string); + + /** The regex pattern that the OnigRegExp matches against */ + readonly source: string; + /** The OnigScanner instance used internally for regex matching */ + readonly scanner: OnigScanner; + + /** Augment the capture indices for the given Match object by extracting + * the substrings associated with each capture, assinging them to the + * CaptureIndex object's 'match' property + * @param string The search string from which 'match' resulted + * @param match The Match object containing the matches of the search + * @return An array of CaptureIndex objects which have been augmented with + * the original text that triggered the match + */ + captureIndicesForMatch(string: any, match: Match): + Array<CaptureIndex & { match: string }>; + /** Search the string for a match starting at the given position. + * @param string The string to search. + * @param startPosition The optional position to start at, defaults to 0 + * @param callback The (error, match) function to call when done. Match will + * be null if no matches were found. Otherwise, match will be an + * array of objects for each matched group. + */ + search(string: string, startPosition: number, + callback: Callback<CaptureIndex[] | null>): void; + /** Search the string for a match starting at the beginning of the string. + * @param string The string to search. + * @param callback The (error, match) function to call when done. Match will + * be null if no matches were found. Otherwise, match will be an + * array of objects for each matched group. + */ + search(string: string, + callback: Callback<CaptureIndex[] | null>): void; + /** Synchronously search the string for a match starting at the given + * position. + * @param string The string to search. + * @param startPosition The optional position to start at, defaults to 0 + * @return An array of objects representing each matched group, or null if + * there were no matches. + */ + searchSync(string: string, startPosition?: number): CaptureIndex[] | null; + /** Test if this regular expression matches the given string. + * @param string The string to test against. + * @param callback The (error, matches) function to call when done. Matches + * will be true if at least one match was found, or false otherwise. + */ + test(sring: string, callback: Callback<boolean>): void; + /** Synchronously test if this regular expression matches the given string. + * @param string The string to test against. + * @return True if there is at least one match, or false otherwise. + */ + testSync(string: string): boolean; +} + +/** An object representing one OR MORE regex patterns, which can be used to + * interrogate strings for matches against any of the supplied patterns. + */ +export class OnigScanner { + /** Create a new scanner with the given patterns. + * @param patterns An array of string patterns. + */ + constructor(patterns: ReadonlyArray<string>); + + /** Find the next match from a given position + * @param string The string to search + * @param startPosition The optional position to start at, defaults to 0 + * @param callback The (error, match) function to be called when done. Match + * will be null when there is no match. + * @return void + */ + findNextMatch(string: string, startPosition: number, + callback: Callback<Match | null>): void; + /** Find the next match from the beginning of a string + * @param string The string to search + * @param callback The (error, match) function to be called when done. Match + * will be null when there is no match. + * @return void + */ + findNextMatch(string: string, callback: Callback<Match | null>): void; + /** Synchronously find the next match from a given position + * @param string The string to search + * @param startPosition The optional position to start at, defaults to 0 + * @return An object containing details about the match, or null if no match + */ + findNextMatchSync(string: string, startPosition?: number): Match | null; + /** Coerce the provided value into either a string primitive or a wrapped + * OnigString object. + * @param value A value of any type + * @return A string primitive or OnigString object representing 'value' + */ + private convertToString(value: any): string | OnigString; + /** Coerce the provided value into a number + * @param value A value of any type + * @return A number representing 'value' + */ + private convertToNumber(value: any): number; +} + +/** An object class used internally as a wrapper for JavaScript string + * primitives. + */ +export class OnigString { + /** Wrap a string primitive in a new OnigString object + * @param string The string primitive to be wrapped + */ + constructor(string: string); + + /** The character length of the string primitive wrapped by the object */ + readonly length: number; + /** The string primitive wrapped by the object */ + readonly content: string; + + /** Returns a reference the string primitive wrapped by the object + * @return A reference to the wrapped string primitive + */ + toString(): string; + /** Returns a substring of the string primitive wrapped by the object + * @param start The index of the first character to include + * @param end The index before which the substring should end + * @return A new string primitive containing the specified index range + */ + substring(start: number, end: number): string; +} diff --git a/types/oniguruma/oniguruma-tests.ts b/types/oniguruma/oniguruma-tests.ts new file mode 100644 index 0000000000..4aa9a83baf --- /dev/null +++ b/types/oniguruma/oniguruma-tests.ts @@ -0,0 +1,84 @@ +import { + OnigRegExp, + OnigScanner, + OnigString, + CaptureIndex, + Match +} from 'oniguruma'; + +// Test OnigRegExp +let aString: string; +let aBoolean: boolean; +const usPhoneNumber = new OnigRegExp( + '(?:\\+?1[- ]?)?(?:\\([0-9]{3}\\)|[0-9]{3})[- ]?[0-9]{3}[- ]?[0-9]{4}' +); +const phoneBook = '(318) 555-1204, 18004389216, donotreply@blep.gov'; +aString = usPhoneNumber.source; +let result: CaptureIndex[] | null; +result = usPhoneNumber.searchSync(phoneBook, 0); +result = usPhoneNumber.searchSync(phoneBook); +aBoolean = usPhoneNumber.testSync(phoneBook); + +const searchCallback = (err: Error, match: CaptureIndex[] | null) => { + if (match !== null) { + console.log(match.length); + } else if (err) { + throw err; + } +}; +usPhoneNumber.search(phoneBook, searchCallback); +usPhoneNumber.search(phoneBook, 8, searchCallback); + +const testCallback = (err: Error, match: boolean) => { + if (match) { + console.log('It matched! :D'); + } +}; +usPhoneNumber.test(phoneBook, testCallback); + +const foo = usPhoneNumber.captureIndicesForMatch(phoneBook, { + index: 0, + captureIndices: [ + { index: 0, start: 0, end: 15, length: 15 } + ] +}); +for (const index of foo) { + let bar: string; + bar = index.match; + console.log(bar); +} + +// Test OnigScanner +let aMatch: Match; +let scanner: OnigScanner; +scanner = usPhoneNumber.scanner; +scanner = new OnigScanner(['abc', 'def']); +scanner.findNextMatch('dcfedeabcedfdef', (err: Error, match: Match | null) => { + if (match !== null) { + aMatch = match; + } +}); +scanner.findNextMatch('dcfedeabcedfdef', 8, (err: Error, match: Match | null) => { + if (match !== null) { + aMatch = match; + } +}); +let rv = scanner.findNextMatchSync('dcfedeabcedfdef'); +if (rv !== null) { + aMatch = rv; +} +rv = scanner.findNextMatchSync('dcfedeabcedfdef', 8); +if (rv !== null) { + aMatch = rv; +} + +// Test OnigString +const blep = new OnigString('bar'); +let blepLength: number; +blepLength = blep.length; +let blepContent: string; +blepContent = blep.content; +let blepToString: string; +blepToString = blep.toString(); +let blepSubstring: string; +blepSubstring = blep.substring(0, 2); diff --git a/types/oniguruma/tsconfig.json b/types/oniguruma/tsconfig.json new file mode 100644 index 0000000000..3f338cdbab --- /dev/null +++ b/types/oniguruma/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "oniguruma-tests.ts" + ] +} diff --git a/types/oniguruma/tslint.json b/types/oniguruma/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/oniguruma/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 460302420194baed69f57e5fdfbcf45e0cb9ba5b Mon Sep 17 00:00:00 2001 From: Matt Traynham <skitch920@gmail.com> Date: Mon, 2 Oct 2017 15:21:31 -0400 Subject: [PATCH 41/67] Add type definitions for webpack-chunk-hash plugin (#20145) --- types/webpack-chunk-hash/index.d.ts | 34 +++++++++++++++++++ types/webpack-chunk-hash/tsconfig.json | 22 ++++++++++++ types/webpack-chunk-hash/tslint.json | 1 + .../webpack-chunk-hash-tests.ts | 15 ++++++++ 4 files changed, 72 insertions(+) create mode 100644 types/webpack-chunk-hash/index.d.ts create mode 100644 types/webpack-chunk-hash/tsconfig.json create mode 100644 types/webpack-chunk-hash/tslint.json create mode 100644 types/webpack-chunk-hash/webpack-chunk-hash-tests.ts diff --git a/types/webpack-chunk-hash/index.d.ts b/types/webpack-chunk-hash/index.d.ts new file mode 100644 index 0000000000..dc8f697a44 --- /dev/null +++ b/types/webpack-chunk-hash/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for webpack-chunk-hash 0.4 +// Project: https://github.com/alexindigo/webpack-chunk-hash#readme +// Definitions by: Matt Traynham <https://github.com/mtraynham> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import webpack = require('webpack'); + +export = WebpackChunkHash; + +declare class WebpackChunkHash extends webpack.Plugin { + constructor(options?: WebpackChunkHash.Options); +} + +declare namespace WebpackChunkHash { + interface Options { + /** + * @default 'md5' + * @description The hash algorithm to use + * @see {@link https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options} + */ + algorithm?: string; + /** + * @default 'hex' + * @description The digest enconding to use + * @see {@link https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options} + */ + digest?: 'hex' | 'latin1' | 'base64'; + /** + * @default null + * @description A callback to add more content to the resulting hash + */ + additionalHashContent?(chunk: any): string; + } +} diff --git a/types/webpack-chunk-hash/tsconfig.json b/types/webpack-chunk-hash/tsconfig.json new file mode 100644 index 0000000000..1d6e971b9d --- /dev/null +++ b/types/webpack-chunk-hash/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", + "webpack-chunk-hash-tests.ts" + ] +} diff --git a/types/webpack-chunk-hash/tslint.json b/types/webpack-chunk-hash/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/webpack-chunk-hash/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/webpack-chunk-hash/webpack-chunk-hash-tests.ts b/types/webpack-chunk-hash/webpack-chunk-hash-tests.ts new file mode 100644 index 0000000000..56a7be1579 --- /dev/null +++ b/types/webpack-chunk-hash/webpack-chunk-hash-tests.ts @@ -0,0 +1,15 @@ +import webpack = require('webpack'); +import WebpackChunkHashPlugin = require('webpack-chunk-hash'); + +const a: webpack.Configuration = { + entry: 'test.js', + plugins: [ + new WebpackChunkHashPlugin() + ] +}; +const b: webpack.Configuration = { + entry: 'test.js', + plugins: [ + new WebpackChunkHashPlugin({algorithm: 'sha-256', digest: 'latin1', additionalHashContent: () => 'test'}) + ] +}; From d21b17c876ae9d54538d0bd3217266b157a3e761 Mon Sep 17 00:00:00 2001 From: Matt Traynham <skitch920@gmail.com> Date: Mon, 2 Oct 2017 15:22:33 -0400 Subject: [PATCH 42/67] Add type definitions for karma-webpack (#20140) --- types/karma-webpack/index.d.ts | 38 ++++++++++++++++++++++ types/karma-webpack/karma-webpack-tests.ts | 14 ++++++++ types/karma-webpack/tsconfig.json | 25 ++++++++++++++ types/karma-webpack/tslint.json | 1 + 4 files changed, 78 insertions(+) create mode 100644 types/karma-webpack/index.d.ts create mode 100644 types/karma-webpack/karma-webpack-tests.ts create mode 100644 types/karma-webpack/tsconfig.json create mode 100644 types/karma-webpack/tslint.json diff --git a/types/karma-webpack/index.d.ts b/types/karma-webpack/index.d.ts new file mode 100644 index 0000000000..0042ff01a3 --- /dev/null +++ b/types/karma-webpack/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for karma-webpack 2.0 +// Project: http://github.com/webpack/karma-webpack +// Definitions by: Matt Traynham <https://github.com/mtraynham> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as m from 'karma'; +import webpack = require('webpack'); +import webpackDevMiddleware = require('webpack-dev-middleware'); + +declare module 'karma' { + // Note: karma-webpack will set publicPath for us, so it is optional here. + // Unfortuantely, Typescript doesn't let you overload properties, so + // the entire definition is duplicated here. + interface KarmaWebpackMiddlewareOptions /** extends webpackDevMiddleware.Options */ { + noInfo?: boolean; + quiet?: boolean; + lazy?: boolean; + watchOptions?: webpack.Options.WatchOptions; + publicPath?: string; + index?: string; + headers?: { + [name: string]: string; + }; + stats?: webpack.Options.Stats; + reporter?: webpackDevMiddleware.Reporter | null; + serverSideRender?: boolean; + + log?: webpackDevMiddleware.Logger; + warn?: webpackDevMiddleware.Logger; + error?: webpackDevMiddleware.Logger; + filename?: string; + } + + interface ConfigOptions { + webpack: webpack.Configuration; + webpackMiddlewareOptions: KarmaWebpackMiddlewareOptions; + } +} diff --git a/types/karma-webpack/karma-webpack-tests.ts b/types/karma-webpack/karma-webpack-tests.ts new file mode 100644 index 0000000000..b04b02f9db --- /dev/null +++ b/types/karma-webpack/karma-webpack-tests.ts @@ -0,0 +1,14 @@ +import karma = require('karma'); + +export default function(config: karma.Config): void { + config.set({ + files: ['src/index.spec.ts'], + browsers: ['ChromeHeadless'], + singleRun: true, + frameworks: ['jasmine'], + preprocessors: {'src/index.spec.ts': ['webpack', 'sourcemap']}, + webpack: {entry: 'test.js'}, + webpackMiddlewareOptions: {noInfo: true}, + reporters: ['spec'] + }); +} diff --git a/types/karma-webpack/tsconfig.json b/types/karma-webpack/tsconfig.json new file mode 100644 index 0000000000..6f357958af --- /dev/null +++ b/types/karma-webpack/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "paths": { + "q": [ "q/v0" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "karma-webpack-tests.ts" + ] +} diff --git a/types/karma-webpack/tslint.json b/types/karma-webpack/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/karma-webpack/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e7819a5f5ad290cacd92364c096a4660864e4b98 Mon Sep 17 00:00:00 2001 From: Matt Traynham <skitch920@gmail.com> Date: Mon, 2 Oct 2017 15:26:40 -0400 Subject: [PATCH 43/67] Add type definitions for webpack-node-externals (#20143) --- types/webpack-node-externals/index.d.ts | 51 +++++++++++++++++++ types/webpack-node-externals/tsconfig.json | 22 ++++++++ types/webpack-node-externals/tslint.json | 1 + .../webpack-node-externals-tests.ts | 21 ++++++++ 4 files changed, 95 insertions(+) create mode 100644 types/webpack-node-externals/index.d.ts create mode 100644 types/webpack-node-externals/tsconfig.json create mode 100644 types/webpack-node-externals/tslint.json create mode 100644 types/webpack-node-externals/webpack-node-externals-tests.ts diff --git a/types/webpack-node-externals/index.d.ts b/types/webpack-node-externals/index.d.ts new file mode 100644 index 0000000000..e1a4078c26 --- /dev/null +++ b/types/webpack-node-externals/index.d.ts @@ -0,0 +1,51 @@ +// Type definitions for webpack-node-externals 1.6 +// Project: https://github.com/liady/webpack-node-externals +// Definitions by: Matt Traynham <https://github.com/mtraynham> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import webpack = require('webpack'); + +export = webpackNodeExternals; + +declare function webpackNodeExternals(options?: webpackNodeExternals.Options): webpack.ExternalsFunctionElement; + +declare namespace webpackNodeExternals { + type WhitelistOption = string | RegExp; + + interface Options { + /** + * An array for the externals to whitelist, so they will be included in the bundle. + * Can accept exact strings ('module_name'), regex patterns (/^module_name/), or a + * function that accepts the module name and returns whether it should be included. + * Important - if you have set aliases in your webpack config with the exact + * same names as modules in node_modules, you need to whitelist them so Webpack will know + * they should be bundled. + * @default [] + */ + whitelist?: WhitelistOption[]; + /** + * @default ['.bin'] + */ + binaryDirs?: string[]; + /** + * The method in which unbundled modules will be required in the code. Best to leave as + * 'commonjs' for node modules. + * @default 'commonjs' + */ + importType?: 'var' | 'this' | 'commonjs' | 'amd' | 'umd'; + /** + * The folder in which to search for the node modules. + * @default 'node_modules' + */ + modulesDir?: string; + /** + * Read the modules from the package.json file instead of the node_modules folder. + * @default false + */ + modulesFromFile?: boolean; + /** + * @default false + */ + includeAbsolutePaths?: boolean; + } +} diff --git a/types/webpack-node-externals/tsconfig.json b/types/webpack-node-externals/tsconfig.json new file mode 100644 index 0000000000..70e62e7b0c --- /dev/null +++ b/types/webpack-node-externals/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", + "webpack-node-externals-tests.ts" + ] +} diff --git a/types/webpack-node-externals/tslint.json b/types/webpack-node-externals/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/webpack-node-externals/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/webpack-node-externals/webpack-node-externals-tests.ts b/types/webpack-node-externals/webpack-node-externals-tests.ts new file mode 100644 index 0000000000..0fc309d280 --- /dev/null +++ b/types/webpack-node-externals/webpack-node-externals-tests.ts @@ -0,0 +1,21 @@ +import webpack = require('webpack'); +import webpackNodeExternals = require('webpack-node-externals'); + +const a: webpack.Configuration = { + entry: 'test.js', + externals: [ + webpackNodeExternals() + ] +}; +const b: webpack.Configuration = { + entry: 'test.js', + externals: webpackNodeExternals() +}; +const c: webpack.Configuration = { + entry: 'test.js', + externals: [ + webpackNodeExternals({ + whitelist: ['jquery', 'webpack/hot/dev-server', /^lodash/] + }) + ] +}; From 00356e86fa7863dac3cab25d22398a1d41174c63 Mon Sep 17 00:00:00 2001 From: Matt Traynham <skitch920@gmail.com> Date: Mon, 2 Oct 2017 15:30:01 -0400 Subject: [PATCH 44/67] Add types for duplicate-package-checker-webpack-plugin (#20141) --- ...te-package-checker-webpack-plugin-tests.ts | 24 +++++++++++++++++++ .../index.d.ts | 21 ++++++++++++++++ .../tsconfig.json | 22 +++++++++++++++++ .../tslint.json | 1 + 4 files changed, 68 insertions(+) create mode 100644 types/duplicate-package-checker-webpack-plugin/duplicate-package-checker-webpack-plugin-tests.ts create mode 100644 types/duplicate-package-checker-webpack-plugin/index.d.ts create mode 100644 types/duplicate-package-checker-webpack-plugin/tsconfig.json create mode 100644 types/duplicate-package-checker-webpack-plugin/tslint.json diff --git a/types/duplicate-package-checker-webpack-plugin/duplicate-package-checker-webpack-plugin-tests.ts b/types/duplicate-package-checker-webpack-plugin/duplicate-package-checker-webpack-plugin-tests.ts new file mode 100644 index 0000000000..0552f0e7c4 --- /dev/null +++ b/types/duplicate-package-checker-webpack-plugin/duplicate-package-checker-webpack-plugin-tests.ts @@ -0,0 +1,24 @@ +import webpack = require('webpack'); +import DuplicatePackageCheckerWebpackPlugin = require('duplicate-package-checker-webpack-plugin'); + +const a: webpack.Configuration = { + entry: 'test.js', + plugins: [ + new DuplicatePackageCheckerWebpackPlugin() + ] +}; +const b: webpack.Configuration = { + entry: 'test.js', + plugins: [ + new DuplicatePackageCheckerWebpackPlugin({}) + ] +}; +const c: webpack.Configuration = { + entry: 'test.js', + plugins: [ + new DuplicatePackageCheckerWebpackPlugin({ + verbose: true, + emitError: true + }) + ] +}; diff --git a/types/duplicate-package-checker-webpack-plugin/index.d.ts b/types/duplicate-package-checker-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..88d8ccd54c --- /dev/null +++ b/types/duplicate-package-checker-webpack-plugin/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for duplicate-package-checker-webpack-plugin 1.2 +// Project: https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin#readme +// Definitions by: Matt Traynham <https://github.com/mtraynham> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import webpack = require('webpack'); + +export = DuplicatePackageCheckerWebpackPlugin; + +declare class DuplicatePackageCheckerWebpackPlugin extends webpack.Plugin { + constructor(options?: DuplicatePackageCheckerWebpackPlugin.Options); +} + +declare namespace DuplicatePackageCheckerWebpackPlugin { + interface Options { + // Also show module that is requiring each duplicate package + verbose?: boolean; + // Emit errors instead of warnings + emitError?: boolean; + } +} diff --git a/types/duplicate-package-checker-webpack-plugin/tsconfig.json b/types/duplicate-package-checker-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..7b3dc55ffe --- /dev/null +++ b/types/duplicate-package-checker-webpack-plugin/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", + "duplicate-package-checker-webpack-plugin-tests.ts" + ] +} diff --git a/types/duplicate-package-checker-webpack-plugin/tslint.json b/types/duplicate-package-checker-webpack-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/duplicate-package-checker-webpack-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 509cff841cf4cdd1774c79c8e771bec82f971ef7 Mon Sep 17 00:00:00 2001 From: Jan Bevers <janbevers87@gmail.com> Date: Mon, 2 Oct 2017 21:31:25 +0200 Subject: [PATCH 45/67] Added typings for redux-first-router-link (#20104) --- types/redux-first-router-link/index.d.ts | 56 +++++++++++++++++++ .../redux-first-router-link-tests.tsx | 31 ++++++++++ types/redux-first-router-link/tsconfig.json | 24 ++++++++ types/redux-first-router-link/tslint.json | 1 + 4 files changed, 112 insertions(+) create mode 100644 types/redux-first-router-link/index.d.ts create mode 100644 types/redux-first-router-link/redux-first-router-link-tests.tsx create mode 100644 types/redux-first-router-link/tsconfig.json create mode 100644 types/redux-first-router-link/tslint.json diff --git a/types/redux-first-router-link/index.d.ts b/types/redux-first-router-link/index.d.ts new file mode 100644 index 0000000000..d7b2e7a079 --- /dev/null +++ b/types/redux-first-router-link/index.d.ts @@ -0,0 +1,56 @@ +// Type definitions for redux-first-router-link 1.4 +// Project: https://github.com/faceyspacey/redux-first-router-link#readme +// Definitions by: janb87 <https://github.com/janb87> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import * as React from "react"; +import { Location } from 'redux-first-router'; + +export type To = string | string[] | object; + +export type OnClick = false | ((e: React.SyntheticEvent<HTMLElement>) => boolean | undefined); + +export interface Match<P> { + params: P; + isExact: boolean; + path: string; + url: string; +} + +export interface LinkProps { + to: To; + redirect?: boolean; + replace?: boolean; + tagName?: string; + children?: React.ReactNode; + onPress?: OnClick; + onClick?: OnClick; + down?: boolean; + shouldDispatch?: boolean; + target?: string; +} + +export default class Link extends React.Component<LinkProps> {} + +export interface NavLinkProps { + to: To; + redirect?: boolean; + replace?: boolean; + children?: React.ReactNode; + onPress?: OnClick; + onClick?: OnClick; + down?: boolean; + shouldDispatch?: boolean; + target?: string; + className?: string; + style?: React.CSSProperties; + activeClassName?: string; + activeStyle?: React.CSSProperties; + ariaCurrent?: string; + exact?: boolean; + strict?: boolean; + isActive?(match: Match<object>, location: Location): boolean; +} + +export class NavLink extends React.Component<NavLinkProps> {} diff --git a/types/redux-first-router-link/redux-first-router-link-tests.tsx b/types/redux-first-router-link/redux-first-router-link-tests.tsx new file mode 100644 index 0000000000..01889e5fe1 --- /dev/null +++ b/types/redux-first-router-link/redux-first-router-link-tests.tsx @@ -0,0 +1,31 @@ +import * as React from "react"; +import Link, { NavLink } from "redux-first-router-link"; + +interface Payload { + category: string; +} + +export default () => { + return ( + <div> + { /* as a standard href path string: */ } + <Link to='/list/db-graphql'>DB & GRAPHQL</Link> + + { /* as an array of path segments: */ } + <Link to={['list', 'react-redux']}>REACT & REDUX</Link> + + { /* as an action object (RECOMMENDED APPROACH SO YOU CAN CHANGE ALL URLs FROM YOUR ROUTESMAP): */ } + <Link to={{type: 'LIST', payload: { category: 'fp' }}}>FP</Link> + + <NavLink + to={{ type: 'LIST', payload: { category: 'redux-first-router' } }} + activeClassName='active' + activeStyle={{ color: 'purple' }} + exact={true} + strict={true} + isActive={(match, location) => (location.payload as Payload).category === 'redux-first-router'} > + Redux First Router + </NavLink> + </div> + ); +}; diff --git a/types/redux-first-router-link/tsconfig.json b/types/redux-first-router-link/tsconfig.json new file mode 100644 index 0000000000..ea8c862f20 --- /dev/null +++ b/types/redux-first-router-link/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "redux-first-router-link-tests.tsx" + ] +} diff --git a/types/redux-first-router-link/tslint.json b/types/redux-first-router-link/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/redux-first-router-link/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bd863e9ed2f2584eca6dfe8221d63ce6fcc1e3fb Mon Sep 17 00:00:00 2001 From: Andy <anhans@microsoft.com> Date: Mon, 2 Oct 2017 13:00:54 -0700 Subject: [PATCH 46/67] i18next/v2: Fix lint (#20212) --- types/i18next/v2/tslint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/i18next/v2/tslint.json b/types/i18next/v2/tslint.json index 23714c9cea..3d8ba29b42 100644 --- a/types/i18next/v2/tslint.json +++ b/types/i18next/v2/tslint.json @@ -1,8 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [ - false - ] + // TODOs + "interface-name": false, + "no-any-union": false } } From aeea74dbb61f0a137058c02694bd676db5e9724d Mon Sep 17 00:00:00 2001 From: Andy <anhans@microsoft.com> Date: Mon, 2 Oct 2017 13:01:04 -0700 Subject: [PATCH 47/67] sencha_touch: Make type of getScrollable() match interface (again) (#20211) --- types/sencha_touch/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/sencha_touch/index.d.ts b/types/sencha_touch/index.d.ts index 733fcb7673..85cc9d5ed6 100644 --- a/types/sencha_touch/index.d.ts +++ b/types/sencha_touch/index.d.ts @@ -17187,7 +17187,7 @@ declare namespace Ext { /** [Method] Returns the value of scrollable * @returns Boolean */ - getScrollable?(): boolean; + getScrollable?(): Ext.scroll.IView; /** [Method] Returns the value of selectedCls * @returns String */ From bfafb5ffc60339a5a713f7e1655408f8ebb9d9ce Mon Sep 17 00:00:00 2001 From: nickmorton <github@nick.morton.name> Date: Mon, 2 Oct 2017 21:05:32 +0100 Subject: [PATCH 48/67] [swaggerize-express] Add RequestHandler array to RouteSegment i/f (#20001) * Added RequestHandler array to RouteSegment i/f Also replaced a couple of String declarations with string. * Removed spread operators to downgrade to TypeScript 2.0 --- types/swaggerize-express/index.d.ts | 6 +-- .../swaggerize-express-tests.ts | 50 +++++++++++-------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/types/swaggerize-express/index.d.ts b/types/swaggerize-express/index.d.ts index 49f2fef004..d7a8df14bb 100644 --- a/types/swaggerize-express/index.d.ts +++ b/types/swaggerize-express/index.d.ts @@ -224,13 +224,13 @@ declare namespace swaggerize { } export interface RouteSegment { - [urlSegment: string]: RouteSegment | express.RequestHandler; + [urlSegment: string]: RouteSegment | express.RequestHandler | express.RequestHandler[]; } export interface Options { api: Swagger.ApiDefinition - docspath: String - handlers: String | RouteSegment + docspath: string + handlers: string | RouteSegment } export interface IConfig { diff --git a/types/swaggerize-express/swaggerize-express-tests.ts b/types/swaggerize-express/swaggerize-express-tests.ts index 79d453f29d..9dd0e1e718 100644 --- a/types/swaggerize-express/swaggerize-express-tests.ts +++ b/types/swaggerize-express/swaggerize-express-tests.ts @@ -2,35 +2,26 @@ import http = require('http'); import express = require('express'); import swaggerize = require('swaggerize-express'); +const api = { + swagger: "2.0", + host: "localhost:8080", + info: { + title: "swaggerize-express.d.ts test", + version: "1" + }, + paths: { + } +}; + var app = express(); app.use(swaggerize(<swaggerize.Options>{ - api: { - swagger: "2.0", - host: "localhost:8080", - info: { - title: "swaggerize-express.d.ts test", - version: "1" - }, - paths: { - - } - }, + api, docspath: '/api-docs', handlers: './handlers' })); app.use(swaggerize(<swaggerize.Options>{ - api: { - swagger: "2.0", - host: "localhost:8080", - info: { - title: "swaggerize-express.d.ts test", - version: "1" - }, - paths: { - - } - }, + api, docspath: '/api-docs', handlers: { 'api': { @@ -43,6 +34,21 @@ app.use(swaggerize(<swaggerize.Options>{ } })); +app.use(swaggerize(<swaggerize.Options>{ + api, + docspath: '/api-docs', + handlers: { + 'api': { + 'authenticated-path': { + '$get': [ + (req: express.Request, res: express.Response, next: express.NextFunction) => next(), + (req: express.Request, res: express.Response) => res.send('v1'), + ] + } + } + } +})); + var server = app.listen(18888, 'localhost', function () { (<swaggerize.SwaggerizedExpress>app).swagger.api.host = server.address().address + ':' + server.address().port; }); From 97642087296f65268787a9d67b7a95e4471e2dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Iglesias?= <jesusgiglesias@gmail.com> Date: Mon, 2 Oct 2017 22:09:11 +0200 Subject: [PATCH 49/67] Fixes #19714. Webdriverio issue (#20040) --- types/webdriverio/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webdriverio/index.d.ts b/types/webdriverio/index.d.ts index ff0628ced4..f1d37d0f88 100644 --- a/types/webdriverio/index.d.ts +++ b/types/webdriverio/index.d.ts @@ -1209,7 +1209,7 @@ declare namespace WebdriverIO { init<P>(capabilities?: DesiredCapabilities): Client<P>; /** @deprecated in favour of Actions.keyDown */ - keys(value: string | string[]): Client<RawResult<null>> & RawResult<null> & never; + keys(value: string | string[]): Client<RawResult<null>> & RawResult<null> & Client<void>; /** @deprecated in favour of Actions.keyDown */ keys<P>(value: string | string[]): Client<P>; From 2717cfa52c5cdab7e234459643fcc90d7382a222 Mon Sep 17 00:00:00 2001 From: Dibyo Majumdar <dibyo.majumdar@gmail.com> Date: Mon, 2 Oct 2017 13:10:11 -0700 Subject: [PATCH 50/67] [react-redux] Add `createProvider` (#20052) * Add ConnectFunction interface * Add createProvider function declaration * Add documentation for createProvider * Update documentation for Connect * Add new author * Add test for createProvider --- types/react-redux/index.d.ts | 129 ++++++++++++++---------- types/react-redux/react-redux-tests.tsx | 64 ++++++++++-- 2 files changed, 127 insertions(+), 66 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 4d3ae2f5c5..203ce7f791 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -6,6 +6,7 @@ // Curits Layne <https://github.com/clayne11> // Frank Tan <https://github.com/tansongyang> // Nicholas Boll <https://github.com/nicholasboll> +// Dibyo Majumdar <https://github.com/mdibyo> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -66,73 +67,80 @@ export type InferableComponentEnhancer<TInjectedProps> = * @param mergeProps * @param options */ -export declare function connect(): InferableComponentEnhancer<DispatchProp<any>>; +export interface Connect { + (): InferableComponentEnhancer<DispatchProp<any>>; -export declare function connect<TStateProps = {}, no_dispatch = {}, TOwnProps = {}>( - mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps> -): InferableComponentEnhancerWithProps<TStateProps & DispatchProp<any>, TOwnProps>; + <TStateProps = {}, no_dispatch = {}, TOwnProps = {}>( + mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps> + ): InferableComponentEnhancerWithProps<TStateProps & DispatchProp<any>, TOwnProps>; -export declare function connect<no_state = {}, TDispatchProps = {}, TOwnProps = {}>( - mapStateToProps: null | undefined, - mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps> -): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>; + <no_state = {}, TDispatchProps = {}, TOwnProps = {}>( + mapStateToProps: null | undefined, + mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps> + ): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>; -export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>( - mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, - mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps> -): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>; + <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>( + mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, + mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps> + ): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>; -export declare function connect<TStateProps = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>( - mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, - mapDispatchToProps: null | undefined, - mergeProps: MergeProps<TStateProps, undefined, TOwnProps, TMergedProps>, -): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; + <TStateProps = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>( + mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, + mapDispatchToProps: null | undefined, + mergeProps: MergeProps<TStateProps, undefined, TOwnProps, TMergedProps>, + ): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; -export declare function connect<no_state = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>( - mapStateToProps: null | undefined, - mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, - mergeProps: MergeProps<undefined, TDispatchProps, TOwnProps, TMergedProps>, -): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; + <no_state = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>( + mapStateToProps: null | undefined, + mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, + mergeProps: MergeProps<undefined, TDispatchProps, TOwnProps, TMergedProps>, + ): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; -export declare function connect<no_state = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>( - mapStateToProps: null | undefined, - mapDispatchToProps: null | undefined, - mergeProps: MergeProps<undefined, undefined, TOwnProps, TMergedProps>, -): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; + <no_state = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>( + mapStateToProps: null | undefined, + mapDispatchToProps: null | undefined, + mergeProps: MergeProps<undefined, undefined, TOwnProps, TMergedProps>, + ): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; -export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>( - mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, - mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, - mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>, -): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; + <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>( + mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, + mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, + mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>, + ): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; -export declare function connect<TStateProps = {}, no_dispatch = {}, TOwnProps = {}>( - mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, - mapDispatchToProps: null | undefined, - mergeProps: null | undefined, - options: Options<TStateProps, TOwnProps> -): InferableComponentEnhancerWithProps<DispatchProp<any> & TStateProps, TOwnProps>; + <TStateProps = {}, no_dispatch = {}, TOwnProps = {}>( + mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, + mapDispatchToProps: null | undefined, + mergeProps: null | undefined, + options: Options<TStateProps, TOwnProps> + ): InferableComponentEnhancerWithProps<DispatchProp<any> & TStateProps, TOwnProps>; -export declare function connect<no_state = {}, TDispatchProps = {}, TOwnProps = {}>( - mapStateToProps: null | undefined, - mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, - mergeProps: null | undefined, - options: Options<no_state, TOwnProps> -): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>; + <no_state = {}, TDispatchProps = {}, TOwnProps = {}>( + mapStateToProps: null | undefined, + mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, + mergeProps: null | undefined, + options: Options<no_state, TOwnProps> + ): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>; -export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>( - mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, - mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, - mergeProps: null | undefined, - options: Options<TStateProps, TOwnProps> -): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>; + <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>( + mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, + mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, + mergeProps: null | undefined, + options: Options<TStateProps, TOwnProps> + ): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>; -export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>( - mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, - mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, - mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>, - options: Options<TStateProps, TOwnProps, TMergedProps> -): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; + <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>( + mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>, + mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, + mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>, + options: Options<TStateProps, TOwnProps, TMergedProps> + ): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>; +} + +/** + * The connect function. See {@type Connect} for details. + */ +export declare const connect: Connect; interface MapStateToProps<TStateProps, TOwnProps> { (state: any, ownProps: TOwnProps): TStateProps; @@ -284,3 +292,12 @@ export interface ProviderProps { * Makes the Redux store available to the connect() calls in the component hierarchy below. */ export class Provider extends React.Component<ProviderProps, {}> { } + +/** + * Creates a new <Provider> which will set the Redux Store on the passed key of the context. You probably only need this + * if you are in the inadvisable position of having multiple stores. You will also need to pass the same storeKey to the + * options argument of connect. + * + * @param storeKey The key of the context on which to set the store. + */ +export declare function createProvider(storeKey: string): typeof Provider; diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index c52d40d0aa..1b10f6d645 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -1,8 +1,8 @@ import { Component, ReactElement } from 'react'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { Store, Dispatch, ActionCreator, bindActionCreators, ActionCreatorsMapObject } from 'redux'; -import { connect, Provider, DispatchProp, MapStateToProps } from 'react-redux'; +import { Store, Dispatch, ActionCreator, createStore, bindActionCreators, ActionCreatorsMapObject } from 'redux'; +import { Connect, connect, createProvider, Provider, DispatchProp, MapStateToProps, Options } from 'react-redux'; import objectAssign = require('object-assign'); // @@ -14,10 +14,10 @@ import objectAssign = require('object-assign'); // output of `connect` to make sure the signature is what is expected namespace Empty { - interface OwnProps { foo: string, dispatch: Dispatch<any> } + interface OwnProps { foo: string, dispatch: Dispatch<any> } class TestComponent extends Component<OwnProps> {} - + const Test = connect()(TestComponent) const verify = <Test foo='bar' /> @@ -90,7 +90,7 @@ namespace MapDispatch { )(TestComponent) const verifyNull = <TestNull foo='bar' /> - + const TestUndefined = connect( undefined, mapDispatchToProps, @@ -140,7 +140,7 @@ namespace MapDispatchFactory { )(TestComponent) const verifyNull = <TestNull foo='bar' /> - + const TestUndefined = connect( undefined, mapDispatchToPropsFactory, @@ -176,11 +176,11 @@ namespace MapStateFactoryAndDispatch { interface OwnProps { foo: string } interface StateProps { bar: number } interface DispatchProps { onClick: () => void } - + const mapStateToPropsFactory = () => () =>({ bar: 1 }) - + const mapDispatchToProps = () => ({ onClick: () => {} }) @@ -199,11 +199,11 @@ namespace MapStateFactoryAndDispatchFactory { interface OwnProps { foo: string } interface StateProps { bar: number } interface DispatchProps { onClick: () => void } - + const mapStateToPropsFactory = () => () =>({ bar: 1 }) - + const mapDispatchToPropsFactory = () => () => ({ onClick: () => {} }) @@ -850,3 +850,47 @@ namespace TestWrappedComponent { // `Connected` does not require explicit `name` prop const TestConnected = (props: any) => <Connected />; } + +namespace TestCreateProvider { + const STORE_KEY = 'myStore'; + + const MyStoreProvider = createProvider(STORE_KEY); + + const myStoreConnect: Connect = function( + mapStateToProps?: any, + mapDispatchToProps?: any, + mergeProps?: any, + options: Options = {}, + ) { + options.storeKey = STORE_KEY; + return connect( + mapStateToProps, + mapDispatchToProps, + mergeProps, + options, + ); + }; + + interface State { a: number }; + const store = createStore<State>(() => ({ a: 1 })); + const myStore = createStore<State>(() => ({ a: 2 })); + + interface AProps { a: number }; + const A = (props: AProps) => (<h1>A is {props.a}</h1>); + const A1 = connect<AProps>(state => state)(A); + const A2 = myStoreConnect<AProps>(state => state)(A); + + const Combined = () => ( + <Provider store={store}> + <MyStoreProvider store={myStore}> + <A1 /> + <A2 /> + </MyStoreProvider> + </Provider> + ); + + // This renders: + // <h1>A is 1</h1> + // <h1>A is 2</h1> + ReactDOM.render(<Combined />, document.body); +} From 69af3a040e289fdd0e8711df677f881427cbc27d Mon Sep 17 00:00:00 2001 From: Oren Farhi <farhioren@gmail.com> Date: Tue, 3 Oct 2017 00:24:28 +0300 Subject: [PATCH 51/67] update "thumbnails" property for GoogleApiYouTubePlaylistResource (#20078) --- types/gapi.youtube/index.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/types/gapi.youtube/index.d.ts b/types/gapi.youtube/index.d.ts index 5f3aef616a..b09779cdb3 100644 --- a/types/gapi.youtube/index.d.ts +++ b/types/gapi.youtube/index.d.ts @@ -1621,7 +1621,7 @@ interface GoogleApiYouTubePlaylistResource { /** * A map of thumbnail images associated with the playlist. For each object in the map, the key is the name of the thumbnail image, and the value is an object that contains other information about the thumbnail. */ - thumbnails: GoogleApiYouTubeThumbnailItemResource[]; + thumbnails: GoogleApiYouTubeThumbnailResource; /** * The channel title of the channel that the video belongs to. */ @@ -1813,6 +1813,14 @@ interface GoogleApiYouTubeThumbnailResource { * A high resolution version of the thumbnail image. For a video (or a resource that refers to a video), this image is 480px wide and 360px tall. For a channel, this image is 800px wide and 800px tall. */ high: GoogleApiYouTubeThumbnailItemResource; + /** + * A standard resolution version of the thumbnail image. For a video (or a resource that refers to a video), this image is 480px wide and 360px tall. For a channel, this image is 800px wide and 800px tall. + */ + standard?: GoogleApiYouTubeThumbnailItemResource; + /** + * A very high resolution version of the thumbnail image. For a video (or a resource that refers to a video), this image is 480px wide and 360px tall. For a channel, this image is 800px wide and 800px tall. + */ + maxres?: GoogleApiYouTubeThumbnailItemResource; } interface GoogleApiYouTubeThumbnailItemResource { From b743589ef96dd18497ac1d70c347d3db7b6d196b Mon Sep 17 00:00:00 2001 From: rapmue <rapmue@gmail.com> Date: Mon, 2 Oct 2017 23:25:27 +0200 Subject: [PATCH 52/67] [recharts] changed the signature of tickformatter (#20201) Changed the signature of tickformatter function. The changes are based on the issue #19756. --- types/recharts/index.d.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 311330b06d..b6aa236663 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -10,6 +10,7 @@ import * as React from 'react'; export type Percentage = string; export type RechartsFunction = () => void; +export type TickFormatterFunction = (value: any) => any; export type LabelFormatter = (label: string | number) => React.ReactNode; export type TooltipFormatter = (value: string | number | Array<string | number>, name: string, entry: TooltipPayload, index: number) => React.ReactNode; @@ -139,7 +140,7 @@ export interface BrushProps { travellerWidth?: number; startIndex?: number; endIndex?: number; - tickFormatter?: RechartsFunction; + tickFormatter?: TickFormatterFunction; onChange?: RechartsFunction; } @@ -379,7 +380,7 @@ export interface PolarAngleAxisProps { tick?: boolean | any | React.ReactElement<any> | RechartsFunction; ticks: any[]; orient?: string; - tickFormatter: RechartsFunction; + tickFormatter: TickFormatterFunction; onClick?: RechartsFunction; onMouseDown?: RechartsFunction; onMouseUp?: RechartsFunction; @@ -413,7 +414,7 @@ export interface PolarRadiusAxisProps { orientation?: "left" | "right" | "middle"; axisLine?: boolean | any; tick?: boolean | any | Element | RechartsFunction; - tickFormatter: RechartsFunction; + tickFormatter: TickFormatterFunction; tickCount?: number; scale?: ScaleType | RechartsFunction; onClick?: RechartsFunction; @@ -763,7 +764,7 @@ export interface XAxisProps { axisLine?: boolean | any; tickLine?: boolean | any; tickSize?: number; - tickFormatter?: RechartsFunction; + tickFormatter?: TickFormatterFunction; ticks?: any[]; tick?: boolean | any | React.ReactElement<any>; mirror?: boolean; @@ -806,7 +807,7 @@ export interface YAxisProps { tickCount?: number; tickLine?: boolean | any; tickSize?: number; - tickFormatter?: RechartsFunction; + tickFormatter?: TickFormatterFunction; ticks?: any[]; tick?: boolean | any | React.ReactElement<any>; mirror?: boolean; From 75d1bec99db3e4e96287ae40076ff3e1ec5a2261 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <tn0502@users.noreply.github.com> Date: Mon, 2 Oct 2017 23:25:46 +0200 Subject: [PATCH 53/67] Add macos to PlatformOSType. (#20206) --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 42a1601612..423ba6e4fc 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -5612,7 +5612,7 @@ export interface PixelRatioStatic { /** * @see https://facebook.github.io/react-native/docs/platform-specific-code.html#content */ -export type PlatformOSType = 'ios' | 'android' | 'windows' | 'web' +export type PlatformOSType = 'ios' | 'android' | 'macos' | 'windows' | 'web' interface PlatformStatic { OS: PlatformOSType From 73c50882bf78d2a6654228ae2fac6cb59fee2d56 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <tn0502@users.noreply.github.com> Date: Mon, 2 Oct 2017 23:26:48 +0200 Subject: [PATCH 54/67] Platform.select to allow any PlatformOSType as key. (#20207) --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 423ba6e4fc..16abbe3f6b 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -5621,7 +5621,7 @@ interface PlatformStatic { /** * @see https://facebook.github.io/react-native/docs/platform-specific-code.html#content */ - select<T>( specifics: { ios?: T, android?: T} ): T; + select<T>( specifics: { [platform in PlatformOSType]?: T; } ): T; } interface PlatformIOSStatic extends PlatformStatic { From 8871815151be9eaa2214a6e21a918037101149b9 Mon Sep 17 00:00:00 2001 From: Dasa Paddock <dpaddock@esri.com> Date: Mon, 2 Oct 2017 14:32:19 -0700 Subject: [PATCH 55/67] Update for ArcGIS API for JavaScript version 3.22 (#20138) --- types/arcgis-js-api/v3/index.d.ts | 132 ++++++++++++++++++++++-------- 1 file changed, 96 insertions(+), 36 deletions(-) diff --git a/types/arcgis-js-api/v3/index.d.ts b/types/arcgis-js-api/v3/index.d.ts index 0c30ae898d..de4328a957 100644 --- a/types/arcgis-js-api/v3/index.d.ts +++ b/types/arcgis-js-api/v3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ArcGIS API for JavaScript 3.21 +// Type definitions for ArcGIS API for JavaScript 3.22 // Project: https://developers.arcgis.com/javascript/3/ // Definitions by: Esri <https://github.com/Esri> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -284,6 +284,8 @@ declare module "esri" { columnDelimiter?: string; /** Copyright information for the layer. */ copyright?: string; + /** Enables feature reduction (for example clustering) on point layers. */ + featureReduction?: any; /** The fields property contains objects with "name", "alias" and "type" String properties. */ fields?: any[]; /** The latitude field name. */ @@ -608,13 +610,13 @@ declare module "esri" { locationProvider: LocationProviderBase; } export interface DataBrowserOptions { - /** Whether or not to display the hierarchy dropdown for countries with multiple hierarchies (e.g. */ + /** Whether or not to display the hierarchy dropdown for countries with multiple hierarchies (for example USA has both Census and Landscape, Germany has both Census and Nexiga). */ allowHierarchies?: boolean; /** Show/hide country drop down. */ countryBox?: boolean; /** Two-digit country code selected in the country drop down. */ countryID?: string; - /** The hierarchy to load for a country (e.g. */ + /** The hierarchy to load for a country (for example 'Census' or 'Landscape' for USA). */ hierarchyID?: string; /** Text string to display on the back button on the second and third pages of the Data Browser. */ pageBackButton?: string; @@ -896,6 +898,8 @@ declare module "esri" { displayOnPan?: boolean; /** Set a callback function that will be invoked by FeatureLayer.getEditSummary. */ editSummaryCallback?: Function; + /** Enables feature reduction (for example clustering) on point layers. */ + featureReduction?: any; /** Specify the geodatabase version to display. */ gdbVersion?: string; /** Unique ID to assign to the layer. */ @@ -1172,7 +1176,7 @@ declare module "esri" { remove(): void; } export interface HeatmapRendererOptions { - /** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */ + /** The radius (in pixels) of the circle over which the majority of each point's value is spread out. */ blurRadius?: number; /** An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). */ colors: string[]; @@ -1718,7 +1722,7 @@ declare module "esri" { pixels: number[][]; /** Pixel type. */ pixelType?: string; - /** Array of objects containing numeric statistical properties (e.g. */ + /** Array of objects containing numeric statistical properties (for example minValue, maxValue, noDataValue, etc.). */ statistics?: any[]; /** Number of columns. */ width: number; @@ -1856,7 +1860,7 @@ declare module "esri" { primaryHandle?: number; /** Toggle for showing the black handle bars. */ showHandles?: boolean; - /** Flexible toggle for showing labels (e.g. */ + /** Flexible toggle for showing labels (for example ["data", "handle"]). */ showLabels?: boolean | string[]; /** Toggle for showing the horizontal line indicators from the center of the handle. */ showTicks?: boolean; @@ -2153,7 +2157,7 @@ declare module "esri" { } export interface TemplatePickerOptions { /** Number of visible columns. */ - columns?: number; + columns?: number | string; /** Defines the text to be displayed when the template picker does not have any templates to display. */ emptyMessage?: string; /** Array of input feature layers. */ @@ -2165,7 +2169,7 @@ declare module "esri" { /** Length of label description. */ maxLabelLength?: number; /** Number of visible rows. */ - rows?: number; + rows?: number | string; /** Tooltip content contains the template name and description. */ showTooltip?: boolean; /** HTML style attributes for the widget. */ @@ -3488,7 +3492,7 @@ declare module "esri/dijit/BasemapGallery" { basemaps: Basemap[]; /** This value is true after the BasemapGallery retrieves the ArcGIS.com basemaps. */ loaded: boolean; - /** Optional parameter to pass in a portal URL, including the instance name, used to access the group containing the basemap gallery items. */ + /** Optional parameter to pass in a portal URL, including the instance name, used to access the group containing the basemap gallery items, for example www.myportal.com/myInstance or http://www.myportal.com/myInstance. */ portalUrl: string; /** * Creates a new BasemapGallery dijit. @@ -4567,8 +4571,8 @@ declare module "esri/dijit/InfoWindow" { /** Determines whether the InfoWindow is currently shown on the map. */ isShowing: boolean; /** - * Create a new Info Window. - * @param params Optional parameters. + * Create a new InfoWindow. + * @param params Specify optional parameters used to create the InfoWindow. * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. */ constructor(params: any, srcNodeRef: Node | string); @@ -4633,6 +4637,12 @@ declare module "esri/dijit/InfoWindowLite" { fixedAnchor: string; /** Determines whether the InfoWindowLite is currently shown on the map. */ isShowing: boolean; + /** + * Create a new InfoWindowLite. + * @param params Specify optional parameters used to create the InfoWindowLite. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: any, srcNodeRef: Node | string); /** Hides the InfoWindow. */ hide(): void; /** @@ -5117,8 +5127,8 @@ declare module "esri/dijit/OverviewMap" { declare module "esri/dijit/Popup" { import esri = require("esri"); import InfoWindowBase = require("esri/InfoWindowBase"); - import Graphic = require("esri/graphic"); import FillSymbol = require("esri/symbols/FillSymbol"); + import Graphic = require("esri/graphic"); import LineSymbol = require("esri/symbols/LineSymbol"); import Point = require("esri/geometry/Point"); import MarkerSymbol = require("esri/symbols/MarkerSymbol"); @@ -5127,6 +5137,8 @@ declare module "esri/dijit/Popup" { class Popup extends InfoWindowBase { /** Controls the placement of the popup window with respect to the geographic location. */ anchor: string; + /** Visualizes the extent of the points summarized by the cluster graphic when the user selects the "Browse Features" action in the cluster popup. */ + clusterFillSymbol: FillSymbol; /** The number of features associated with the info window. */ count: number; /** An array of pending deferreds, null if there are not any pending deferreds. */ @@ -5179,16 +5191,28 @@ declare module "esri/dijit/Popup" { * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. */ constructor(options: esri.PopupOptions, srcNodeRef: Node | string); + /** + * Creates links for the specified actions at the bottom of the popup window. + * @param actions An array of action objects that define the behavior for actions included in the popup. + */ + addActions(actions: any[]): any[]; /** Removes all features and destroys any pending deferreds. */ clearFeatures(): void; /** Destroy the popup. */ destroy(): void; + /** Returns the current placement of the popup window. */ + getCurrentAnchor(): string; /** Get the currently selected feature. */ getSelectedFeature(): Graphic; /** Hide the info window. */ hide(): void; /** Maximize the info window. */ maximize(): void; + /** + * Removes the specified actions from the popup window. + * @param actionInfos An array of objects that describe actions created with addActions(). + */ + removeActions(actionInfos: any[]): void; /** Re-calculates the popup's position with respect to the map location it is pointing to. */ reposition(): void; /** @@ -5222,8 +5246,9 @@ declare module "esri/dijit/Popup" { /** * Associate an array of features or an array of deferreds that return features with the info window. * @param features An array of features or deferreds. + * @param options Additional options for setting features in the popup. */ - setFeatures(features: Graphic[] | any[]): void; + setFeatures(features: Graphic[] | any[], options?: any): void; /** * Sets the info window title. * @param title The text for the title. @@ -5332,8 +5357,6 @@ declare module "esri/dijit/PopupTemplate" { /** The PopupTemplate class extends esri/InfoTemplate and provides support for defining a layout. */ class PopupTemplate extends InfoTemplate { - /** An array of objects that reference Arcade expressions. */ - expressionInfos: any[]; /** The popup definition defined as a JavaScript object. */ info: any; /** @@ -5399,7 +5422,7 @@ declare module "esri/dijit/RendererSlider" { precision: number; /** Toggle for showing the black handle bars. */ showHandles: boolean; - /** Flexible toggle for showing labels e.g. */ + /** Flexible toggle for showing labels, for example ["data","handle"]. */ showLabels: boolean | string[]; /** Toggle for showing the horizontal line indicators from the center of the handle. */ showTicks: boolean; @@ -7991,10 +8014,10 @@ declare module "esri/geometry/geometryEngine" { clip(geometry: Geometry, envelope: Extent): Geometry; /** * Indicates if one geometry contains another geometry. - * @param geometry1 The geometry that is tested for the contains relationship to the other geometry. - * @param geometry2 The geometry that is tested for within relationship to the other geometry. + * @param containerGeometry The geometry that is tested for the "contains" relationship to the other geometry. + * @param insideGeometry The geometry that is tested for the "within" relationship to the containerGeometry. */ - contains(geometry1: Geometry, geometry2: Geometry): boolean; + contains(containerGeometry: Geometry, insideGeometry: Geometry): boolean; /** * Calculates the convex hull of the input geometry. * @param geometry The input geometry. @@ -8200,10 +8223,10 @@ declare module "esri/geometry/geometryEngine" { union(geometries: Geometry[]): Geometry; /** * Indicates if one geometry is within another geometry. - * @param geometry1 The base geometry that is tested for within relationship to the other geometry. - * @param geometry2 The comparison geometry that is tested for the contains relationship to the other geometry. + * @param innerGeometry The base geometry that is tested for within relationship to the other geometry. + * @param outerGeometry The comparison geometry that is tested for the contains relationship to the other geometry. */ - within(geometry1: Geometry, geometry2: Geometry): boolean; + within(innerGeometry: Geometry, outerGeometry: Geometry): boolean; }; export = geometryEngine; } @@ -8234,10 +8257,10 @@ declare module "esri/geometry/geometryEngineAsync" { clip(geometry: Geometry, envelope: Extent): any; /** * Indicates if one geometry contains another geometry. - * @param geometry1 The geometry that is tested for the contains relationship to the other geometry. - * @param geometry2 The geometry that is tested for within relationship to the other geometry. + * @param containerGeometry The geometry that is tested for the "contains" relationship to the other geometry. + * @param insideGeometry The geometry that is tested for the "within" relationship to the containerGeometry. */ - contains(geometry1: Geometry, geometry2: Geometry): any; + contains(containerGeometry: Geometry, insideGeometry: Geometry): any; /** * Calculates the convex hull of the input geometry. * @param geometry The input geometry. @@ -8443,10 +8466,10 @@ declare module "esri/geometry/geometryEngineAsync" { union(geometries: Geometry[]): any; /** * Indicates if one geometry is within another geometry. - * @param geometry1 The base geometry that is tested for within relationship to the other geometry. - * @param geometry2 The comparison geometry that is tested for the contains relationship to the other geometry. + * @param innerGeometry The base geometry that is tested for within relationship to the other geometry. + * @param outerGeometry The comparison geometry that is tested for the contains relationship to the other geometry. */ - within(geometry1: Geometry, geometry2: Geometry): any; + within(innerGeometry: Geometry, outerGeometry: Geometry): any; }; export = geometryEngineAsync; } @@ -8664,8 +8687,15 @@ declare module "esri/graphic" { * @param value The value of the attribute. */ attr(name: string, value: string): Graphic; + /** Creates a deep clone of the graphic object. */ + clone(): Graphic; /** Draws the graphic. */ draw(): Graphic; + /** + * Returns the graphics summarized by the given aggregate graphic in a clustering or feature reduction visualization. + * @param aggregateGraphic A graphic representing the aggregation (or reduction) of several individual graphics in a layer. + */ + getChildGraphics(aggregateGraphic: Graphic): Graphic[]; /** Returns the content string based on attributes and infoTemplate values. */ getContent(): string; /** Returns the dojo/gfx/shape.Shape of the Esri graphic. */ @@ -8688,6 +8718,8 @@ declare module "esri/graphic" { getTitle(): string; /** Hides the graphic. */ hide(): void; + /** Indicates if the graphic represents a cluster of features. */ + isAggregate(): boolean; /** * Defines the attributes of the graphic. * @param attributes The name value pairs of fields and field values associated with the graphic. @@ -9055,7 +9087,7 @@ declare module "esri/layers/ArcGISImageServiceLayer" { timeInfo: TimeInfo; /** By default, images are exported in MIME format, and the image is streamed to the client. */ useMapImage: boolean; - /** The version of ArcGIS Server the image service is published to, e.g. */ + /** The version of ArcGIS Server the image service is published to, such as 9.3, 9.31, 10, 10.41. */ version: number; /** * Creates a new ArcGISImageServiceLayer object. @@ -9073,7 +9105,7 @@ declare module "esri/layers/ArcGISImageServiceLayer" { getDefinitionExpression(): string; /** Get key properties of an ImageService including information such as the band names associated with the imagery. */ getKeyProperties(): any; - /** Asynchronously returns the raster attribute table of an ImageService which returns categorical mapping of pixel values (e.g. */ + /** Asynchronously returns the raster attribute table of an ImageService which returns categorical mapping of pixel values (for example a class, group, category, or membership). */ getRasterAttributeTable(): any; /** Gets the currently visible rasters. */ getVisibleRasters(): Graphic[]; @@ -9651,6 +9683,12 @@ declare module "esri/layers/FeatureLayer" { * @param errback An error object is returned if an error occurs. */ deleteAttachments(objectId: number, attachmentIds: number[], callback?: Function, errback?: Function): any; + /** Disables feature reduction (for example clustering) on the layer. */ + disableFeatureReduction(): void; + /** Enables feature reduction (for example clustering) on the layer using the options set in setFeatureReduction(). */ + enableFeatureReduction(): void; + /** Returns graphics representing the aggregation of several point features clustered together. */ + getAggregateGraphics(): Graphic[]; /** Asynchrously returns custom data for the layer when available. */ getAttributionData(): any; /** Returns the current definition expression. */ @@ -9678,6 +9716,8 @@ declare module "esri/layers/FeatureLayer" { * @param options See the object specifications table below for the structure of the options object. */ getEditSummary(feature: Graphic, options?: any): string; + /** Returns the options used to reduce the number of features visualized by the layer (for example clustering). */ + getFeatureReduction(): any; /** * Returns the Field given the specified field name. * @param fieldName Name of the attribute field. @@ -9691,6 +9731,8 @@ declare module "esri/layers/FeatureLayer" { getSelectedFeatures(): Graphic[]; /** Gets the current selection symbol. */ getSelectionSymbol(): Symbol; + /** Returns graphics from the layer that are not represented by aggregate graphics when feature reduction (such as clustering) is enabled. */ + getSingleGraphics(): Graphic[]; /** Get the current time definition applied to the feature layer. */ getTimeDefinition(): TimeExtent; /** @@ -9702,6 +9744,10 @@ declare module "esri/layers/FeatureLayer" { hasXYFootprint(): boolean; /** Returns true if the FeatureLayer is editable. */ isEditable(): boolean; + /** Indicates if feature reduction (for example clustering) is active in the view. */ + isFeatureReductionActive(): boolean; + /** Indicates if feature reduction (for example clustering) is enabled. */ + isFeatureReductionEnabled(): boolean; /** * Returns true if the layer is visible at the given scale. * @param scale The scale at which to check if the layer is visible. @@ -9778,6 +9824,11 @@ declare module "esri/layers/FeatureLayer" { * @param editable When true, the layer will be set as editable. */ setEditable(editable: boolean): FeatureLayer; + /** + * Sets feature reduction options on the layer (for example clustering options). + * @param options Options for reducing (or aggregating) the features in the map. + */ + setFeatureReduction(options: any): void; /** * Set the layer's data source to the specified geodatabase version. * @param versionName The name of the geodatabase version to use as the layer's data source. @@ -10340,6 +10391,8 @@ declare module "esri/layers/KMLLayer" { * @param isVisible The visibility of the folder and all kml features within the folder. */ setFolderVisibility(folder: KMLFolder, isVisible: boolean): void; + /** Fires when one or more of the layer's network link children fail to load. */ + on(type: "network-link-error", listener: (event: { error: Error; target: KMLLayer }) => void): esri.Handle; /** Fired after the layer is refreshed. */ on(type: "refresh", listener: (event: { target: KMLLayer }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -10692,11 +10745,11 @@ declare module "esri/layers/PixelBlock" { height: number; /** An array of nodata mask. */ mask: any[]; - /** A two dimensional array. */ + /** A two dimensional array representing the pixels from the Image Service displayed on the client. */ pixels: number[][]; /** Pixel type. */ pixelType: string; - /** Array of objects containing numeric statistical properties (e.g. */ + /** Array of objects containing numeric statistical properties (for example minValue, maxValue, noDataValue, etc.). */ statistics: any[]; /** Number of columns. */ width: number; @@ -10710,7 +10763,7 @@ declare module "esri/layers/PixelBlock" { * @param planeData Must have two properties set: pixels and statistics. */ addData(planeData: any): void; - /** Returns pixels and masks using a single array in bip format (e.g. */ + /** Returns pixels and masks using a single array in bip format (for example [p_00_r, p_00_g, p_00_b, p_00_a, p_10_r, p_10_g, p_10_b, p_10_a, .....]). */ getAsRGBA(): any[]; /** Similar to getAsRGBA, but returns floating point data. */ getAsRGBAFloat(): any[]; @@ -12026,7 +12079,7 @@ declare module "esri/map" { resize(immediate?: boolean): void; /** * Change the background color of the map. - * @param color Color specified using either a named string (e.g. + * @param color Color specified using either a named string (for example red), hex string (for example #FF0000), array of rgba values with "a" in the 0-1 range (for example [255,0,0,0.75]), or an instance of esri/Color. */ setBackgroundColor(color: Color | string): void; /** @@ -13023,7 +13076,7 @@ declare module "esri/renderers/HeatmapRenderer" { /** The HeatmapRenderer renders feature layer point data into a raster visualization that emphasizes areas of higher density or weighted values. */ class HeatmapRenderer extends Renderer { - /** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */ + /** The radius (in pixels) of the circle over which the majority of each point's value is spread out. */ blurRadius: number; /** An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). */ colors: string[]; @@ -13336,6 +13389,7 @@ declare module "esri/renderers/TimeRampAger" { declare module "esri/renderers/UniqueValueRenderer" { import Renderer = require("esri/renderers/Renderer"); + import FillSymbol = require("esri/symbols/FillSymbol"); import Symbol = require("esri/symbols/Symbol"); import Graphic = require("esri/graphic"); @@ -13347,6 +13401,8 @@ declare module "esri/renderers/UniqueValueRenderer" { attributeField2: string; /** If needed, specify an additional attribute field the renderer uses to match values. */ attributeField3: string; + /** A symbol used for polygon features as a background if the renderer uses point symbols, for example for bivariate types & size rendering. */ + backgroundFillSymbol: FillSymbol; /** Label for the default symbol used to draw unspecified values. */ defaultLabel: string; /** Default symbol used when a value or break cannot be matched. */ @@ -13506,7 +13562,7 @@ declare module "esri/renderers/smartMapping" { */ createTypeRenderer(params: any): any; /** - * Searches the fields of an input layer or array of field objects for field names commonly used in rendering based on usage (e.g. + * Searches the fields of an input layer or array of field objects for field names commonly used in rendering based on usage (e.g., RANK, TOTAL, AVERAGE, NAME, etc). * @param params See the object specifications table below for details about the params object. */ getSuggestedField(params: any): any; @@ -15247,8 +15303,12 @@ declare module "esri/tasks/IdentifyParameters" { mapExtent: Extent; /** The maximum allowable offset used for generalizing geometries returned by the identify operation. */ maxAllowableOffset: number; + /** If true, field names will be returned instead of field aliases. */ + returnFieldName: boolean; /** If "true", the result set includes the geometry associated with each result. */ returnGeometry: boolean; + /** If true, the values in the result will not be formatted i.e. */ + returnUnformattedValues: boolean; /** The spatial reference of the input and output geometries as well as of the mapExtent. */ spatialReference: SpatialReference; /** Specify the time extent used by the identify task. */ From e1de492381c20b2607322d4a9dc411051bc7a07e Mon Sep 17 00:00:00 2001 From: Dasa Paddock <dpaddock@esri.com> Date: Mon, 2 Oct 2017 14:33:37 -0700 Subject: [PATCH 56/67] [arcgis-js-api] Update for version 4.5 (#20139) * Update for ArcGIS API for JavaScript version 4.5 * Set TypeScript Version to 2.3 --- types/arcgis-js-api/index.d.ts | 13184 ++++++++++++++++--------------- 1 file changed, 6964 insertions(+), 6220 deletions(-) diff --git a/types/arcgis-js-api/index.d.ts b/types/arcgis-js-api/index.d.ts index 115d270add..5098cf63ad 100644 --- a/types/arcgis-js-api/index.d.ts +++ b/types/arcgis-js-api/index.d.ts @@ -1,13 +1,14 @@ -// Type definitions for ArcGIS API for JavaScript 4.4 +// Type definitions for ArcGIS API for JavaScript 4.5 // Project: http://js.arcgis.com // Definitions by: Esri <https://github.com/Esri> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -interface HashMap<T> { +interface HashMap<T = any> { [index: string]: T; } -interface IPromise<T> { +interface IPromise<T = any> { always<U>(callback?: (valueOrError: T) => IPromise<U> | U | void): IPromise<U>; cancel?<U>(reason?: U, strict?: boolean): U; isCanceled?(): boolean; @@ -51,43 +52,951 @@ declare namespace __esri { protected _set<T>(propertyName: string, value: T): this; } + + export type ItemCallback<T> = (item: T, index: number) => void; + + export type ItemCompareCallback<T> = (firstItem: T, secondItem: T) => number; + + export type ItemMapCallback<T, R> = (item: T, index: number) => R; + + export type ItemReduceCallback<T, R> = (previousValue: R, currentValue: T, index: number) => R; + + export type ItemTestCallback<T> = (item: T, index: number) => boolean; + + interface Collection<T = any> extends Evented {} + + type Constructor<T> = new (...params: any[]) => T; + + interface Types<T extends Base, Base = T> { + key: string | ((obj: any) => string); + base: Constructor<Base> | Function; + typeMap: HashMap<Constructor<T>>; + } + + export class Collection<T = any> extends Accessor { + constructor(values?: any[] | Collection<any>); + + readonly length: number; + + add(item: T, index?: number): void; + addMany(items: T[] | Collection<T>, index?: number): void; + clone(): Collection<T>; + concat(value: T[] | Collection<T>): Collection<T>; + every(callback: ItemTestCallback<T>): boolean; + filter(callback: ItemTestCallback<T>): Collection<T>; + find(callback: ItemTestCallback<T>): T; + findIndex(callback: ItemTestCallback<T>): number; + flatten(callback: ItemCallback<T>): Collection<T>; + forEach(callback: ItemCallback<T>): void; + getItemAt(index: number): T; + includes(searchElement: T): boolean; + indexOf(searchElement: T, fromIndex?: number): number; + join(separator?: string): string; + lastIndexOf(searchElement: T, fromIndex?: number): number; + map<R = T>(callback: ItemMapCallback<T, R>): Collection<R>; + pop(): T; + push(item: T): number; + reduce<R = T>(callback: ItemReduceCallback<T, R>, initialValue?: R): R; + reduceRight<R = T>(callback: ItemReduceCallback<T, R>, initialValue?: R): R; + remove(item: T): void; + removeAll(): void; + removeAt(index: number): any; + removeMany(items: T[] | Collection<T>): T[]; + reorder(item: T, index: number): T; + reverse(): Collection<T>; + shift(): T; + slice(begin?: number, end?: number): Collection<T>; + some(callback: ItemCallback<T>): boolean; + sort(compareFunction?: ItemCompareCallback<T>): void; + splice(start: number, deleteCount: number, items: T[] | Collection<T>): T[]; + toArray(): T[]; + unshift(...items: T[]): number; + + static isCollection<T = any>(value: any | Collection<T>): value is Collection<T>; + + static ofType<T extends Base, Base = T>(type: Constructor<T> | Types<T, Base>): new (items?: (T[] | Collection<T>) | { items?: T[] | Collection<T> }) => Collection<T>; + } + + type CollectionProperties<T = any> = T[] | Collection<T>; + + + + type DateProperties = number | string | Date; + + + export type BaseDynamicLayerLayerviewCreateEventHandler = (event: BaseDynamicLayerLayerviewCreateEvent) => void; + + export type BaseDynamicLayerLayerviewDestroyEventHandler = (event: BaseDynamicLayerLayerviewDestroyEvent) => void; + + export type BaseElevationLayerLayerviewCreateEventHandler = (event: BaseElevationLayerLayerviewCreateEvent) => void; + + export type BaseElevationLayerLayerviewDestroyEventHandler = (event: BaseElevationLayerLayerviewDestroyEvent) => void; + + export type BaseTileLayerLayerviewCreateEventHandler = (event: BaseTileLayerLayerviewCreateEvent) => void; + + export type BaseTileLayerLayerviewDestroyEventHandler = (event: BaseTileLayerLayerviewDestroyEvent) => void; + + export type CSVLayerLayerviewCreateEventHandler = (event: CSVLayerLayerviewCreateEvent) => void; + + export type CSVLayerLayerviewDestroyEventHandler = (event: CSVLayerLayerviewDestroyEvent) => void; + + export type ElevationLayerLayerviewCreateEventHandler = (event: ElevationLayerLayerviewCreateEvent) => void; + + export type ElevationLayerLayerviewDestroyEventHandler = (event: ElevationLayerLayerviewDestroyEvent) => void; + + export type FeatureLayerLayerviewCreateEventHandler = (event: FeatureLayerLayerviewCreateEvent) => void; + + export type FeatureLayerLayerviewDestroyEventHandler = (event: FeatureLayerLayerviewDestroyEvent) => void; + + export type GeoRSSLayerLayerviewCreateEventHandler = (event: GeoRSSLayerLayerviewCreateEvent) => void; + + export type GeoRSSLayerLayerviewDestroyEventHandler = (event: GeoRSSLayerLayerviewDestroyEvent) => void; + + export type GraphicsLayerLayerviewCreateEventHandler = (event: GraphicsLayerLayerviewCreateEvent) => void; + + export type GraphicsLayerLayerviewDestroyEventHandler = (event: GraphicsLayerLayerviewDestroyEvent) => void; + + export type GroupLayerLayerviewCreateEventHandler = (event: GroupLayerLayerviewCreateEvent) => void; + + export type GroupLayerLayerviewDestroyEventHandler = (event: GroupLayerLayerviewDestroyEvent) => void; + + export type IdentityManagerCredentialCreateEventHandler = (event: IdentityManagerCredentialCreateEvent) => void; + + export type IdentityManagerCredentialsDestroyEventHandler = (event: IdentityManagerCredentialsDestroyEvent) => void; + + export type ImageryLayerLayerviewCreateEventHandler = (event: ImageryLayerLayerviewCreateEvent) => void; + + export type ImageryLayerLayerviewDestroyEventHandler = (event: ImageryLayerLayerviewDestroyEvent) => void; + + export type IntegratedMeshLayerLayerviewCreateEventHandler = (event: IntegratedMeshLayerLayerviewCreateEvent) => void; + + export type IntegratedMeshLayerLayerviewDestroyEventHandler = (event: IntegratedMeshLayerLayerviewDestroyEvent) => void; + + export type KMLLayerLayerviewCreateEventHandler = (event: KMLLayerLayerviewCreateEvent) => void; + + export type KMLLayerLayerviewDestroyEventHandler = (event: KMLLayerLayerviewDestroyEvent) => void; + + export type MapImageLayerLayerviewCreateEventHandler = (event: MapImageLayerLayerviewCreateEvent) => void; + + export type MapImageLayerLayerviewDestroyEventHandler = (event: MapImageLayerLayerviewDestroyEvent) => void; + + export type MapNotesLayerLayerviewCreateEventHandler = (event: MapNotesLayerLayerviewCreateEvent) => void; + + export type MapNotesLayerLayerviewDestroyEventHandler = (event: MapNotesLayerLayerviewDestroyEvent) => void; + + export type MapViewClickEventHandler = (event: MapViewClickEvent) => void; + + export type MapViewDoubleClickEventHandler = (event: MapViewDoubleClickEvent) => void; + + export type MapViewDragEventHandler = (event: MapViewDragEvent) => void; + + export type MapViewHoldEventHandler = (event: MapViewHoldEvent) => void; + + export type MapViewKeyDownEventHandler = (event: MapViewKeyDownEvent) => void; + + export type MapViewKeyUpEventHandler = (event: MapViewKeyUpEvent) => void; + + export type MapViewLayerviewCreateEventHandler = (event: MapViewLayerviewCreateEvent) => void; + + export type MapViewLayerviewDestroyEventHandler = (event: MapViewLayerviewDestroyEvent) => void; + + export type MapViewMouseWheelEventHandler = (event: MapViewMouseWheelEvent) => void; + + export type MapViewPointerDownEventHandler = (event: MapViewPointerDownEvent) => void; + + export type MapViewPointerMoveEventHandler = (event: MapViewPointerMoveEvent) => void; + + export type MapViewPointerUpEventHandler = (event: MapViewPointerUpEvent) => void; + + export type MapViewResizeEventHandler = (event: MapViewResizeEvent) => void; + + interface Basemap extends Accessor, Loadable, JSONSupport { + baseLayers: Collection<Layer>; + id: string; + loaded: boolean; + portalItem: PortalItem; + referenceLayers: Collection<Layer>; + thumbnailUrl: string; + title: string; + + clone(): Basemap; + } + + interface BasemapConstructor { + new(properties?: BasemapProperties): Basemap; + + + fromId(id: string): Basemap; + + fromJSON(json: any): Basemap; + } + + export const Basemap: BasemapConstructor; + + interface BasemapProperties extends LoadableProperties { + baseLayers?: CollectionProperties<LayerProperties>; + id?: string; + loaded?: boolean; + portalItem?: PortalItemProperties; + referenceLayers?: CollectionProperties<LayerProperties>; + thumbnailUrl?: string; + title?: string; + } + + interface Camera extends Accessor, JSONSupport { + fov: number; + heading: number; + position: Point; + tilt: number; + + clone(): Camera; + } + + interface CameraConstructor { + new(properties?: CameraProperties): Camera; + + fromJSON(json: any): Camera; + } + + export const Camera: CameraConstructor; + + interface CameraProperties { + fov?: number; + heading?: number; + position?: PointProperties; + tilt?: number; + } + + interface Color { + a: number; + b: number; + g: number; + r: number; + + clone(): Color; + setColor(color: string | number[] | any): Color; + toCss(includeAlpha?: boolean): string; + toHex(): string; + toJSON(): any; + toRgb(): number[]; + toRgba(): number[]; + } + + interface ColorConstructor { + + blendColors(start: Color, end: Color, weight: number, obj?: Color): Color; + new(color: string | number[] | any): Color; + fromArray(a: number[], obj?: Color): Color; + fromHex(color: string, obj?: Color): Color; + fromJSON(json: any): Color; + fromRgb(color: string, obj?: Color): Color; + fromString(str: string, obj?: Color): Color; + } + + export const Color: ColorConstructor; + + interface config { + geometryServiceUrl: string; + geoRSSServiceUrl: string; + kmlServiceUrl: string; + portalUrl: string; + request: configRequest; + workers: configWorkers; + } + + export const config: config; + + export interface configRequest { + corsDetection?: boolean; + corsDetectionTimeout?: number; + corsEnabledServers?: (string | configRequestCorsEnabledServers)[]; + forceProxy?: boolean; + httpsDomains?: string[]; + maxUrlLength?: number; + proxyUrl?: string; + timeout?: number; + useCors?: string | boolean; + useIdentity?: boolean; + proxyRules?: configRequestProxyRules[]; + } + + export interface configRequestCorsEnabledServers { + host?: string; + withCredentials?: boolean; + } + + export interface configRequestProxyRules { + proxyUrl?: string; + urlPrefix?: string; + } + + export interface configWorkers { + loaderConfig?: configWorkersLoaderConfig; + } + + export interface configWorkersLoaderConfig { + has?: any; + paths?: any; + map?: any; + packages?: any[]; + } + + + + export type WatchCallback = (newValue: any, oldValue: any, propertyName: string, target: Accessor) => void; + + export interface WatchHandle { + remove(): void; + } + + interface decorators { + aliasOf(propertyName: string): Function; + cast(propertyName: string): Function; + cast(classFunction: Function): Function; + declared<T>(baseClass: T, ...mixinClasses: any[]): T; + property(propertyMetadata?: decoratorsPropertyPropertyMetadata): Function; + subclass(declaredClass?: string): Function; + } + + export const decorators: decorators; + + export interface decoratorsPropertyPropertyMetadata { + dependsOn?: string[]; + type?: Function; + cast?: Function; + readOnly?: boolean; + constructOnly?: boolean; + aliasOf?: string; + value?: any; + } + + + + + + + + + + + + + + interface Error { + details: any; + message: string; + name: string; + } + + export const Error: Error; + + export class Evented { + protected emit(type: string, event: any): void; + hasEventListener(type: string): boolean; + on(type: string, listener: EventHandler): IHandle; + } + + export type EventHandler = (event: any) => void; + + interface JSONSupport { + toJSON(): any; + } + + interface JSONSupportConstructor { + new(): JSONSupport; + + + fromJSON(json: any): any; + } + + export const JSONSupport: JSONSupportConstructor; + + interface lang { + clone(elem: any): any; + } + + export const lang: lang; + + interface Loadable { + loadError: Error; + loadStatus: string; + loadWarnings: any[]; + + always(callbackOrErrback?: Function): IPromise<any>; + cancelLoad(): void; + isFulfilled(): boolean; + isRejected(): boolean; + isResolved(): boolean; + load(): IPromise<any>; + otherwise(errback?: Function): IPromise<any>; + then(callback?: Function, errback?: Function, progback?: Function): IPromise<any>; + } + + interface LoadableConstructor { + new(): Loadable; + } + + export const Loadable: LoadableConstructor; + + interface LoadableProperties { + loadError?: Error; + loadStatus?: string; + loadWarnings?: any[]; + } + + interface corePromise { + always(callbackOrErrback?: Function): IPromise<any>; + isFulfilled(): boolean; + isRejected(): boolean; + isResolved(): boolean; + otherwise(errback?: Function): IPromise<any>; + then(callback?: Function, errback?: Function, progback?: Function): IPromise<any>; + } + + interface corePromiseConstructor { + new(): corePromise; + } + + export const corePromise: corePromiseConstructor; + + interface promiseUtils { + eachAlways(promises: IPromise<any>[] | any): IPromise<EachAlwaysResult[]> | any; + filter<T>(input: T[], predicate: FilterPredicateCallback): IPromise<T[]>; + reject<T>(error?: any): IPromise<T>; + resolve<T>(value?: T): IPromise<T>; + } + + export const promiseUtils: promiseUtils; + + export interface EachAlwaysResult { + promise: IPromise<any>; + value: any; + error: any; + } + + export type FilterPredicateCallback = (value: any, index: number) => IPromise<any>; + + interface requireUtils { + when(moduleRequire: any, moduleNames: string[] | string): IPromise<any>; + } + + export const requireUtils: requireUtils; + + interface urlUtils { + addProxyRule(rule: urlUtilsAddProxyRuleRule): number; + getProxyRule(url: string): any; + urlToObject(url: string): any; + } + + export const urlUtils: urlUtils; + + export interface urlUtilsAddProxyRuleRule { + proxyUrl: string; + urlPrefix: string; + } + + interface watchUtils { + init(obj: Accessor, propertyName: string | string[], callback: WatchCallback): WatchHandle; + on(obj: Accessor, propertyName: string, eventName: string, eventHandler: Function, attachedHandler?: EventAttachedCallback, detachedHandler?: EventAttachedCallback): WatchHandle; + once(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; + pausable(obj: Accessor, propertyName: string, callback?: WatchCallback): PausableWatchHandle; + watch(obj: Accessor, propertyName: string | string[], callback: WatchCallback): WatchHandle; + when(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; + whenDefined(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; + whenDefinedOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; + whenFalse(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; + whenFalseOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; + whenNot(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; + whenNotOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; + whenOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; + whenTrue(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; + whenTrueOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; + whenUndefined(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; + whenUndefinedOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; + } + + export const watchUtils: watchUtils; + + export type EventAttachedCallback = (target: any, propName: string, obj: Accessor, eventName: string) => void; + + export interface PausableWatchHandle { + remove(): void; + pause(): void; + resume(): void; + } + export interface PromisedWatchHandle extends IPromise<any> { remove(): void; } - export type ItemCallback = (item: any, index: number) => void; - export type ItemCompareCallback = (firstItem: any, secondItem: any) => number; - - export type ItemMapCallback = (item: any, index: number) => any; - - export type ItemReduceCallback = (previousValue: any, currentValue: any, index: number) => any; - - export type ItemTestCallback = (item: any, index: number) => boolean; - - export interface PortalItemFetchRelatedItemsParams { - relationshipType: string; - direction?: string; + interface workers { + open(client: any, modulePath: string): IPromise<Connection>; } - export interface PortalItemUpdateParams { - data: string | any; + export const workers: workers; + + interface Connection { + broadcast(methodName: string, data?: any, buffers?: ArrayBuffer[]): IPromise<any[]>; + close(): void; + invoke(methodName: string, data?: any, buffers?: ArrayBuffer[]): IPromise<any>; } - export interface PortalUserAddItemParams { - item: PortalItem; - data?: string | any; - folder?: PortalFolder; + interface ConnectionConstructor { + new(client: any, id: number): Connection; } - export interface PortalUserFetchItemsParams { - folder: PortalFolder; - num: number; - start: number; + export const Connection: ConnectionConstructor; + + interface Circle extends Polygon { + center: Point | number[]; + geodesic: boolean; + numberOfPoints: number; + radius: number; + radiusUnit: string; + + clone(): Circle; } - export interface PortalFeaturedGroups { - owner: string; - title: string; + interface CircleConstructor { + new(properties?: CircleProperties): Circle; + + fromJSON(json: any): Circle; + } + + export const Circle: CircleConstructor; + + interface CircleProperties extends PolygonProperties { + center?: PointProperties | number[]; + geodesic?: boolean; + numberOfPoints?: number; + radius?: number; + radiusUnit?: string; + } + + interface Extent extends Geometry { + center: Point; + height: number; + mmax: number; + mmin: number; + width: number; + xmax: number; + xmin: number; + ymax: number; + ymin: number; + zmax: number; + zmin: number; + + centerAt(point: Point): Extent; + clone(): Extent; + contains(geometry: Point | Extent): boolean; + equals(extent: Extent): boolean; + expand(factor: number): Extent; + intersection(extent: Extent): Extent; + intersects(geometry: Geometry): boolean; + normalize(): Extent[]; + offset(dx: number, dy: number, dz: number): Extent; + union(extent: Extent): Extent; + } + + interface ExtentConstructor { + new(properties?: ExtentProperties): Extent; + + fromJSON(json: any): Extent; + } + + export const Extent: ExtentConstructor; + + interface ExtentProperties extends GeometryProperties { + center?: PointProperties; + height?: number; + mmax?: number; + mmin?: number; + width?: number; + xmax?: number; + xmin?: number; + ymax?: number; + ymin?: number; + zmax?: number; + zmin?: number; + } + + interface Geometry extends Accessor, JSONSupport { + cache: any; + extent: Extent; + hasM: boolean; + hasZ: boolean; + spatialReference: SpatialReference; + type: string; + + clone(): Geometry; + } + + interface GeometryConstructor { + new(properties?: GeometryProperties): Geometry; + + fromJSON(json: any): Geometry; + } + + export const Geometry: GeometryConstructor; + + interface GeometryProperties { + cache?: any; + extent?: ExtentProperties; + hasM?: boolean; + hasZ?: boolean; + spatialReference?: SpatialReferenceProperties; + type?: string; + } + + interface geometryEngine { + buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; + clip(geometry: Geometry, envelope: Extent): Geometry; + contains(containerGeometry: Geometry, insideGeometry: Geometry): boolean; + convexHull(geometry: Geometry, merge?: boolean): Geometry | Geometry[]; + crosses(geometry1: Geometry, geometry2: Geometry): boolean; + cut(geometry: Geometry, cutter: Polyline): Geometry[]; + densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): Geometry; + difference(inputGeometry: Geometry | Geometry[], subtractor: Geometry): Geometry | Geometry[]; + disjoint(geometry1: Geometry, geometry2: Geometry): boolean; + distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): number; + equals(geometry1: Geometry, geometry2: Geometry): boolean; + extendedSpatialReferenceInfo(spatialReference: SpatialReference): any; + flipHorizontal(geometry: Geometry, flipOrigin?: Point): Geometry; + flipVertical(geometry: Geometry, flipOrigin?: Point): Geometry; + generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): Geometry; + geodesicArea(geometry: Polygon, unit: string | number): number; + geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; + geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit: string | number): Geometry; + geodesicLength(geometry: Geometry, unit: string | number): number; + intersect(geometry: Geometry | Geometry[], intersector: Geometry): Geometry | Geometry[]; + intersects(geometry1: Geometry, geometry2: Geometry): boolean; + isSimple(geometry: Geometry): boolean; + nearestCoordinate(geometry: Geometry, inputPoint: Point): NearestPointResult; + nearestVertex(geometry: Geometry, inputPoint: Point): NearestPointResult; + nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): NearestPointResult[]; + offset(geometry: Geometry | Geometry[], offsetDistance: number, offsetUnit: string | number, joinType: string, bevelRatio?: number, flattenError?: number): Geometry | Geometry[]; + overlaps(geometry1: Geometry, geometry2: Geometry): boolean; + planarArea(geometry: Polygon, unit: string | number): number; + planarLength(geometry: Geometry, unit: string | number): number; + relate(geometry1: Geometry, geometry2: Geometry, relation: string): boolean; + rotate(geometry: Geometry, angle: number, rotationOrigin?: Point): Geometry; + simplify(geometry: Geometry): Geometry; + symmetricDifference(leftGeometry: Geometry | Geometry[], rightGeometry: Geometry): Geometry | Geometry[]; + touches(geometry1: Geometry, geometry2: Geometry): boolean; + union(geometries: Geometry[]): Geometry; + within(innerGeometry: Geometry, outerGeometry: Geometry): boolean; + } + + export const geometryEngine: geometryEngine; + + export interface NearestPointResult { + coordinate: Point; + distance: number; + isRightSide: boolean; + vertexIndex: number; + isEmpty: boolean; + } + + interface geometryEngineAsync { + buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): IPromise<Polygon | Polygon[]>; + clip(geometry: Geometry, envelope: Extent): IPromise<Geometry>; + contains(containerGeometry: Geometry, insideGeometry: Geometry): IPromise<boolean>; + convexHull(geometry: Geometry, merge?: boolean): IPromise<Geometry>; + crosses(geometry1: Geometry, geometry2: Geometry): IPromise<boolean>; + cut(geometry: Geometry, cutter: Polyline): IPromise<Geometry[]>; + densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): IPromise<Geometry>; + difference(inputGeometry: Geometry | Geometry[], subtractor: Geometry): IPromise<Geometry>; + disjoint(geometry1: Geometry, geometry2: Geometry): IPromise<boolean>; + distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): IPromise<number>; + equals(geometry1: Geometry, geometry2: Geometry): IPromise<boolean>; + extendedSpatialReferenceInfo(spatialReference: SpatialReference): IPromise<any>; + flipHorizontal(geometry: Geometry, flipOrigin?: Point): IPromise<Geometry>; + flipVertical(geometry: Geometry, flipOrigin?: Point): IPromise<Geometry>; + generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): IPromise<Geometry>; + geodesicArea(geometry: Polygon, unit: string | number): IPromise<number>; + geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): IPromise<Polygon | Polygon[]>; + geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit: string | number): IPromise<Geometry>; + geodesicLength(geometry: Geometry, unit: string | number): IPromise<number>; + intersect(geometry: Geometry | Geometry[], intersector: Geometry): IPromise<Geometry>; + intersects(geometry1: Geometry, geometry2: Geometry): IPromise<boolean>; + isSimple(geometry: Geometry): IPromise<boolean>; + nearestCoordinate(geometry: Geometry, inputPoint: Point): IPromise<NearestPointResult>; + nearestVertex(geometry: Geometry, inputPoint: Point): IPromise<NearestPointResult>; + nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): IPromise<NearestPointResult>; + offset(geometry: Geometry | Geometry[], offsetDistance: number, offsetUnit: string | number, joinType: string, bevelRatio?: number, flattenError?: number): IPromise<Geometry[]>; + overlaps(geometry1: Geometry, geometry2: Geometry): IPromise<boolean>; + planarArea(geometry: Polygon, unit: string | number): IPromise<number>; + planarLength(geometry: Geometry, unit: string | number): IPromise<number>; + relate(geometry1: Geometry, geometry2: Geometry, relation: string): IPromise<boolean>; + rotate(geometry: Geometry, angle: number, rotationOrigin?: Point): IPromise<Geometry>; + simplify(geometry: Geometry): IPromise<Geometry>; + symmetricDifference(leftGeometry: Geometry | Geometry[], rightGeometry: Geometry): IPromise<Geometry | Geometry[]>; + touches(geometry1: Geometry, geometry2: Geometry): IPromise<boolean>; + union(geometries: Geometry[]): IPromise<Geometry>; + within(innerGeometry: Geometry, outerGeometry: Geometry): IPromise<boolean>; + } + + export const geometryEngineAsync: geometryEngineAsync; + + interface HeightModelInfo extends Accessor, JSONSupport { + heightModel: string; + heightUnit: string; + vertCRS: string; + } + + interface HeightModelInfoConstructor { + new(properties?: HeightModelInfoProperties): HeightModelInfo; + + fromJSON(json: any): HeightModelInfo; + } + + export const HeightModelInfo: HeightModelInfoConstructor; + + interface HeightModelInfoProperties { + heightModel?: string; + heightUnit?: string; + vertCRS?: string; + } + + interface Multipoint extends Geometry { + points: number[][]; + + addPoint(point: Point | number[]): Multipoint; + clone(): Multipoint; + getPoint(index: number): Point; + removePoint(index: number): Point; + setPoint(index: number, point: Point): Multipoint; + } + + interface MultipointConstructor { + new(properties?: MultipointProperties): Multipoint; + + fromJSON(json: any): Multipoint; + } + + export const Multipoint: MultipointConstructor; + + interface MultipointProperties extends GeometryProperties { + points?: number[][]; + } + + interface Point extends Geometry { + latitude: number; + longitude: number; + m: number; + x: number; + y: number; + z: number; + + clone(): Point; + copy(other: Point): void; + distance(other: Point): number; + equals(point: Point): boolean; + normalize(): Point; + } + + interface PointConstructor { + new(properties?: PointProperties): Point; + + fromJSON(json: any): Point; + } + + export const Point: PointConstructor; + + interface PointProperties extends GeometryProperties { + latitude?: number; + longitude?: number; + m?: number; + x?: number; + y?: number; + z?: number; + } + + interface Polygon extends Geometry { + centroid: Point; + isSelfIntersecting: boolean; + rings: number[][][]; + + addRing(ring: Point[] | number[][]): Polygon; + clone(): Polygon; + contains(point: Point): boolean; + getPoint(ringIndex: number, pointIndex: number): Point; + insertPoint(ringIndex: number, pointIndex: number, point: Point): Polygon; + isClockwise(ring: Point[] | number[][]): boolean; + removePoint(ringIndex: number, pointIndex: number): Point[]; + removeRing(index: number): Point[]; + setPoint(ringIndex: number, pointIndex: number, point: Point): Polygon; + } + + interface PolygonConstructor { + new(properties?: PolygonProperties): Polygon; + + + fromExtent(extent: Extent): Polygon; + + fromJSON(json: any): Polygon; + } + + export const Polygon: PolygonConstructor; + + interface PolygonProperties extends GeometryProperties { + centroid?: PointProperties; + isSelfIntersecting?: boolean; + rings?: number[][][]; + } + + interface Polyline extends Geometry { + paths: number[][][]; + + addPath(points: number[][]): Polyline; + clone(): Polyline; + getPoint(pathIndex: number, pointIndex: number): Point; + insertPoint(pathIndex: number, pointIndex: number, point: Point): Polyline; + removePath(index: number): Point[]; + removePoint(pathIndex: number, pointIndex: number): Point; + setPoint(pathIndex: number, pointIndex: number, point: Point): Polyline; + } + + interface PolylineConstructor { + new(properties?: PolylineProperties): Polyline; + + fromJSON(json: any): Polyline; + } + + export const Polyline: PolylineConstructor; + + interface PolylineProperties extends GeometryProperties { + paths?: number[][][]; + } + + interface ScreenPoint extends Accessor { + x: number; + y: number; + } + + interface ScreenPointConstructor { + new(properties?: ScreenPointProperties): ScreenPoint; + } + + export const ScreenPoint: ScreenPointConstructor; + + interface ScreenPointProperties { + x?: number; + y?: number; + } + + interface SpatialReference extends Accessor, JSONSupport { + isGeographic: boolean; + isWebMercator: boolean; + isWGS84: boolean; + isWrappable: boolean; + WebMercator: SpatialReference; + WGS84: SpatialReference; + wkid: number; + wkt: string; + + clone(): SpatialReference; + equals(spatialReference: SpatialReference): boolean; + } + + interface SpatialReferenceConstructor { + new(properties?: SpatialReferenceProperties): SpatialReference; + + fromJSON(json: any): SpatialReference; + } + + export const SpatialReference: SpatialReferenceConstructor; + + interface SpatialReferenceProperties { + isGeographic?: boolean; + isWebMercator?: boolean; + isWGS84?: boolean; + isWrappable?: boolean; + WebMercator?: SpatialReferenceProperties; + WGS84?: SpatialReferenceProperties; + wkid?: number; + wkt?: string; + } + + interface jsonUtils { + fromJSON(json: any): Geometry; + getJsonType(geometry: Geometry): string; + } + + export const jsonUtils: jsonUtils; + + interface normalizeUtils { + normalizeCentralMeridian(geometries: Geometry[], geometryService?: GeometryService): IPromise<Geometry[]>; + } + + export const normalizeUtils: normalizeUtils; + + interface webMercatorUtils { + canProject(source: SpatialReference | any, target: SpatialReference | any): boolean; + geographicToWebMercator(geometry: Geometry): Geometry; + lngLatToXY(long: number, lat: number): number[]; + project(geometry: Geometry, spatialReference: SpatialReference | any): Geometry; + webMercatorToGeographic(geometry: Geometry): Geometry; + xyToLngLat(x: number, y: number): number[]; + } + + export const webMercatorUtils: webMercatorUtils; + + interface Graphic extends Accessor, JSONSupport { + attributes: any; + geometry: Geometry; + layer: FeatureLayer | GraphicsLayer; + popupTemplate: PopupTemplate; + symbol: Symbol; + visible: boolean; + + clone(): Graphic; + getAttribute(name: string): any; + setAttribute(name: string, newValue: any): void; + } + + interface GraphicConstructor { + new(properties?: GraphicProperties): Graphic; + + fromJSON(json: any): Graphic; + } + + export const Graphic: GraphicConstructor; + + interface GraphicProperties { + attributes?: any; + geometry?: GeometryProperties; + layer?: FeatureLayerProperties | GraphicsLayerProperties; + popupTemplate?: PopupTemplateProperties; + symbol?: SymbolProperties; + visible?: boolean; + } + + interface Ground extends Accessor, Loadable, JSONSupport { + layers: Collection<Layer>; + loaded: boolean; + + clone(): Ground; + queryElevation(geometry: Point | Multipoint | Polyline, options?: GroundQueryElevationOptions): IPromise<ElevationQueryResult>; + } + + interface GroundConstructor { + new(properties?: GroundProperties): Ground; + + fromJSON(json: any): Ground; + } + + export const Ground: GroundConstructor; + + interface GroundProperties extends LoadableProperties { + layers?: CollectionProperties<LayerProperties>; + loaded?: boolean; + } + + export interface ElevationQueryResult { + geometry: Point | Multipoint | Polyline; + sampleInfo: ElevationQueryResultSampleInfo[]; + noDataValue: number; } export interface GroundQueryElevationOptions { @@ -95,27 +1004,576 @@ declare namespace __esri { noDataValue?: number; } - export interface PopupTemplateExpressionInfos { - name: string; - title?: string; - expression: string; - returnType?: string; + export interface ElevationQueryResultSampleInfo { + demResolution: number; + source: ElevationLayer; } - export interface PopupTemplateFieldInfos { - fieldName: string; - format?: PopupTemplateFieldInfosFormat; - isEditable?: boolean; - label?: string; - stringFieldOption?: string; - tooltip?: string; - visible?: boolean; + interface Credential extends Accessor { + expires: number; + isAdmin: boolean; + oAuthState: any; + server: string; + ssl: boolean; + token: string; + userId: string; + + destroy(): void; + refreshToken(): void; } - export interface PopupTemplateFieldInfosFormat { - dateFormat?: string; - digitSeparator?: boolean; - places?: number; + interface CredentialConstructor { + new(properties?: CredentialProperties): Credential; + } + + export const Credential: CredentialConstructor; + + interface CredentialProperties { + expires?: number; + isAdmin?: boolean; + oAuthState?: any; + server?: string; + ssl?: boolean; + token?: string; + userId?: string; + } + + interface IdentityManager extends IdentityManagerBase { + dialog: any; + + setOAuthRedirectionHandler(handlerFunction: HandlerCallback): void; + setOAuthResponseHash(hash: string): void; + + on(name: "credential-create", eventHandler: IdentityManagerCredentialCreateEventHandler): IHandle; + on(name: "credential-create", modifiers: string[], eventHandler: IdentityManagerCredentialCreateEventHandler): IHandle; + on(name: "credentials-destroy", eventHandler: IdentityManagerCredentialsDestroyEventHandler): IHandle; + on(name: "credentials-destroy", modifiers: string[], eventHandler: IdentityManagerCredentialsDestroyEventHandler): IHandle; + } + + interface IdentityManagerConstructor { + new(): IdentityManager; + } + + export const IdentityManager: IdentityManagerConstructor; + + export interface IdentityManagerCredentialCreateEvent { + credential: Credential; + } + + export interface IdentityManagerCredentialsDestroyEvent { + } + + export type HandlerCallback = (authorizeParams: any, authorizeUrl: string, oAuthInfo: OAuthInfo, resourceUrl: string, serverInfo: ServerInfo) => void; + + interface IdentityManagerBase extends Evented { + tokenValidity: number; + + checkSignInStatus(resUrl: string): IPromise<Credential>; + destroyCredentials(): void; + findCredential(url: string, userId?: string): Credential; + findOAuthInfo(url: string): OAuthInfo; + findServerInfo(url: string): ServerInfo; + generateToken(serverInfo: ServerInfo, userInfo: any, options?: IdentityManagerBaseGenerateTokenOptions): IPromise<any>; + getCredential(url: string, options?: IdentityManagerBaseGetCredentialOptions): IPromise<any>; + initialize(json: any): void; + isBusy(): boolean; + oAuthSignIn(resUrl: string, serverInfo: ServerInfo, oAuthInfo: OAuthInfo, options?: IdentityManagerBaseOAuthSignInOptions): IPromise<any>; + registerOAuthInfos(oAuthInfos: OAuthInfo[]): void; + registerServers(serverInfos: ServerInfo[]): void; + registerToken(properties: IdentityManagerBaseRegisterTokenProperties): void; + setProtocolErrorHandler(handlerFunction: IdentityManagerBaseSetProtocolErrorHandlerHandlerFunction): void; + setRedirectionHandler(handlerFunction: IdentityManagerBaseSetRedirectionHandlerHandlerFunction): void; + signIn(url: string, serverInfo: ServerInfo, options?: IdentityManagerBaseSignInOptions): IPromise<any>; + toJSON(): any; + } + + interface IdentityManagerBaseConstructor { + new(): IdentityManagerBase; + } + + export const IdentityManagerBase: IdentityManagerBaseConstructor; + + export interface IdentityManagerBaseGenerateTokenOptions { + serverUrl: string; + token: string; + ssl: boolean; + } + + export interface IdentityManagerBaseGetCredentialOptions { + error?: Error; + oAuthPopupConfirmation?: boolean; + retry?: boolean; + token?: string; + } + + export interface IdentityManagerBaseOAuthSignInOptions { + error: Error; + oAuthPopupConfirmation: boolean; + token: string; + } + + export interface IdentityManagerBaseRegisterTokenProperties { + expires?: number; + server: string; + ssl?: boolean; + token: string; + userId?: string; + } + + export interface IdentityManagerBaseSetProtocolErrorHandlerHandlerFunction { + resourceUrl: string; + serverInfo: ServerInfo; + } + + export interface IdentityManagerBaseSetRedirectionHandlerHandlerFunction { + resourceUrl: string; + returnUrlParamName: string; + serverInfo: ServerInfo; + signInPage: string; + } + + export interface IdentityManagerBaseSignInOptions { + error: Error; + } + + interface OAuthInfo extends Accessor, JSONSupport { + appId: string; + authNamespace: string; + expiration: number; + locale: string; + minTimeUntilExpiration: number; + popup: boolean; + popupCallbackUrl: string; + popupWindowFeatures: string; + portalUrl: string; + + clone(): OAuthInfo; + } + + interface OAuthInfoConstructor { + new(properties?: OAuthInfoProperties): OAuthInfo; + + fromJSON(json: any): OAuthInfo; + } + + export const OAuthInfo: OAuthInfoConstructor; + + interface OAuthInfoProperties { + appId?: string; + authNamespace?: string; + expiration?: number; + locale?: string; + minTimeUntilExpiration?: number; + popup?: boolean; + popupCallbackUrl?: string; + popupWindowFeatures?: string; + portalUrl?: string; + } + + interface ServerInfo extends Accessor, JSONSupport { + adminTokenServiceUrl: string; + currentVersion: number; + server: string; + shortLivedTokenValidity: number; + tokenServiceUrl: string; + } + + interface ServerInfoConstructor { + new(properties?: ServerInfoProperties): ServerInfo; + + fromJSON(json: any): ServerInfo; + } + + export const ServerInfo: ServerInfoConstructor; + + interface ServerInfoProperties { + adminTokenServiceUrl?: string; + currentVersion?: number; + server?: string; + shortLivedTokenValidity?: number; + tokenServiceUrl?: string; + } + + interface kernel { + version: string; + } + + export const kernel: kernel; + + interface BaseDynamicLayer extends Layer, ScaleRangeLayer { + addResolvingPromise(promiseToLoad: IPromise<any>): IPromise<any>; + fetchImage(extent: Extent, width: number, height: number, options?: BaseDynamicLayerFetchImageOptions): IPromise<HTMLImageElement | HTMLCanvasElement>; + getImageUrl(extent: Extent, width: number, height: number): IPromise<string> | string; + + on(name: "layerview-create", eventHandler: BaseDynamicLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: BaseDynamicLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: BaseDynamicLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: BaseDynamicLayerLayerviewDestroyEventHandler): IHandle; + } + + interface BaseDynamicLayerConstructor { + new(properties?: BaseDynamicLayerProperties): BaseDynamicLayer; + } + + export const BaseDynamicLayer: BaseDynamicLayerConstructor; + + interface BaseDynamicLayerProperties extends LayerProperties, ScaleRangeLayerProperties { + + } + + export interface BaseDynamicLayerFetchImageOptions { + allowImageDataAccess?: boolean; + } + + export interface BaseDynamicLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface BaseDynamicLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface BaseElevationLayer extends Layer { + spatialReference: SpatialReference; + tileInfo: TileInfo; + + addResolvingPromise(promiseToLoad: IPromise<any>): IPromise<any>; + fetchTile(level: number, row: number, column: number, options?: BaseElevationLayerFetchTileOptions): IPromise<ElevationTileData>; + getTileBounds(level: number, row: number, column: number, out?: number[]): number[]; + + on(name: "layerview-create", eventHandler: BaseElevationLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: BaseElevationLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: BaseElevationLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: BaseElevationLayerLayerviewDestroyEventHandler): IHandle; + } + + interface BaseElevationLayerConstructor { + new(properties?: BaseElevationLayerProperties): BaseElevationLayer; + } + + export const BaseElevationLayer: BaseElevationLayerConstructor; + + interface BaseElevationLayerProperties extends LayerProperties { + spatialReference?: SpatialReferenceProperties; + tileInfo?: TileInfoProperties; + } + + export interface BaseElevationLayerFetchTileOptions { + noDataValue?: number; + } + + export interface ElevationTileData { + values: number[]; + width: number; + height: number; + maxZError: number; + noDataValue: number; + } + + export interface BaseElevationLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface BaseElevationLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface BaseTileLayer extends Layer, ScaleRangeLayer { + spatialReference: SpatialReference; + tileInfo: TileInfo; + + addResolvingPromise(promiseToLoad: IPromise<any>): IPromise<any>; + fetchTile(level: number, row: number, column: number, options?: BaseTileLayerFetchTileOptions): IPromise<HTMLImageElement | HTMLCanvasElement>; + getTileBounds(level: number, row: number, column: number, out?: number[]): number[]; + getTileUrl(level: number, row: number, column: number): string | IPromise<any>; + + on(name: "layerview-create", eventHandler: BaseTileLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: BaseTileLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: BaseTileLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: BaseTileLayerLayerviewDestroyEventHandler): IHandle; + } + + interface BaseTileLayerConstructor { + new(properties?: BaseTileLayerProperties): BaseTileLayer; + } + + export const BaseTileLayer: BaseTileLayerConstructor; + + interface BaseTileLayerProperties extends LayerProperties, ScaleRangeLayerProperties { + spatialReference?: SpatialReferenceProperties; + tileInfo?: TileInfoProperties; + } + + export interface BaseTileLayerFetchTileOptions { + allowImageDataAccess?: boolean; + } + + export interface BaseTileLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface BaseTileLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface CSVLayer extends Layer { + copyright: string; + delimiter: string; + elevationInfo: CSVLayerElevationInfo; + featureReduction: CSVLayerFeatureReduction; + fields: Field[]; + labelingInfo: LabelClass[]; + labelsVisible: boolean; + latitudeField: string; + legendEnabled: boolean; + longitudeField: string; + maxScale: number; + minScale: number; + outFields: string[]; + popupEnabled: boolean; + popupTemplate: PopupTemplate; + renderer: Renderer; + screenSizePerspectiveEnabled: boolean; + url: string; + + on(name: "layerview-create", eventHandler: CSVLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: CSVLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: CSVLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: CSVLayerLayerviewDestroyEventHandler): IHandle; + } + + interface CSVLayerConstructor { + new(properties?: CSVLayerProperties): CSVLayer; + } + + export const CSVLayer: CSVLayerConstructor; + + interface CSVLayerProperties extends LayerProperties { + copyright?: string; + delimiter?: string; + elevationInfo?: CSVLayerElevationInfo; + featureReduction?: CSVLayerFeatureReduction; + fields?: FieldProperties[]; + labelingInfo?: LabelClassProperties[]; + labelsVisible?: boolean; + latitudeField?: string; + legendEnabled?: boolean; + longitudeField?: string; + maxScale?: number; + minScale?: number; + outFields?: string[]; + popupEnabled?: boolean; + popupTemplate?: PopupTemplateProperties; + renderer?: RendererProperties; + screenSizePerspectiveEnabled?: boolean; + url?: string; + } + + export interface CSVLayerElevationInfo { + mode: string; + offset?: number; + featureExpressionInfo?: CSVLayerElevationInfoFeatureExpressionInfo; + unit?: string; + } + + export interface CSVLayerElevationInfoFeatureExpressionInfo { + expression?: string; + } + + export interface CSVLayerFeatureReduction { + type: string; + } + + export interface CSVLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface CSVLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface DynamicLayer { + portalItem: PortalItem; + url: string; + + fetchImage(extent: Extent, width: number, height: number, options?: DynamicLayerFetchImageOptions): IPromise<HTMLImageElement | HTMLCanvasElement>; + getImageUrl(extent: Extent, width: number, height: number, options?: DynamicLayerGetImageUrlOptions): IPromise<string> | string; + } + + interface DynamicLayerConstructor { + new(): DynamicLayer; + } + + export const DynamicLayer: DynamicLayerConstructor; + + interface DynamicLayerProperties { + portalItem?: PortalItemProperties; + url?: string; + } + + export interface DynamicLayerFetchImageOptions { + allowImageDataAccess?: boolean; + rotation?: number; + pixelRatio?: number; + } + + export interface DynamicLayerGetImageUrlOptions { + pixelRatio?: number; + rotation?: number; + } + + interface ElevationLayer extends Layer, ArcGISMapService, ArcGISCachedService, PortalLayer, TiledLayer { + url: string; + + fetchTile(level: number, row: number, column: number, noDataValue?: number): IPromise<ElevationTileData>; + queryElevation(geometry: Point | Multipoint | Polyline, options?: ElevationLayerQueryElevationOptions): IPromise<ElevationLayerElevationQueryResult>; + + on(name: "layerview-create", eventHandler: ElevationLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: ElevationLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: ElevationLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: ElevationLayerLayerviewDestroyEventHandler): IHandle; + } + + interface ElevationLayerConstructor { + new(properties?: ElevationLayerProperties): ElevationLayer; + + fromJSON(json: any): ElevationLayer; + } + + export const ElevationLayer: ElevationLayerConstructor; + + interface ElevationLayerProperties extends LayerProperties, ArcGISMapServiceProperties, ArcGISCachedServiceProperties, PortalLayerProperties, TiledLayerProperties { + url?: string; + } + + export interface ElevationLayerQueryElevationOptions { + demResolution?: number | string; + returnSampleInfo?: boolean; + noDataValue?: number; + } + + export interface ElevationLayerElevationQueryResult { + geometry: Point | Multipoint | Polyline; + sampleInfo: ElevationLayerElevationQueryResultSampleInfo[]; + noDataValue: number; + } + + export interface ElevationLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface ElevationLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + export interface ElevationLayerElevationQueryResultSampleInfo { + demResolution: number; + } + + interface FeatureLayer extends Layer, PortalLayer, ScaleRangeLayer { + capabilities: FeatureLayerCapabilities; + copyright: string; + definitionExpression: string; + displayField: string; + elevationInfo: FeatureLayerElevationInfo; + featureReduction: FeatureLayerFeatureReduction; + fields: Field[]; + gdbVersion: string; + geometryType: string; + hasAttachments: boolean; + hasM: boolean; + hasZ: boolean; + labelingInfo: LabelClass[]; + labelsVisible: boolean; + layerId: number; + legendEnabled: boolean; + objectIdField: string; + outFields: string[]; + popupEnabled: boolean; + popupTemplate: PopupTemplate; + renderer: Renderer; + returnM: boolean; + returnZ: boolean; + screenSizePerspectiveEnabled: boolean; + source: Collection<Graphic>; + spatialReference: SpatialReference; + templates: FeatureTemplate[]; + token: string; + typeIdField: string; + types: FeatureType[]; + url: string; + version: number; + + applyEdits(edits: FeatureLayerApplyEditsEdits): IPromise<any>; + createQuery(): Query; + getFieldDomain(fieldName: string, options?: FeatureLayerGetFieldDomainOptions): Domain; + queryExtent(params?: Query): IPromise<any>; + queryFeatureCount(params?: Query): IPromise<number>; + queryFeatures(params?: Query): IPromise<FeatureSet>; + queryObjectIds(params?: Query): IPromise<number[]>; + + on(name: "layerview-create", eventHandler: FeatureLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: FeatureLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: FeatureLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: FeatureLayerLayerviewDestroyEventHandler): IHandle; + } + + interface FeatureLayerConstructor { + new(properties?: FeatureLayerProperties): FeatureLayer; + + fromJSON(json: any): FeatureLayer; + } + + export const FeatureLayer: FeatureLayerConstructor; + + interface FeatureLayerProperties extends LayerProperties, PortalLayerProperties, ScaleRangeLayerProperties { + capabilities?: FeatureLayerCapabilities; + copyright?: string; + definitionExpression?: string; + displayField?: string; + elevationInfo?: FeatureLayerElevationInfo; + featureReduction?: FeatureLayerFeatureReduction; + fields?: FieldProperties[]; + gdbVersion?: string; + geometryType?: string; + hasAttachments?: boolean; + hasM?: boolean; + hasZ?: boolean; + labelingInfo?: LabelClassProperties[]; + labelsVisible?: boolean; + layerId?: number; + legendEnabled?: boolean; + objectIdField?: string; + outFields?: string[]; + popupEnabled?: boolean; + popupTemplate?: PopupTemplateProperties; + renderer?: RendererProperties; + returnM?: boolean; + returnZ?: boolean; + screenSizePerspectiveEnabled?: boolean; + source?: CollectionProperties<GraphicProperties>; + spatialReference?: SpatialReferenceProperties; + templates?: FeatureTemplateProperties[]; + token?: string; + typeIdField?: string; + types?: FeatureTypeProperties[]; + url?: string; + version?: number; + } + + export interface FeatureEditResult { + objectId: number; + error: FeatureEditResultError; } export interface FeatureLayerApplyEditsEdits { @@ -184,6 +1642,12 @@ declare namespace __esri { export interface FeatureLayerElevationInfo { mode: string; offset?: number; + featureExpressionInfo?: FeatureLayerElevationInfoFeatureExpressionInfo; + unit?: string; + } + + export interface FeatureLayerElevationInfoFeatureExpressionInfo { + expression?: string; } export interface FeatureLayerFeatureReduction { @@ -195,3220 +1659,21 @@ declare namespace __esri { } export interface FeatureLayerLayerviewCreateEvent { - view: View; layerView: LayerView; + view: View; } - export type FeatureLayerLayerviewCreateEventHandler = (event: FeatureLayerLayerviewCreateEvent) => void; - export interface FeatureLayerLayerviewDestroyEvent { + layerView: LayerView; view: View; - layerView: LayerView; } - export type FeatureLayerLayerviewDestroyEventHandler = (event: FeatureLayerLayerviewDestroyEvent) => void; - - export interface GraphicsLayerElevationInfo { - mode: string; - offset?: number; - } - - export interface GraphicsLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type GraphicsLayerLayerviewCreateEventHandler = (event: GraphicsLayerLayerviewCreateEvent) => void; - - export interface GraphicsLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type GraphicsLayerLayerviewDestroyEventHandler = (event: GraphicsLayerLayerviewDestroyEvent) => void; - - export interface LayerFromArcGISServerUrlParams { - url: string; - properties?: any; - } - - export interface LayerFromPortalItemParams { - portalItem: PortalItem; - } - - export interface FeatureTemplateThumbnail { - contentType: any; - imageData: string; - height: number; - width: number; - } - - export interface LabelClassLabelExpressionInfo { - value?: string; - } - - export interface LabelSymbol3DVerticalOffsetProperties { - screenLength?: number; - minWorldLength?: number; - maxWorldLength?: number; - } - export interface LabelSymbol3DVerticalOffset extends Accessor { - screenLength: number; - minWorldLength?: number; - maxWorldLength?: number; - } - - export interface QueryQuantizationParameters { - extent?: Extent; - mode?: string; - originPosition?: string; - tolerance?: number; - } - - export interface ViewPadding { - left?: number; - top?: number; - right?: number; - bottom?: number; - } - - export interface WebMapSourceVersion { - major: number; - minor: number; - } - - export interface WebSceneSaveAsOptions { - folder?: PortalFolder; - ignoreUnsupported?: boolean; - } - - export interface WebSceneSaveOptions { - ignoreUnsupported?: boolean; - } - - export interface WebSceneSourceVersion { - major: number; - minor: number; - } - - export interface WebSceneUpdateFromOptions { - environmentExcluded?: boolean; - viewpointExcluded?: boolean; - } - - export type EventHandler = (event: any) => void; - - export interface SceneViewDragEventOrigin { - x: number; - y: number; - } - - export interface SceneViewClickEvent { - mapPoint: Point; - x: number; - y: number; - button: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewClickEventHandler = (event: SceneViewClickEvent) => void; - - export interface SceneViewDoubleClickEvent { - mapPoint: Point; - x: number; - y: number; - button: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewDoubleClickEventHandler = (event: SceneViewDoubleClickEvent) => void; - - export interface SceneViewDragEvent { - action: string; - x: number; - y: number; - origin: SceneViewDragEventOrigin; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewDragEventHandler = (event: SceneViewDragEvent) => void; - - export type EasingFunction = (t: number, duration: number) => number; - - export interface SceneViewHoldEvent { - mapPoint: Point; - x: number; - y: number; - button: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewHoldEventHandler = (event: SceneViewHoldEvent) => void; - - export interface SceneViewKeyDownEvent { - repeat: boolean; - key: string; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewKeyDownEventHandler = (event: SceneViewKeyDownEvent) => void; - - export interface SceneViewKeyUpEvent { - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewKeyUpEventHandler = (event: SceneViewKeyUpEvent) => void; - - export interface SceneViewLayerviewCreateEvent { - layer: Layer; - layerView: LayerView; - } - - export type SceneViewLayerviewCreateEventHandler = (event: SceneViewLayerviewCreateEvent) => void; - - export interface SceneViewLayerviewDestroyEvent { - layer: Layer; - layerView: LayerView; - } - - export type SceneViewLayerviewDestroyEventHandler = (event: SceneViewLayerviewDestroyEvent) => void; - - export interface SceneViewMouseWheelEvent { - x: number; - y: number; - deltaY: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewMouseWheelEventHandler = (event: SceneViewMouseWheelEvent) => void; - - export interface SceneViewPointerDownEvent { - pointerId: number; - pointerType: string; - x: number; - y: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewPointerDownEventHandler = (event: SceneViewPointerDownEvent) => void; - - export interface SceneViewPointerMoveEvent { - pointerId: number; - pointerType: string; - x: number; - y: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewPointerMoveEventHandler = (event: SceneViewPointerMoveEvent) => void; - - export interface SceneViewPointerUpEvent { - pointerId: number; - pointerType: string; - x: number; - y: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type SceneViewPointerUpEventHandler = (event: SceneViewPointerUpEvent) => void; - - export interface SceneViewResizeEvent { - oldWidth: number; - oldHeight: number; - width: number; - height: number; - } - - export type SceneViewResizeEventHandler = (event: SceneViewResizeEvent) => void; - - export interface SceneViewConstraintsProperties { - altitude?: SceneViewConstraintsAltitudeProperties; - clipDistance?: SceneViewConstraintsClipDistanceProperties; - collision?: SceneViewConstraintsCollision; - tilt?: SceneViewConstraintsTiltProperties; - } - export interface SceneViewConstraints extends Accessor { - altitude?: SceneViewConstraintsAltitude; - clipDistance?: SceneViewConstraintsClipDistance; - collision?: SceneViewConstraintsCollision; - tilt?: SceneViewConstraintsTilt; - } - - export interface SceneViewConstraintsAltitudeProperties { - min?: number; - max?: number; - } - export interface SceneViewConstraintsAltitude extends Accessor { - min?: number; - max?: number; - } - - export interface SceneViewConstraintsClipDistanceProperties { - near?: number; - far?: number; - mode?: string; - } - export interface SceneViewConstraintsClipDistance extends Accessor { - near?: number; - far?: number; - mode?: string; - } - - export interface SceneViewConstraintsCollision { - enabled?: boolean; - } - - export interface SceneViewConstraintsTiltProperties { - max?: number; - mode?: string; - } - export interface SceneViewConstraintsTilt extends Accessor { - max?: number; - mode?: string; - } - - export interface SceneViewEnvironmentProperties { - lighting?: SceneViewEnvironmentLightingProperties; - atmosphereEnabled?: boolean; - atmosphere?: SceneViewEnvironmentAtmosphereProperties; - starsEnabled?: boolean; - } - export interface SceneViewEnvironment extends Accessor { - lighting?: SceneViewEnvironmentLighting; - atmosphereEnabled?: boolean; - atmosphere?: SceneViewEnvironmentAtmosphere; - starsEnabled?: boolean; - } - - export interface SceneViewEnvironmentAtmosphereProperties { - quality?: string; - } - export interface SceneViewEnvironmentAtmosphere extends Accessor { - quality?: string; - } - - export interface SceneViewEnvironmentLightingProperties { - date?: Date; - directShadowsEnabled?: boolean; - ambientOcclusionEnabled?: boolean; - cameraTrackingEnabled?: boolean; - } - export interface SceneViewEnvironmentLighting extends Accessor { - date?: Date; - directShadowsEnabled?: boolean; - ambientOcclusionEnabled?: boolean; - cameraTrackingEnabled?: boolean; - } - - export interface SceneViewGoToOptions { - animate?: boolean; - speedFactor?: number; - duration?: number; - maxDuration?: number; - easing?: string | EasingFunction; - } - - export interface SceneViewHighlightOptions { - color?: Color; - haloOpacity?: number; - fillOpacity?: number; - } - - export interface SceneViewHitTestScreenPoint { - x: number; - y: number; - } - - export interface SceneViewToMapScreenPoint { - x: number; - y: number; - } - - export interface WatchHandle { - remove(): void; - } - - export type WatchCallback = (newValue: any, oldValue: any, propertyName: string, target: Accessor) => void; - - export interface IdentityManagerBaseGenerateTokenOptions { - serverUrl: string; - token: string; - ssl: boolean; - } - - export interface IdentityManagerBaseGetCredentialOptions { - error?: Error; - oAuthPopupConfirmation?: boolean; - retry?: boolean; - token?: string; - } - - export interface IdentityManagerBaseOAuthSignInOptions { - error: Error; - oAuthPopupConfirmation: boolean; - token: string; - } - - export interface IdentityManagerBaseRegisterTokenProperties { - expires?: number; - server: string; - ssl?: boolean; - token: string; - userId?: string; - } - - export interface IdentityManagerBaseSetProtocolErrorHandlerHandlerFunction { - resourceUrl: string; - serverInfo: ServerInfo; - } - - export interface IdentityManagerBaseSetRedirectionHandlerHandlerFunction { - resourceUrl: string; - returnUrlParamName: string; - serverInfo: ServerInfo; - signInPage: string; - } - - export interface IdentityManagerBaseSignInOptions { - error: Error; - } - - export interface IdentityManagerCredentialCreateEvent { - credential: Credential; - } - - export type IdentityManagerCredentialCreateEventHandler = (event: IdentityManagerCredentialCreateEvent) => void; - - export interface IdentityManagerCredentialsDestroyEvent { - } - - export type IdentityManagerCredentialsDestroyEventHandler = (event: IdentityManagerCredentialsDestroyEvent) => void; - - export type HandlerCallback = (authorizeParams: any, authorizeUrl: string, oAuthInfo: OAuthInfo, resourceUrl: string, serverInfo: ServerInfo) => void; - - export interface BaseElevationLayerFetchTileOptions { - noDataValue?: number; - } - - export interface BaseElevationLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type BaseElevationLayerLayerviewCreateEventHandler = (event: BaseElevationLayerLayerviewCreateEvent) => void; - - export interface BaseElevationLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type BaseElevationLayerLayerviewDestroyEventHandler = (event: BaseElevationLayerLayerviewDestroyEvent) => void; - - export interface CSVLayerElevationInfo { - mode: string; - offset?: number; - } - - export interface CSVLayerFeatureReduction { - type: string; - } - - export interface CSVLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type CSVLayerLayerviewCreateEventHandler = (event: CSVLayerLayerviewCreateEvent) => void; - - export interface CSVLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type CSVLayerLayerviewDestroyEventHandler = (event: CSVLayerLayerviewDestroyEvent) => void; - - export interface ElevationLayerQueryElevationOptions { - demResolution?: number | string; - returnSampleInfo?: boolean; - noDataValue?: number; - } - - export interface ElevationLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type ElevationLayerLayerviewCreateEventHandler = (event: ElevationLayerLayerviewCreateEvent) => void; - - export interface ElevationLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type ElevationLayerLayerviewDestroyEventHandler = (event: ElevationLayerLayerviewDestroyEvent) => void; - - export interface GeoRSSLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type GeoRSSLayerLayerviewCreateEventHandler = (event: GeoRSSLayerLayerviewCreateEvent) => void; - - export interface GeoRSSLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type GeoRSSLayerLayerviewDestroyEventHandler = (event: GeoRSSLayerLayerviewDestroyEvent) => void; - - export interface GroupLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type GroupLayerLayerviewCreateEventHandler = (event: GroupLayerLayerviewCreateEvent) => void; - - export interface GroupLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type GroupLayerLayerviewDestroyEventHandler = (event: GroupLayerLayerviewDestroyEvent) => void; - - export interface ImageryLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type ImageryLayerLayerviewCreateEventHandler = (event: ImageryLayerLayerviewCreateEvent) => void; - - export interface ImageryLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type ImageryLayerLayerviewDestroyEventHandler = (event: ImageryLayerLayerviewDestroyEvent) => void; - - export interface IntegratedMeshLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type IntegratedMeshLayerLayerviewCreateEventHandler = (event: IntegratedMeshLayerLayerviewCreateEvent) => void; - - export interface IntegratedMeshLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type IntegratedMeshLayerLayerviewDestroyEventHandler = (event: IntegratedMeshLayerLayerviewDestroyEvent) => void; - - export interface MapImageLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type MapImageLayerLayerviewCreateEventHandler = (event: MapImageLayerLayerviewCreateEvent) => void; - - export interface MapImageLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type MapImageLayerLayerviewDestroyEventHandler = (event: MapImageLayerLayerviewDestroyEvent) => void; - - export interface MapNotesLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type MapNotesLayerLayerviewCreateEventHandler = (event: MapNotesLayerLayerviewCreateEvent) => void; - - export interface MapNotesLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type MapNotesLayerLayerviewDestroyEventHandler = (event: MapNotesLayerLayerviewDestroyEvent) => void; - - export interface OpenStreetMapLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type OpenStreetMapLayerLayerviewCreateEventHandler = (event: OpenStreetMapLayerLayerviewCreateEvent) => void; - - export interface OpenStreetMapLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type OpenStreetMapLayerLayerviewDestroyEventHandler = (event: OpenStreetMapLayerLayerviewDestroyEvent) => void; - - export interface PointCloudLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type PointCloudLayerLayerviewCreateEventHandler = (event: PointCloudLayerLayerviewCreateEvent) => void; - - export interface PointCloudLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type PointCloudLayerLayerviewDestroyEventHandler = (event: PointCloudLayerLayerviewDestroyEvent) => void; - - export interface PointCloudLayerElevationInfo { - mode: string; - offset?: number; - } - - export interface PointCloudRendererColorModulation { - field: string; - minValue: number; - maxValue: number; - } - - export interface PointCloudRendererPointSizeAlgorithm { - type?: string; - useRealWorldSymbolSizes?: boolean; - size?: number; - scaleFactor?: number; - minSize?: number; - } - - export interface SceneLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type SceneLayerLayerviewCreateEventHandler = (event: SceneLayerLayerviewCreateEvent) => void; - - export interface SceneLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type SceneLayerLayerviewDestroyEventHandler = (event: SceneLayerLayerviewDestroyEvent) => void; - - export interface SceneLayerElevationInfo { - mode: string; - offset?: number; - } - - export interface SceneLayerFeatureReduction { - type: string; - } - - export interface StreamLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type StreamLayerLayerviewCreateEventHandler = (event: StreamLayerLayerviewCreateEvent) => void; - - export interface StreamLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type StreamLayerLayerviewDestroyEventHandler = (event: StreamLayerLayerviewDestroyEvent) => void; - - export interface StreamLayerFilter { - geometry?: Extent; - where?: string; - } - - export interface StreamLayerPurgeOptions { - displayCount: number; - age: number; - } - - export interface StreamLayerUpdateFilterFilterChanges { - geometry: Extent; - where: string; - } - - export interface TileLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type TileLayerLayerviewCreateEventHandler = (event: TileLayerLayerviewCreateEvent) => void; - - export interface TileLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type TileLayerLayerviewDestroyEventHandler = (event: TileLayerLayerviewDestroyEvent) => void; - - export interface TileLayerFetchTileOptions { - allowImageDataAccess?: boolean; - } - - export interface UnknownLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type UnknownLayerLayerviewCreateEventHandler = (event: UnknownLayerLayerviewCreateEvent) => void; - - export interface UnknownLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type UnknownLayerLayerviewDestroyEventHandler = (event: UnknownLayerLayerviewDestroyEvent) => void; - - export interface UnsupportedLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type UnsupportedLayerLayerviewCreateEventHandler = (event: UnsupportedLayerLayerviewCreateEvent) => void; - - export interface UnsupportedLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type UnsupportedLayerLayerviewDestroyEventHandler = (event: UnsupportedLayerLayerviewDestroyEvent) => void; - - export interface VectorTileLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type VectorTileLayerLayerviewCreateEventHandler = (event: VectorTileLayerLayerviewCreateEvent) => void; - - export interface VectorTileLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type VectorTileLayerLayerviewDestroyEventHandler = (event: VectorTileLayerLayerviewDestroyEvent) => void; - - export interface VectorTileLayerCurrentStyleInfo { - serviceUrl: string; - styleUrl: string; - spriteUrl: string; - glyphsUrl: string; - style: any; - layerDefinition: any; - } - - export interface WebTileLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type WebTileLayerLayerviewCreateEventHandler = (event: WebTileLayerLayerviewCreateEvent) => void; - - export interface WebTileLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type WebTileLayerLayerviewDestroyEventHandler = (event: WebTileLayerLayerviewDestroyEvent) => void; - - export interface WMSLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type WMSLayerLayerviewCreateEventHandler = (event: WMSLayerLayerviewCreateEvent) => void; - - export interface WMSLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type WMSLayerLayerviewDestroyEventHandler = (event: WMSLayerLayerviewDestroyEvent) => void; - - export interface WMSLayerFetchImageOptions { - allowImageDataAccess?: boolean; - pixelRatio?: number; - rotation?: number; - } - - export interface WMTSLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type WMTSLayerLayerviewCreateEventHandler = (event: WMTSLayerLayerviewCreateEvent) => void; - - export interface WMTSLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type WMTSLayerLayerviewDestroyEventHandler = (event: WMTSLayerLayerviewDestroyEvent) => void; - - export interface BaseDynamicLayerFetchImageOptions { - allowImageDataAccess?: boolean; - } - - export interface BaseDynamicLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type BaseDynamicLayerLayerviewCreateEventHandler = (event: BaseDynamicLayerLayerviewCreateEvent) => void; - - export interface BaseDynamicLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type BaseDynamicLayerLayerviewDestroyEventHandler = (event: BaseDynamicLayerLayerviewDestroyEvent) => void; - - export interface BaseTileLayerFetchTileOptions { - allowImageDataAccess?: boolean; - } - - export interface BaseTileLayerLayerviewCreateEvent { - view: View; - layerView: LayerView; - } - - export type BaseTileLayerLayerviewCreateEventHandler = (event: BaseTileLayerLayerviewCreateEvent) => void; - - export interface BaseTileLayerLayerviewDestroyEvent { - view: View; - layerView: LayerView; - } - - export type BaseTileLayerLayerviewDestroyEventHandler = (event: BaseTileLayerLayerviewDestroyEvent) => void; - - export interface CodedValueDomainCodedValues { + export interface FeatureEditResultError { name: string; - code: string | number; - } - - export interface PixelBlockAddDataPlaneData { - pixels: number[][]; - statistics: any[]; - } - - export interface PixelBlockStatistics { - maxValue?: number; - minValue?: number; - noDataValue?: number; - } - - export interface ClassBreaksRendererClassBreakInfos { - minValue: number; - maxValue: number; - symbol: Symbol; - label?: string; - } - - export interface ClassBreaksRendererLegendOptions { - title: string; - } - - export interface UniqueValueRendererLegendOptions { - title?: string; - } - - export interface UniqueValueRendererUniqueValueInfos { - value: string | number; - symbol: Symbol; - label?: string; - } - - export interface PointCloudClassBreaksRendererColorClassBreakInfos { - minValue: number; - maxValue: number; - color: Color; - label?: string; - } - - export interface PointCloudStretchRendererStops { - value: number; - label?: string; - color: Color; - } - - export interface PointCloudUniqueValueRendererColorUniqueValueInfos { - values: number[]; - color: Color; - label?: string; - } - - export interface FillSymbol3DLayerOutline { - color: Color; - size: number; - } - - export interface IconSymbol3DLayerOutline { - color?: Color; - size?: number; - } - - export interface IconSymbol3DLayerResource { - primitive?: string; - href?: string; - } - - export interface ObjectSymbol3DLayerResource { - primitive?: string; - href?: string; - } - - export interface PointSymbol3DVerticalOffsetProperties { - screenLength?: number; - minWorldLength?: number; - maxWorldLength?: number; - } - export interface PointSymbol3DVerticalOffset extends Accessor { - screenLength: number; - minWorldLength?: number; - maxWorldLength?: number; - } - - export interface Symbol3DStyleOrigin { - styleName?: string; - styleUrl?: string; - name: string; - } - - export interface TextSymbol3DLayerFont { - family?: string; - weight?: string; - style?: string; - } - - export interface TextSymbol3DLayerHalo { - color?: Color; - size?: number; - } - - export interface LineCallout3DBorderProperties { - color?: Color; - } - export interface LineCallout3DBorder extends Accessor { - color?: Color; - } - - export interface ClosestFacilityParametersAttributeParameterValues { - attributeName: string; - parameterName: string; - value: string; - } - - export interface GeometryServiceFromGeoCoordinateStringParams { - strings: string[]; - sr: SpatialReference | string; - conversionType: string; - conversionMode?: string; - } - - export interface GeometryServiceToGeoCoordinateStringParams { - sr: SpatialReference | string; - coordinates: number[][]; - conversionType: string; - conversionMode?: string; - numOfDigits?: number; - rounding?: boolean; - addSpaces?: boolean; - } - - export interface ProjectParametersTransformation { - wkid?: number; - wkt?: string; - } - - export interface LocatorAddressToLocationsParams { - address: any; - categories: string[]; - countryCode: string; - distance: number; - forStorage: boolean; - location: Point; - magicKey: string; - maxLocations: number; - outFields: string[]; - searchExtent: Extent; - } - - export interface LocatorAddressesToLocationsParams { - addresses: any[]; - countryCode: string; - categories: string[]; - } - - export interface LocatorSuggestLocationsParams { - categories: string[]; - distance: number; - location: Point; - text: string; - } - - export interface PrintTemplateExportOptions { - width?: number; - height?: number; - dpi?: number; - } - - export interface PrintTemplateLayoutOptions { - titleText: string; - authorText: string; - copyrightText: string; - scalebarUnit: string; - legendLayers: LegendLayer[]; - customTextElements: any[]; - } - - export interface MapViewDragEventOrigin { - x: number; - y: number; - } - - export interface MapViewClickEvent { - mapPoint: Point; - x: number; - y: number; - button: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewClickEventHandler = (event: MapViewClickEvent) => void; - - export interface MapViewDoubleClickEvent { - mapPoint: Point; - x: number; - y: number; - button: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewDoubleClickEventHandler = (event: MapViewDoubleClickEvent) => void; - - export interface MapViewDragEvent { - action: string; - x: number; - y: number; - origin: MapViewDragEventOrigin; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewDragEventHandler = (event: MapViewDragEvent) => void; - - export interface MapViewHoldEvent { - mapPoint: Point; - x: number; - y: number; - button: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewHoldEventHandler = (event: MapViewHoldEvent) => void; - - export interface MapViewKeyDownEvent { - repeat: boolean; - key: string; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewKeyDownEventHandler = (event: MapViewKeyDownEvent) => void; - - export interface MapViewKeyUpEvent { - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewKeyUpEventHandler = (event: MapViewKeyUpEvent) => void; - - export interface MapViewLayerviewCreateEvent { - layer: Layer; - layerView: LayerView; - } - - export type MapViewLayerviewCreateEventHandler = (event: MapViewLayerviewCreateEvent) => void; - - export interface MapViewLayerviewDestroyEvent { - layer: Layer; - layerView: LayerView; - } - - export type MapViewLayerviewDestroyEventHandler = (event: MapViewLayerviewDestroyEvent) => void; - - export interface MapViewConstraints { - lods?: LOD[]; - minScale?: number; - maxScale?: number; - minZoom?: number; - maxZoom?: number; - snapToZoom?: boolean; - rotationEnabled?: boolean; - effectiveLODs?: LOD[]; - effectiveMinZoom?: number; - effectiveMaxZoom?: number; - effectiveMinScale?: number; - effectiveMaxScale?: number; - } - - export interface MapViewGoToOptions { - animate?: boolean; - duration?: number; - easing?: string | Function; - } - - export interface MapViewHitTestScreenPoint { - x: number; - y: number; - } - - export interface MapViewToMapScreenPoint { - x: number; - y: number; - } - - export interface MapViewMouseWheelEvent { - x: number; - y: number; - deltaY: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewMouseWheelEventHandler = (event: MapViewMouseWheelEvent) => void; - - export interface MapViewPointerDownEvent { - pointerId: number; - pointerType: string; - x: number; - y: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewPointerDownEventHandler = (event: MapViewPointerDownEvent) => void; - - export interface MapViewPointerMoveEvent { - pointerId: number; - pointerType: string; - x: number; - y: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewPointerMoveEventHandler = (event: MapViewPointerMoveEvent) => void; - - export interface MapViewPointerUpEvent { - pointerId: number; - pointerType: string; - x: number; - y: number; - type: string; - stopPropagation: Function; - timestamp: number; - native: any; - } - - export type MapViewPointerUpEventHandler = (event: MapViewPointerUpEvent) => void; - - export interface MapViewResizeEvent { - oldWidth: number; - oldHeight: number; - width: number; - height: number; - } - - export type MapViewResizeEventHandler = (event: MapViewResizeEvent) => void; - - export interface AttributeParamValue { - attributeName: string; - parameterName: string; - value: string; - } - - export interface ConfigurationTaskGetDataWorkspaceDetailsParams { - dataWorkspaceId: string; - user: string; - } - - export interface ConfigurationTaskGetUserJobQueryDetailsParams { - queryId: number; - user: string; - } - - export interface AuxRecordDescription { - properties: any; - recordId: number; - tableName: string; - } - - export interface JobCreationParameters { - loi: Geometry; - assignedTo: string; - autoCommitWorkflow: boolean; - autoExecute: boolean; - dataWorkspaceId: string; - description: string; - dueDate: Date; - jobTypeId: number; - assignedType: string; - name: string; - numJobs: string; - ownedBy: string; - parentJobId: number; - parentVersion: string; - priority: number; - startDate: Date; - user: string; - } - - export interface JobQueryParameters { - aliases: string; - fields: string; - orderBy: string; - tables: string; - where: string; - user: string; - } - - export interface JobTaskAddEmbeddedAttachmentParams { - jobId: number; - form: any; - user: string; - } - - export interface JobTaskAddLinkedAttachmentParams { - jobId: number; - attachmentType: number; - path: string; - user: string; - } - - export interface JobTaskAddLinkedRecordParams { - jobId: number; - tableName: string; - user: string; - } - - export interface JobTaskAssignJobsParams { - jobIds: number[]; - assignedType: string; - assignedTo: string; - user: string; - } - - export interface JobTaskCloseJobsParams { - jobIds: number[]; - user: string; - } - - export interface JobTaskCreateDependencyParams { - jobId: number; - heldOnType: string; - heldOnValue: number; - depJobId: number; - depOnType: string; - depOnValue: number; - user: string; - } - - export interface JobTaskCreateHoldParams { - jobId: number; - holdTypeId: number; - comments: string; - user: string; - } - - export interface JobTaskCreateJobVersionParams { - jobId: number; - name: string; - parent: string; - user: string; - } - - export interface JobTaskDeleteAttachmentParams { - jobId: number; - attachmentId: number; - user: string; - } - - export interface JobTaskDeleteDependencyParams { - jobId: number; - dependencyId: number; - user: string; - } - - export interface JobTaskDeleteJobsParams { - jobIds: number[]; - deleteHistory?: boolean; - user: string; - } - - export interface JobTaskDeleteLinkedRecordParams { - jobId: number; - tableName: string; - recordId: number; - user: string; - } - - export interface JobTaskGetAttachmentContentUrlParams { - jobId: number; - attachmentId: number; - } - - export interface JobTaskListFieldValuesParams { - jobId: number; - tableName: string; - field: string; - user: string; - } - - export interface JobTaskListMultiLevelFieldValuesParams { - field: string; - previousSelectedValues: string[]; - user: string; - } - - export interface JobTaskLogActionParams { - jobId: number; - activityTypeId: number; - comments: string; - user: string; - } - - export interface JobTaskQueryJobsParams { - queryId: number; - user: string; - } - - export interface JobTaskQueryMultiLevelSelectedValuesParams { - field: string; - user: string; - } - - export interface JobTaskReleaseHoldParams { - jobId: number; - holdId: number; - } - - export interface JobTaskReopenClosedJobsParams { - jobIds: number[]; - user: string; - } - - export interface JobTaskSearchJobsParams { - text: string; - user: string; - } - - export interface JobTaskUnassignJobsParams { - jobIds: number[]; - user: string; - } - - export interface JobTaskUpdateNotesParams { - jobId: number; - notes: string; - user: string; - } - - export interface JobTaskUpdateRecordParams { - jobId: number; - record: AuxRecordDescription; - user: string; - } - - export interface JobUpdateParameters { - ownedBy: string; - assignedTo: string; - dataWorkspaceId: string; - description: string; - dueDate: Date; - loi: Geometry; - jobId: number; - name: string; - assignedType: string; - parentJobId: number; - parentVersion: string; - percent: number; - priority: number; - startDate: Date; - status: number; - versionName: string; - user: string; - } - - export interface ChangeRule { - description: string; - evaluators: any[]; - id: number; - name: string; - notifier: any; - summarize: boolean; - } - - export interface NotificationTaskAddChangeRuleParams { - rule: ChangeRule; - user: string; - } - - export interface NotificationTaskDeleteChangeRuleParams { - ruleId: string; - user: string; - } - - export interface NotificationTaskNotifySessionParams { - sessionid: string; - deleteAfter: boolean; - user: string; - } - - export interface NotificationTaskQueryChangeRulesParams { - name: string; - description: string; - searchType: string; - user: string; - } - - export interface NotificationTaskRunSpatialNotificationOnHistoryParams { - dataWorkspaceId: string; - from: Date; - to: Date; - logMatches: boolean; - send: boolean; - user: string; - } - - export interface NotificationTaskSendNotificationParams { - jobId: number; - notificationType: string; - user: string; - } - - export interface NotificationTaskSubscribeToNotificationParams { - notificationTypeId: number; - email: string; - user: string; - } - - export interface NotificationTaskUnsubscribeFromNotificationParams { - notificationTypeId: number; - email: string; - user: string; - } - - export interface ReportTaskGenerateReportParams { - reportId: number; - user: string; - } - - export interface ReportTaskGetReportContentUrlParams { - reportId: number; - user: number; - } - - export interface ReportTaskGetReportDataParams { - reportId: number; - user: string; - } - - export interface TokenTaskParseTokensParams { - jobId: any; - stringToParse: string; - user: string; - } - - export interface WorkflowTaskCanRunStepParams { - jobId: number; - stepId: number; - user: string; - } - - export interface WorkflowTaskExecuteStepsParams { - jobId: number; - stepIds: number[]; - auto: boolean; - user: string; - } - - export interface WorkflowTaskGetStepDescriptionParams { - jobId: number; - stepId: number; - } - - export interface WorkflowTaskGetStepFileUrlParams { - jobId: number; - stepId: number; - } - - export interface WorkflowTaskGetStepParams { - jobId: number; - stepId: number; - } - - export interface WorkflowTaskMarkStepsAsDoneParams { - jobId: number; - stepIds: number[]; - user: string; - } - - export interface WorkflowTaskMoveToNextStepParams { - jobId: number; - stepId: number; - returnCode: number; - user: string; - } - - export interface WorkflowTaskRecreateWorkflowParams { - jobId: number; - user: string; - } - - export interface WorkflowTaskResolveConflictParams { - jobId: number; - stepId: number; - optionReturnCode: number; - optionStepIds: number[]; - user: string; - } - - export interface WorkflowTaskSetCurrentStepParams { - jobId: number; - stepId: number; - user: string; - } - - export interface ImageryLayerViewPixelData { - extent?: Extent; - pixelBlock: PixelBlock; - } - - export interface StreamLayerViewDataReceivedEvent { - } - - export type StreamLayerViewDataReceivedEventHandler = (event: StreamLayerViewDataReceivedEvent) => void; - - export interface StreamLayerViewFilter { - geometry?: Extent; - where?: string; - } - - export interface StreamLayerViewUpdateFilterFilter { - geometry?: Extent; - where?: string; - } - - export interface SlideApplyToOptions { - animate: boolean; - speedFactor?: number; - duration?: number; - maxDuration?: number; - easing?: string | EasingFunction; - } - - export interface SlideCreateFromOptions { - screenshot: SlideCreateFromOptionsScreenshot; - } - - export interface SlideCreateFromOptionsScreenshot { - format: string; - quality: number; - width: number; - height: number; - } - - export interface SlideDescriptionProperties { - text?: string; - } - export interface SlideDescription extends Accessor { - text?: string; - } - - export interface SlideThumbnailProperties { - url?: string; - } - export interface SlideThumbnail extends Accessor { - url?: string; - } - - export interface SlideTitleProperties { - text?: string; - } - export interface SlideTitle extends Accessor { - text?: string; - } - - export interface SlideUpdateFromOptions { - screenshot: SlideUpdateFromOptionsScreenshot; - } - - export interface SlideUpdateFromOptionsScreenshot { - format: string; - quality: number; - width: number; - height: number; - } - - export interface SlideVisibleLayers extends Collection { - id: string; - } - - export interface ColorSliderValues { - color: Color; - value: number; - label: string; - } - - export interface LegendLayerInfos { - title?: string; - layer: Layer; - } - - export interface PopupDockOptions { - breakpoint?: any | boolean; - buttonEnabled?: boolean; - position?: string | Function; - } - - export interface PopupOpenOptions { - title?: string; - content?: string; - location?: Geometry; - features?: Graphic[]; - promises?: IPromise<any>[]; - updateLocationEnabled?: boolean; - } - - export interface SearchViewModelSearchCompleteEventResults { - results: SearchViewModelSearchCompleteEventResultsResults[]; - sourceIndex: number; - source: any[]; - } - - export interface SearchViewModelSearchCompleteEventResultsResults { - extent: Extent; - feature: Graphic; - name: string; - } - - export interface SearchViewModelSelectResultEventResult { - extent: Extent; - feature: Graphic; - name: string; - } - - export interface SearchViewModelSuggestCompleteEventResults { - results: SearchViewModelSuggestCompleteEventResultsResults[]; - sourceIndex: number; - source: any; - } - - export interface SearchViewModelSuggestCompleteEventResultsResults { - extent: Extent; - feature: Graphic; - name: string; - isCollection: boolean; - magicKey: string; - text: string; - } - - export interface SearchViewModelLoadEvent { - } - - export type SearchViewModelLoadEventHandler = (event: SearchViewModelLoadEvent) => void; - - export interface SearchViewModelSearchClearEvent { - } - - export type SearchViewModelSearchClearEventHandler = (event: SearchViewModelSearchClearEvent) => void; - - export interface SearchViewModelSearchCompleteEvent { - activeSourceIndex: number; - errors: Error[]; - numResults: number; - searchTerm: string; - results: SearchViewModelSearchCompleteEventResults[]; - } - - export type SearchViewModelSearchCompleteEventHandler = (event: SearchViewModelSearchCompleteEvent) => void; - - export interface SearchViewModelSearchStartEvent { - } - - export type SearchViewModelSearchStartEventHandler = (event: SearchViewModelSearchStartEvent) => void; - - export interface SearchViewModelSelectResultEvent { - result: SearchViewModelSelectResultEventResult; - source: any; - sourceIndex: number; - } - - export type SearchViewModelSelectResultEventHandler = (event: SearchViewModelSelectResultEvent) => void; - - export interface SearchViewModelSuggestCompleteEvent { - activeSourceIndex: number; - errors: Error[]; - numResults: number; - searchTerm: string; - results: SearchViewModelSuggestCompleteEventResults[]; - } - - export type SearchViewModelSuggestCompleteEventHandler = (event: SearchViewModelSuggestCompleteEvent) => void; - - export interface SearchViewModelSuggestStartEvent { - } - - export type SearchViewModelSuggestStartEventHandler = (event: SearchViewModelSuggestStartEvent) => void; - - export interface DynamicLayerFetchImageOptions { - allowImageDataAccess?: boolean; - rotation?: number; - pixelRatio?: number; - } - - export interface DynamicLayerGetImageUrlOptions { - pixelRatio?: number; - rotation?: number; - } - - export interface ArcGISDynamicMapServiceGetExportImageParametersOptions { - rotation?: number; - } - - export interface SceneServiceVersion { - major: number; - minor: number; - versionString: string; - } - - export interface BreakpointsOwnerBreakpoints { - xsmall: number; - small: number; - medium: number; - large: number; - } - - export interface configRequest { - corsDetection?: boolean; - corsDetectionTimeout?: number; - corsEnabledServers?: Array<string | configRequestCorsEnabledServers>; - forceProxy?: boolean; - httpsDomains?: string[]; - maxUrlLength?: number; - proxyUrl?: string; - timeout?: number; - useCors?: string | boolean; - proxyRules?: configRequestProxyRules[]; - } - - export interface configRequestCorsEnabledServers { - host?: string; - withCredentials?: boolean; - } - - export interface configRequestProxyRules { - proxyUrl?: string; - urlPrefix?: string; - } - - export interface configWorkers { - loaderConfig?: configWorkersLoaderConfig; - } - - export interface configWorkersLoaderConfig { - has?: any; - paths?: any; - map?: any; - packages?: any[]; - } - - export interface requestEsriRequestOptions { - callbackParamName?: string; - query?: any; - responseType?: string; - headers?: any; - timeout?: number; - method?: string; - body?: any | any | string; - useProxy?: boolean; - cacheBust?: boolean; - allowImageDataAccess?: boolean; - } - - export interface EachAlwaysResult { - promise: IPromise<any>; - value: any; - error: any; - } - - export interface urlUtilsAddProxyRuleRule { - proxyUrl: string; - urlPrefix: string; - } - - export type EventAttachedCallback = (target: any, propName: string, obj: Accessor, eventName: string) => void; - - export interface PausableWatchHandle { - remove(): void; - pause(): void; - resume(): void; - } - - export interface decoratorsPropertyPropertyMetadata { - dependsOn?: string[]; - type?: Function; - cast?: Function; - readOnly?: boolean; - aliasOf?: string; - value?: any; - } - - export interface colorCreateContinuousRendererParams { - layer: FeatureLayer | SceneLayer; - field: string; - normalizationField?: string; - basemap?: string | Basemap; - theme?: string; - colorScheme?: any; - legendOptions?: colorCreateContinuousRendererParamsLegendOptions; - statistics?: any; - minValue?: number; - maxValue?: number; - defaultSymbolEnabled?: boolean; - view?: SceneView; - symbolType?: string; - colorMixMode?: string; - } - - export interface colorCreateContinuousRendererParamsLegendOptions { - title: string; - } - - export interface colorCreateVisualVariableParams { - layer: FeatureLayer | SceneLayer; - field: string; - normalizationField?: string; - basemap?: string | Basemap; - theme?: string; - colorScheme?: any; - legendOptions?: colorCreateVisualVariableParamsLegendOptions; - statistics?: any; - minValue?: number; - maxValue?: number; - view?: SceneView; - worldScale?: boolean; - } - - export interface colorCreateVisualVariableParamsLegendOptions { - title: string; - } - - export interface locationCreateRendererParams { - layer: FeatureLayer | SceneLayer; - basemap?: string | Basemap; - locationScheme?: any | any | any; - view?: SceneView; - symbolType?: string; - colorMixMode?: string; - } - - export interface sizeCreateContinuousRendererParams { - layer: FeatureLayer | SceneLayer; - field: string; - normalizationField?: string; - basemap?: string | Basemap; - sizeScheme?: any | any | any; - legendOptions?: sizeCreateContinuousRendererParamsLegendOptions; - statistics?: any; - minValue?: number; - maxValue?: number; - defaultSymbolEnabled?: boolean; - view?: SceneView; - symbolType?: string; - } - - export interface sizeCreateContinuousRendererParamsLegendOptions { - title: string; - } - - export interface sizeCreateVisualVariablesParams { - layer: FeatureLayer | SceneLayer; - field: string; - normalizationField?: string; - basemap?: string | Basemap; - sizeScheme?: any | any | any; - legendOptions?: sizeCreateVisualVariablesParamsLegendOptions; - statistics?: any; - minValue?: number; - maxValue?: number; - view?: SceneView; - worldScale?: boolean; - axis?: boolean; - } - - export interface sizeCreateVisualVariablesParamsLegendOptions { - title: string; - } - - export interface typeCreateRendererParams { - layer: FeatureLayer | SceneLayer; - field: string; - basemap?: string | Basemap; - numTypes?: number; - sortBy?: string; - typeScheme?: any | any | any; - legendOptions?: typeCreateRendererParamsLegendOptions; - defaultSymbolEnabled?: boolean; - view?: SceneView; - symbolType?: string; - statistics?: any; - colorMixMode?: string; - } - - export interface typeCreateRendererParamsLegendOptions { - title: string; - } - - export interface univariateColorSizeCreateContinuousRendererParams { - layer: FeatureLayer | SceneLayer; - basemap?: string | Basemap; - field: string; - normalizationField?: string; - statistics?: any; - minValue?: number; - maxValue?: number; - defaultSymbolEnabled?: boolean; - colorOptions?: univariateColorSizeCreateContinuousRendererParamsColorOptions; - sizeOptions?: univariateColorSizeCreateContinuousRendererParamsSizeOptions; - view?: SceneView; - symbolType?: string; - } - - export interface univariateColorSizeCreateContinuousRendererParamsColorOptions { - theme?: string; - colorScheme?: any; - legendOptions?: univariateColorSizeCreateContinuousRendererParamsColorOptionsLegendOptions; - } - - export interface univariateColorSizeCreateContinuousRendererParamsColorOptionsLegendOptions { - title: string; - } - - export interface univariateColorSizeCreateContinuousRendererParamsSizeOptions { - sizeScheme?: any | any | any; - legendOptions?: univariateColorSizeCreateContinuousRendererParamsSizeOptionsLegendOptions; - } - - export interface univariateColorSizeCreateContinuousRendererParamsSizeOptionsLegendOptions { - title: string; - } - - export interface univariateColorSizeCreateVisualVariablesParams { - layer: FeatureLayer | SceneLayer; - basemap?: string | Basemap; - field: string; - normalizationField?: string; - statistics?: any; - minValue?: number; - maxValue?: number; - colorOptions?: univariateColorSizeCreateVisualVariablesParamsColorOptions; - sizeOptions?: univariateColorSizeCreateVisualVariablesParamsSizeOptions; - view?: SceneView; - worldScale?: boolean; - } - - export interface univariateColorSizeCreateVisualVariablesParamsColorOptions { - theme?: string; - colorScheme?: any; - legendOptions?: univariateColorSizeCreateVisualVariablesParamsColorOptionsLegendOptions; - } - - export interface univariateColorSizeCreateVisualVariablesParamsColorOptionsLegendOptions { - title: string; - } - - export interface univariateColorSizeCreateVisualVariablesParamsSizeOptions { - axis?: boolean; - sizeScheme?: any | any | any; - legendOptions?: univariateColorSizeCreateVisualVariablesParamsSizeOptionsLegendOptions; - } - - export interface univariateColorSizeCreateVisualVariablesParamsSizeOptionsLegendOptions { - title: string; - } - - export interface classBreaksClassBreaksParams { - layer: FeatureLayer | SceneLayer; - field?: string; - normalizationField?: string; - classificationMethod?: string; - standardDeviationInterval?: number; - minValue?: number; - maxValue?: number; - numClasses?: number; - } - - export interface histogramHistogramParams { - layer: FeatureLayer | SceneLayer; - field?: string; - normalizationField?: string; - classificationMethod?: string; - standardDeviationInterval?: number; - minValue?: number; - maxValue?: number; - numBins?: number; - } - - export interface summaryStatisticsSummaryStatisticsParams { - layer: FeatureLayer | SceneLayer; - field?: string; - normalizationField?: string; - features?: Graphic[]; - minValue?: number; - maxValue?: number; - } - - export interface uniqueValuesUniqueValuesParams { - layer: FeatureLayer | SceneLayer; - field: string; - features?: Graphic[]; - returnAllCodedValues?: boolean; - } - - export interface colorGetSchemesParams { - basemap: string | Basemap; - geometryType: string; - theme: string; - view?: SceneView; - worldScale?: boolean; - } - - export interface locationGetSchemesParams { - basemap: string | Basemap; - geometryType: string; - view?: SceneView; - worldScale?: boolean; - } - - export interface sizeGetSchemesParams { - basemap: string | Basemap; - geometryType: string; - view?: SceneView; - worldScale?: boolean; - } - - export interface typeGetSchemesParams { - basemap: string | Basemap; - geometryType: string; - worldScale?: boolean; - view?: SceneView; - } - - export interface JobQuery { - id: number; - name: string; - } - - export interface GroupMembership { - id: number; - name: string; - } - - export interface JobQueryContainer { - containers: JobQueryContainer[]; - id: number; - name: string; - queries: JobQuery[]; - } - - export interface Privilege { - description: string; - id: number; - name: string; - } - - export interface DataWorkspace { - id: string; - name: string; - } - - export interface HoldType { - description: string; - id: number; - name: string; - } - - export interface JobPriority { - description: string; - name: string; - value: number; - } - - export interface JobStatus { - caption: string; - description: string; - id: number; - name: string; - } - - export interface JobType { - category: string; - description: string; - id: string; - name: string; - state: string; - } - - export interface ActivityType { - desription: string; - id: number; message: string; - name: string; } - export interface NotificationType { - attachJobAttachments: boolean; - id: number; - message: string; - senderEmail: string; - senderName: string; - subject: string; - subscribers: string[]; - type: string; - } - - export interface AuxRecord { - displayProperty: any; - id: number; - recordvalues: AuxRecordValue; - } - - export interface AuxRecordValue { - filter: string; - alias: string; - data: any; - dataType: string; - displayOrder: number; - displayType: string; - domain: string; - canUpdate: boolean; - length: number; - name: string; - required: boolean; - tableListClass: string; - tableListDisplayField: string; - tableListStoreField: string; - userVisible: boolean; - } - - export interface JobVersionInfo { - dataWorkspaceId: string; - name: string; - parent: string; - created: boolean; - owner: string; - } - - export interface QueryFieldInfo { - alias: string; - length: string; - name: string; - type: string; - } - - export interface DatasetConfiguration { - changeCondition: number; - changeFields: string; - dataset: string; - dataWorkspaceId: string; - name: string; - whereConditions: WhereCondition[]; - } - - export interface WhereCondition { - compareValue: any; - field: string; - operator: string; - } - - export interface ReportDataGroup { - aggregateLabel: string; - aggregateValue: string; - row: string[]; - value: string; - } - - export interface WorkflowConflicts { - jobID: number; - options: WorkflowOption[]; - spawnsConcurrency: boolean; - stepId: number; - } - - export interface WorkflowOption { - returnCode: number; - steps: WorkflowStepInfo[]; - } - - export interface WorkflowStepInfo { - id: number; - name: string; - } - - export interface StepType { - program: string; - arguments: string; - executionType: string; - id: number; - name: string; - description: string; - stepDescriptionLink: string; - stepDescriptionType: string; - stepIndicatorType: string; - supportedPlatform: string; - visible: boolean; - } - - export interface WorkflowAnnotationDisplayDetails { - centerX: number; - centerY: number; - fillColor: any; - height: number; - label: string; - labelColor: any; - OutlineColor: any; - width: number; - } - - export interface WorkflowPathDisplayDetails { - destStepId: number; - sourceStepID: number; - label: string; - labelColor: any; - labelX: number; - labelY: number; - lineColor: any; - pathObject: any; - } - - export interface WorkflowStepDisplayDetails { - labelColor: any; - centerX: number; - fillColor: any; - height: number; - label: string; - centerY: number; - OutlineColor: any; - shape: string; - stepId: number; - stepType: string; - width: number; - } - - export interface ColorAndIntensity { - color: any; - intensity: number; - } - - export interface RenderCamera { - viewMatrix: any; - viewInverseTransposeMatrix: any; - projectionMatrix: any; - eye: any; - center: any; - up: any; - near: number; - far: number; - fovX: number; - fovY: number; - } - - export interface SunLight { - direction: any; - diffuse: ColorAndIntensity; - ambient: ColorAndIntensity; - } - - interface Basemap extends Accessor, Loadable, JSONSupport { - baseLayers: Collection; - id: string; - loaded: boolean; - portalItem: PortalItem; - referenceLayers: Collection; - thumbnailUrl: string; - title: string; - - clone(): this; - } - - interface BasemapConstructor { - new(properties?: BasemapProperties): Basemap; - - - fromId(id: string): Basemap; - - fromJSON(json: any): Basemap; - } - - export const Basemap: BasemapConstructor; - - interface BasemapProperties extends LoadableProperties { - baseLayers?: Collection | any[]; - id?: string; - loaded?: boolean; - portalItem?: PortalItemProperties; - referenceLayers?: Collection | any[]; - thumbnailUrl?: string; - title?: string; - } - - interface Camera extends Accessor, JSONSupport { - fov: number; - heading: number; - position: Point; - tilt: number; - - clone(): this; - } - - interface CameraConstructor { - new(properties?: CameraProperties): Camera; - - fromJSON(json: any): Camera; - } - - export const Camera: CameraConstructor; - - interface CameraProperties { - fov?: number; - heading?: number; - position?: PointProperties; - tilt?: number; - } - - interface Color { - a: number; - b: number; - g: number; - r: number; - - clone(): this; - setColor(color: string | number[] | any): Color; - toCss(includeAlpha?: boolean): string; - toHex(): string; - toJSON(): any; - toRgb(): number[]; - toRgba(): number[]; - } - - interface ColorConstructor { - - blendColors(start: Color, end: Color, weight: number, obj?: Color): Color; - new(color: string | number[] | any): Color; - fromArray(a: number[], obj?: Color): Color; - fromHex(color: string, obj?: Color): Color; - fromJSON(json: any): Color; - fromRgb(color: string, obj?: Color): Color; - fromString(str: string, obj?: Color): Color; - } - - export const Color: ColorConstructor; - - interface Graphic extends Accessor, JSONSupport { - attributes: any; - geometry: Geometry; - layer: FeatureLayer | GraphicsLayer; - popupTemplate: PopupTemplate; - symbol: Symbol; - visible: boolean; - - clone(): this; - getAttribute(name: string): any; - getEffectivePopupTemplate(): PopupTemplate; - setAttribute(name: string, newValue: any): void; - } - - interface GraphicConstructor { - new(properties?: GraphicProperties): Graphic; - - fromJSON(json: any): Graphic; - } - - export const Graphic: GraphicConstructor; - - interface GraphicProperties { - attributes?: any; - geometry?: GeometryProperties; - layer?: FeatureLayer | GraphicsLayer; - popupTemplate?: PopupTemplateProperties; - symbol?: SymbolProperties; - visible?: boolean; - } - - interface Ground extends Accessor { - layers: Collection; - - clone(): this; - queryElevation(geometry: Point | Multipoint | Polyline, options?: GroundQueryElevationOptions): IPromise<any>; - } - - interface GroundConstructor { - new(properties?: GroundProperties): Ground; - } - - export const Ground: GroundConstructor; - - interface GroundProperties { - layers?: Collection | any[]; - } - - interface Map extends Accessor, LayersMixin { - allLayers: Collection; - basemap: Basemap; - ground: Ground; - } - - interface MapConstructor { - new(properties?: MapProperties): Map; - } - - export const Map: MapConstructor; - - interface MapProperties extends LayersMixinProperties { - allLayers?: Collection | any[]; - basemap?: BasemapProperties; - ground?: GroundProperties; - } - - interface PopupTemplate extends Accessor, JSONSupport { - actions: Collection; - content: string; - expressionInfos: PopupTemplateExpressionInfos[]; - fieldInfos: PopupTemplateFieldInfos[]; - overwriteActions: boolean; - title: string; - - clone(): this; - } - - interface PopupTemplateConstructor { - new(properties?: PopupTemplateProperties): PopupTemplate; - - fromJSON(json: any): PopupTemplate; - } - - export const PopupTemplate: PopupTemplateConstructor; - - interface PopupTemplateProperties { - actions?: Collection | any[]; - content?: string | any[] | Function | IPromise<any>; - expressionInfos?: PopupTemplateExpressionInfos[]; - fieldInfos?: PopupTemplateFieldInfos[]; - overwriteActions?: boolean; - title?: string | Function; - } - - interface Viewpoint extends Accessor, JSONSupport { - camera: Camera; - rotation: number; - scale: number; - targetGeometry: Geometry; - - clone(): this; - } - - interface ViewpointConstructor { - new(properties?: ViewpointProperties): Viewpoint; - - fromJSON(json: any): Viewpoint; - } - - export const Viewpoint: ViewpointConstructor; - - interface ViewpointProperties { - camera?: CameraProperties; - rotation?: number; - scale?: number; - targetGeometry?: GeometryProperties; - } - - interface WebMap extends Map, corePromise { - applicationProperties: any; - bookmarks: any[]; - initialViewProperties: InitialViewProperties; - loaded: boolean; - loadError: Error; - loadStatus: string; - portalItem: PortalItem; - presentation: any; - sourceVersion: WebMapSourceVersion; - tables: any[]; - widgets: any; - - load(): IPromise<any>; - } - - interface WebMapConstructor { - new(properties?: WebMapProperties): WebMap; - } - - export const WebMap: WebMapConstructor; - - interface WebMapProperties extends MapProperties { - applicationProperties?: any; - bookmarks?: any[]; - initialViewProperties?: InitialViewPropertiesProperties; - loaded?: boolean; - loadError?: Error; - loadStatus?: string; - portalItem?: PortalItemProperties; - presentation?: any; - sourceVersion?: WebMapSourceVersion; - tables?: any[]; - widgets?: any; - } - - interface WebScene extends Map, corePromise { - clippingArea: Extent; - clippingEnabled: boolean; - initialViewProperties: websceneInitialViewProperties; - loaded: boolean; - loadError: Error; - loadStatus: string; - portalItem: PortalItem; - presentation: Presentation; - sourceVersion: WebSceneSourceVersion; - - load(): IPromise<any>; - save(options?: WebSceneSaveOptions): IPromise<any>; - saveAs(portalItem: PortalItem, options?: WebSceneSaveAsOptions): IPromise<any>; - toJSON(): any; - updateFrom(view: SceneView, options?: WebSceneUpdateFromOptions): void; - } - - interface WebSceneConstructor { - new(properties?: WebSceneProperties): WebScene; - - - fromJSON(json: any): any; - } - - export const WebScene: WebSceneConstructor; - - interface WebSceneProperties extends MapProperties { - clippingArea?: ExtentProperties; - clippingEnabled?: boolean; - initialViewProperties?: websceneInitialViewPropertiesProperties; - loaded?: boolean; - loadError?: Error; - loadStatus?: string; - portalItem?: PortalItemProperties; - presentation?: PresentationProperties; - sourceVersion?: WebSceneSourceVersion; - } - - - - interface Collection extends Accessor, Evented { - length: number; - - add(item: any, index?: number): void; - addMany(items: any[] | Collection, index?: number): void; - clone(): this; - concat(value: any[] | Collection): Collection; - every(callback: ItemTestCallback): boolean; - filter(callback: ItemTestCallback): Collection; - find(callback: ItemTestCallback): any; - findIndex(callback: ItemTestCallback): number; - flatten(callback: ItemCallback): Collection; - forEach(callback: ItemCallback): void; - getItemAt(index: number): any; - includes(searchElement: any): boolean; - indexOf(searchElement: any, fromIndex?: number): number; - join(separator?: string): string; - lastIndexOf(searchElement: any, fromIndex?: number): number; - map(callback: ItemMapCallback): Collection; - pop(): any; - push(item: any): number; - reduce(callback: ItemReduceCallback): any; - reduceRight(callback: ItemReduceCallback, initialValue?: any): any; - remove(item: any): void; - removeAll(): void; - removeAt(index: number): any; - removeMany(items: any[] | Collection): any; - reorder(item: any, index: number): any; - reverse(): Collection; - shift(): any; - slice(begin?: number, end?: number): Collection; - some(callback: ItemCallback): boolean; - sort(compareFunction?: ItemCompareCallback): void; - splice(start: number, deleteCount: number, items: any): any[]; - toArray(): any[]; - unshift(items: any): number; - } - - interface CollectionConstructor { - new(properties?: CollectionProperties): Collection; - - - isCollection(value: any): boolean; - ofType(type: any): any; - } - - export const Collection: CollectionConstructor; - - interface CollectionProperties { - length?: number; - } - - interface Connection { - broadcast(methodName: string, data?: any, buffers?: any[]): IPromise<any>[]; - close(): void; - invoke(methodName: string, data?: any, buffers?: any[]): IPromise<any>; - } - - interface ConnectionConstructor { - new(client: any, id: number): Connection; - } - - export const Connection: ConnectionConstructor; - - interface Circle extends Polygon { - center: Point | number[]; - geodesic: boolean; - numberOfPoints: number; - radius: number; - radiusUnit: string; - } - - interface CircleConstructor { - new(properties?: CircleProperties): Circle; - - fromJSON(json: any): Circle; - } - - export const Circle: CircleConstructor; - - interface CircleProperties extends PolygonProperties { - center?: Point | number[]; - geodesic?: boolean; - numberOfPoints?: number; - radius?: number; - radiusUnit?: string; - } - - interface Extent extends Geometry { - center: Point; - height: number; - mmax: number; - mmin: number; - width: number; - xmax: number; - xmin: number; - ymax: number; - ymin: number; - zmax: number; - zmin: number; - - centerAt(point: Point): Extent; - contains(geometry: Point | Extent): boolean; - equals(extent: Extent): boolean; - expand(factor: number): Extent; - intersection(extent: Extent): Extent; - intersects(geometry: Geometry): boolean; - normalize(): Extent[]; - offset(dx: number, dy: number, dz: number): Extent; - union(extent: Extent): Extent; - } - - interface ExtentConstructor { - new(properties?: ExtentProperties): Extent; - - fromJSON(json: any): Extent; - } - - export const Extent: ExtentConstructor; - - interface ExtentProperties extends GeometryProperties { - center?: PointProperties; - height?: number; - mmax?: number; - mmin?: number; - width?: number; - xmax?: number; - xmin?: number; - ymax?: number; - ymin?: number; - zmax?: number; - zmin?: number; - } - - interface Geometry extends Accessor, JSONSupport { - cache: any; - extent: Extent; - hasM: boolean; - hasZ: boolean; - spatialReference: SpatialReference; - type: string; - - clone(): this; - } - - interface GeometryConstructor { - new(properties?: GeometryProperties): Geometry; - - fromJSON(json: any): Geometry; - } - - export const Geometry: GeometryConstructor; - - interface GeometryProperties { - cache?: any; - extent?: ExtentProperties; - hasM?: boolean; - hasZ?: boolean; - spatialReference?: SpatialReferenceProperties; - type?: string; - } - - interface Multipoint extends Geometry { - points: number[][]; - - addPoint(point: Point | number[]): Multipoint; - getPoint(index: number): Point; - removePoint(index: number): Point; - setPoint(index: number, point: Point): Multipoint; - } - - interface MultipointConstructor { - new(properties?: MultipointProperties): Multipoint; - - fromJSON(json: any): Multipoint; - } - - export const Multipoint: MultipointConstructor; - - interface MultipointProperties extends GeometryProperties { - points?: number[][]; - } - - interface Point extends Geometry { - latitude: number; - longitude: number; - m: number; - x: number; - y: number; - z: number; - - copy(other: Point): void; - distance(other: Point): number; - equals(point: Point): boolean; - normalize(): Point; - } - - interface PointConstructor { - new(properties?: PointProperties): Point; - - fromJSON(json: any): Point; - } - - export const Point: PointConstructor; - - interface PointProperties extends GeometryProperties { - latitude?: number; - longitude?: number; - m?: number; - x?: number; - y?: number; - z?: number; - } - - interface Polygon extends Geometry { - centroid: Point; - isSelfIntersecting: boolean; - rings: number[][][]; - - addRing(ring: Point[] | number[][]): Polygon; - contains(point: Point): boolean; - getPoint(ringIndex: number, pointIndex: number): Point; - insertPoint(ringIndex: number, pointIndex: number, point: Point): Polygon; - isClockwise(ring: Point[] | number[][]): boolean; - removePoint(ringIndex: number, pointIndex: number): Point[]; - removeRing(index: number): Point[]; - setPoint(ringIndex: number, pointIndex: number, point: Point): Polygon; - } - - interface PolygonConstructor { - new(properties?: PolygonProperties): Polygon; - - - fromExtent(extent: Extent): Polygon; - - fromJSON(json: any): Polygon; - } - - export const Polygon: PolygonConstructor; - - interface PolygonProperties extends GeometryProperties { - centroid?: PointProperties; - isSelfIntersecting?: boolean; - rings?: number[][][]; - } - - interface Polyline extends Geometry { - paths: number[][][]; - - addPath(points: number[][]): Polyline; - getPoint(pathIndex: number, pointIndex: number): Point; - insertPoint(pathIndex: number, pointIndex: number, point: Point): Polyline; - removePath(index: number): Point[]; - removePoint(pathIndex: number, pointIndex: number): Point; - setPoint(pathIndex: number, pointIndex: number, point: Point): Polyline; - } - - interface PolylineConstructor { - new(properties?: PolylineProperties): Polyline; - - fromJSON(json: any): Polyline; - } - - export const Polyline: PolylineConstructor; - - interface PolylineProperties extends GeometryProperties { - paths?: number[][][]; - } - - interface ScreenPoint extends Accessor { - x: number; - y: number; - } - - interface ScreenPointConstructor { - new(properties?: ScreenPointProperties): ScreenPoint; - } - - export const ScreenPoint: ScreenPointConstructor; - - interface ScreenPointProperties { - x?: number; - y?: number; - } - - interface SpatialReference extends Accessor, JSONSupport { - isGeographic: boolean; - isWebMercator: boolean; - isWGS84: boolean; - isWrappable: boolean; - WebMercator: SpatialReference; - WGS84: SpatialReference; - wkid: number; - wkt: string; - - clone(): this; - equals(spatialReference: SpatialReference): boolean; - } - - interface SpatialReferenceConstructor { - new(properties?: SpatialReferenceProperties): SpatialReference; - - fromJSON(json: any): SpatialReference; - } - - export const SpatialReference: SpatialReferenceConstructor; - - interface SpatialReferenceProperties { - isGeographic?: boolean; - isWebMercator?: boolean; - isWGS84?: boolean; - isWrappable?: boolean; - WebMercator?: SpatialReferenceProperties; - WGS84?: SpatialReferenceProperties; - wkid?: number; - wkt?: string; - } - - interface Credential extends Accessor { - expires: number; - isAdmin: boolean; - oAuthState: any; - server: string; - ssl: boolean; - token: string; - userId: string; - - destroy(): void; - refreshToken(): void; - } - - interface CredentialConstructor { - new(properties?: CredentialProperties): Credential; - } - - export const Credential: CredentialConstructor; - - interface CredentialProperties { - expires?: number; - isAdmin?: boolean; - oAuthState?: any; - server?: string; - ssl?: boolean; - token?: string; - userId?: string; - } - - interface IdentityManagerBase extends Evented { - tokenValidity: number; - - checkSignInStatus(resUrl: string): IPromise<any>; - destroyCredentials(): void; - findCredential(url: string, userId?: string): Credential; - findOAuthInfo(url: string): OAuthInfo; - findServerInfo(url: string): ServerInfo; - generateToken(serverInfo: ServerInfo, userInfo: any, options?: IdentityManagerBaseGenerateTokenOptions): IPromise<any>; - getCredential(url: string, options?: IdentityManagerBaseGetCredentialOptions): IPromise<any>; - initialize(json: any): void; - isBusy(): boolean; - oAuthSignIn(resUrl: string, serverInfo: ServerInfo, oAuthInfo: OAuthInfo, options?: IdentityManagerBaseOAuthSignInOptions): IPromise<any>; - registerOAuthInfos(oAuthInfos: OAuthInfo[]): void; - registerServers(serverInfos: ServerInfo[]): void; - registerToken(properties: IdentityManagerBaseRegisterTokenProperties): void; - setProtocolErrorHandler(handlerFunction: IdentityManagerBaseSetProtocolErrorHandlerHandlerFunction): void; - setRedirectionHandler(handlerFunction: IdentityManagerBaseSetRedirectionHandlerHandlerFunction): void; - signIn(url: string, serverInfo: ServerInfo, options?: IdentityManagerBaseSignInOptions): IPromise<any>; - toJSON(): any; - } - - interface IdentityManagerBaseConstructor { - new(): IdentityManagerBase; - } - - export const IdentityManagerBase: IdentityManagerBaseConstructor; - - interface IdentityManager extends IdentityManagerBase { - dialog: any; - - setOAuthRedirectionHandler(handlerFunction: HandlerCallback): void; - setOAuthResponseHash(hash: string): void; - - on(name: "credential-create", eventHandler: IdentityManagerCredentialCreateEventHandler): IHandle; - on(name: "credential-create", modifiers: string[], eventHandler: IdentityManagerCredentialCreateEventHandler): IHandle; - on(name: "credentials-destroy", eventHandler: IdentityManagerCredentialsDestroyEventHandler): IHandle; - on(name: "credentials-destroy", modifiers: string[], eventHandler: IdentityManagerCredentialsDestroyEventHandler): IHandle; - } - - interface IdentityManagerConstructor { - new(): IdentityManager; - } - - export const IdentityManager: IdentityManagerConstructor; - - interface OAuthInfo extends Accessor, JSONSupport { - appId: string; - authNamespace: string; - expiration: number; - locale: string; - minTimeUntilExpiration: number; - popup: boolean; - popupCallbackUrl: string; - popupWindowFeatures: string; - portalUrl: string; - - clone(): this; - } - - interface OAuthInfoConstructor { - new(properties?: OAuthInfoProperties): OAuthInfo; - - fromJSON(json: any): OAuthInfo; - } - - export const OAuthInfo: OAuthInfoConstructor; - - interface OAuthInfoProperties { - appId?: string; - authNamespace?: string; - expiration?: number; - locale?: string; - minTimeUntilExpiration?: number; - popup?: boolean; - popupCallbackUrl?: string; - popupWindowFeatures?: string; - portalUrl?: string; - } - - interface ServerInfo extends Accessor, JSONSupport { - adminTokenServiceUrl: string; - currentVersion: number; - server: string; - shortLivedTokenValidity: number; - tokenServiceUrl: string; - } - - interface ServerInfoConstructor { - new(properties?: ServerInfoProperties): ServerInfo; - - fromJSON(json: any): ServerInfo; - } - - export const ServerInfo: ServerInfoConstructor; - - interface ServerInfoProperties { - adminTokenServiceUrl?: string; - currentVersion?: number; - server?: string; - shortLivedTokenValidity?: number; - tokenServiceUrl?: string; - } - - interface BaseElevationLayer extends Layer { - spatialReference: SpatialReference; - tileInfo: TileInfo; - - addResolvingPromise(promiseToLoad: IPromise<any>): IPromise<any>; - fetchTile(level: number, row: number, column: number, options?: BaseElevationLayerFetchTileOptions): IPromise<any>; - getTileBounds(level: number, row: number, column: number, out?: number[]): number[]; - - on(name: "layerview-create", eventHandler: BaseElevationLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: BaseElevationLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: BaseElevationLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: BaseElevationLayerLayerviewDestroyEventHandler): IHandle; - } - - interface BaseElevationLayerConstructor { - new(properties?: BaseElevationLayerProperties): BaseElevationLayer; - } - - export const BaseElevationLayer: BaseElevationLayerConstructor; - - interface BaseElevationLayerProperties extends LayerProperties { - spatialReference?: SpatialReferenceProperties; - tileInfo?: TileInfoProperties; - } - - interface CSVLayer extends Layer { - copyright: string; - delimiter: string; - elevationInfo: CSVLayerElevationInfo; - featureReduction: CSVLayerFeatureReduction; - fields: Field[]; - labelingInfo: LabelClass[]; - labelsVisible: boolean; - latitudeField: string; - legendEnabled: boolean; - longitudeField: string; - maxScale: number; - minScale: number; - outFields: string[]; - popupEnabled: boolean; - popupTemplate: PopupTemplate; - renderer: Renderer; - screenSizePerspectiveEnabled: boolean; - url: string; - - on(name: "layerview-create", eventHandler: CSVLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: CSVLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: CSVLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: CSVLayerLayerviewDestroyEventHandler): IHandle; - } - - interface CSVLayerConstructor { - new(properties?: CSVLayerProperties): CSVLayer; - } - - export const CSVLayer: CSVLayerConstructor; - - interface CSVLayerProperties extends LayerProperties { - copyright?: string; - delimiter?: string; - elevationInfo?: CSVLayerElevationInfo; - featureReduction?: CSVLayerFeatureReduction; - fields?: FieldProperties[]; - labelingInfo?: LabelClassProperties[]; - labelsVisible?: boolean; - latitudeField?: string; - legendEnabled?: boolean; - longitudeField?: string; - maxScale?: number; - minScale?: number; - outFields?: string[]; - popupEnabled?: boolean; - popupTemplate?: PopupTemplateProperties; - renderer?: RendererProperties; - screenSizePerspectiveEnabled?: boolean; - url?: string; - } - - interface ElevationLayer extends Layer, ArcGISMapService, ArcGISCachedService, PortalLayer, TiledLayer { - url: string; - - fetchTile(level: number, row: number, column: number, noDataValue?: number): IPromise<any>; - queryElevation(geometry: Point | Multipoint | Polyline, options?: ElevationLayerQueryElevationOptions): IPromise<any>; - - on(name: "layerview-create", eventHandler: ElevationLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: ElevationLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: ElevationLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: ElevationLayerLayerviewDestroyEventHandler): IHandle; - } - - interface ElevationLayerConstructor { - new(properties?: ElevationLayerProperties): ElevationLayer; - - fromJSON(json: any): ElevationLayer; - } - - export const ElevationLayer: ElevationLayerConstructor; - - interface ElevationLayerProperties extends LayerProperties, ArcGISMapServiceProperties, ArcGISCachedServiceProperties, PortalLayerProperties, TiledLayerProperties { - url?: string; - } - - interface FeatureLayer extends Layer, PortalLayer, ScaleRangeLayer { - capabilities: FeatureLayerCapabilities; - copyright: string; - definitionExpression: string; - displayField: string; - elevationInfo: FeatureLayerElevationInfo; - featureReduction: FeatureLayerFeatureReduction; - fields: Field[]; - gdbVersion: string; - geometryType: string; - hasAttachments: boolean; - hasM: boolean; - hasZ: boolean; - labelingInfo: LabelClass[]; - labelsVisible: boolean; - layerId: number; - legendEnabled: boolean; - objectIdField: string; - outFields: string[]; - popupEnabled: boolean; - popupTemplate: PopupTemplate; - renderer: Renderer; - returnM: boolean; - returnZ: boolean; - screenSizePerspectiveEnabled: boolean; - source: Collection; - spatialReference: SpatialReference; - templates: FeatureTemplate[]; - token: string; - typeIdField: string; - types: FeatureType[]; - url: string; - version: number; - - applyEdits(edits: FeatureLayerApplyEditsEdits): IPromise<any>; - createQuery(): Query; - getFieldDomain(fieldName: string, options?: FeatureLayerGetFieldDomainOptions): Domain; - queryExtent(params?: Query): IPromise<any>; - queryFeatureCount(params?: Query): IPromise<any>; - queryFeatures(params?: Query): IPromise<any>; - queryObjectIds(params?: Query): IPromise<any>; - - on(name: "layerview-create", eventHandler: FeatureLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: FeatureLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: FeatureLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: FeatureLayerLayerviewDestroyEventHandler): IHandle; - } - - interface FeatureLayerConstructor { - new(properties?: FeatureLayerProperties): FeatureLayer; - - fromJSON(json: any): FeatureLayer; - } - - export const FeatureLayer: FeatureLayerConstructor; - - interface FeatureLayerProperties extends LayerProperties, PortalLayerProperties, ScaleRangeLayerProperties { - capabilities?: FeatureLayerCapabilities; - copyright?: string; - definitionExpression?: string; - displayField?: string; - elevationInfo?: FeatureLayerElevationInfo; - featureReduction?: FeatureLayerFeatureReduction; - fields?: FieldProperties[]; - gdbVersion?: string; - geometryType?: string; - hasAttachments?: boolean; - hasM?: boolean; - hasZ?: boolean; - labelingInfo?: LabelClassProperties[]; - labelsVisible?: boolean; - layerId?: number; - legendEnabled?: boolean; - objectIdField?: string; - outFields?: string[]; - popupEnabled?: boolean; - popupTemplate?: PopupTemplateProperties; - renderer?: RendererProperties; - returnM?: boolean; - returnZ?: boolean; - screenSizePerspectiveEnabled?: boolean; - source?: Collection | any[]; - spatialReference?: SpatialReferenceProperties; - templates?: FeatureTemplateProperties[]; - token?: string; - typeIdField?: string; - types?: FeatureTypeProperties[]; - url?: string; - version?: number; - } - - interface GeoRSSLayer extends Layer { + interface GeoRSSLayer extends Layer, ScaleRangeLayer { lineSymbol: SimpleLineSymbol; pointSymbol: PictureMarkerSymbol; polygonSymbol: SimpleFillSymbol; @@ -3426,16 +1691,26 @@ declare namespace __esri { export const GeoRSSLayer: GeoRSSLayerConstructor; - interface GeoRSSLayerProperties extends LayerProperties { + interface GeoRSSLayerProperties extends LayerProperties, ScaleRangeLayerProperties { lineSymbol?: SimpleLineSymbolProperties; pointSymbol?: PictureMarkerSymbolProperties; polygonSymbol?: SimpleFillSymbolProperties; url?: string; } + export interface GeoRSSLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface GeoRSSLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + interface GraphicsLayer extends Layer, ScaleRangeLayer { elevationInfo: GraphicsLayerElevationInfo; - graphics: Collection; + graphics: Collection<Graphic>; screenSizePerspectiveEnabled: boolean; add(graphic: Graphic): void; @@ -3458,10 +1733,31 @@ declare namespace __esri { interface GraphicsLayerProperties extends LayerProperties, ScaleRangeLayerProperties { elevationInfo?: GraphicsLayerElevationInfo; - graphics?: Collection | any[]; + graphics?: CollectionProperties<GraphicProperties>; screenSizePerspectiveEnabled?: boolean; } + export interface GraphicsLayerElevationInfo { + mode: string; + offset?: number; + featureExpressionInfo?: GraphicsLayerElevationInfoFeatureExpressionInfo; + unit?: string; + } + + export interface GraphicsLayerElevationInfoFeatureExpressionInfo { + expression?: string; + } + + export interface GraphicsLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface GraphicsLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + interface GroupLayer extends Layer, LayersMixin, PortalLayer { visibilityMode: string; @@ -3483,6 +1779,16 @@ declare namespace __esri { visibilityMode?: string; } + export interface GroupLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface GroupLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + interface ImageryLayer extends Layer, ArcGISImageService, ScaleRangeLayer { pixelFilter: Function; popupEnabled: boolean; @@ -3512,7 +1818,19 @@ declare namespace __esri { token?: string; } + export interface ImageryLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface ImageryLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + interface IntegratedMeshLayer extends Layer, SceneService, PortalLayer { + elevationInfo: IntegratedMeshLayerElevationInfo; + on(name: "layerview-create", eventHandler: IntegratedMeshLayerLayerviewCreateEventHandler): IHandle; on(name: "layerview-create", modifiers: string[], eventHandler: IntegratedMeshLayerLayerviewCreateEventHandler): IHandle; on(name: "layerview-destroy", eventHandler: IntegratedMeshLayerLayerviewDestroyEventHandler): IHandle; @@ -3528,7 +1846,63 @@ declare namespace __esri { export const IntegratedMeshLayer: IntegratedMeshLayerConstructor; interface IntegratedMeshLayerProperties extends LayerProperties, SceneServiceProperties, PortalLayerProperties { + elevationInfo?: IntegratedMeshLayerElevationInfo; + } + export interface IntegratedMeshLayerElevationInfo { + mode: string; + offset?: number; + } + + export interface IntegratedMeshLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface IntegratedMeshLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface KMLLayer extends Layer, PortalLayer, ScaleRangeLayer { + allVisibleMapImages: Collection<any>; + allVisiblePoints: Collection<Point>; + allVisiblePolygons: Collection<Polygon>; + allVisiblePolylines: Collection<Polyline>; + sublayers: Collection<KMLSublayer>; + url: string; + + on(name: "layerview-create", eventHandler: KMLLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: KMLLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: KMLLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: KMLLayerLayerviewDestroyEventHandler): IHandle; + } + + interface KMLLayerConstructor { + new(properties?: KMLLayerProperties): KMLLayer; + + fromJSON(json: any): KMLLayer; + } + + export const KMLLayer: KMLLayerConstructor; + + interface KMLLayerProperties extends LayerProperties, PortalLayerProperties, ScaleRangeLayerProperties { + allVisibleMapImages?: CollectionProperties<any>; + allVisiblePoints?: CollectionProperties<PointProperties>; + allVisiblePolygons?: CollectionProperties<PolygonProperties>; + allVisiblePolylines?: CollectionProperties<PolylineProperties>; + sublayers?: CollectionProperties<KMLSublayerProperties>; + url?: string; + } + + export interface KMLLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface KMLLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; } interface Layer extends Accessor, Loadable, Evented { @@ -3548,8 +1922,8 @@ declare namespace __esri { new(properties?: LayerProperties): Layer; - fromArcGISServerUrl(params: LayerFromArcGISServerUrlParams): IPromise<any>; - fromPortalItem(params: LayerFromPortalItemParams): IPromise<any>; + fromArcGISServerUrl(params: LayerFromArcGISServerUrlParams): IPromise<Layer>; + fromPortalItem(params: LayerFromPortalItemParams): IPromise<Layer>; } export const Layer: LayerConstructor; @@ -3565,7 +1939,16 @@ declare namespace __esri { visible?: boolean; } - interface MapImageLayer extends Layer, ArcGISMapService, ArcGISDynamicMapService, DynamicLayer { + export interface LayerFromArcGISServerUrlParams { + url: string; + properties?: any; + } + + export interface LayerFromPortalItemParams { + portalItem: PortalItem; + } + + interface MapImageLayer extends Layer, ArcGISMapService, ArcGISDynamicMapService, DynamicLayer, ScaleRangeLayer { on(name: "layerview-create", eventHandler: MapImageLayerLayerviewCreateEventHandler): IHandle; on(name: "layerview-create", modifiers: string[], eventHandler: MapImageLayerLayerviewCreateEventHandler): IHandle; on(name: "layerview-destroy", eventHandler: MapImageLayerLayerviewDestroyEventHandler): IHandle; @@ -3580,11 +1963,21 @@ declare namespace __esri { export const MapImageLayer: MapImageLayerConstructor; - interface MapImageLayerProperties extends LayerProperties, ArcGISMapServiceProperties, ArcGISDynamicMapServiceProperties, DynamicLayerProperties { + interface MapImageLayerProperties extends LayerProperties, ArcGISMapServiceProperties, ArcGISDynamicMapServiceProperties, DynamicLayerProperties, ScaleRangeLayerProperties { } - interface MapNotesLayer extends Layer, PortalLayer { + export interface MapImageLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface MapImageLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface MapNotesLayer extends Layer, PortalLayer, ScaleRangeLayer { on(name: "layerview-create", eventHandler: MapNotesLayerLayerviewCreateEventHandler): IHandle; on(name: "layerview-create", modifiers: string[], eventHandler: MapNotesLayerLayerviewCreateEventHandler): IHandle; on(name: "layerview-destroy", eventHandler: MapNotesLayerLayerviewDestroyEventHandler): IHandle; @@ -3599,10 +1992,225 @@ declare namespace __esri { export const MapNotesLayer: MapNotesLayerConstructor; - interface MapNotesLayerProperties extends LayerProperties, PortalLayerProperties { + interface MapNotesLayerProperties extends LayerProperties, PortalLayerProperties, ScaleRangeLayerProperties { } + export interface MapNotesLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface MapNotesLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface ArcGISCachedService { + tileInfo: TileInfo; + + fromJSON(json: any): any; + toJSON(): any; + } + + interface ArcGISCachedServiceConstructor { + new(properties?: ArcGISCachedServiceProperties): ArcGISCachedService; + + fromJSON(json: any): ArcGISCachedService; + } + + export const ArcGISCachedService: ArcGISCachedServiceConstructor; + + interface ArcGISCachedServiceProperties { + tileInfo?: TileInfoProperties; + } + + interface ArcGISDynamicMapService { + allSublayers: Collection<Sublayer>; + dpi: number; + gdbVersion: string; + imageFormat: string; + imageMaxHeight: number; + imageMaxWidth: number; + imageTransparency: boolean; + sublayers: Collection<Sublayer>; + + createServiceSublayers(): Collection<Sublayer>; + findSublayerById(id: number): Sublayer; + getExportImageParameters(extent: Extent, width: number, height: number, options?: ArcGISDynamicMapServiceGetExportImageParametersOptions): any; + } + + interface ArcGISDynamicMapServiceConstructor { + new(): ArcGISDynamicMapService; + } + + export const ArcGISDynamicMapService: ArcGISDynamicMapServiceConstructor; + + interface ArcGISDynamicMapServiceProperties { + allSublayers?: CollectionProperties<SublayerProperties>; + dpi?: number; + gdbVersion?: string; + imageFormat?: string; + imageMaxHeight?: number; + imageMaxWidth?: number; + imageTransparency?: boolean; + sublayers?: CollectionProperties<SublayerProperties>; + } + + export interface ArcGISDynamicMapServiceGetExportImageParametersOptions { + rotation?: number; + } + + interface ArcGISImageService { + compressionQuality: number; + compressionTolerance: number; + copyright: string; + definitionExpression: string; + domainFields: Field[]; + fields: Field[]; + format: string; + fullExtent: Extent; + hasMultidimensions: boolean; + hasRasterAttributeTable: boolean; + imageMaxHeight: number; + imageMaxWidth: number; + mosaicRule: MosaicRule; + multidimensionalInfo: any; + pixelType: string; + popupTemplate: PopupTemplate; + rasterAttributeTable: any; + rasterAttributeTableFieldPrefix: string; + rasterFields: Field[]; + renderingRule: RasterFunction; + spatialReference: SpatialReference; + url: string; + version: number; + + fetchImage(extent: Extent, width: number, height: number): IPromise<any>; + fromJSON(json: any): any; + toJSON(): any; + } + + interface ArcGISImageServiceConstructor { + new(properties?: ArcGISImageServiceProperties): ArcGISImageService; + + fromJSON(json: any): ArcGISImageService; + } + + export const ArcGISImageService: ArcGISImageServiceConstructor; + + interface ArcGISImageServiceProperties { + compressionQuality?: number; + compressionTolerance?: number; + copyright?: string; + definitionExpression?: string; + domainFields?: FieldProperties[]; + fields?: FieldProperties[]; + format?: string; + fullExtent?: ExtentProperties; + hasMultidimensions?: boolean; + hasRasterAttributeTable?: boolean; + imageMaxHeight?: number; + imageMaxWidth?: number; + mosaicRule?: MosaicRuleProperties; + multidimensionalInfo?: any; + pixelType?: string; + popupTemplate?: PopupTemplateProperties; + rasterAttributeTable?: any; + rasterAttributeTableFieldPrefix?: string; + rasterFields?: FieldProperties[]; + renderingRule?: RasterFunctionProperties; + spatialReference?: SpatialReferenceProperties; + url?: string; + version?: number; + } + + interface ArcGISMapService { + copyright: string; + fullExtent: Extent; + spatialReference: SpatialReference; + token: string; + } + + interface ArcGISMapServiceConstructor { + new(properties?: ArcGISMapServiceProperties): ArcGISMapService; + + fromJSON(json: any): ArcGISMapService; + } + + export const ArcGISMapService: ArcGISMapServiceConstructor; + + interface ArcGISMapServiceProperties { + copyright?: string; + fullExtent?: ExtentProperties; + spatialReference?: SpatialReferenceProperties; + token?: string; + } + + interface PortalLayer { + portalItem: PortalItem; + } + + interface PortalLayerConstructor { + new(properties?: PortalLayerProperties): PortalLayer; + + fromJSON(json: any): PortalLayer; + } + + export const PortalLayer: PortalLayerConstructor; + + interface PortalLayerProperties { + portalItem?: PortalItemProperties; + } + + interface ScaleRangeLayer { + maxScale: number; + minScale: number; + } + + interface ScaleRangeLayerConstructor { + new(): ScaleRangeLayer; + } + + export const ScaleRangeLayer: ScaleRangeLayerConstructor; + + interface ScaleRangeLayerProperties { + maxScale?: number; + minScale?: number; + } + + interface SceneService { + copyright: string; + layerId: number; + spatialReference: SpatialReference; + token: string; + url: string; + version: SceneServiceVersion; + } + + interface SceneServiceConstructor { + new(properties?: SceneServiceProperties): SceneService; + + fromJSON(json: any): SceneService; + } + + export const SceneService: SceneServiceConstructor; + + interface SceneServiceProperties { + copyright?: string; + layerId?: number; + spatialReference?: SpatialReferenceProperties; + token?: string; + url?: string; + version?: SceneServiceVersion; + } + + export interface SceneServiceVersion { + major: number; + minor: number; + versionString: string; + } + interface OpenStreetMapLayer extends WebTileLayer { on(name: "layerview-create", eventHandler: OpenStreetMapLayerLayerviewCreateEventHandler): IHandle; on(name: "layerview-create", modifiers: string[], eventHandler: OpenStreetMapLayerLayerviewCreateEventHandler): IHandle; @@ -3622,9 +2230,20 @@ declare namespace __esri { } + export interface OpenStreetMapLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface OpenStreetMapLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + interface PointCloudLayer extends Layer, SceneService, PortalLayer { elevationInfo: PointCloudLayerElevationInfo; fields: Field[]; + legendEnabled: boolean; renderer: PointCloudRenderer; on(name: "layerview-create", eventHandler: PointCloudLayerLayerviewCreateEventHandler): IHandle; @@ -3644,9 +2263,25 @@ declare namespace __esri { interface PointCloudLayerProperties extends LayerProperties, SceneServiceProperties, PortalLayerProperties { elevationInfo?: PointCloudLayerElevationInfo; fields?: FieldProperties[]; + legendEnabled?: boolean; renderer?: PointCloudRendererProperties; } + export interface PointCloudLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface PointCloudLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + export interface PointCloudLayerElevationInfo { + mode: string; + offset?: number; + } + interface SceneLayer extends Layer, SceneService, PortalLayer { definitionExpression: string; elevationInfo: SceneLayerElevationInfo; @@ -3665,9 +2300,9 @@ declare namespace __esri { createQuery(): Query; getFieldUsageInfo(fieldName: string): any; queryExtent(params?: Query): IPromise<any>; - queryFeatureCount(params?: Query): IPromise<any>; - queryFeatures(params?: Query): IPromise<any>; - queryObjectIds(params?: Query): IPromise<any>; + queryFeatureCount(params?: Query): IPromise<number>; + queryFeatures(params?: Query): IPromise<FeatureSet>; + queryObjectIds(params?: Query): IPromise<number[]>; on(name: "layerview-create", eventHandler: SceneLayerLayerviewCreateEventHandler): IHandle; on(name: "layerview-create", modifiers: string[], eventHandler: SceneLayerLayerviewCreateEventHandler): IHandle; @@ -3699,6 +2334,25 @@ declare namespace __esri { screenSizePerspectiveEnabled?: boolean; } + export interface SceneLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface SceneLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + export interface SceneLayerElevationInfo { + mode: string; + offset?: number; + } + + export interface SceneLayerFeatureReduction { + type: string; + } + interface StreamLayer extends FeatureLayer { filter: StreamLayerFilter; geometryDefinition: Extent; @@ -3728,266 +2382,29 @@ declare namespace __esri { purgeOptions?: StreamLayerPurgeOptions; } - interface TileLayer extends Layer, ArcGISMapService, ArcGISCachedService, PortalLayer, TiledLayer { - attributionDataUrl: string; - hasAttributionData: boolean; - legendEnabled: boolean; - tileServers: string[]; - url: string; - - fetchTile(level: number, row: number, column: number, options?: TileLayerFetchTileOptions): IPromise<any>; - getTileUrl(level: number, row: number, col: number): string; - - on(name: "layerview-create", eventHandler: TileLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: TileLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: TileLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: TileLayerLayerviewDestroyEventHandler): IHandle; + export interface StreamLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; } - interface TileLayerConstructor { - new(properties?: TileLayerProperties): TileLayer; - - fromJSON(json: any): TileLayer; + export interface StreamLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; } - export const TileLayer: TileLayerConstructor; - - interface TileLayerProperties extends LayerProperties, ArcGISMapServiceProperties, ArcGISCachedServiceProperties, PortalLayerProperties, TiledLayerProperties { - attributionDataUrl?: string; - hasAttributionData?: boolean; - legendEnabled?: boolean; - tileServers?: string[]; - url?: string; + export interface StreamLayerFilter { + geometry?: Extent; + where?: string; } - interface UnknownLayer extends Layer { - on(name: "layerview-create", eventHandler: UnknownLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: UnknownLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: UnknownLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: UnknownLayerLayerviewDestroyEventHandler): IHandle; + export interface StreamLayerPurgeOptions { + displayCount: number; + age: number; } - interface UnknownLayerConstructor { - new(properties?: UnknownLayerProperties): UnknownLayer; - } - - export const UnknownLayer: UnknownLayerConstructor; - - interface UnknownLayerProperties extends LayerProperties { - - } - - interface UnsupportedLayer extends Layer { - on(name: "layerview-create", eventHandler: UnsupportedLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: UnsupportedLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: UnsupportedLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: UnsupportedLayerLayerviewDestroyEventHandler): IHandle; - } - - interface UnsupportedLayerConstructor { - new(properties?: UnsupportedLayerProperties): UnsupportedLayer; - } - - export const UnsupportedLayer: UnsupportedLayerConstructor; - - interface UnsupportedLayerProperties extends LayerProperties { - - } - - interface VectorTileLayer extends Layer, PortalLayer, ScaleRangeLayer, TiledLayer { - attributionDataUrl: string; - currentStyleInfo: VectorTileLayerCurrentStyleInfo; - spatialReference: SpatialReference; - token: string; - url: string; - - loadStyle(style: string | any): IPromise<any>; - - on(name: "layerview-create", eventHandler: VectorTileLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: VectorTileLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: VectorTileLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: VectorTileLayerLayerviewDestroyEventHandler): IHandle; - } - - interface VectorTileLayerConstructor { - new(properties?: VectorTileLayerProperties): VectorTileLayer; - - fromJSON(json: any): VectorTileLayer; - } - - export const VectorTileLayer: VectorTileLayerConstructor; - - interface VectorTileLayerProperties extends LayerProperties, PortalLayerProperties, ScaleRangeLayerProperties, TiledLayerProperties { - attributionDataUrl?: string; - currentStyleInfo?: VectorTileLayerCurrentStyleInfo; - spatialReference?: SpatialReferenceProperties; - token?: string; - url?: string | any; - } - - interface WebTileLayer extends Layer, TiledLayer, ScaleRangeLayer { - copyright: string; - spatialReference: SpatialReference; - subDomains: string[]; - tileServers: string[]; - urlTemplate: string; - - on(name: "layerview-create", eventHandler: WebTileLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: WebTileLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: WebTileLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: WebTileLayerLayerviewDestroyEventHandler): IHandle; - } - - interface WebTileLayerConstructor { - new(properties?: WebTileLayerProperties): WebTileLayer; - - fromJSON(json: any): WebTileLayer; - } - - export const WebTileLayer: WebTileLayerConstructor; - - interface WebTileLayerProperties extends LayerProperties, TiledLayerProperties, ScaleRangeLayerProperties { - copyright?: string; - spatialReference?: SpatialReferenceProperties; - subDomains?: string[]; - tileServers?: string[]; - urlTemplate?: string; - } - - interface WMSLayer extends Layer, PortalLayer { - copyright: string; - customLayerParameters: any; - customParameters: any; - description: string; - featureInfoFormat: string; - featureInfoUrl: string; - fullExtents: Extent[]; - imageFormat: string; - imageMaxHeight: number; - imageMaxWidth: number; - imageTransparency: boolean; - spatialReference: SpatialReference; - spatialReferences: number[]; - sublayers: Collection; - version: string; - - fetchImage(extent: Extent, width: number, height: number, options?: WMSLayerFetchImageOptions): IPromise<any>; - findSublayerById(id: number): WMSSublayer; - - on(name: "layerview-create", eventHandler: WMSLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: WMSLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: WMSLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: WMSLayerLayerviewDestroyEventHandler): IHandle; - } - - interface WMSLayerConstructor { - new(properties?: WMSLayerProperties): WMSLayer; - - fromJSON(json: any): WMSLayer; - } - - export const WMSLayer: WMSLayerConstructor; - - interface WMSLayerProperties extends LayerProperties, PortalLayerProperties { - copyright?: string; - customLayerParameters?: any; - customParameters?: any; - description?: string; - featureInfoFormat?: string; - featureInfoUrl?: string; - fullExtents?: ExtentProperties[]; - imageFormat?: string; - imageMaxHeight?: number; - imageMaxWidth?: number; - imageTransparency?: boolean; - spatialReference?: SpatialReferenceProperties; - spatialReferences?: number[]; - sublayers?: Collection | any[]; - version?: string; - } - - interface WMTSLayer extends Layer, PortalLayer { - activeLayer: WMTSSublayer; - copyright: string; - customLayerParameters: any; - customParameters: any; - serviceMode: string; - sublayers: Collection; - url: string; - version: string; - - findSublayerById(id: string): WMTSSublayer; - - on(name: "layerview-create", eventHandler: WMTSLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: WMTSLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: WMTSLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: WMTSLayerLayerviewDestroyEventHandler): IHandle; - } - - interface WMTSLayerConstructor { - new(properties?: WMTSLayerProperties): WMTSLayer; - - fromJSON(json: any): WMTSLayer; - } - - export const WMTSLayer: WMTSLayerConstructor; - - interface WMTSLayerProperties extends LayerProperties, PortalLayerProperties { - activeLayer?: WMTSSublayerProperties; - copyright?: string; - customLayerParameters?: any; - customParameters?: any; - serviceMode?: string; - sublayers?: Collection | any[]; - url?: string; - version?: string; - } - - interface BaseDynamicLayer extends Layer { - addResolvingPromise(promiseToLoad: IPromise<any>): IPromise<any>; - fetchImage(extent: Extent, width: number, height: number, options?: BaseDynamicLayerFetchImageOptions): IPromise<any>; - getImageUrl(extent: Extent, width: number, height: number): IPromise<any> | string; - - on(name: "layerview-create", eventHandler: BaseDynamicLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: BaseDynamicLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: BaseDynamicLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: BaseDynamicLayerLayerviewDestroyEventHandler): IHandle; - } - - interface BaseDynamicLayerConstructor { - new(properties?: BaseDynamicLayerProperties): BaseDynamicLayer; - } - - export const BaseDynamicLayer: BaseDynamicLayerConstructor; - - interface BaseDynamicLayerProperties extends LayerProperties { - - } - - interface BaseTileLayer extends Layer { - spatialReference: SpatialReference; - tileInfo: TileInfo; - - addResolvingPromise(promiseToLoad: IPromise<any>): IPromise<any>; - fetchTile(level: number, row: number, column: number, options?: BaseTileLayerFetchTileOptions): IPromise<any>; - getTileBounds(level: number, row: number, column: number, out?: number[]): number[]; - getTileUrl(level: number, row: number, column: number): string | IPromise<any>; - - on(name: "layerview-create", eventHandler: BaseTileLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-create", modifiers: string[], eventHandler: BaseTileLayerLayerviewCreateEventHandler): IHandle; - on(name: "layerview-destroy", eventHandler: BaseTileLayerLayerviewDestroyEventHandler): IHandle; - on(name: "layerview-destroy", modifiers: string[], eventHandler: BaseTileLayerLayerviewDestroyEventHandler): IHandle; - } - - interface BaseTileLayerConstructor { - new(properties?: BaseTileLayerProperties): BaseTileLayer; - } - - export const BaseTileLayer: BaseTileLayerConstructor; - - interface BaseTileLayerProperties extends LayerProperties { - spatialReference?: SpatialReferenceProperties; - tileInfo?: TileInfoProperties; + export interface StreamLayerUpdateFilterFilterChanges { + geometry: Extent; + where: string; } interface CodedValueDomain extends Domain { @@ -4008,6 +2425,11 @@ declare namespace __esri { codedValues?: CodedValueDomainCodedValues[]; } + export interface CodedValueDomainCodedValues { + name: string; + code: string | number; + } + interface DimensionalDefinition { dimensionName: string; isSlice: boolean; @@ -4041,6 +2463,59 @@ declare namespace __esri { type?: string; } + interface FeatureTemplate extends Accessor, JSONSupport { + description: string; + drawingTool: string; + name: string; + prototype: any; + thumbnail: FeatureTemplateThumbnail; + } + + interface FeatureTemplateConstructor { + new(properties?: FeatureTemplateProperties): FeatureTemplate; + + fromJSON(json: any): FeatureTemplate; + } + + export const FeatureTemplate: FeatureTemplateConstructor; + + interface FeatureTemplateProperties { + description?: string; + drawingTool?: string; + name?: string; + prototype?: any; + thumbnail?: FeatureTemplateThumbnail; + } + + export interface FeatureTemplateThumbnail { + contentType: any; + imageData: string; + height: number; + width: number; + } + + interface FeatureType extends Accessor, JSONSupport { + domains: any; + id: number | string; + name: string; + templates: FeatureTemplate[]; + } + + interface FeatureTypeConstructor { + new(properties?: FeatureTypeProperties): FeatureType; + + fromJSON(json: any): FeatureType; + } + + export const FeatureType: FeatureTypeConstructor; + + interface FeatureTypeProperties { + domains?: any; + id?: number | string; + name?: string; + templates?: FeatureTemplateProperties[]; + } + interface Field extends Accessor, JSONSupport { alias: string; domain: Domain; @@ -4069,52 +2544,6 @@ declare namespace __esri { type?: string; } - interface FeatureTemplate extends Accessor, JSONSupport { - description: string; - drawingTool: string; - name: string; - prototype: any; - thumbnail: FeatureTemplateThumbnail; - } - - interface FeatureTemplateConstructor { - new(properties?: FeatureTemplateProperties): FeatureTemplate; - - fromJSON(json: any): FeatureTemplate; - } - - export const FeatureTemplate: FeatureTemplateConstructor; - - interface FeatureTemplateProperties { - description?: string; - drawingTool?: string; - name?: string; - prototype?: any; - thumbnail?: FeatureTemplateThumbnail; - } - - interface FeatureType extends Accessor, JSONSupport { - domains: any; - id: number | string; - name: string; - templates: FeatureTemplate[]; - } - - interface FeatureTypeConstructor { - new(properties?: FeatureTypeProperties): FeatureType; - - fromJSON(json: any): FeatureType; - } - - export const FeatureType: FeatureTypeConstructor; - - interface FeatureTypeProperties { - domains?: any; - id?: number | string; - name?: string; - templates?: FeatureTemplateProperties[]; - } - interface ImageParameters extends Accessor { dpi: number; extent: Extent; @@ -4164,6 +2593,56 @@ declare namespace __esri { } + interface KMLSublayer extends Accessor, JSONSupport { + description: string; + id: number; + layer: KMLLayer; + mapImages: Collection<any>; + networkLink: KMLSublayerNetworkLink; + points: Collection<Point>; + polygons: Collection<Polygon>; + polylines: Collection<Polyline>; + sublayers: Collection<KMLSublayer>; + title: string; + visible: boolean; + } + + interface KMLSublayerConstructor { + new(properties?: KMLSublayerProperties): KMLSublayer; + + fromJSON(json: any): KMLSublayer; + } + + export const KMLSublayer: KMLSublayerConstructor; + + interface KMLSublayerProperties { + description?: string; + id?: number; + layer?: KMLLayerProperties; + mapImages?: CollectionProperties<any>; + networkLink?: KMLSublayerNetworkLink; + points?: CollectionProperties<PointProperties>; + polygons?: CollectionProperties<PolygonProperties>; + polylines?: CollectionProperties<PolylineProperties>; + sublayers?: CollectionProperties<KMLSublayerProperties>; + title?: string; + visible?: boolean; + } + + export interface KMLSublayerNetworkLink { + id: number; + name: string; + description: string; + visibility: number; + refreshMode: string; + refreshInterval: number; + viewRefreshMode: string; + viewRefreshTime: number; + viewBoundScale: number; + viewFormat: string; + httpQuery: string; + } + interface LabelClass extends Accessor, JSONSupport { labelExpression: string; labelExpressionInfo: LabelClassLabelExpressionInfo; @@ -4174,7 +2653,7 @@ declare namespace __esri { useCodedValues: boolean; where: string; - clone(): this; + clone(): LabelClass; } interface LabelClassConstructor { @@ -4191,11 +2670,16 @@ declare namespace __esri { labelPlacement?: string; maxScale?: number; minScale?: number; - symbol?: TextSymbol | LabelSymbol3D; + symbol?: TextSymbolProperties | LabelSymbol3DProperties; useCodedValues?: boolean; where?: string; } + export interface LabelClassLabelExpressionInfo { + value?: string; + expression: string; + } + interface LOD extends Accessor, JSONSupport { level: number; levelValue: string; @@ -4221,7 +2705,7 @@ declare namespace __esri { interface MapImage extends Accessor, JSONSupport { extent: Extent; height: number; - href: number; + href: string; opacity: number; scale: number; visible: boolean; @@ -4239,7 +2723,7 @@ declare namespace __esri { interface MapImageProperties { extent?: ExtentProperties; height?: number; - href?: number; + href?: string; opacity?: number; scale?: number; visible?: boolean; @@ -4309,6 +2793,17 @@ declare namespace __esri { width?: number; } + export interface PixelBlockAddDataPlaneData { + pixels: number[][]; + statistics: any[]; + } + + export interface PixelBlockStatistics { + maxValue?: number; + minValue?: number; + noDataValue?: number; + } + interface RangeDomain extends Domain { maxValue: number; minValue: number; @@ -4361,15 +2856,15 @@ declare namespace __esri { opacity: number; popupTemplate: PopupTemplate; renderer: Renderer; - source: any | any; - sublayers: Collection; + source: DynamicMapLayer | DynamicDataLayer; + sublayers: Collection<Sublayer>; title: string; url: string; visible: boolean; - clone(): this; + clone(): Sublayer; createQuery(): Query; - queryFeatures(params?: Query): IPromise<any>; + queryFeatures(params?: Query): IPromise<FeatureSet>; } interface SublayerConstructor { @@ -4390,16 +2885,65 @@ declare namespace __esri { opacity?: number; popupTemplate?: PopupTemplateProperties; renderer?: RendererProperties; - source?: any | any; - sublayers?: Collection | any[]; + source?: DynamicMapLayer | DynamicDataLayer; + sublayers?: CollectionProperties<SublayerProperties>; title?: string; url?: string; visible?: boolean; } + export interface DynamicDataLayer { + type: string; + dataSource: TableDataSource | QueryTableDataSource | RasterDataSource | JoinTableDataSource; + fields: DynamicDataLayerFields[]; + } + + export interface DynamicMapLayer { + type: string; + mapLayerId: number; + gdbVersion: string; + } + + export interface JoinTableDataSource { + type: string; + leftTableKey: string; + rightTableKey: string; + leftTableSource: DynamicMapLayer | DynamicDataLayer; + rightTableSource: DynamicMapLayer | DynamicDataLayer; + joinType: string; + } + + export interface QueryTableDataSource { + type: string; + workspaceId: string; + query: string; + oidFields: string; + spatialReference: SpatialReference; + geometryType: string; + } + + export interface RasterDataSource { + type: string; + workspaceId: string; + dataSourceName: string; + } + + export interface TableDataSource { + type: string; + workspaceId: string; + dataSourceName: string; + gdbVersion: string; + } + + export interface DynamicDataLayerFields { + name: string; + alias: string; + } + interface TileInfo extends Accessor, JSONSupport { dpi: number; format: string; + isWrappable: boolean; lods: LOD[]; origin: Point; size: number[]; @@ -4417,6 +2961,7 @@ declare namespace __esri { interface TileInfoProperties { dpi?: number; format?: string; + isWrappable?: boolean; lods?: LODProperties[]; origin?: PointProperties; size?: number[]; @@ -4428,7 +2973,7 @@ declare namespace __esri { id: string; tileInfo: TileInfo; - clone(): this; + clone(): TileMatrixSet; } interface TileMatrixSetConstructor { @@ -4450,14 +2995,17 @@ declare namespace __esri { fullExtent: Extent; id: number; layer: WMSLayer; + legendEnabled: boolean; + legendUrl: string; name: string; popupEnabled: boolean; + queryable: boolean; spatialReferences: number[]; - sublayers: Collection; + sublayers: Collection<WMSSublayer>; title: string; visible: boolean; - clone(): this; + clone(): WMSSublayer; } interface WMSSublayerConstructor { @@ -4472,7 +3020,7 @@ declare namespace __esri { legendUrl: string; title: string; - clone(): this; + clone(): WMTSStyle; } interface WMTSStyleConstructor { @@ -4498,12 +3046,13 @@ declare namespace __esri { imageFormats: string[]; layer: WMTSLayer; styleId: string; - styles: Collection; + styles: Collection<WMTSStyle>; + tileMatrixSet: TileMatrixSet; tileMatrixSetId: string; - tileMatrixSets: Collection; + tileMatrixSets: Collection<TileMatrixSet>; title: string; - clone(): this; + clone(): WMTSSublayer; } interface WMTSSublayerConstructor { @@ -4522,12 +3071,446 @@ declare namespace __esri { imageFormats?: string[]; layer?: WMTSLayerProperties; styleId?: string; - styles?: Collection | any[]; + styles?: CollectionProperties<WMTSStyleProperties>; + tileMatrixSet?: TileMatrixSetProperties; tileMatrixSetId?: string; - tileMatrixSets?: Collection | any[]; + tileMatrixSets?: CollectionProperties<TileMatrixSetProperties>; title?: string; } + interface TiledLayer { + tileInfo: TileInfo; + } + + interface TiledLayerConstructor { + new(properties?: TiledLayerProperties): TiledLayer; + + fromJSON(json: any): TiledLayer; + } + + export const TiledLayer: TiledLayerConstructor; + + interface TiledLayerProperties { + tileInfo?: TileInfoProperties; + } + + interface TileLayer extends Layer, ArcGISMapService, ArcGISCachedService, ScaleRangeLayer, PortalLayer, TiledLayer { + attributionDataUrl: string; + hasAttributionData: boolean; + legendEnabled: boolean; + tileServers: string[]; + url: string; + + fetchTile(level: number, row: number, column: number, options?: TileLayerFetchTileOptions): IPromise<HTMLImageElement | HTMLCanvasElement>; + getTileUrl(level: number, row: number, col: number): string; + + on(name: "layerview-create", eventHandler: TileLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: TileLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: TileLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: TileLayerLayerviewDestroyEventHandler): IHandle; + } + + interface TileLayerConstructor { + new(properties?: TileLayerProperties): TileLayer; + + fromJSON(json: any): TileLayer; + } + + export const TileLayer: TileLayerConstructor; + + interface TileLayerProperties extends LayerProperties, ArcGISMapServiceProperties, ArcGISCachedServiceProperties, ScaleRangeLayerProperties, PortalLayerProperties, TiledLayerProperties { + attributionDataUrl?: string; + hasAttributionData?: boolean; + legendEnabled?: boolean; + tileServers?: string[]; + url?: string; + } + + export interface TileLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface TileLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + export interface TileLayerFetchTileOptions { + allowImageDataAccess?: boolean; + } + + interface UnknownLayer extends Layer { + on(name: "layerview-create", eventHandler: UnknownLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: UnknownLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: UnknownLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: UnknownLayerLayerviewDestroyEventHandler): IHandle; + } + + interface UnknownLayerConstructor { + new(properties?: UnknownLayerProperties): UnknownLayer; + } + + export const UnknownLayer: UnknownLayerConstructor; + + interface UnknownLayerProperties extends LayerProperties { + + } + + export interface UnknownLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface UnknownLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface UnsupportedLayer extends Layer { + on(name: "layerview-create", eventHandler: UnsupportedLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: UnsupportedLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: UnsupportedLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: UnsupportedLayerLayerviewDestroyEventHandler): IHandle; + } + + interface UnsupportedLayerConstructor { + new(properties?: UnsupportedLayerProperties): UnsupportedLayer; + } + + export const UnsupportedLayer: UnsupportedLayerConstructor; + + interface UnsupportedLayerProperties extends LayerProperties { + + } + + export interface UnsupportedLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface UnsupportedLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface VectorTileLayer extends Layer, PortalLayer, ScaleRangeLayer, TiledLayer { + attributionDataUrl: string; + currentStyleInfo: VectorTileLayerCurrentStyleInfo; + spatialReference: SpatialReference; + token: string; + url: string | any; + + loadStyle(style: string | any): IPromise<any>; + + on(name: "layerview-create", eventHandler: VectorTileLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: VectorTileLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: VectorTileLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: VectorTileLayerLayerviewDestroyEventHandler): IHandle; + } + + interface VectorTileLayerConstructor { + new(properties?: VectorTileLayerProperties): VectorTileLayer; + + fromJSON(json: any): VectorTileLayer; + } + + export const VectorTileLayer: VectorTileLayerConstructor; + + interface VectorTileLayerProperties extends LayerProperties, PortalLayerProperties, ScaleRangeLayerProperties, TiledLayerProperties { + attributionDataUrl?: string; + currentStyleInfo?: VectorTileLayerCurrentStyleInfo; + spatialReference?: SpatialReferenceProperties; + token?: string; + url?: string | any; + } + + export interface VectorTileLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface VectorTileLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + export interface VectorTileLayerCurrentStyleInfo { + serviceUrl: string; + styleUrl: string; + spriteUrl: string; + glyphsUrl: string; + style: any; + layerDefinition: any; + } + + interface WebTileLayer extends Layer, TiledLayer, ScaleRangeLayer { + copyright: string; + spatialReference: SpatialReference; + subDomains: string[]; + tileServers: string[]; + urlTemplate: string; + + on(name: "layerview-create", eventHandler: WebTileLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: WebTileLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: WebTileLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: WebTileLayerLayerviewDestroyEventHandler): IHandle; + } + + interface WebTileLayerConstructor { + new(properties?: WebTileLayerProperties): WebTileLayer; + + fromJSON(json: any): WebTileLayer; + } + + export const WebTileLayer: WebTileLayerConstructor; + + interface WebTileLayerProperties extends LayerProperties, TiledLayerProperties, ScaleRangeLayerProperties { + copyright?: string; + spatialReference?: SpatialReferenceProperties; + subDomains?: string[]; + tileServers?: string[]; + urlTemplate?: string; + } + + export interface WebTileLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface WebTileLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface WMSLayer extends Layer, PortalLayer, ScaleRangeLayer { + copyright: string; + customLayerParameters: any; + customParameters: any; + description: string; + featureInfoFormat: string; + featureInfoUrl: string; + fullExtents: Extent[]; + imageFormat: string; + imageMaxHeight: number; + imageMaxWidth: number; + imageTransparency: boolean; + legendEnabled: boolean; + spatialReference: SpatialReference; + spatialReferences: number[]; + sublayers: Collection<WMSSublayer>; + url: string; + version: string; + + fetchImage(extent: Extent, width: number, height: number, options?: WMSLayerFetchImageOptions): IPromise<any>; + findSublayerById(id: number): WMSSublayer; + + on(name: "layerview-create", eventHandler: WMSLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: WMSLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: WMSLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: WMSLayerLayerviewDestroyEventHandler): IHandle; + } + + interface WMSLayerConstructor { + new(properties?: WMSLayerProperties): WMSLayer; + + fromJSON(json: any): WMSLayer; + } + + export const WMSLayer: WMSLayerConstructor; + + interface WMSLayerProperties extends LayerProperties, PortalLayerProperties, ScaleRangeLayerProperties { + copyright?: string; + customLayerParameters?: any; + customParameters?: any; + description?: string; + featureInfoFormat?: string; + featureInfoUrl?: string; + fullExtents?: ExtentProperties[]; + imageFormat?: string; + imageMaxHeight?: number; + imageMaxWidth?: number; + imageTransparency?: boolean; + legendEnabled?: boolean; + spatialReference?: SpatialReferenceProperties; + spatialReferences?: number[]; + sublayers?: CollectionProperties<WMSSublayer>; + url?: string; + version?: string; + } + + export interface WMSLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface WMSLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + export interface WMSLayerFetchImageOptions { + allowImageDataAccess?: boolean; + pixelRatio?: number; + rotation?: number; + } + + interface WMTSLayer extends Layer, PortalLayer, ScaleRangeLayer { + activeLayer: WMTSSublayer; + copyright: string; + customLayerParameters: any; + customParameters: any; + serviceMode: string; + sublayers: Collection<WMTSSublayer>; + url: string; + version: string; + + findSublayerById(id: string): WMTSSublayer; + + on(name: "layerview-create", eventHandler: WMTSLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-create", modifiers: string[], eventHandler: WMTSLayerLayerviewCreateEventHandler): IHandle; + on(name: "layerview-destroy", eventHandler: WMTSLayerLayerviewDestroyEventHandler): IHandle; + on(name: "layerview-destroy", modifiers: string[], eventHandler: WMTSLayerLayerviewDestroyEventHandler): IHandle; + } + + interface WMTSLayerConstructor { + new(properties?: WMTSLayerProperties): WMTSLayer; + + fromJSON(json: any): WMTSLayer; + } + + export const WMTSLayer: WMTSLayerConstructor; + + interface WMTSLayerProperties extends LayerProperties, PortalLayerProperties, ScaleRangeLayerProperties { + activeLayer?: WMTSSublayerProperties; + copyright?: string; + customLayerParameters?: any; + customParameters?: any; + serviceMode?: string; + sublayers?: CollectionProperties<WMTSSublayerProperties>; + url?: string; + version?: string; + } + + export interface WMTSLayerLayerviewCreateEvent { + layerView: LayerView; + view: View; + } + + export interface WMTSLayerLayerviewDestroyEvent { + layerView: LayerView; + view: View; + } + + interface Map extends Accessor, LayersMixin { + allLayers: Collection<Layer>; + basemap: Basemap; + ground: Ground; + } + + interface MapConstructor { + new(properties?: MapProperties): Map; + } + + export const Map: MapConstructor; + + interface MapProperties extends LayersMixinProperties { + allLayers?: CollectionProperties<LayerProperties>; + basemap?: BasemapProperties; + ground?: GroundProperties; + } + + interface PopupTemplate extends Accessor, JSONSupport { + actions: Collection<Collection<Action>>; + content: string | any[] | Function | IPromise<any>; + expressionInfos: PopupTemplateExpressionInfos[]; + fieldInfos: PopupTemplateFieldInfos[]; + layerOptions: PopupTemplateLayerOptions; + overwriteActions: boolean; + title: string | Function; + + clone(): PopupTemplate; + } + + interface PopupTemplateConstructor { + new(properties?: PopupTemplateProperties): PopupTemplate; + + fromJSON(json: any): PopupTemplate; + } + + export const PopupTemplate: PopupTemplateConstructor; + + interface PopupTemplateProperties { + actions?: CollectionProperties<CollectionProperties<ActionProperties>>; + content?: string | any[] | Function | IPromise<any>; + expressionInfos?: PopupTemplateExpressionInfos[]; + fieldInfos?: PopupTemplateFieldInfos[]; + layerOptions?: PopupTemplateLayerOptions; + overwriteActions?: boolean; + title?: string | Function; + } + + export interface Attachments { + type: string; + } + + export interface Fields { + type: string; + fieldInfos: any[]; + } + + export interface Media { + type: string; + mediaInfos: MediaMediaInfos[]; + } + + export interface PopupTemplateExpressionInfos { + name: string; + title?: string; + expression: string; + returnType?: string; + } + + export interface PopupTemplateFieldInfos { + fieldName: string; + format?: PopupTemplateFieldInfosFormat; + label?: string; + stringFieldOption?: string; + tooltip?: string; + visible?: boolean; + } + + export interface PopupTemplateFieldInfosFormat { + dateFormat?: string; + digitSeparator?: boolean; + places?: number; + } + + export interface PopupTemplateLayerOptions { + showNoDataRecords: boolean; + } + + export interface Text { + type: string; + text: string; + } + + export interface MediaMediaInfos { + title: string; + caption: string; + refreshInterval: number; + type: string; + value: MediaMediaInfosValue; + } + + export interface MediaMediaInfosValue { + sourceURL: string; + fields: string[]; + normalizationField: string; + theme: string; + tooltipField: string; + } + interface Portal extends Accessor, Loadable { access: string; allSSL: boolean; @@ -4589,11 +3572,11 @@ declare namespace __esri { useVectorBasemaps: boolean; vectorBasemapGalleryGroupQuery: string; - fetchBasemaps(): IPromise<any>; - fetchFeaturedGroups(): IPromise<any>; - queryGroups(queryParams: PortalQueryParams): IPromise<any>; - queryItems(queryParams: PortalQueryParams): IPromise<any>; - queryUsers(queryParams: PortalQueryParams): IPromise<any>; + fetchBasemaps(basemapGalleryGroupQuery?: string): IPromise<Basemap[]>; + fetchFeaturedGroups(): IPromise<PortalGroup[]>; + queryGroups(queryParams: PortalQueryParams): IPromise<PortalQueryResult>; + queryItems(queryParams: PortalQueryParams): IPromise<PortalQueryResult>; + queryUsers(queryParams: PortalQueryParams): IPromise<PortalQueryResult>; } interface PortalConstructor { @@ -4623,7 +3606,7 @@ declare namespace __esri { canSignInIDP?: boolean; colorSetsGroupQuery?: string; commentsEnabled?: boolean; - created?: Date; + created?: DateProperties; culture?: string; customBaseUrl?: string; defaultBasemap?: BasemapProperties; @@ -4645,7 +3628,7 @@ declare namespace __esri { layerTemplatesGroupQuery?: string; loaded?: boolean; maxTokenExpirationMinutes?: number; - modified?: Date; + modified?: DateProperties; name?: string; portalHostname?: string; portalMode?: string; @@ -4667,6 +3650,11 @@ declare namespace __esri { vectorBasemapGalleryGroupQuery?: string; } + export interface PortalFeaturedGroups { + owner: string; + title: string; + } + interface PortalFolder extends Accessor { created: Date; id: string; @@ -4682,7 +3670,7 @@ declare namespace __esri { export const PortalFolder: PortalFolderConstructor; interface PortalFolderProperties { - created?: Date; + created?: DateProperties; id?: string; portal?: PortalProperties; title?: string; @@ -4706,7 +3694,7 @@ declare namespace __esri { fetchMembers(): IPromise<any>; getThumbnailUrl(width?: number): string; - queryItems(queryParams?: PortalQueryParams): IPromise<any>; + queryItems(queryParams?: PortalQueryParams): IPromise<PortalQueryResult>; } interface PortalGroupConstructor { @@ -4717,11 +3705,11 @@ declare namespace __esri { interface PortalGroupProperties { access?: string; - created?: Date; + created?: DateProperties; description?: string; id?: string; isInvitationOnly?: boolean; - modified?: Date; + modified?: DateProperties; owner?: string; portal?: PortalProperties; snippet?: string; @@ -4761,13 +3749,14 @@ declare namespace __esri { typeKeywords: string[]; url: string; - addRating(rating: number | PortalRating): IPromise<any>; + addRating(rating: number | PortalRating): IPromise<PortalRating>; deleteRating(): IPromise<any>; fetchData(responseType?: string): IPromise<any>; - fetchRating(): IPromise<any>; - fetchRelatedItems(params: PortalItemFetchRelatedItemsParams): IPromise<any>; + fetchRating(): IPromise<PortalRating>; + fetchRelatedItems(params: PortalItemFetchRelatedItemsParams): IPromise<PortalItem[]>; getThumbnailUrl(width?: number): string; - update(params?: PortalItemUpdateParams): IPromise<any>; + update(params?: PortalItemUpdateParams): IPromise<PortalItem>; + updateThumbnail(params: PortalItemUpdateThumbnailParams): IPromise<PortalItem>; } interface PortalItemConstructor { @@ -4782,7 +3771,7 @@ declare namespace __esri { access?: string; accessInformation?: string; avgRating?: number; - created?: Date; + created?: DateProperties; culture?: string; description?: string; extent?: ExtentProperties; @@ -4792,7 +3781,7 @@ declare namespace __esri { itemUrl?: string; licenseInfo?: string; loaded?: boolean; - modified?: Date; + modified?: DateProperties; name?: string; numComments?: number; numRatings?: number; @@ -4809,20 +3798,17 @@ declare namespace __esri { url?: string; } - interface PortalRating extends Accessor { - created: Date; - rating: number; + export interface PortalItemFetchRelatedItemsParams { + relationshipType: string; + direction?: string; } - interface PortalRatingConstructor { - new(properties?: PortalRatingProperties): PortalRating; + export interface PortalItemUpdateParams { + data: string | any; } - export const PortalRating: PortalRatingConstructor; - - interface PortalRatingProperties { - created?: Date; - rating?: number; + export interface PortalItemUpdateThumbnailParams { + thumbnail: Blob | string; } interface PortalQueryParams extends Accessor { @@ -4833,7 +3819,7 @@ declare namespace __esri { sortOrder: string; start: number; - clone(): this; + clone(): PortalQueryParams; } interface PortalQueryParamsConstructor { @@ -4871,6 +3857,22 @@ declare namespace __esri { total?: number; } + interface PortalRating extends Accessor { + created: Date; + rating: number; + } + + interface PortalRatingConstructor { + new(properties?: PortalRatingProperties): PortalRating; + } + + export const PortalRating: PortalRatingConstructor; + + interface PortalRatingProperties { + created?: DateProperties; + rating?: number; + } + interface PortalUser extends Accessor { access: string; created: Date; @@ -4890,13 +3892,13 @@ declare namespace __esri { userContentUrl: string; username: string; - addItem(params: PortalUserAddItemParams): IPromise<any>; + addItem(params: PortalUserAddItemParams): IPromise<PortalItem>; deleteItem(item: PortalItem): IPromise<any>; - fetchFolders(): IPromise<any>; - fetchGroups(): IPromise<any>; + fetchFolders(): IPromise<PortalFolder[]>; + fetchGroups(): IPromise<PortalGroup[]>; fetchItems(params: PortalUserFetchItemsParams): IPromise<any>; getThumbnailUrl(width?: number): string; - queryFavorites(queryParams?: PortalQueryParams): IPromise<any>; + queryFavorites(queryParams?: PortalQueryParams): IPromise<PortalQueryResult>; } interface PortalUserConstructor { @@ -4907,12 +3909,12 @@ declare namespace __esri { interface PortalUserProperties { access?: string; - created?: Date; + created?: DateProperties; culture?: string; description?: string; email?: string; fullName?: string; - modified?: Date; + modified?: DateProperties; orgId?: string; portal?: PortalProperties; preferredView?: string; @@ -4925,11 +3927,23 @@ declare namespace __esri { username?: string; } + export interface PortalUserAddItemParams { + item: PortalItem; + data?: string | any; + folder?: PortalFolder; + } + + export interface PortalUserFetchItemsParams { + folder: PortalFolder; + num: number; + start: number; + } + interface ClassBreaksRenderer extends Renderer, VisualVariablesMixin { backgroundFillSymbol: FillSymbol; classBreakInfos: ClassBreaksRendererClassBreakInfos[]; defaultSymbol: Symbol; - field: string; + field: string | Function; isMaxInclusive: boolean; legendOptions: ClassBreaksRendererLegendOptions; normalizationField: string; @@ -4940,7 +3954,7 @@ declare namespace __esri { valueExpressionTitle: string; addClassBreakInfo(min: number | any, max: number, symbol: Symbol): void; - clone(): this; + clone(): ClassBreaksRenderer; getClassBreakInfo(graphic: Graphic): any; removeClassBreakInfo(min: number, max: number): void; } @@ -4968,8 +3982,166 @@ declare namespace __esri { valueExpressionTitle?: string; } + export interface ClassBreaksRendererClassBreakInfos { + minValue: number; + maxValue: number; + symbol: Symbol; + label?: string; + } + + export interface ClassBreaksRendererLegendOptions { + title: string; + } + + interface PointCloudClassBreaksRenderer extends PointCloudRenderer { + colorClassBreakInfos: PointCloudClassBreaksRendererColorClassBreakInfos[]; + field: string; + fieldTransformType: string; + type: string; + + clone(): PointCloudClassBreaksRenderer; + } + + interface PointCloudClassBreaksRendererConstructor { + new(properties?: PointCloudClassBreaksRendererProperties): PointCloudClassBreaksRenderer; + + fromJSON(json: any): PointCloudClassBreaksRenderer; + } + + export const PointCloudClassBreaksRenderer: PointCloudClassBreaksRendererConstructor; + + interface PointCloudClassBreaksRendererProperties extends PointCloudRendererProperties { + colorClassBreakInfos?: PointCloudClassBreaksRendererColorClassBreakInfos[]; + field?: string; + fieldTransformType?: string; + type?: string; + } + + export interface PointCloudClassBreaksRendererColorClassBreakInfos { + minValue: number; + maxValue: number; + color: Color; + label?: string; + } + + interface PointCloudRenderer extends Accessor, JSONSupport { + colorModulation: PointCloudRendererColorModulation; + pointSizeAlgorithm: PointCloudRendererPointSizeAlgorithm; + pointsPerInch: number; + + clone(): PointCloudRenderer; + } + + interface PointCloudRendererConstructor { + new(properties?: PointCloudRendererProperties): PointCloudRenderer; + + fromJSON(json: any): PointCloudRenderer; + } + + export const PointCloudRenderer: PointCloudRendererConstructor; + + interface PointCloudRendererProperties { + colorModulation?: PointCloudRendererColorModulation; + pointSizeAlgorithm?: PointCloudRendererPointSizeAlgorithm; + pointsPerInch?: number; + } + + export interface PointCloudRendererColorModulation { + field: string; + minValue?: number; + maxValue?: number; + } + + export interface PointCloudRendererPointSizeAlgorithm { + type: string; + useRealWorldSymbolSizes?: boolean; + size?: number; + scaleFactor?: number; + minSize?: number; + } + + interface PointCloudRGBRenderer extends PointCloudRenderer { + field: string; + type: string; + + clone(): PointCloudRGBRenderer; + } + + interface PointCloudRGBRendererConstructor { + new(properties?: PointCloudRGBRendererProperties): PointCloudRGBRenderer; + + fromJSON(json: any): PointCloudRGBRenderer; + } + + export const PointCloudRGBRenderer: PointCloudRGBRendererConstructor; + + interface PointCloudRGBRendererProperties extends PointCloudRendererProperties { + field?: string; + type?: string; + } + + interface PointCloudStretchRenderer extends PointCloudRenderer { + field: string; + fieldTransformType: string; + stops: PointCloudStretchRendererStops[]; + type: string; + + clone(): PointCloudStretchRenderer; + } + + interface PointCloudStretchRendererConstructor { + new(properties?: PointCloudStretchRendererProperties): PointCloudStretchRenderer; + + fromJSON(json: any): PointCloudStretchRenderer; + } + + export const PointCloudStretchRenderer: PointCloudStretchRendererConstructor; + + interface PointCloudStretchRendererProperties extends PointCloudRendererProperties { + field?: string; + fieldTransformType?: string; + stops?: PointCloudStretchRendererStops[]; + type?: string; + } + + export interface PointCloudStretchRendererStops { + value: number; + label?: string; + color: Color; + } + + interface PointCloudUniqueValueRenderer extends PointCloudRenderer { + colorUniqueValueInfos: PointCloudUniqueValueRendererColorUniqueValueInfos[]; + field: string; + fieldTransformType: string; + type: string; + + clone(): PointCloudUniqueValueRenderer; + } + + interface PointCloudUniqueValueRendererConstructor { + new(properties?: PointCloudUniqueValueRendererProperties): PointCloudUniqueValueRenderer; + + fromJSON(json: any): PointCloudUniqueValueRenderer; + } + + export const PointCloudUniqueValueRenderer: PointCloudUniqueValueRendererConstructor; + + interface PointCloudUniqueValueRendererProperties extends PointCloudRendererProperties { + colorUniqueValueInfos?: PointCloudUniqueValueRendererColorUniqueValueInfos[]; + field?: string; + fieldTransformType?: string; + type?: string; + } + + export interface PointCloudUniqueValueRendererColorUniqueValueInfos { + values: number[]; + color: Color; + label?: string; + } + interface Renderer extends Accessor, JSONSupport { - authoringInfo: any; + authoringInfo: AuthoringInfo; } interface RendererConstructor { @@ -4981,7 +4153,107 @@ declare namespace __esri { export const Renderer: RendererConstructor; interface RendererProperties { - authoringInfo?: any; + authoringInfo?: AuthoringInfo; + } + + export interface AuthoringInfo { + type: string; + fields: string[]; + classificationMethod: string; + standardDeviationInterval: number; + visualVariables: AuthoringInfoVisualVariables[]; + } + + export interface ColorVisualVariable { + type: string; + field: string | Function; + normalizationField: string; + valueExpression: string; + valueExpressionTitle: string; + legendOptions: ColorVisualVariableLegendOptions; + stops: ColorVisualVariableStops[]; + } + + export interface OpacityVisualVariable { + type: string; + field: string | Function; + normalizationField: string; + valueExpression: string; + valueExpressionTitle: string; + legendOptions: OpacityVisualVariableLegendOptions; + stops: OpacityVisualVariableStops[]; + } + + export interface RotationVisualVariable { + type: string; + field: string | Function; + valueExpression: string; + axis: string; + rotationType: string; + } + + export interface SizeVisualVariable { + maxDataValue: number; + type: string; + normalizationField: string; + valueExpression: string; + valueExpressionTitle: string; + legendOptions: SizeVisualVariableLegendOptions; + axis: string; + expression: string; + field: string | Function; + minDataValue: number; + maxSize: string | number | SizeVisualVariable; + minSize: string | number | SizeVisualVariable; + stops: SizeVisualVariableStops[]; + valueUnit: string; + valueRepresentation: string; + useSymbolValue: boolean; + } + + export interface AuthoringInfoVisualVariables { + type: string; + field: string; + minSliderValue: number; + maxSliderValue: number; + theme: string; + style: string; + units: string; + startTime: string | number; + endTime: string | number; + } + + export interface ColorVisualVariableLegendOptions { + title: string; + showLegend: boolean; + } + + export interface ColorVisualVariableStops { + value: number; + color: Color; + label: string; + } + + export interface OpacityVisualVariableLegendOptions { + title: string; + showLegend: boolean; + } + + export interface OpacityVisualVariableStops { + value: number; + opacity: number; + label: string; + } + + export interface SizeVisualVariableLegendOptions { + title: string; + showLegend: boolean; + } + + export interface SizeVisualVariableStops { + value: number; + size: string | number | any; + label: string; } interface SimpleRenderer extends Renderer, VisualVariablesMixin { @@ -4989,7 +4261,7 @@ declare namespace __esri { symbol: Symbol; type: string; - clone(): this; + clone(): SimpleRenderer; } interface SimpleRendererConstructor { @@ -5006,10 +4278,666 @@ declare namespace __esri { type?: string; } + interface color { + createContinuousRenderer(params: colorCreateContinuousRendererParams): IPromise<ContinuousRendererResult>; + createPCContinuousRenderer(params: colorCreatePCContinuousRendererParams): IPromise<PCContinuousRendererResult>; + createPCTrueColorRenderer(params: colorCreatePCTrueColorRendererParams): IPromise<PCTrueColorRendererResult>; + createVisualVariable(params: colorCreateVisualVariableParams): IPromise<VisualVariableResult>; + } + + export const color: color; + + export interface colorCreateContinuousRendererParams { + layer: FeatureLayer | SceneLayer; + field: string; + normalizationField?: string; + basemap?: string | Basemap; + theme?: string; + colorScheme?: ColorScheme; + legendOptions?: colorCreateContinuousRendererParamsLegendOptions; + statistics?: SummaryStatisticsResult; + minValue?: number; + maxValue?: number; + defaultSymbolEnabled?: boolean; + view?: SceneView; + symbolType?: string; + colorMixMode?: string; + } + + export interface colorCreateContinuousRendererParamsLegendOptions { + title: string; + } + + export interface colorCreatePCContinuousRendererParams { + layer: PointCloudLayer; + field: string; + basemap?: string | Basemap; + size?: string; + density?: number; + colorScheme?: ColorScheme; + statistics?: SummaryStatisticsResult; + } + + export interface colorCreatePCTrueColorRendererParams { + layer: PointCloudLayer; + size?: string; + density?: number; + } + + export interface colorCreateVisualVariableParams { + layer: FeatureLayer | SceneLayer; + field: string; + normalizationField?: string; + basemap?: string | Basemap; + theme?: string; + colorScheme?: ColorScheme; + legendOptions?: colorCreateVisualVariableParamsLegendOptions; + statistics?: SummaryStatisticsResult; + minValue?: number; + maxValue?: number; + view?: SceneView; + worldScale?: boolean; + } + + export interface colorCreateVisualVariableParamsLegendOptions { + title: string; + } + + export interface ContinuousRendererResult { + renderer: ClassBreaksRenderer; + visualVariable: ColorVisualVariable; + colorScheme: ColorScheme; + defaultValuesUsed: boolean; + statistics: SummaryStatisticsResult; + basemapId: string; + } + + export interface PCContinuousRendererResult { + renderer: PointCloudStretchRenderer; + colorScheme: ColorScheme; + defaultValuesUsed: boolean; + statistics: SummaryStatisticsResult; + basemapId: string; + } + + export interface PCTrueColorRendererResult { + renderer: PointCloudRGBRenderer; + } + + export interface VisualVariableResult { + visualVariable: ColorVisualVariable; + colorScheme: ColorScheme; + statistics: SummaryStatisticsResult; + defaultValuesUsed: boolean; + basemapId: string; + authoringInfo: AuthoringInfo; + } + + interface location { + createRenderer(params: locationCreateRendererParams): IPromise<RendererResult>; + } + + export const location: location; + + export interface locationCreateRendererParams { + layer: FeatureLayer | SceneLayer; + basemap?: string | Basemap; + locationScheme?: PointLocationScheme | PolylineLocationScheme | PolygonLocationScheme; + view?: SceneView; + symbolType?: string; + colorMixMode?: string; + } + + export interface RendererResult { + renderer: SimpleRenderer; + locationScheme: PointLocationScheme | PolylineLocationScheme | PolygonLocationScheme; + basemapId: string; + } + + interface size { + createContinuousRenderer(params: sizeCreateContinuousRendererParams): IPromise<sizeContinuousRendererResult>; + createVisualVariables(params: sizeCreateVisualVariablesParams): IPromise<sizeVisualVariableResult>; + } + + export const size: size; + + export interface sizeContinuousRendererResult { + renderer: ClassBreaksRenderer; + visualVariables: SizeVisualVariable[]; + sizeScheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + defaultValuesUsed: boolean; + statistics: SummaryStatisticsResult; + basemapId: string; + } + + export interface sizeCreateContinuousRendererParams { + layer: FeatureLayer | SceneLayer; + field: string; + normalizationField?: string; + basemap?: string | Basemap; + sizeScheme?: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + legendOptions?: sizeCreateContinuousRendererParamsLegendOptions; + statistics?: SummaryStatisticsResult; + minValue?: number; + maxValue?: number; + defaultSymbolEnabled?: boolean; + view?: SceneView; + symbolType?: string; + } + + export interface sizeCreateContinuousRendererParamsLegendOptions { + title: string; + } + + export interface sizeCreateVisualVariablesParams { + layer: FeatureLayer | SceneLayer; + field: string; + normalizationField?: string; + basemap?: string | Basemap; + sizeScheme?: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + legendOptions?: sizeCreateVisualVariablesParamsLegendOptions; + statistics?: SummaryStatisticsResult; + minValue?: number; + maxValue?: number; + view?: SceneView; + worldScale?: boolean; + axis?: boolean; + } + + export interface sizeCreateVisualVariablesParamsLegendOptions { + title: string; + } + + export interface sizeVisualVariableResult { + visualVariables: SizeVisualVariable[]; + sizeScheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + defaultValuesUsed: boolean; + statistics: SummaryStatisticsResult; + basemapId: string; + authoringInfo: AuthoringInfo; + } + + interface type { + createPCClassRenderer(params: typeCreatePCClassRendererParams): IPromise<PCClassRendererResult>; + createRenderer(params: typeCreateRendererParams): IPromise<typeRendererResult>; + } + + export const type: type; + + export interface PCClassRendererResult { + renderer: PointCloudUniqueValueRenderer; + } + + export interface typeRendererResult { + renderer: UniqueValueRenderer; + uniqueValueInfos: RendererResultUniqueValueInfos[]; + excludedUniqueValueInfos: any[]; + typeScheme: PointTypeScheme | PolylineTypeScheme | PolygonTypeScheme | MeshTypeScheme; + basemapId: string; + } + + export interface typeCreatePCClassRendererParams { + layer: PointCloudLayer; + field: string; + size?: string; + density?: number; + typeScheme?: PointTypeScheme; + statistics?: UniqueValuesResult; + } + + export interface typeCreateRendererParams { + layer: FeatureLayer | SceneLayer; + field: string; + basemap?: string | Basemap; + numTypes?: number; + sortBy?: string; + typeScheme?: PointTypeScheme | PolylineTypeScheme | PolygonTypeScheme | MeshTypeScheme; + legendOptions?: typeCreateRendererParamsLegendOptions; + defaultSymbolEnabled?: boolean; + view?: SceneView; + symbolType?: string; + statistics?: UniqueValuesResult; + colorMixMode?: string; + } + + export interface typeCreateRendererParamsLegendOptions { + title: string; + } + + export interface RendererResultUniqueValueInfos { + value: string | number; + count: number; + label: string; + symbol: Symbol; + } + + interface univariateColorSize { + createContinuousRenderer(params: univariateColorSizeCreateContinuousRendererParams): IPromise<univariateColorSizeContinuousRendererResult>; + createVisualVariables(params: univariateColorSizeCreateVisualVariablesParams): IPromise<VisualVariablesResult>; + } + + export const univariateColorSize: univariateColorSize; + + export interface univariateColorSizeContinuousRendererResult { + renderer: ClassBreaksRenderer; + color: ContinuousRendererResultColor; + size: ContinuousRendererResultSize; + defaultValuesUsed: boolean; + statistics: SummaryStatisticsResult; + basemapId: string; + } + + export interface univariateColorSizeCreateContinuousRendererParams { + layer: FeatureLayer | SceneLayer; + basemap?: string | Basemap; + field: string; + normalizationField?: string; + statistics?: SummaryStatisticsResult; + minValue?: number; + maxValue?: number; + defaultSymbolEnabled?: boolean; + colorOptions?: univariateColorSizeCreateContinuousRendererParamsColorOptions; + sizeOptions?: univariateColorSizeCreateContinuousRendererParamsSizeOptions; + view?: SceneView; + symbolType?: string; + } + + export interface univariateColorSizeCreateContinuousRendererParamsColorOptions { + theme?: string; + colorScheme?: ColorScheme; + legendOptions?: univariateColorSizeCreateContinuousRendererParamsColorOptionsLegendOptions; + } + + export interface univariateColorSizeCreateContinuousRendererParamsColorOptionsLegendOptions { + title: string; + } + + export interface univariateColorSizeCreateContinuousRendererParamsSizeOptions { + sizeScheme?: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + legendOptions?: univariateColorSizeCreateContinuousRendererParamsSizeOptionsLegendOptions; + } + + export interface univariateColorSizeCreateContinuousRendererParamsSizeOptionsLegendOptions { + title: string; + } + + export interface univariateColorSizeCreateVisualVariablesParams { + layer: FeatureLayer | SceneLayer; + basemap?: string | Basemap; + field: string; + normalizationField?: string; + statistics?: SummaryStatisticsResult; + minValue?: number; + maxValue?: number; + colorOptions?: univariateColorSizeCreateVisualVariablesParamsColorOptions; + sizeOptions?: univariateColorSizeCreateVisualVariablesParamsSizeOptions; + view?: SceneView; + worldScale?: boolean; + } + + export interface univariateColorSizeCreateVisualVariablesParamsColorOptions { + theme?: string; + colorScheme?: ColorScheme; + legendOptions?: univariateColorSizeCreateVisualVariablesParamsColorOptionsLegendOptions; + } + + export interface univariateColorSizeCreateVisualVariablesParamsColorOptionsLegendOptions { + title: string; + } + + export interface univariateColorSizeCreateVisualVariablesParamsSizeOptions { + axis?: boolean; + sizeScheme?: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + legendOptions?: univariateColorSizeCreateVisualVariablesParamsSizeOptionsLegendOptions; + } + + export interface univariateColorSizeCreateVisualVariablesParamsSizeOptionsLegendOptions { + title: string; + } + + export interface VisualVariablesResult { + color: VisualVariablesResultColor; + size: VisualVariablesResultSize; + defaultValuesUsed: boolean; + statistics: SummaryStatisticsResult; + basemapId: string; + authoringInfo: AuthoringInfo; + } + + export interface ContinuousRendererResultColor { + visualVariable: ColorVisualVariable; + colorScheme: ColorScheme; + } + + export interface ContinuousRendererResultSize { + visualVariables: SizeVisualVariable[]; + sizeScheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + } + + export interface VisualVariablesResultColor { + visualVariable: ColorVisualVariable; + colorScheme: ColorScheme; + } + + export interface VisualVariablesResultSize { + visualVariables: SizeVisualVariable[]; + sizeScheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + } + + interface classBreaks { + classBreaks(params: classBreaksClassBreaksParams): IPromise<ClassBreaksResult>; + } + + const __classBreaksMapped: classBreaks; + export const classBreaks: typeof __classBreaksMapped.classBreaks; + + + export interface classBreaksClassBreaksParams { + layer: FeatureLayer | SceneLayer; + field?: string; + normalizationField?: string; + classificationMethod?: string; + standardDeviationInterval?: number; + minValue?: number; + maxValue?: number; + numClasses?: number; + } + + export interface ClassBreaksResult { + classBreaksInfos: ClassBreaksResultClassBreaksInfos[]; + minValue: number; + maxValue: number; + } + + export interface ClassBreaksResultClassBreaksInfos { + label: string; + minValue: number; + maxValue: number; + } + + interface histogram { + histogram(params: histogramHistogramParams): IPromise<HistogramResult>; + } + + const __histogramMapped: histogram; + export const histogram: typeof __histogramMapped.histogram; + + + export interface histogramHistogramParams { + layer: FeatureLayer | SceneLayer | PointCloudLayer; + field?: string; + normalizationField?: string; + classificationMethod?: string; + standardDeviationInterval?: number; + minValue?: number; + maxValue?: number; + numBins?: number; + } + + export interface HistogramResult { + bins: HistogramResultBins[]; + minValue: number; + maxValue: number; + } + + export interface HistogramResultBins { + count: number; + minValue: number; + maxValue: number; + } + + interface summaryStatistics { + summaryStatistics(params: summaryStatisticsSummaryStatisticsParams): IPromise<SummaryStatisticsResult>; + } + + const __summaryStatisticsMapped: summaryStatistics; + export const summaryStatistics: typeof __summaryStatisticsMapped.summaryStatistics; + + + export interface SummaryStatisticsResult { + avg: number; + count: number; + max: number; + min: number; + stddev: number; + sum: number; + variance: number; + } + + export interface summaryStatisticsSummaryStatisticsParams { + layer: FeatureLayer | SceneLayer | PointCloudLayer; + field?: string; + normalizationField?: string; + features?: Graphic[]; + minValue?: number; + maxValue?: number; + } + + interface uniqueValues { + uniqueValues(params: uniqueValuesUniqueValuesParams): IPromise<UniqueValuesResult>; + } + + const __uniqueValuesMapped: uniqueValues; + export const uniqueValues: typeof __uniqueValuesMapped.uniqueValues; + + + export interface UniqueValuesResult { + uniqueValueInfos: UniqueValuesResultUniqueValueInfos[]; + } + + export interface uniqueValuesUniqueValuesParams { + layer: FeatureLayer | SceneLayer | PointCloudLayer; + field: string; + features?: Graphic[]; + returnAllCodedValues?: boolean; + } + + export interface UniqueValuesResultUniqueValueInfos { + value: string | number; + count: number; + } + + interface symbologyColor { + cloneScheme(scheme: ColorScheme): ColorScheme; + flipColors(scheme: ColorScheme): ColorScheme; + getSchemes(params: colorGetSchemesParams): any; + getThemes(basemap?: string | Basemap): any[]; + } + + export const symbologyColor: symbologyColor; + + export interface colorGetSchemesParams { + basemap: string | Basemap; + geometryType: string; + theme: string; + view?: SceneView; + worldScale?: boolean; + } + + export interface ColorScheme { + id: string; + theme: string; + colors: Color[]; + noDataColor: Color; + colorsForClassBreaks: ColorSchemeColorsForClassBreaks[]; + outline: ColorSchemeOutline; + size: number; + width: number; + opacity: number; + } + + export interface ColorSchemeColorsForClassBreaks { + colors: Color[]; + numClasses: number; + } + + export interface ColorSchemeOutline { + color: Color; + width: number; + } + + interface symbologyLocation { + cloneScheme(scheme: PointLocationScheme | PolylineLocationScheme | PolygonLocationScheme): PointLocationScheme | PolylineLocationScheme | PolygonLocationScheme; + getSchemes(params: locationGetSchemesParams): any; + } + + export const symbologyLocation: symbologyLocation; + + export interface locationGetSchemesParams { + basemap: string | Basemap; + geometryType: string; + view?: SceneView; + worldScale?: boolean; + } + + export interface PointLocationScheme { + color: Color; + outline: PointLocationSchemeOutline; + size: number; + opacity: number; + } + + export interface PolygonLocationScheme { + color: Color; + outline: PolygonLocationSchemeOutline; + opacity: number; + } + + export interface PolylineLocationScheme { + color: Color; + width: number; + opacity: number; + } + + export interface PointLocationSchemeOutline { + color: Color; + width: number; + } + + export interface PolygonLocationSchemeOutline { + color: Color; + width: number; + } + + interface symbologySize { + cloneScheme(scheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme): any; + getSchemes(params: sizeGetSchemesParams): any; + } + + export const symbologySize: symbologySize; + + export interface PointSizeScheme { + color: Color; + noDataColor: Color; + outline: PointSizeSchemeOutline; + size: number; + noDataSize: number; + minSize: number; + maxSize: number; + opacity: number; + } + + export interface PolygonSizeScheme { + marker: PointSizeScheme; + background: PolygonSizeSchemeBackground; + opacity: number; + } + + export interface PolylineSizeScheme { + color: Color; + noDataColor: Color; + width: number; + noDataWidth: number; + minWidth: number; + maxWidth: number; + opacity: number; + } + + export interface sizeGetSchemesParams { + basemap: string | Basemap; + geometryType: string; + view?: SceneView; + worldScale?: boolean; + } + + export interface PointSizeSchemeOutline { + color: Color; + width: number; + } + + export interface PolygonSizeSchemeBackground { + color: Color; + outline: PolygonSizeSchemeBackgroundOutline; + } + + export interface PolygonSizeSchemeBackgroundOutline { + color: Color; + width: number; + } + + interface symbologyType { + cloneScheme(scheme: PointTypeScheme | PolylineTypeScheme | PolygonTypeScheme | MeshTypeScheme): any; + getSchemes(params: typeGetSchemesParams): any; + } + + export const symbologyType: symbologyType; + + export interface MeshTypeScheme { + colors: Color[]; + noDataColor: Color; + opacity: number; + } + + export interface PointTypeScheme { + colors: Color[]; + noDataColor: Color; + outline: PointTypeSchemeOutline; + size: number; + opacity: number; + } + + export interface PolygonTypeScheme { + colors: Color[]; + noDataColor: Color; + outline: PolygonTypeSchemeOutline; + opacity: number; + } + + export interface PolylineTypeScheme { + colors: Color[]; + noDataColor: Color; + width: number; + opacity: number; + } + + export interface typeGetSchemesParams { + basemap: string | Basemap; + geometryType: string; + theme?: string; + worldScale?: boolean; + view?: SceneView; + } + + export interface PointTypeSchemeOutline { + color: Color; + width: number; + } + + export interface PolygonTypeSchemeOutline { + color: Color; + width: number; + } + + interface supportJsonUtils { + fromJSON(json: any): Renderer; + } + + export const supportJsonUtils: supportJsonUtils; + interface UniqueValueRenderer extends Renderer, VisualVariablesMixin { defaultLabel: string; defaultSymbol: Symbol; - field: string; + field: string | Function; field2: string; field3: string; fieldDelimiter: string; @@ -5020,7 +4948,7 @@ declare namespace __esri { valueExpressionTitle: string; addUniqueValueInfo(valueOrInfo: string | number | any, symbol?: Symbol): void; - clone(): this; + clone(): UniqueValueRenderer; getUniqueValueInfo(graphic: Graphic): any; removeUniqueValueInfo(value: string): void; } @@ -5047,110 +4975,63 @@ declare namespace __esri { valueExpressionTitle?: string; } - interface PointCloudRenderer extends Accessor, JSONSupport { - colorModulation: PointCloudRendererColorModulation; - pointSizeAlgorithm: PointCloudRendererPointSizeAlgorithm; - pointsPerInch: number; - - clone(): this; + export interface UniqueValueRendererLegendOptions { + title?: string; } - interface PointCloudRendererConstructor { - new(properties?: PointCloudRendererProperties): PointCloudRenderer; - - fromJSON(json: any): PointCloudRenderer; + export interface UniqueValueRendererUniqueValueInfos { + value: string | number; + symbol: Symbol; + label?: string; } - export const PointCloudRenderer: PointCloudRendererConstructor; - - interface PointCloudRendererProperties { - colorModulation?: PointCloudRendererColorModulation; - pointSizeAlgorithm?: PointCloudRendererPointSizeAlgorithm; - pointsPerInch?: number; + interface VisualVariablesMixin { + visualVariables: any[]; } - interface PointCloudClassBreaksRenderer extends PointCloudRenderer { - colorClassBreakInfos: PointCloudClassBreaksRendererColorClassBreakInfos[]; - field: string; - fieldTransformType: string; - type: string; + interface VisualVariablesMixinConstructor { + new(): VisualVariablesMixin; } - interface PointCloudClassBreaksRendererConstructor { - new(properties?: PointCloudClassBreaksRendererProperties): PointCloudClassBreaksRenderer; + export const VisualVariablesMixin: VisualVariablesMixinConstructor; - fromJSON(json: any): PointCloudClassBreaksRenderer; + interface VisualVariablesMixinProperties { + visualVariables?: any[]; } - export const PointCloudClassBreaksRenderer: PointCloudClassBreaksRendererConstructor; - - interface PointCloudClassBreaksRendererProperties extends PointCloudRendererProperties { - colorClassBreakInfos?: PointCloudClassBreaksRendererColorClassBreakInfos[]; - field?: string; - fieldTransformType?: string; - type?: string; + interface request { + esriRequest(url: string, options?: requestEsriRequestOptions): IPromise<any>; } - interface PointCloudRGBRenderer extends PointCloudRenderer { - field: string; - type: string; + const __requestMapped: request; + export const request: typeof __requestMapped.esriRequest; + + + export interface EsriErrorDetails { + getHeader: GetHeader; + httpStatus: number; + messageCode: string; + messages: string[]; + requestOptions: any; + ssl: boolean; + subCode: number; + url: string; } - interface PointCloudRGBRendererConstructor { - new(properties?: PointCloudRGBRendererProperties): PointCloudRGBRenderer; + export type GetHeader = (headerName: string) => string; - fromJSON(json: any): PointCloudRGBRenderer; - } - - export const PointCloudRGBRenderer: PointCloudRGBRendererConstructor; - - interface PointCloudRGBRendererProperties extends PointCloudRendererProperties { - field?: string; - type?: string; - } - - interface PointCloudStretchRenderer extends PointCloudRenderer { - field: string; - fieldTransformType: string; - stops: PointCloudStretchRendererStops[]; - type: string; - } - - interface PointCloudStretchRendererConstructor { - new(properties?: PointCloudStretchRendererProperties): PointCloudStretchRenderer; - - fromJSON(json: any): PointCloudStretchRenderer; - } - - export const PointCloudStretchRenderer: PointCloudStretchRendererConstructor; - - interface PointCloudStretchRendererProperties extends PointCloudRendererProperties { - field?: string; - fieldTransformType?: string; - stops?: PointCloudStretchRendererStops[]; - type?: string; - } - - interface PointCloudUniqueValueRenderer extends PointCloudRenderer { - colorUniqueValueInfos: PointCloudUniqueValueRendererColorUniqueValueInfos[]; - field: string; - fieldTransformType: string; - type: string; - } - - interface PointCloudUniqueValueRendererConstructor { - new(properties?: PointCloudUniqueValueRendererProperties): PointCloudUniqueValueRenderer; - - fromJSON(json: any): PointCloudUniqueValueRenderer; - } - - export const PointCloudUniqueValueRenderer: PointCloudUniqueValueRendererConstructor; - - interface PointCloudUniqueValueRendererProperties extends PointCloudRendererProperties { - colorUniqueValueInfos?: PointCloudUniqueValueRendererColorUniqueValueInfos[]; - field?: string; - fieldTransformType?: string; - type?: string; + export interface requestEsriRequestOptions { + callbackParamName?: string; + query?: any; + responseType?: string; + headers?: any; + timeout?: number; + method?: string; + body?: FormData | HTMLFormElement | string; + useProxy?: boolean; + cacheBust?: boolean; + allowImageDataAccess?: boolean; + authMode?: string; } interface Action extends Accessor { @@ -5160,7 +5041,7 @@ declare namespace __esri { title: string; visible: boolean; - clone(): this; + clone(): Action; } interface ActionConstructor { @@ -5177,10 +5058,79 @@ declare namespace __esri { visible?: boolean; } + interface LayersMixin { + layers: Collection<Layer>; + + add(layers: Layer, index?: number): void; + addMany(layers: Layer[], index?: number): void; + findLayerById(layerId: string): Layer; + remove(layer: Layer): Layer; + removeAll(): Layer[]; + removeMany(layers: Layer[]): Layer[]; + reorder(layer: Layer, index: number): Layer; + } + + interface LayersMixinConstructor { + new(): LayersMixin; + } + + export const LayersMixin: LayersMixinConstructor; + + interface LayersMixinProperties { + layers?: CollectionProperties<LayerProperties>; + } + + interface Callout3D extends Accessor, JSONSupport { + clone(): Callout3D; + } + + interface Callout3DConstructor { + new(properties?: Callout3DProperties): Callout3D; + + fromJSON(json: any): Callout3D; + } + + export const Callout3D: Callout3DConstructor; + + interface Callout3DProperties { + + } + + interface LineCallout3D extends Callout3D { + border: LineCallout3DBorder; + color: Color; + size: number; + type: string; + + clone(): LineCallout3D; + } + + interface LineCallout3DConstructor { + new(properties?: LineCallout3DProperties): LineCallout3D; + + fromJSON(json: any): LineCallout3D; + } + + export const LineCallout3D: LineCallout3DConstructor; + + interface LineCallout3DProperties extends Callout3DProperties { + border?: LineCallout3DBorderProperties; + color?: Color; + size?: number; + type?: string; + } + + export interface LineCallout3DBorderProperties { + color?: Color; + } + export interface LineCallout3DBorder extends Accessor { + color?: Color; + } + interface ExtrudeSymbol3DLayer extends Symbol3DLayer { size: number; - clone(): this; + clone(): ExtrudeSymbol3DLayer; } interface ExtrudeSymbol3DLayerConstructor { @@ -5214,7 +5164,7 @@ declare namespace __esri { interface FillSymbol3DLayer extends Symbol3DLayer { outline: FillSymbol3DLayerOutline; - clone(): this; + clone(): FillSymbol3DLayer; } interface FillSymbol3DLayerConstructor { @@ -5229,8 +5179,13 @@ declare namespace __esri { outline?: FillSymbol3DLayerOutline; } + export interface FillSymbol3DLayerOutline { + color: Color; + size: number; + } + interface Font extends Accessor, JSONSupport { - clone(): this; + clone(): Font; } interface FontConstructor { @@ -5251,7 +5206,7 @@ declare namespace __esri { resource: IconSymbol3DLayerResource; size: number; - clone(): this; + clone(): IconSymbol3DLayer; } interface IconSymbol3DLayerConstructor { @@ -5269,11 +5224,21 @@ declare namespace __esri { size?: number; } + export interface IconSymbol3DLayerOutline { + color?: Color; + size?: number; + } + + export interface IconSymbol3DLayerResource { + primitive?: string; + href?: string; + } + interface LabelSymbol3D extends Symbol3D { callout: Callout3D; verticalOffset: LabelSymbol3DVerticalOffset; - clone(): this; + clone(): LabelSymbol3D; } interface LabelSymbol3DConstructor { @@ -5289,6 +5254,17 @@ declare namespace __esri { verticalOffset?: LabelSymbol3DVerticalOffsetProperties; } + export interface LabelSymbol3DVerticalOffsetProperties { + screenLength?: number; + minWorldLength?: number; + maxWorldLength?: number; + } + export interface LabelSymbol3DVerticalOffset extends Accessor { + screenLength: number; + minWorldLength?: number; + maxWorldLength?: number; + } + interface LineSymbol extends Symbol { color: Color; width: number; @@ -5308,7 +5284,7 @@ declare namespace __esri { } interface LineSymbol3D extends Symbol3D { - clone(): this; + clone(): LineSymbol3D; } interface LineSymbol3DConstructor { @@ -5326,7 +5302,7 @@ declare namespace __esri { interface LineSymbol3DLayer extends Symbol3DLayer { size: number; - clone(): this; + clone(): LineSymbol3DLayer; } interface LineSymbol3DLayerConstructor { @@ -5362,7 +5338,7 @@ declare namespace __esri { } interface MeshSymbol3D extends Symbol3D { - clone(): this; + clone(): MeshSymbol3D; } interface MeshSymbol3DConstructor { @@ -5387,7 +5363,7 @@ declare namespace __esri { tilt: number; width: number; - clone(): this; + clone(): ObjectSymbol3DLayer; } interface ObjectSymbol3DLayerConstructor { @@ -5409,6 +5385,29 @@ declare namespace __esri { width?: number; } + export interface ObjectSymbol3DLayerResource { + primitive?: string; + href?: string; + } + + interface PathSymbol3DLayer extends Symbol3DLayer { + size: number; + + clone(): PathSymbol3DLayer; + } + + interface PathSymbol3DLayerConstructor { + new(properties?: PathSymbol3DLayerProperties): PathSymbol3DLayer; + + fromJSON(json: any): PathSymbol3DLayer; + } + + export const PathSymbol3DLayer: PathSymbol3DLayerConstructor; + + interface PathSymbol3DLayerProperties extends Symbol3DLayerProperties { + size?: number; + } + interface PictureFillSymbol extends FillSymbol { height: number; url: string; @@ -5418,7 +5417,7 @@ declare namespace __esri { yoffset: number; yscale: number; - clone(): this; + clone(): PictureFillSymbol; } interface PictureFillSymbolConstructor { @@ -5444,7 +5443,7 @@ declare namespace __esri { url: string; width: number; - clone(): this; + clone(): PictureMarkerSymbol; } interface PictureMarkerSymbolConstructor { @@ -5461,29 +5460,11 @@ declare namespace __esri { width?: number; } - interface PathSymbol3DLayer extends Symbol3DLayer { - size: number; - - clone(): this; - } - - interface PathSymbol3DLayerConstructor { - new(properties?: PathSymbol3DLayerProperties): PathSymbol3DLayer; - - fromJSON(json: any): PathSymbol3DLayer; - } - - export const PathSymbol3DLayer: PathSymbol3DLayerConstructor; - - interface PathSymbol3DLayerProperties extends Symbol3DLayerProperties { - size?: number; - } - interface PointSymbol3D extends Symbol3D { callout: Callout3D; verticalOffset: PointSymbol3DVerticalOffset; - clone(): this; + clone(): PointSymbol3D; } interface PointSymbol3DConstructor { @@ -5499,8 +5480,19 @@ declare namespace __esri { verticalOffset?: PointSymbol3DVerticalOffsetProperties; } + export interface PointSymbol3DVerticalOffsetProperties { + screenLength?: number; + minWorldLength?: number; + maxWorldLength?: number; + } + export interface PointSymbol3DVerticalOffset extends Accessor { + screenLength: number; + minWorldLength?: number; + maxWorldLength?: number; + } + interface PolygonSymbol3D extends Symbol3D { - clone(): this; + clone(): PolygonSymbol3D; } interface PolygonSymbol3DConstructor { @@ -5519,7 +5511,7 @@ declare namespace __esri { color: Color; style: string; - clone(): this; + clone(): SimpleFillSymbol; } interface SimpleFillSymbolConstructor { @@ -5541,7 +5533,7 @@ declare namespace __esri { miterLimit: number; style: string; - clone(): this; + clone(): SimpleLineSymbol; } interface SimpleLineSymbolConstructor { @@ -5566,7 +5558,7 @@ declare namespace __esri { size: number; style: string; - clone(): this; + clone(): SimpleMarkerSymbol; } interface SimpleMarkerSymbolConstructor { @@ -5585,6 +5577,12 @@ declare namespace __esri { style?: string; } + interface symbolsSupportJsonUtils { + fromJSON(json: any): Symbol; + } + + export const symbolsSupportJsonUtils: symbolsSupportJsonUtils; + interface Symbol extends Accessor, JSONSupport { type: string; } @@ -5603,7 +5601,7 @@ declare namespace __esri { interface Symbol3D extends Symbol { styleOrigin: Symbol3DStyleOrigin; - symbolLayers: Collection; + symbolLayers: Collection<Symbol3DLayer>; } interface Symbol3DConstructor { @@ -5616,7 +5614,13 @@ declare namespace __esri { interface Symbol3DProperties extends SymbolProperties { styleOrigin?: Symbol3DStyleOrigin; - symbolLayers?: Collection | any[]; + symbolLayers?: CollectionProperties<Symbol3DLayerProperties>; + } + + export interface Symbol3DStyleOrigin { + styleName?: string; + styleUrl?: string; + name: string; } interface Symbol3DLayer extends Accessor, JSONSupport { @@ -5654,7 +5658,7 @@ declare namespace __esri { xoffset: number; yoffset: number; - clone(): this; + clone(): TextSymbol; } interface TextSymbolConstructor { @@ -5689,7 +5693,7 @@ declare namespace __esri { size: number; text: string; - clone(): this; + clone(): TextSymbol3DLayer; } interface TextSymbol3DLayerConstructor { @@ -5707,14 +5711,25 @@ declare namespace __esri { text?: string; } + export interface TextSymbol3DLayerFont { + family?: string; + weight?: string; + style?: string; + } + + export interface TextSymbol3DLayerHalo { + color?: Color; + size?: number; + } + interface WebStyleSymbol extends Symbol { name: string; portal: Portal; styleName: string; styleUrl: string; - clone(): this; - fetchSymbol(): IPromise<any>; + clone(): WebStyleSymbol; + fetchSymbol(): IPromise<PointSymbol3D>; } interface WebStyleSymbolConstructor { @@ -5732,46 +5747,8 @@ declare namespace __esri { styleUrl?: string; } - interface Callout3D extends Accessor, JSONSupport { - clone(): this; - } - - interface Callout3DConstructor { - new(properties?: Callout3DProperties): Callout3D; - - fromJSON(json: any): Callout3D; - } - - export const Callout3D: Callout3DConstructor; - - interface Callout3DProperties { - - } - - interface LineCallout3D extends Callout3D { - border: LineCallout3DBorder; - color: Color; - size: number; - type: string; - } - - interface LineCallout3DConstructor { - new(properties?: LineCallout3DProperties): LineCallout3D; - - fromJSON(json: any): LineCallout3D; - } - - export const LineCallout3D: LineCallout3DConstructor; - - interface LineCallout3DProperties extends Callout3DProperties { - border?: LineCallout3DBorderProperties; - color?: Color; - size?: number; - type?: string; - } - interface ClosestFacilityTask extends Task { - solve(params: ClosestFacilityParameters, requestOptions?: any): IPromise<any>; + solve(params: ClosestFacilityParameters, requestOptions?: any): IPromise<ClosestFacilitySolveResult>; } interface ClosestFacilityTaskConstructor { @@ -5802,26 +5779,26 @@ declare namespace __esri { interface GeometryService extends Task { areasAndLengths(areasAndLengthsParameters: AreasAndLengthsParameters, requestOptions?: any): IPromise<any>; - autoComplete(polygons: Polygon[], polylines: Polyline[], requestOptions?: any): IPromise<any>; - buffer(bufferParameters: BufferParameters, requestOptions?: any): IPromise<any>; - convexHull(geometries: Geometry[], requestOptions?: any): IPromise<any>; + autoComplete(polygons: Polygon[], polylines: Polyline[], requestOptions?: any): IPromise<Polygon>; + buffer(bufferParameters: BufferParameters, requestOptions?: any): IPromise<Polygon[]>; + convexHull(geometries: Geometry[], requestOptions?: any): IPromise<Geometry>; cut(geometries: Geometry[], cutter: Polyline, requestOptions?: any): IPromise<any>; - densify(densifyParameters: DensifyParameters, requestOptions?: any): IPromise<any>; - difference(geometries: Geometry[], geometry: Geometry, requestOptions?: any): IPromise<any>; - distance(params: DistanceParameters, requestOptions?: any): IPromise<any>; + densify(densifyParameters: DensifyParameters, requestOptions?: any): IPromise<Geometry[]>; + difference(geometries: Geometry[], geometry: Geometry, requestOptions?: any): IPromise<Geometry>; + distance(params: DistanceParameters, requestOptions?: any): IPromise<number>; fromGeoCoordinateString(params: GeometryServiceFromGeoCoordinateStringParams, requestOptions?: any): IPromise<any>; - generalize(params: GeneralizeParameters, requestOptions?: any): IPromise<any>; - intersect(geometries: Geometry[], intersector: Geometry, requestOptions?: any): IPromise<any>; - labelPoints(polygons: Polygon[], requestOptions?: any): IPromise<any>; + generalize(params: GeneralizeParameters, requestOptions?: any): IPromise<Geometry[]>; + intersect(geometries: Geometry[], intersector: Geometry, requestOptions?: any): IPromise<Geometry[]>; + labelPoints(polygons: Polygon[], requestOptions?: any): IPromise<Point>; lengths(params: LengthsParameters, requestOptions?: any): IPromise<any>; - offset(params: OffsetParameters, requestOptions?: any): IPromise<any>; - project(params: ProjectParameters, requestOptions?: any): IPromise<any>; - relation(params: RelationParameters, requestOptions?: any): IPromise<any>; - reshape(targetGeometry: Geometry, reshaper: Geometry, requestOptions?: any): IPromise<any>; - simplify(geometries: Geometry[], requestOptions?: any): IPromise<any>; - toGeoCoordinateString(params: GeometryServiceToGeoCoordinateStringParams, requestOptions?: any): IPromise<any>; - trimExtend(params: TrimExtendParameters, requestOptions?: any): IPromise<any>; - union(geometries: Geometry[], requestOptions?: any): IPromise<any>; + offset(params: OffsetParameters, requestOptions?: any): IPromise<Geometry[]>; + project(params: ProjectParameters, requestOptions?: any): IPromise<Geometry[]>; + relation(params: RelationParameters, requestOptions?: any): IPromise<Polygon[]>; + reshape(targetGeometry: Geometry, reshaper: Geometry, requestOptions?: any): IPromise<Geometry>; + simplify(geometries: Geometry[], requestOptions?: any): IPromise<Geometry[]>; + toGeoCoordinateString(params: GeometryServiceToGeoCoordinateStringParams, requestOptions?: any): IPromise<string[]>; + trimExtend(params: TrimExtendParameters, requestOptions?: any): IPromise<Geometry[]>; + union(geometries: Geometry[], requestOptions?: any): IPromise<Geometry>; } interface GeometryServiceConstructor { @@ -5834,6 +5811,23 @@ declare namespace __esri { } + export interface GeometryServiceFromGeoCoordinateStringParams { + strings: string[]; + sr: SpatialReference | string; + conversionType: string; + conversionMode?: string; + } + + export interface GeometryServiceToGeoCoordinateStringParams { + sr: SpatialReference | string; + coordinates: number[][]; + conversionType: string; + conversionMode?: string; + numOfDigits?: number; + rounding?: boolean; + addSpaces?: boolean; + } + interface Geoprocessor extends Task { outSpatialReference: SpatialReference; processSpatialReference: SpatialReference; @@ -5878,7 +5872,7 @@ declare namespace __esri { } interface ImageServiceIdentifyTask extends Task { - execute(params: ImageServiceIdentifyParameters, requestOptions?: any): IPromise<any>; + execute(params: ImageServiceIdentifyParameters, requestOptions?: any): IPromise<ImageServiceIdentifyResult>; } interface ImageServiceIdentifyTaskConstructor { @@ -5896,10 +5890,10 @@ declare namespace __esri { countryCode: string; outSpatialReference: SpatialReference; - addressesToLocations(params: LocatorAddressesToLocationsParams, requestOptions?: any): IPromise<any>; - addressToLocations(params: LocatorAddressToLocationsParams, requestOptions?: any): IPromise<any>; - locationToAddress(location: Point, distance?: number, requestOptions?: any): IPromise<any>; - suggestLocations(params: LocatorSuggestLocationsParams, requestOptions?: any): IPromise<any>; + addressesToLocations(params: LocatorAddressesToLocationsParams, requestOptions?: any): IPromise<AddressCandidate[]>; + addressToLocations(params: LocatorAddressToLocationsParams, requestOptions?: any): IPromise<AddressCandidate[]>; + locationToAddress(location: Point, distance?: number, requestOptions?: any): IPromise<AddressCandidate>; + suggestLocations(params: LocatorSuggestLocationsParams, requestOptions?: any): IPromise<SuggestionResult>; } interface LocatorConstructor { @@ -5914,24 +5908,36 @@ declare namespace __esri { outSpatialReference?: SpatialReferenceProperties; } - interface QueryTask extends Task { - gdbVersion: string; - - execute(params: Query, requestOptions?: any): IPromise<any>; - executeForCount(params: Query, requestOptions?: any): IPromise<any>; - executeForExtent(params: Query, requestOptions?: any): IPromise<any>; - executeForIds(params: Query, requestOptions?: any): IPromise<any>; - executeRelationshipQuery(params: RelationshipQuery, requestOptions?: any): IPromise<any>; + export interface LocatorAddressesToLocationsParams { + addresses: any[]; + countryCode: string; + categories: string[]; } - interface QueryTaskConstructor { - new(properties?: QueryTaskProperties): QueryTask; + export interface LocatorAddressToLocationsParams { + address: any; + categories: string[]; + countryCode: string; + distance: number; + forStorage: boolean; + location: Point; + magicKey: string; + maxLocations: number; + outFields: string[]; + searchExtent: Extent; } - export const QueryTask: QueryTaskConstructor; + export interface LocatorSuggestLocationsParams { + categories: string[]; + distance: number; + location: Point; + text: string; + } - interface QueryTaskProperties extends TaskProperties { - gdbVersion?: string; + export interface SuggestionResult { + isCollection: boolean; + magicKey: string; + text: string; } interface PrintTask extends Task { @@ -5952,8 +5958,28 @@ declare namespace __esri { updateDelay?: number; } + interface QueryTask extends Task { + gdbVersion: string; + + execute(params: Query, requestOptions?: any): IPromise<FeatureSet>; + executeForCount(params: Query, requestOptions?: any): IPromise<number>; + executeForExtent(params: Query, requestOptions?: any): IPromise<any>; + executeForIds(params: Query, requestOptions?: any): IPromise<number[]>; + executeRelationshipQuery(params: RelationshipQuery, requestOptions?: any): IPromise<FeatureSet>; + } + + interface QueryTaskConstructor { + new(properties?: QueryTaskProperties): QueryTask; + } + + export const QueryTask: QueryTaskConstructor; + + interface QueryTaskProperties extends TaskProperties { + gdbVersion?: string; + } + interface RouteTask extends Task { - solve(params: RouteParameters, requestOptions?: any): IPromise<any>; + solve(params: RouteParameters, requestOptions?: any): IPromise<RouteResult>; } interface RouteTaskConstructor { @@ -5967,7 +5993,7 @@ declare namespace __esri { } interface ServiceAreaTask extends Task { - solve(params: ServiceAreaParameters, requestOptions?: any): IPromise<any>; + solve(params: ServiceAreaParameters, requestOptions?: any): IPromise<ServiceAreaSolveResult>; } interface ServiceAreaTaskConstructor { @@ -5980,22 +6006,6 @@ declare namespace __esri { } - interface Task extends Accessor { - requestOptions: any; - url: string; - } - - interface TaskConstructor { - new(properties?: TaskProperties): Task; - } - - export const Task: TaskConstructor; - - interface TaskProperties { - requestOptions?: any; - url?: string; - } - interface AddressCandidate extends Accessor, JSONSupport { address: string; attributes: any; @@ -6087,7 +6097,7 @@ declare namespace __esri { outputGeometryPrecision: number; outputGeometryPrecisionUnits: string; outputLines: string; - outSpatialReference: SpatialReference; + outSpatialReference: SpatialReference | string; pointBarriers: DataLayer | FeatureSet; polygonBarriers: DataLayer | FeatureSet; polylineBarriers: DataLayer | FeatureSet; @@ -6125,16 +6135,16 @@ declare namespace __esri { directionsStyleName?: string; directionsTimeAttribute?: string; doNotLocateOnRestrictedElements?: boolean; - facilities?: DataLayer | FeatureSet; + facilities?: DataLayerProperties | FeatureSetProperties; impedanceAttribute?: string; - incidents?: DataLayer | FeatureSet; + incidents?: DataLayerProperties | FeatureSetProperties; outputGeometryPrecision?: number; outputGeometryPrecisionUnits?: string; outputLines?: string; - outSpatialReference?: SpatialReference | string; - pointBarriers?: DataLayer | FeatureSet; - polygonBarriers?: DataLayer | FeatureSet; - polylineBarriers?: DataLayer | FeatureSet; + outSpatialReference?: SpatialReferenceProperties | string; + pointBarriers?: DataLayerProperties | FeatureSetProperties; + polygonBarriers?: DataLayerProperties | FeatureSetProperties; + polylineBarriers?: DataLayerProperties | FeatureSetProperties; restrictionAttributes?: string[]; restrictUTurns?: string; returnDirections?: boolean; @@ -6144,12 +6154,18 @@ declare namespace __esri { returnPolygonBarriers?: boolean; returnPolylineBarriers?: boolean; returnRoutes?: boolean; - timeOfDay?: Date; + timeOfDay?: DateProperties; timeOfDayUsage?: string; travelDirection?: string; useHierarchy?: boolean; } + export interface ClosestFacilityParametersAttributeParameterValues { + attributeName: string; + parameterName: string; + value: string; + } + interface ClosestFacilitySolveResult extends Accessor, JSONSupport { directions: DirectionsFeatureSet; facilities: Point[]; @@ -6234,7 +6250,7 @@ declare namespace __esri { export const supportDate: supportDateConstructor; interface supportDateProperties { - date?: Date; + date?: DateProperties; format?: string; } @@ -6513,7 +6529,7 @@ declare namespace __esri { export const ImageServiceIdentifyParameters: ImageServiceIdentifyParametersConstructor; interface ImageServiceIdentifyParametersProperties { - geometry?: Point | Polygon; + geometry?: PointProperties | PolygonProperties; mosaicRule?: MosaicRuleProperties; noData?: string | number; pixelSize?: SymbolProperties; @@ -6738,6 +6754,21 @@ declare namespace __esri { showLabels?: boolean; } + export interface PrintTemplateExportOptions { + width?: number; + height?: number; + dpi?: number; + } + + export interface PrintTemplateLayoutOptions { + titleText: string; + authorText: string; + copyrightText: string; + scalebarUnit: string; + legendLayers: LegendLayer[]; + customTextElements: any[]; + } + interface ProjectParameters extends Accessor { geometries: Geometry[]; outSpatialReference: SpatialReference; @@ -6762,6 +6793,11 @@ declare namespace __esri { transformForward?: boolean; } + export interface ProjectParametersTransformation { + wkid?: number; + wkt?: string; + } + interface Query extends Accessor { distance: number; geometry: Geometry; @@ -6822,6 +6858,13 @@ declare namespace __esri { where?: string; } + export interface QueryQuantizationParameters { + extent?: Extent; + mode?: string; + originPosition?: string; + tolerance?: number; + } + interface RasterData extends Accessor, JSONSupport { format: string; itemId: string; @@ -6942,7 +6985,7 @@ declare namespace __esri { interface RouteParametersProperties { accumulateAttributes?: string[]; attributeParameterValues?: AttributeParamValue; - barriers?: DataLayer | FeatureSet; + barriers?: DataLayerProperties | FeatureSetProperties; directionsLanguage?: string; directionsLengthUnits?: string; directionsOutputType?: string; @@ -6956,8 +6999,8 @@ declare namespace __esri { outputGeometryPrecisionUnits?: string; outputLines?: string; outSpatialReference?: SpatialReferenceProperties; - polygonBarriers?: DataLayer | FeatureSet; - polylineBarriers?: DataLayer | FeatureSet; + polygonBarriers?: DataLayerProperties | FeatureSetProperties; + polylineBarriers?: DataLayerProperties | FeatureSetProperties; preserveFirstStop?: boolean; preserveLastStop?: boolean; restrictionAttributes?: string[]; @@ -6969,13 +7012,19 @@ declare namespace __esri { returnRoutes?: boolean; returnStops?: boolean; returnZ?: boolean; - startTime?: Date; + startTime?: DateProperties; startTimeIsUTC?: boolean; - stops?: DataLayer | FeatureSet; + stops?: DataLayerProperties | FeatureSetProperties; useHierarchy?: boolean; useTimeWindows?: boolean; } + export interface AttributeParamValue { + attributeName: string; + parameterName: string; + value: string; + } + interface RouteResult extends Accessor, JSONSupport { directions: DirectionsFeatureSet; route: Graphic; @@ -7047,7 +7096,7 @@ declare namespace __esri { defaultBreaks?: number[]; doNotLocateOnRestrictedElements?: boolean; excludeSourcesFromPolygons?: string[]; - facilities?: DataLayer | FeatureSet; + facilities?: DataLayerProperties | FeatureSetProperties; impedanceAttribute?: string; mergeSimilarPolygonRanges?: boolean; outputGeometryPrecision?: number; @@ -7057,9 +7106,9 @@ declare namespace __esri { outSpatialReference?: SpatialReferenceProperties; overlapLines?: boolean; overlapPolygons?: boolean; - pointBarriers?: DataLayer | FeatureSet; - polygonBarriers?: DataLayer | FeatureSet; - polylineBarriers?: DataLayer | FeatureSet; + pointBarriers?: DataLayerProperties | FeatureSetProperties; + polygonBarriers?: DataLayerProperties | FeatureSetProperties; + polylineBarriers?: DataLayerProperties | FeatureSetProperties; restrictionAttributes?: string[]; restrictUTurns?: string; returnFacilities?: boolean; @@ -7068,7 +7117,7 @@ declare namespace __esri { returnPolylineBarriers?: boolean; splitLinesAtBreaks?: boolean; splitPolygonsAtBreaks?: boolean; - timeOfDay?: Date; + timeOfDay?: DateProperties; travelDirection?: string; trimOuterPolygon?: boolean; trimPolygonDistance?: number; @@ -7144,20 +7193,36 @@ declare namespace __esri { trimExtendTo?: PolylineProperties; } + interface Task extends Accessor { + requestOptions: any; + url: string; + } + + interface TaskConstructor { + new(properties?: TaskProperties): Task; + } + + export const Task: TaskConstructor; + + interface TaskProperties { + requestOptions?: any; + url?: string; + } + interface ConfigurationTask extends Task { url: string; - getAllGroups(requestOptions?: any): IPromise<any>; - getAllUsers(requestOptions?: any): IPromise<any>; - getDataWorkspaceDetails(params: ConfigurationTaskGetDataWorkspaceDetailsParams, requestOptions?: any): IPromise<any>; - getGroup(groupId: number, requestOptions?: any): IPromise<any>; - getJobTypeDetails(jobTypeId: number, requestOptions?: any): IPromise<any>; - getPublicJobQueryDetails(queryId: number, requestOptions?: any): IPromise<any>; - getServiceInfo(requestOptions?: any): IPromise<any>; - getTableRelationshipsDetails(requestOptions?: any): IPromise<any>; - getUser(user: string, requestOptions?: any): IPromise<any>; - getUserJobQueryDetails(params: ConfigurationTaskGetUserJobQueryDetailsParams, requestOptions?: any): IPromise<any>; - getVisibleJobTypes(user: string, requestOptions?: any): IPromise<any>; + getAllGroups(requestOptions?: any): IPromise<any[]>; + getAllUsers(requestOptions?: any): IPromise<any[]>; + getDataWorkspaceDetails(params: ConfigurationTaskGetDataWorkspaceDetailsParams, requestOptions?: any): IPromise<any[]>; + getGroup(groupId: number, requestOptions?: any): IPromise<any[]>; + getJobTypeDetails(jobTypeId: number, requestOptions?: any): IPromise<JobTypeDetails>; + getPublicJobQueryDetails(queryId: number, requestOptions?: any): IPromise<JobQueryDetails>; + getServiceInfo(requestOptions?: any): IPromise<WorkflowManagerServiceInfo>; + getTableRelationshipsDetails(requestOptions?: any): IPromise<TableRelationship>; + getUser(user: string, requestOptions?: any): IPromise<UserDetails>; + getUserJobQueryDetails(params: ConfigurationTaskGetUserJobQueryDetailsParams, requestOptions?: any): IPromise<JobQueryDetails>; + getVisibleJobTypes(user: string, requestOptions?: any): IPromise<JobType>; } interface ConfigurationTaskConstructor { @@ -7170,44 +7235,218 @@ declare namespace __esri { url?: string; } + export interface ConfigurationTaskGetDataWorkspaceDetailsParams { + dataWorkspaceId: string; + user: string; + } + + export interface ConfigurationTaskGetUserJobQueryDetailsParams { + queryId: number; + user: string; + } + + export interface DataWorkspace { + id: string; + name: string; + } + + export interface GroupMembership { + id: number; + name: string; + } + + export interface HoldType { + description: string; + id: number; + name: string; + } + + export interface JobPriority { + description: string; + name: string; + value: number; + } + + export interface JobQuery { + id: number; + name: string; + } + + export interface JobQueryContainer { + containers: JobQueryContainer[]; + id: number; + name: string; + queries: JobQuery[]; + } + + export interface JobQueryDetails { + aliases: string[]; + fields: string[]; + id: number; + name: string; + orderBy: string; + tables: string[]; + where: string; + } + + export interface JobStatus { + caption: string; + description: string; + id: number; + name: string; + } + + export interface JobType { + category: string; + description: string; + id: string; + name: string; + state: string; + } + + export interface JobTypeDetails { + defaultParentVersionName: string; + autoExecuteCreatedJobs: boolean; + category: string; + defaultAssignedTo: string; + defaultAssignedType: string; + defaultDataWorkspaceId: string; + defaultDescription: string; + defaultDueDate: string; + defaultJobDuration: number; + canDataWorkspaceChange: boolean; + defaultPriority: string; + defaultStartDate: Date; + description: string; + id: string; + jobNamingScheme: string; + jobVersionNamingScheme: string; + mxdNamingScheme: string; + name: string; + state: string; + } + + export interface Privilege { + description: string; + id: number; + name: string; + } + + export interface TableRelationship { + cardinality: string; + linkField: string; + tableAlias: string; + tableName: string; + } + + export interface UserDetails { + lastName: string; + address: string; + faxNumber: string; + firstName: string; + fullName: string; + groups: GroupMembership[]; + email: string; + phoneNumber: string; + privileges: Privilege[]; + roomNumber: string; + userName: string; + userQueries: JobQueryContainer[]; + zipCode: string; + } + + export interface VersionInfo { + access: string; + name: string; + parent: string; + } + + export interface WorkflowManagerServiceInfo { + jobPriorities: JobPriority[]; + activityTypes: ActivityType[]; + currentVersion: number; + dataWorkspaces: DataWorkspace[]; + holdTypes: HoldType[]; + configProperties: WorkflowManagerServiceInfoConfigProperties; + jobStatuses: JobStatus[]; + jobTypes: JobType[]; + notificationTypes: NotificationType[]; + privileges: Privilege[]; + publicQueries: JobQueryContainer[]; + } + + export interface WorkflowManagerServiceInfoConfigProperties { + AOIOVERLAP: string; + AOISELECTIONCOLOR: number; + AUTOASSIGNJOB: boolean; + AUTOCLOSEJOB: boolean; + AUTOCOMMITWORKFLOW: boolean; + AUTOSTATUSASSIGN: boolean; + CONFIRMPROCEDURALCHECK: boolean; + DEFAULT_SENDER_EMAIL: string; + DEFAULT_SENDER_NAME: string; + HTML_SUPPORT: string; + JOB_ID_START_VALUE: string; + PENDING_DAYS_USE_HOLDS: boolean; + PROMPTSDEPWD: boolean; + REQUIREPROCEDURALCHECKSTART: number; + RESTRICT_AOI_OPTION: string; + SEND_SN_CUSTOM_POST: boolean; + SHOW_STEP_IDS: boolean; + SHOW_STEP_PERCENT_COMPLETE: boolean; + SMTP_PASSWORD: string; + SHOW_PENDING_DAYS: boolean; + SMTP_PORT: string; + SMTP_PROTOCOL: string; + SMTP_SERVER: string; + SMTP_USERNAME: string; + USE_STEP_STATUS: boolean; + USER_STORE: string; + USEUSERDOMAIN: boolean; + WF_SEL_STEP_FILL_COLOR: number; + WF_SEL_STEP_OUTLINE_COLOR: number; + WF_SEL_STEP_OUTLINE_WIDTH: number; + ZOOMTOAOI: boolean; + } + interface JobTask extends Task { url: string; - addEmbeddedAttachment(params: JobTaskAddEmbeddedAttachmentParams, requestOptions?: any): IPromise<any>; - addLinkedAttachment(params: JobTaskAddLinkedAttachmentParams, requestOptions?: any): IPromise<any>; - addLinkedRecord(params: JobTaskAddLinkedRecordParams, requestOptions?: any): IPromise<any>; - assignJobs(params: JobTaskAssignJobsParams, requestOptions?: any): IPromise<any>; - closeJobs(params: JobTaskCloseJobsParams, requestOptions?: any): IPromise<any>; - createDependency(params: JobTaskCreateDependencyParams, requestOptions?: any): IPromise<any>; - createHold(params: JobTaskCreateHoldParams, requestOptions?: any): IPromise<any>; - createJobs(params: JobCreationParameters, requestOptions?: any): IPromise<any>; - createJobVersion(params: JobTaskCreateJobVersionParams, requestOptions?: any): IPromise<any>; - deleteAttachment(params: JobTaskDeleteAttachmentParams, requestOptions?: any): IPromise<any>; - deleteDependency(params: JobTaskDeleteDependencyParams, requestOptions?: any): IPromise<any>; - deleteJobs(params: JobTaskDeleteJobsParams, requestOptions?: any): IPromise<any>; - deleteLinkedRecord(params: JobTaskDeleteLinkedRecordParams, requestOptions?: any): IPromise<any>; - getActivityLog(jobId: number, requestOptions?: any): IPromise<any>; + addEmbeddedAttachment(params: JobTaskAddEmbeddedAttachmentParams, requestOptions?: any): IPromise<string>; + addLinkedAttachment(params: JobTaskAddLinkedAttachmentParams, requestOptions?: any): IPromise<string>; + addLinkedRecord(params: JobTaskAddLinkedRecordParams, requestOptions?: any): IPromise<string>; + assignJobs(params: JobTaskAssignJobsParams, requestOptions?: any): IPromise<boolean>; + closeJobs(params: JobTaskCloseJobsParams, requestOptions?: any): IPromise<boolean>; + createDependency(params: JobTaskCreateDependencyParams, requestOptions?: any): IPromise<string>; + createHold(params: JobTaskCreateHoldParams, requestOptions?: any): IPromise<string>; + createJobs(params: JobCreationParameters, requestOptions?: any): IPromise<string[]>; + createJobVersion(params: JobTaskCreateJobVersionParams, requestOptions?: any): IPromise<string>; + deleteAttachment(params: JobTaskDeleteAttachmentParams, requestOptions?: any): IPromise<boolean>; + deleteDependency(params: JobTaskDeleteDependencyParams, requestOptions?: any): IPromise<boolean>; + deleteJobs(params: JobTaskDeleteJobsParams, requestOptions?: any): IPromise<boolean>; + deleteLinkedRecord(params: JobTaskDeleteLinkedRecordParams, requestOptions?: any): IPromise<boolean>; + getActivityLog(jobId: number, requestOptions?: any): IPromise<any[]>; getAttachmentContentUrl(params: JobTaskGetAttachmentContentUrlParams): string; - getAttachments(jobId: number, requestOptions?: any): IPromise<any>; - getDependencies(jobId: number, requestOptions?: any): IPromise<any>; - getExtendedProperties(jobId: number, requestOptions?: any): IPromise<any>; - getHolds(jobId: number, requestOptions?: any): IPromise<any>; - getJob(jobId: number, requestOptions?: any): IPromise<any>; - getJobIds(requestOptions?: any): IPromise<any>; - getNotes(jobId: number, requestOptions?: any): IPromise<any>; - listFieldValues(params: JobTaskListFieldValuesParams, requestOptions?: any): IPromise<any>; - listMultiLevelFieldValues(params: JobTaskListMultiLevelFieldValuesParams, requestOptions?: any): IPromise<any>; - logAction(params: JobTaskLogActionParams, requestOptions?: any): IPromise<any>; - queryJobs(params: JobTaskQueryJobsParams, requestOptions?: any): IPromise<any>; - queryJobsAdHoc(params: JobQueryParameters, requestOptions?: any): IPromise<any>; - queryMultiLevelSelectedValues(params: JobTaskQueryMultiLevelSelectedValuesParams, requestOptions?: any): IPromise<any>; - releaseHold(params: JobTaskReleaseHoldParams, requestOptions?: any): IPromise<any>; - reopenClosedJobs(params: JobTaskReopenClosedJobsParams, requestOptions?: any): IPromise<any>; - searchJobs(params: JobTaskSearchJobsParams, requestOptions?: any): IPromise<any>; - unassignJobs(params: JobTaskUnassignJobsParams, requestOptions?: any): IPromise<any>; - updateJob(params: JobUpdateParameters, requestOptions?: any): IPromise<any>; - updateNotes(params: JobTaskUpdateNotesParams, requestOptions?: any): IPromise<any>; - updateRecord(params: JobTaskUpdateRecordParams, requestOptions?: any): IPromise<any>; + getAttachments(jobId: number, requestOptions?: any): IPromise<JobAttachment>; + getDependencies(jobId: number, requestOptions?: any): IPromise<JobDependency>; + getExtendedProperties(jobId: number, requestOptions?: any): IPromise<AuxRecordContainer>; + getHolds(jobId: number, requestOptions?: any): IPromise<any[]>; + getJob(jobId: number, requestOptions?: any): IPromise<JobTaskJobInfo>; + getJobIds(requestOptions?: any): IPromise<string[]>; + getNotes(jobId: number, requestOptions?: any): IPromise<string>; + listFieldValues(params: JobTaskListFieldValuesParams, requestOptions?: any): IPromise<FieldValue>; + listMultiLevelFieldValues(params: JobTaskListMultiLevelFieldValuesParams, requestOptions?: any): IPromise<FieldValue>; + logAction(params: JobTaskLogActionParams, requestOptions?: any): IPromise<boolean>; + queryJobs(params: JobTaskQueryJobsParams, requestOptions?: any): IPromise<QueryResult>; + queryJobsAdHoc(params: JobQueryParameters, requestOptions?: any): IPromise<QueryResult>; + queryMultiLevelSelectedValues(params: JobTaskQueryMultiLevelSelectedValuesParams, requestOptions?: any): IPromise<string[]>; + releaseHold(params: JobTaskReleaseHoldParams, requestOptions?: any): IPromise<boolean>; + reopenClosedJobs(params: JobTaskReopenClosedJobsParams, requestOptions?: any): IPromise<boolean>; + searchJobs(params: JobTaskSearchJobsParams, requestOptions?: any): IPromise<QueryResult>; + unassignJobs(params: JobTaskUnassignJobsParams, requestOptions?: any): IPromise<boolean>; + updateJob(params: JobUpdateParameters, requestOptions?: any): IPromise<boolean>; + updateNotes(params: JobTaskUpdateNotesParams, requestOptions?: any): IPromise<boolean>; + updateRecord(params: JobTaskUpdateRecordParams, requestOptions?: any): IPromise<boolean>; } interface JobTaskConstructor { @@ -7220,22 +7459,332 @@ declare namespace __esri { url?: string; } + export interface ActivityType { + desription: string; + id: number; + message: string; + name: string; + } + + export interface AuxRecord { + displayProperty: any; + id: number; + recordvalues: AuxRecordValue; + } + + export interface AuxRecordContainer { + records: AuxRecord; + relationshipType: string; + tableAlias: string; + tableName: string; + } + + export interface AuxRecordDescription { + properties: any; + recordId: number; + tableName: string; + } + + export interface AuxRecordValue { + filter: string; + alias: string; + data: any; + dataType: string; + displayOrder: number; + displayType: string; + domain: string; + canUpdate: boolean; + length: number; + name: string; + required: boolean; + tableListClass: string; + tableListDisplayField: string; + tableListStoreField: string; + userVisible: boolean; + } + + export interface FieldValue { + description: string; + value: any; + } + + export interface JobAttachment { + filename: string; + folder: string; + id: number; + storageType: string; + } + + export interface JobCreationParameters { + loi: Geometry; + assignedTo: string; + autoCommitWorkflow: boolean; + autoExecute: boolean; + dataWorkspaceId: string; + description: string; + dueDate: Date; + jobTypeId: number; + assignedType: string; + name: string; + numJobs: string; + ownedBy: string; + parentJobId: number; + parentVersion: string; + priority: number; + startDate: Date; + user: string; + } + + export interface JobDependency { + depJobId: number; + depOnType: string; + depOnValue: string; + heldOnValue: number; + holdOnType: string; + id: number; + jobID: string; + } + + export interface JobTaskJobInfo { + name: string; + assignedTo: string; + childJobIds: number[]; + createdBy: string; + createdDate: Date; + dataWorkspaceId: string; + description: string; + dueDate: Date; + endDate: Date; + id: number; + jobTypeId: number; + loi: Geometry; + assignedType: string; + ownedBy: string; + parentJobId: number; + parentVersion: string; + pendingDays: number; + percentageComplete: number; + priority: number; + stage: string; + startDate: Date; + status: number; + versionExists: boolean; + versionInfo: JobVersionInfo; + versionName: string; + } + + export interface JobQueryParameters { + aliases: string; + fields: string; + orderBy: string; + tables: string; + where: string; + user: string; + } + + export interface JobTaskAddEmbeddedAttachmentParams { + jobId: number; + form: any; + user: string; + } + + export interface JobTaskAddLinkedAttachmentParams { + jobId: number; + attachmentType: number; + path: string; + user: string; + } + + export interface JobTaskAddLinkedRecordParams { + jobId: number; + tableName: string; + user: string; + } + + export interface JobTaskAssignJobsParams { + jobIds: number[]; + assignedType: string; + assignedTo: string; + user: string; + } + + export interface JobTaskCloseJobsParams { + jobIds: number[]; + user: string; + } + + export interface JobTaskCreateDependencyParams { + jobId: number; + heldOnType: string; + heldOnValue: number; + depJobId: number; + depOnType: string; + depOnValue: number; + user: string; + } + + export interface JobTaskCreateHoldParams { + jobId: number; + holdTypeId: number; + comments: string; + user: string; + } + + export interface JobTaskCreateJobVersionParams { + jobId: number; + name: string; + parent: string; + user: string; + } + + export interface JobTaskDeleteAttachmentParams { + jobId: number; + attachmentId: number; + user: string; + } + + export interface JobTaskDeleteDependencyParams { + jobId: number; + dependencyId: number; + user: string; + } + + export interface JobTaskDeleteJobsParams { + jobIds: number[]; + deleteHistory?: boolean; + user: string; + } + + export interface JobTaskDeleteLinkedRecordParams { + jobId: number; + tableName: string; + recordId: number; + user: string; + } + + export interface JobTaskGetAttachmentContentUrlParams { + jobId: number; + attachmentId: number; + } + + export interface JobTaskListFieldValuesParams { + jobId: number; + tableName: string; + field: string; + user: string; + } + + export interface JobTaskListMultiLevelFieldValuesParams { + field: string; + previousSelectedValues: string[]; + user: string; + } + + export interface JobTaskLogActionParams { + jobId: number; + activityTypeId: number; + comments: string; + user: string; + } + + export interface JobTaskQueryJobsParams { + queryId: number; + user: string; + } + + export interface JobTaskQueryMultiLevelSelectedValuesParams { + field: string; + user: string; + } + + export interface JobTaskReleaseHoldParams { + jobId: number; + holdId: number; + } + + export interface JobTaskReopenClosedJobsParams { + jobIds: number[]; + user: string; + } + + export interface JobTaskSearchJobsParams { + text: string; + user: string; + } + + export interface JobTaskUnassignJobsParams { + jobIds: number[]; + user: string; + } + + export interface JobTaskUpdateNotesParams { + jobId: number; + notes: string; + user: string; + } + + export interface JobTaskUpdateRecordParams { + jobId: number; + record: AuxRecordDescription; + user: string; + } + + export interface JobUpdateParameters { + ownedBy: string; + assignedTo: string; + dataWorkspaceId: string; + description: string; + dueDate: Date; + loi: Geometry; + jobId: number; + name: string; + assignedType: string; + parentJobId: number; + parentVersion: string; + percent: number; + priority: number; + startDate: Date; + status: number; + versionName: string; + user: string; + } + + export interface JobVersionInfo { + dataWorkspaceId: string; + name: string; + parent: string; + created: boolean; + owner: string; + } + + export interface QueryFieldInfo { + alias: string; + length: string; + name: string; + type: string; + } + + export interface QueryResult { + fields: QueryFieldInfo[]; + rows: string[]; + } + interface NotificationTask extends Task { url: string; - addChangeRule(params: NotificationTaskAddChangeRuleParams, requestOptions?: any): IPromise<any>; - deleteChangeRule(params: NotificationTaskDeleteChangeRuleParams, requestOptions?: any): IPromise<any>; - getAllChangeRules(requestOptions?: any): IPromise<any>; - getChangeRule(ruleId: string, requestOptions?: any): IPromise<any>; - getChangeRuleMatch(matchId: string, requestOptions?: any): IPromise<any>; - getDatabaseTime(dataWorkspaceId: string, requestOptions?: any): IPromise<any>; - getSessionMatches(sessionId: string, requestOptions?: any): IPromise<any>; - notifySession(params: NotificationTaskNotifySessionParams, requestOptions?: any): IPromise<any>; - queryChangeRules(params: NotificationTaskQueryChangeRulesParams, requestOptions?: any): IPromise<any>; - runSpatialNotificationOnHistory(params: NotificationTaskRunSpatialNotificationOnHistoryParams, requestOptions?: any): IPromise<any>; - sendNotification(params: NotificationTaskSendNotificationParams, requestOptions?: any): IPromise<any>; - subscribeToNotification(params: NotificationTaskSubscribeToNotificationParams, requestOptions?: any): IPromise<any>; - unsubscribeFromNotification(params: NotificationTaskUnsubscribeFromNotificationParams, requestOptions?: any): IPromise<any>; + addChangeRule(params: NotificationTaskAddChangeRuleParams, requestOptions?: any): IPromise<ChangeRule>; + deleteChangeRule(params: NotificationTaskDeleteChangeRuleParams, requestOptions?: any): IPromise<boolean>; + getAllChangeRules(requestOptions?: any): IPromise<ChangeRule>; + getChangeRule(ruleId: string, requestOptions?: any): IPromise<ChangeRule>; + getChangeRuleMatch(matchId: string, requestOptions?: any): IPromise<ChangeRule>; + getDatabaseTime(dataWorkspaceId: string, requestOptions?: any): IPromise<Date>; + getSessionMatches(sessionId: string, requestOptions?: any): IPromise<ChangeRuleMatch>; + notifySession(params: NotificationTaskNotifySessionParams, requestOptions?: any): IPromise<boolean>; + queryChangeRules(params: NotificationTaskQueryChangeRulesParams, requestOptions?: any): IPromise<ChangeRule>; + runSpatialNotificationOnHistory(params: NotificationTaskRunSpatialNotificationOnHistoryParams, requestOptions?: any): IPromise<string>; + sendNotification(params: NotificationTaskSendNotificationParams, requestOptions?: any): IPromise<boolean>; + subscribeToNotification(params: NotificationTaskSubscribeToNotificationParams, requestOptions?: any): IPromise<boolean>; + unsubscribeFromNotification(params: NotificationTaskUnsubscribeFromNotificationParams, requestOptions?: any): IPromise<boolean>; } interface NotificationTaskConstructor { @@ -7248,14 +7797,135 @@ declare namespace __esri { url?: string; } + export interface AOIEvaluator { + aoi: Polygon; + inverse: boolean; + name: string; + relation: string; + type: string; + useJobAOI: boolean; + } + + export interface ChangeRule { + description: string; + evaluators: any[]; + id: number; + name: string; + notifier: any; + summarize: boolean; + } + + export interface ChangeRuleMatch { + changeTime: Date; + changeType: string; + dataset: string; + dataWorkspaceId: string; + id: string; + jobID: string; + ruleID: string; + } + + export interface DatasetConfiguration { + changeCondition: number; + changeFields: string; + dataset: string; + dataWorkspaceId: string; + name: string; + whereConditions: WhereCondition[]; + } + + export interface DataSetEvaluator { + dataSetConfigurations: DatasetConfiguration[]; + name: string; + type: string; + } + + export interface EmailNotifier { + attachJobAttachments: boolean; + message: string; + name: string; + senderEmail: string; + senderName: string; + subject: string; + subscribers: string[]; + type: string; + } + + export interface NotificationTaskAddChangeRuleParams { + rule: ChangeRule; + user: string; + } + + export interface NotificationTaskDeleteChangeRuleParams { + ruleId: string; + user: string; + } + + export interface NotificationTaskNotifySessionParams { + sessionid: string; + deleteAfter: boolean; + user: string; + } + + export interface NotificationTaskQueryChangeRulesParams { + name: string; + description: string; + searchType: string; + user: string; + } + + export interface NotificationTaskRunSpatialNotificationOnHistoryParams { + dataWorkspaceId: string; + from: Date; + to: Date; + logMatches: boolean; + send: boolean; + user: string; + } + + export interface NotificationTaskSendNotificationParams { + jobId: number; + notificationType: string; + user: string; + } + + export interface NotificationTaskSubscribeToNotificationParams { + notificationTypeId: number; + email: string; + user: string; + } + + export interface NotificationTaskUnsubscribeFromNotificationParams { + notificationTypeId: number; + email: string; + user: string; + } + + export interface NotificationType { + attachJobAttachments: boolean; + id: number; + message: string; + senderEmail: string; + senderName: string; + subject: string; + subscribers: string[]; + type: string; + } + + export interface WhereCondition { + compareValue: any; + field: string; + operator: string; + } + interface ReportTask extends Task { url: string; - generateReport(params: ReportTaskGenerateReportParams, requestOptions?: any): IPromise<any>; - getAllReports(requestOptions?: any): IPromise<any>; + generateReport(params: ReportTaskGenerateReportParams, requestOptions?: any): IPromise<string>; + getAllReports(requestOptions?: any): IPromise<Report>; getReportContentUrl(params: ReportTaskGetReportContentUrlParams): string; - getReportData(params: ReportTaskGetReportDataParams, requestOptions?: any): IPromise<any>; - getReportStylesheet(reportId: number, requestOptions?: any): IPromise<any>; + getReportData(params: ReportTaskGetReportDataParams, requestOptions?: any): IPromise<ReportData>; + getReportStylesheet(reportId: number, requestOptions?: any): IPromise<string>; } interface ReportTaskConstructor { @@ -7268,8 +7938,45 @@ declare namespace __esri { url?: string; } + export interface Report { + description: string; + hierarchy: string; + id: number; + name: string; + title: string; + } + + export interface ReportData { + columns: string[]; + description: string; + groups: ReportDataGroup[]; + title: string; + } + + export interface ReportDataGroup { + aggregateLabel: string; + aggregateValue: string; + row: string[]; + value: string; + } + + export interface ReportTaskGenerateReportParams { + reportId: number; + user: string; + } + + export interface ReportTaskGetReportContentUrlParams { + reportId: number; + user: number; + } + + export interface ReportTaskGetReportDataParams { + reportId: number; + user: string; + } + interface TokenTask extends Task { - parseTokens(params: TokenTaskParseTokensParams, requestOptions?: any): IPromise<any>; + parseTokens(params: TokenTaskParseTokensParams, requestOptions?: any): IPromise<string>; } interface TokenTaskConstructor { @@ -7282,23 +7989,29 @@ declare namespace __esri { } + export interface TokenTaskParseTokensParams { + jobId: any; + stringToParse: string; + user: string; + } + interface WorkflowTask extends Task { url: string; - canRunStep(params: WorkflowTaskCanRunStepParams, requestOptions?: any): IPromise<any>; - executeSteps(params: WorkflowTaskExecuteStepsParams, requestOptions?: any): IPromise<any>; - getAllSteps(jobId: number, requestOptions?: any): IPromise<any>; - getCurrentSteps(jobId: number, requestOptions?: any): IPromise<any>; - getStep(params: WorkflowTaskGetStepParams, requestOptions?: any): IPromise<any>; - getStepDescription(params: WorkflowTaskGetStepDescriptionParams, requestOptions?: any): IPromise<any>; + canRunStep(params: WorkflowTaskCanRunStepParams, requestOptions?: any): IPromise<string>; + executeSteps(params: WorkflowTaskExecuteStepsParams, requestOptions?: any): IPromise<ExecuteInfo>; + getAllSteps(jobId: number, requestOptions?: any): IPromise<Step>; + getCurrentSteps(jobId: number, requestOptions?: any): IPromise<Step>; + getStep(params: WorkflowTaskGetStepParams, requestOptions?: any): IPromise<Step>; + getStepDescription(params: WorkflowTaskGetStepDescriptionParams, requestOptions?: any): IPromise<string>; getStepFileUrl(params: WorkflowTaskGetStepFileUrlParams): string; - getWorkflowDisplayDetails(jobId: number, requestOptions?: any): IPromise<any>; + getWorkflowDisplayDetails(jobId: number, requestOptions?: any): IPromise<WorkflowDisplayDetails>; getWorkflowImageUrl(jobId: number): string; - markStepsAsDone(params: WorkflowTaskMarkStepsAsDoneParams, requestOptions?: any): IPromise<any>; - moveToNextStep(params: WorkflowTaskMoveToNextStepParams, requestOptions?: any): IPromise<any>; - recreateWorkflow(params: WorkflowTaskRecreateWorkflowParams, requestOptions?: any): IPromise<any>; - resolveConflict(params: WorkflowTaskResolveConflictParams, requestOptions?: any): IPromise<any>; - setCurrentStep(params: WorkflowTaskSetCurrentStepParams, requestOptions?: any): IPromise<any>; + markStepsAsDone(params: WorkflowTaskMarkStepsAsDoneParams, requestOptions?: any): IPromise<ExecuteInfo>; + moveToNextStep(params: WorkflowTaskMoveToNextStepParams, requestOptions?: any): IPromise<boolean>; + recreateWorkflow(params: WorkflowTaskRecreateWorkflowParams, requestOptions?: any): IPromise<boolean>; + resolveConflict(params: WorkflowTaskResolveConflictParams, requestOptions?: any): IPromise<boolean>; + setCurrentStep(params: WorkflowTaskSetCurrentStepParams, requestOptions?: any): IPromise<boolean>; } interface WorkflowTaskConstructor { @@ -7311,19 +8024,622 @@ declare namespace __esri { url?: string; } - interface MapView extends View { + export interface ExecuteInfo { + conflicts: WorkflowConflicts; + errorCode: number; + errorDescription: string; + executionResult: string; + hasConflicts: boolean; + hasReturnCode: boolean; + jobID: number; + returnCode: number; + stepID: number; + threwError: boolean; + } + + export interface Step { + hasBeenExecuted: boolean; + assignedTo: string; + async: boolean; + autoRun: boolean; + canSkip: boolean; + canSpawnConcurrency: boolean; + commonId: number; + defaultPercentComplete: number; + assignedType: string; + hasBeenStarted: boolean; + id: number; + name: string; + selfCheck: boolean; + statusId: number; + stepPercentComplete: number; + notificationType: string; + stepType: StepType; + } + + export interface StepType { + program: string; + arguments: string; + executionType: string; + id: number; + name: string; + description: string; + stepDescriptionLink: string; + stepDescriptionType: string; + stepIndicatorType: string; + supportedPlatform: string; + visible: boolean; + } + + export interface WorkflowAnnotationDisplayDetails { + centerX: number; + centerY: number; + fillColor: Color; + height: number; + label: string; + labelColor: Color; + OutlineColor: Color; + width: number; + } + + export interface WorkflowConflicts { + jobID: number; + options: WorkflowOption[]; + spawnsConcurrency: boolean; + stepId: number; + } + + export interface WorkflowDisplayDetails { + annotations: WorkflowAnnotationDisplayDetails[]; + paths: WorkflowPathDisplayDetails[]; + steps: WorkflowStepDisplayDetails[]; + } + + export interface WorkflowOption { + returnCode: number; + steps: WorkflowStepInfo[]; + } + + export interface WorkflowPathDisplayDetails { + destStepId: number; + sourceStepID: number; + label: string; + labelColor: Color; + labelX: number; + labelY: number; + lineColor: Color; + pathObject: any; + } + + export interface WorkflowStepDisplayDetails { + labelColor: Color; + centerX: number; + fillColor: Color; + height: number; + label: string; + centerY: number; + OutlineColor: Color; + shape: string; + stepId: number; + stepType: string; + width: number; + } + + export interface WorkflowStepInfo { + id: number; + name: string; + } + + export interface WorkflowTaskCanRunStepParams { + jobId: number; + stepId: number; + user: string; + } + + export interface WorkflowTaskExecuteStepsParams { + jobId: number; + stepIds: number[]; + auto: boolean; + user: string; + } + + export interface WorkflowTaskGetStepDescriptionParams { + jobId: number; + stepId: number; + } + + export interface WorkflowTaskGetStepFileUrlParams { + jobId: number; + stepId: number; + } + + export interface WorkflowTaskGetStepParams { + jobId: number; + stepId: number; + } + + export interface WorkflowTaskMarkStepsAsDoneParams { + jobId: number; + stepIds: number[]; + user: string; + } + + export interface WorkflowTaskMoveToNextStepParams { + jobId: number; + stepId: number; + returnCode: number; + user: string; + } + + export interface WorkflowTaskRecreateWorkflowParams { + jobId: number; + user: string; + } + + export interface WorkflowTaskResolveConflictParams { + jobId: number; + stepId: number; + optionReturnCode: number; + optionStepIds: number[]; + user: string; + } + + export interface WorkflowTaskSetCurrentStepParams { + jobId: number; + stepId: number; + user: string; + } + + interface Viewpoint extends Accessor, JSONSupport { + camera: Camera; + rotation: number; + scale: number; + targetGeometry: Geometry; + + clone(): Viewpoint; + } + + interface ViewpointConstructor { + new(properties?: ViewpointProperties): Viewpoint; + + fromJSON(json: any): Viewpoint; + } + + export const Viewpoint: ViewpointConstructor; + + interface ViewpointProperties { + camera?: CameraProperties; + rotation?: number; + scale?: number; + targetGeometry?: GeometryProperties; + } + + interface Draw extends Accessor { + activeAction: PointDrawAction | PolygonDrawAction | PolylineDrawAction; + view: MapView; + + create(drawAction: string): PointDrawAction | PolygonDrawAction | PolylineDrawAction; + } + + interface DrawConstructor { + new(properties?: DrawProperties): Draw; + } + + export const Draw: DrawConstructor; + + interface DrawProperties { + activeAction?: PointDrawActionProperties | PolygonDrawActionProperties | PolylineDrawActionProperties; + view?: MapViewProperties; + } + + interface PointDrawAction extends Accessor, Evented { + view: MapView; + + complete(): void; + } + + interface PointDrawActionConstructor { + new(properties?: PointDrawActionProperties): PointDrawAction; + } + + export const PointDrawAction: PointDrawActionConstructor; + + interface PointDrawActionProperties { + view?: MapViewProperties; + } + + interface PolygonDrawAction extends Accessor, Evented { + vertices: number[][]; + view: MapView; + + canRedo(): boolean; + canUndo(): boolean; + complete(): void; + redo(): void; + undo(): void; + + on(name: "cursor-update", eventHandler: PolygonDrawActionCursorUpdateEventHandler): IHandle; + on(name: "cursor-update", modifiers: string[], eventHandler: PolygonDrawActionCursorUpdateEventHandler): IHandle; + on(name: "vertex-add", eventHandler: PolygonDrawActionVertexAddEventHandler): IHandle; + on(name: "vertex-add", modifiers: string[], eventHandler: PolygonDrawActionVertexAddEventHandler): IHandle; + on(name: "vertex-remove", eventHandler: PolygonDrawActionVertexRemoveEventHandler): IHandle; + on(name: "vertex-remove", modifiers: string[], eventHandler: PolygonDrawActionVertexRemoveEventHandler): IHandle; + on(name: "draw-complete", eventHandler: PolygonDrawActionDrawCompleteEventHandler): IHandle; + on(name: "draw-complete", modifiers: string[], eventHandler: PolygonDrawActionDrawCompleteEventHandler): IHandle; + } + + interface PolygonDrawActionConstructor { + new(properties?: PolygonDrawActionProperties): PolygonDrawAction; + } + + export const PolygonDrawAction: PolygonDrawActionConstructor; + + interface PolygonDrawActionProperties { + vertices?: number[][]; + view?: MapViewProperties; + } + + export interface PolygonDrawActionCursorUpdateEvent { + defaultPrevented: boolean; + preventDefault: Function; + type: string; + vertexIndex: number; + vertices: number[][]; + } + + export interface PolygonDrawActionDrawCompleteEvent { + defaultPrevented: boolean; + preventDefault: Function; + type: string; + vertices: number[][]; + } + + export interface PolygonDrawActionVertexAddEvent { + defaultPrevented: boolean; + preventDefault: Function; + type: string; + vertexIndex: number; + vertices: number[][]; + } + + export interface PolygonDrawActionVertexRemoveEvent { + defaultPrevented: boolean; + preventDefault: Function; + type: string; + vertexIndex: number; + vertices: number[][]; + } + + interface PolylineDrawAction extends Accessor, Evented { + vertices: number[][]; + view: MapView; + + canRedo(): boolean; + canUndo(): boolean; + complete(): void; + redo(): void; + undo(): void; + + on(name: "cursor-update", eventHandler: PolylineDrawActionCursorUpdateEventHandler): IHandle; + on(name: "cursor-update", modifiers: string[], eventHandler: PolylineDrawActionCursorUpdateEventHandler): IHandle; + on(name: "vertex-add", eventHandler: PolylineDrawActionVertexAddEventHandler): IHandle; + on(name: "vertex-add", modifiers: string[], eventHandler: PolylineDrawActionVertexAddEventHandler): IHandle; + on(name: "vertex-remove", eventHandler: PolylineDrawActionVertexRemoveEventHandler): IHandle; + on(name: "vertex-remove", modifiers: string[], eventHandler: PolylineDrawActionVertexRemoveEventHandler): IHandle; + on(name: "draw-complete", eventHandler: PolylineDrawActionDrawCompleteEventHandler): IHandle; + on(name: "draw-complete", modifiers: string[], eventHandler: PolylineDrawActionDrawCompleteEventHandler): IHandle; + } + + interface PolylineDrawActionConstructor { + new(properties?: PolylineDrawActionProperties): PolylineDrawAction; + } + + export const PolylineDrawAction: PolylineDrawActionConstructor; + + interface PolylineDrawActionProperties { + vertices?: number[][]; + view?: MapViewProperties; + } + + export interface PolylineDrawActionCursorUpdateEvent { + defaultPrevented: boolean; + preventDefault: Function; + type: string; + vertexIndex: number; + vertices: number[][]; + } + + export interface PolylineDrawActionDrawCompleteEvent { + defaultPrevented: boolean; + preventDefault: Function; + type: string; + vertices: number[][]; + } + + export interface PolylineDrawActionVertexAddEvent { + defaultPrevented: boolean; + preventDefault: Function; + type: string; + vertexIndex: number; + vertices: number[][]; + } + + export interface PolylineDrawActionVertexRemoveEvent { + defaultPrevented: boolean; + preventDefault: Function; + type: string; + vertexIndex: number; + vertices: number[][]; + } + + interface externalRenderers { + add(view: SceneView, renderer: ExternalRenderer): void; + fromRenderCoordinates(view: SceneView, srcCoordinates: number[] | any, srcStart: number, destCoordinates: number[] | any, destStart: number, destSpatialReference: SpatialReference, count: number): number[] | any; + remove(view: SceneView, renderer: ExternalRenderer): void; + renderCoordinateTransformAt(view: SceneView, origin: number[] | any, srcSpatialReference?: SpatialReference, dest?: number[] | any): number[] | any; + requestRender(view: SceneView): void; + toRenderCoordinates(view: SceneView, srcCoordinates: number[] | any, srcStart: number, srcSpatialReference: SpatialReference, destCoordinates: number[] | any, destStart: number, count: number): number[] | any; + } + + export const externalRenderers: externalRenderers; + + export interface ColorAndIntensity { + color: any; + intensity: number; + } + + export interface ExternalRenderer { + setup(): void; + render(): void; + dispose(): void; + } + + export interface RenderCamera { + viewMatrix: any; + viewInverseTransposeMatrix: any; + projectionMatrix: any; + eye: any; + center: any; + up: any; + near: number; + far: number; + fovX: number; + fovY: number; + } + + export interface RenderContext { + gl: any; + camera: RenderCamera; + sunLight: SunLight; + + resetWebGLState(): void; + bindRenderTarget(): void; + } + + export interface SunLight { + direction: any; + diffuse: ColorAndIntensity; + ambient: ColorAndIntensity; + } + + interface BreakpointsOwner { + breakpoints: BreakpointsOwnerBreakpoints; + heightBreakpoint: string; + orientation: string; + widthBreakpoint: string; + } + + interface BreakpointsOwnerConstructor { + new(): BreakpointsOwner; + } + + export const BreakpointsOwner: BreakpointsOwnerConstructor; + + interface BreakpointsOwnerProperties { + breakpoints?: BreakpointsOwnerBreakpoints; + heightBreakpoint?: string; + orientation?: string; + widthBreakpoint?: string; + } + + export interface BreakpointsOwnerBreakpoints { + xsmall: number; + small: number; + medium: number; + large: number; + } + + interface DOMContainer { + container: HTMLDivElement | string; + height: number; + popup: Popup; + resizing: boolean; + size: number[]; + suspended: boolean; + ui: DefaultUI; + width: number; + } + + interface DOMContainerConstructor { + new(): DOMContainer; + } + + export const DOMContainer: DOMContainerConstructor; + + interface DOMContainerProperties { + container?: HTMLDivElement | string; + height?: number; + popup?: PopupProperties; + resizing?: boolean; + size?: number[]; + suspended?: boolean; + ui?: DefaultUIProperties; + width?: number; + } + + interface CSVLayerView extends LayerView { + highlight(target?: Graphic | Graphic[]): any; + queryExtent(params?: Query): IPromise<any>; + queryFeatureCount(params?: Query): IPromise<number>; + queryFeatures(params?: Query): IPromise<Graphic[]>; + queryObjectIds(params?: Query): IPromise<number[]>; + } + + interface CSVLayerViewConstructor { + new(properties?: CSVLayerViewProperties): CSVLayerView; + } + + export const CSVLayerView: CSVLayerViewConstructor; + + interface CSVLayerViewProperties extends LayerViewProperties { + + } + + interface FeatureLayerView extends LayerView { + highlight(target?: Graphic | Graphic[] | number | number[]): any; + queryExtent(params?: Query): IPromise<any>; + queryFeatureCount(params?: Query): IPromise<number>; + queryFeatures(params?: Query): IPromise<Graphic[]>; + queryObjectIds(params?: Query): IPromise<number[]>; + } + + interface FeatureLayerViewConstructor { + new(properties?: FeatureLayerViewProperties): FeatureLayerView; + } + + export const FeatureLayerView: FeatureLayerViewConstructor; + + interface FeatureLayerViewProperties extends LayerViewProperties { + + } + + interface GraphicsLayerView extends LayerView { + highlight(target?: Graphic | Graphic[] | number | number[]): any; + queryGraphics(): IPromise<Graphic[]>; + } + + interface GraphicsLayerViewConstructor { + new(properties?: GraphicsLayerViewProperties): GraphicsLayerView; + } + + export const GraphicsLayerView: GraphicsLayerViewConstructor; + + interface GraphicsLayerViewProperties extends LayerViewProperties { + + } + + interface ImageryLayerView extends LayerView { + pixelData: ImageryLayerViewPixelData; + } + + interface ImageryLayerViewConstructor { + new(properties?: ImageryLayerViewProperties): ImageryLayerView; + } + + export const ImageryLayerView: ImageryLayerViewConstructor; + + interface ImageryLayerViewProperties extends LayerViewProperties { + pixelData?: ImageryLayerViewPixelData; + } + + export interface ImageryLayerViewPixelData { + extent?: Extent; + pixelBlock: PixelBlock; + } + + interface LayerView extends Accessor, corePromise { + layer: Layer; + suspended: boolean; + updating: boolean; + visible: boolean; + } + + interface LayerViewConstructor { + new(properties?: LayerViewProperties): LayerView; + } + + export const LayerView: LayerViewConstructor; + + interface LayerViewProperties { + layer?: LayerProperties; + suspended?: boolean; + updating?: boolean; + visible?: boolean; + } + + interface SceneLayerView extends LayerView { + highlight(target?: Graphic | Graphic[] | number | number[]): any; + queryExtent(params?: Query): IPromise<any>; + queryFeatureCount(params?: Query): IPromise<number>; + queryFeatures(params?: Query): IPromise<FeatureSet>; + queryObjectIds(params?: Query): IPromise<number[]>; + } + + interface SceneLayerViewConstructor { + new(properties?: SceneLayerViewProperties): SceneLayerView; + } + + export const SceneLayerView: SceneLayerViewConstructor; + + interface SceneLayerViewProperties extends LayerViewProperties { + + } + + interface StreamLayerView extends LayerView, Evented { + connectionError: Error; + connectionStatus: string; + filter: StreamLayerViewFilter; + graphics: Collection<Graphic>; + + connect(): IPromise<any>; + disconnect(): void; + updateFilter(filter: StreamLayerViewUpdateFilterFilter): IPromise<any>; + + on(name: "data-received", eventHandler: StreamLayerViewDataReceivedEventHandler): IHandle; + on(name: "data-received", modifiers: string[], eventHandler: StreamLayerViewDataReceivedEventHandler): IHandle; + } + + interface StreamLayerViewConstructor { + new(properties?: StreamLayerViewProperties): StreamLayerView; + } + + export const StreamLayerView: StreamLayerViewConstructor; + + interface StreamLayerViewProperties extends LayerViewProperties { + connectionError?: Error; + connectionStatus?: string; + filter?: StreamLayerViewFilter; + graphics?: CollectionProperties<GraphicProperties>; + } + + export interface StreamLayerViewDataReceivedEvent { + } + + export interface StreamLayerViewFilter { + geometry?: Extent; + where?: string; + } + + export interface StreamLayerViewUpdateFilterFilter { + geometry?: Extent; + where?: string; + } + + interface MapView extends View, BreakpointsOwner { center: Point; constraints: MapViewConstraints; extent: Extent; + highlightOptions: MapViewHighlightOptions; resizeAlign: string; rotation: number; scale: number; viewpoint: Viewpoint; zoom: number; - goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | any, options?: MapViewGoToOptions): IPromise<any>; + focus(): void; + goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | MapViewGoToTarget, options?: MapViewGoToOptions): IPromise<ViewAnimation>; hasEventListener(type: string): boolean; - hitTest(screenPoint: MapViewHitTestScreenPoint): IPromise<any>; + hitTest(screenPoint: MapViewHitTestScreenPoint): IPromise<HitTestResult>; on(type: string | string[], modifiersOrHandler: string[] | EventHandler, handler?: EventHandler): IHandle; toMap(screenPoint: MapViewToMapScreenPoint): Point; toScreen(point: Point, screenPoint?: ScreenPoint): ScreenPoint; @@ -7362,10 +8678,11 @@ declare namespace __esri { export const MapView: MapViewConstructor; - interface MapViewProperties extends ViewProperties { + interface MapViewProperties extends ViewProperties, BreakpointsOwnerProperties { center?: PointProperties; constraints?: MapViewConstraints; extent?: ExtentProperties; + highlightOptions?: MapViewHighlightOptions; resizeAlign?: string; rotation?: number; scale?: number; @@ -7373,7 +8690,185 @@ declare namespace __esri { zoom?: number; } - interface SceneView extends View { + export interface MapViewClickEvent { + button: number; + mapPoint: Point; + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface MapViewDoubleClickEvent { + button: number; + mapPoint: Point; + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface MapViewDragEvent { + action: string; + native: any; + origin: MapViewDragEventOrigin; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface HitTestResult { + results: HitTestResultResults[]; + } + + export interface MapViewHoldEvent { + button: number; + mapPoint: Point; + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface MapViewKeyDownEvent { + key: string; + native: any; + repeat: boolean; + stopPropagation: Function; + timestamp: number; + type: string; + } + + export interface MapViewKeyUpEvent { + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + } + + export interface MapViewLayerviewCreateEvent { + layer: Layer; + layerView: LayerView; + } + + export interface MapViewLayerviewDestroyEvent { + layer: Layer; + layerView: LayerView; + } + + export interface MapViewConstraints { + lods?: LOD[]; + minScale?: number; + maxScale?: number; + minZoom?: number; + maxZoom?: number; + snapToZoom?: boolean; + rotationEnabled?: boolean; + effectiveLODs?: LOD[]; + effectiveMinZoom?: number; + effectiveMaxZoom?: number; + effectiveMinScale?: number; + effectiveMaxScale?: number; + } + + export interface MapViewGoToOptions { + animate?: boolean; + duration?: number; + easing?: string | Function; + } + + export interface MapViewGoToTarget { + target?: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint; + center?: number[]; + scale?: number; + zoom?: number; + } + + export interface MapViewHighlightOptions { + color?: Color; + haloOpacity?: number; + fillOpacity?: number; + } + + export interface MapViewHitTestScreenPoint { + x: number; + y: number; + } + + export interface MapViewToMapScreenPoint { + x: number; + y: number; + } + + export interface MapViewMouseWheelEvent { + deltaY: number; + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface MapViewPointerDownEvent { + native: any; + pointerId: number; + pointerType: string; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface MapViewPointerMoveEvent { + native: any; + pointerId: number; + pointerType: string; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface MapViewPointerUpEvent { + native: any; + pointerId: number; + pointerType: string; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface MapViewResizeEvent { + height: number; + oldHeight: number; + oldWidth: number; + width: number; + } + + export interface MapViewDragEventOrigin { + x: number; + y: number; + } + + export interface HitTestResultResults { + graphic: Graphic; + mapPoint: Point; + } + + interface SceneView extends View, BreakpointsOwner { camera: Camera; center: Point; clippingArea: Extent; @@ -7387,9 +8882,10 @@ declare namespace __esri { viewpoint: Viewpoint; zoom: number; - goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | Camera | any, options?: SceneViewGoToOptions): IPromise<any>; + focus(): void; + goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | Camera | SceneViewGoToTarget, options?: SceneViewGoToOptions): IPromise<any>; hasEventListener(type: string): boolean; - hitTest(screenPoint: SceneViewHitTestScreenPoint): IPromise<any>; + hitTest(screenPoint: SceneViewHitTestScreenPoint): IPromise<SceneViewHitTestResult>; on(type: string | string[], modifiersOrHandler: string[] | EventHandler, handler?: EventHandler): IHandle; toMap(screenPoint: SceneViewToMapScreenPoint, mapPoint?: Point): Point; toScreen(point: Point, screenPoint?: ScreenPoint): ScreenPoint; @@ -7428,7 +8924,7 @@ declare namespace __esri { export const SceneView: SceneViewConstructor; - interface SceneViewProperties extends ViewProperties { + interface SceneViewProperties extends ViewProperties, BreakpointsOwnerProperties { camera?: CameraProperties; center?: PointProperties; clippingArea?: ExtentProperties; @@ -7443,12 +8939,318 @@ declare namespace __esri { zoom?: number; } - interface View extends Accessor, corePromise, BreakpointsOwner, DOMContainer { - allLayerViews: Collection; + export interface SceneViewClickEvent { + button: number; + mapPoint: Point; + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface SceneViewDoubleClickEvent { + button: number; + mapPoint: Point; + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface SceneViewDragEvent { + action: string; + native: any; + origin: SceneViewDragEventOrigin; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export type EasingFunction = (t: number, duration: number) => number; + + export interface SceneViewHitTestResult { + results: SceneViewHitTestResultResults[]; + } + + export interface SceneViewHoldEvent { + button: number; + mapPoint: Point; + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface SceneViewKeyDownEvent { + key: string; + native: any; + repeat: boolean; + stopPropagation: Function; + timestamp: number; + type: string; + } + + export interface SceneViewKeyUpEvent { + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + } + + export interface SceneViewLayerviewCreateEvent { + layer: Layer; + layerView: LayerView; + } + + export interface SceneViewLayerviewDestroyEvent { + layer: Layer; + layerView: LayerView; + } + + export interface SceneViewMouseWheelEvent { + deltaY: number; + native: any; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface SceneViewPointerDownEvent { + native: any; + pointerId: number; + pointerType: string; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface SceneViewPointerMoveEvent { + native: any; + pointerId: number; + pointerType: string; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface SceneViewPointerUpEvent { + native: any; + pointerId: number; + pointerType: string; + stopPropagation: Function; + timestamp: number; + type: string; + x: number; + y: number; + } + + export interface SceneViewResizeEvent { + height: number; + oldHeight: number; + oldWidth: number; + width: number; + } + + export interface SceneViewConstraintsProperties { + altitude?: SceneViewConstraintsAltitudeProperties; + clipDistance?: SceneViewConstraintsClipDistanceProperties; + collision?: SceneViewConstraintsCollision; + tilt?: SceneViewConstraintsTiltProperties; + } + export interface SceneViewConstraints extends Accessor { + altitude?: SceneViewConstraintsAltitude; + clipDistance?: SceneViewConstraintsClipDistance; + collision?: SceneViewConstraintsCollision; + tilt?: SceneViewConstraintsTilt; + } + + export interface SceneViewConstraintsAltitudeProperties { + min?: number; + max?: number; + } + export interface SceneViewConstraintsAltitude extends Accessor { + min?: number; + max?: number; + } + + export interface SceneViewConstraintsClipDistanceProperties { + near?: number; + far?: number; + mode?: string; + } + export interface SceneViewConstraintsClipDistance extends Accessor { + near?: number; + far?: number; + mode?: string; + } + + export interface SceneViewConstraintsCollision { + enabled?: boolean; + } + + export interface SceneViewConstraintsTiltProperties { + max?: number; + mode?: string; + } + export interface SceneViewConstraintsTilt extends Accessor { + max?: number; + mode?: string; + } + + export interface SceneViewEnvironmentProperties { + lighting?: SceneViewEnvironmentLightingProperties; + atmosphereEnabled?: boolean; + atmosphere?: SceneViewEnvironmentAtmosphereProperties; + starsEnabled?: boolean; + } + export interface SceneViewEnvironment extends Accessor { + lighting?: SceneViewEnvironmentLighting; + atmosphereEnabled?: boolean; + atmosphere?: SceneViewEnvironmentAtmosphere; + starsEnabled?: boolean; + } + + export interface SceneViewEnvironmentAtmosphereProperties { + quality?: string; + } + export interface SceneViewEnvironmentAtmosphere extends Accessor { + quality?: string; + } + + export interface SceneViewEnvironmentLightingProperties { + date?: DateProperties; + directShadowsEnabled?: boolean; + ambientOcclusionEnabled?: boolean; + cameraTrackingEnabled?: boolean; + } + export interface SceneViewEnvironmentLighting extends Accessor { + date?: Date; + directShadowsEnabled?: boolean; + ambientOcclusionEnabled?: boolean; + cameraTrackingEnabled?: boolean; + } + + export interface SceneViewGoToOptions { + animate?: boolean; + speedFactor?: number; + duration?: number; + maxDuration?: number; + easing?: string | EasingFunction; + } + + export interface SceneViewGoToTarget { + target?: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | Camera; + center?: number[]; + scale?: number; + zoom?: number; + heading?: number; + tilt?: number; + position?: number; + } + + export interface SceneViewHighlightOptions { + color?: Color; + haloOpacity?: number; + fillOpacity?: number; + } + + export interface SceneViewHitTestScreenPoint { + x: number; + y: number; + } + + export interface SceneViewToMapScreenPoint { + x: number; + y: number; + } + + export interface SceneViewDragEventOrigin { + x: number; + y: number; + } + + export interface SceneViewHitTestResultResults { + graphic: Graphic; + mapPoint: Point; + } + + interface DefaultUI extends UI { + components: string[]; + } + + interface DefaultUIConstructor { + new(properties?: DefaultUIProperties): DefaultUI; + } + + export const DefaultUI: DefaultUIConstructor; + + interface DefaultUIProperties extends UIProperties { + components?: string[]; + } + + interface UI extends Accessor { + container: HTMLElement; + height: number; + padding: any | number; + view: MapView | SceneView; + width: number; + + add(component: Widget | HTMLElement | string | any[] | UIAddComponent, position?: string | UIAddPosition): void; + empty(position?: string): void; + move(component: Widget | HTMLElement | string | any[] | UIMoveComponent, position?: string): void; + remove(component: Widget | HTMLElement | string | any[]): void; + } + + interface UIConstructor { + new(properties?: UIProperties): UI; + } + + export const UI: UIConstructor; + + interface UIProperties { + container?: HTMLElement; + height?: number; + padding?: any | number; + view?: MapViewProperties | SceneViewProperties; + width?: number; + } + + export interface UIAddComponent { + component: Widget | HTMLElement | string; + position?: string; + index?: number; + } + + export interface UIAddPosition { + position?: string; + index: number; + } + + export interface UIMoveComponent { + component: Widget | HTMLElement | string; + position?: string; + } + + interface View extends Accessor, corePromise, DOMContainer { + allLayerViews: Collection<LayerView>; animation: ViewAnimation; - graphics: Collection; + graphics: Collection<Graphic>; interacting: boolean; - layerViews: Collection; + layerViews: Collection<LayerView>; map: Map; padding: ViewPadding; ready: boolean; @@ -7457,7 +9259,7 @@ declare namespace __esri { type: string; updating: boolean; - whenLayerView(layer: Layer): IPromise<any>; + whenLayerView(layer: Layer): IPromise<LayerView>; } interface ViewConstructor { @@ -7466,12 +9268,12 @@ declare namespace __esri { export const View: ViewConstructor; - interface ViewProperties extends BreakpointsOwnerProperties, DOMContainerProperties { - allLayerViews?: Collection | any[]; + interface ViewProperties extends DOMContainerProperties { + allLayerViews?: CollectionProperties<LayerViewProperties>; animation?: ViewAnimationProperties; - graphics?: Collection | any[]; + graphics?: CollectionProperties<GraphicProperties>; interacting?: boolean; - layerViews?: Collection | any[]; + layerViews?: CollectionProperties<LayerViewProperties>; map?: MapProperties; padding?: ViewPadding; ready?: boolean; @@ -7481,6 +9283,13 @@ declare namespace __esri { updating?: boolean; } + export interface ViewPadding { + left?: number; + top?: number; + right?: number; + bottom?: number; + } + interface ViewAnimation extends Accessor, corePromise { state: string; target: Viewpoint; @@ -7500,182 +9309,47 @@ declare namespace __esri { target?: ViewpointProperties; } - interface LayerView extends Accessor, corePromise { - layer: Layer; - suspended: boolean; - updating: boolean; - visible: boolean; + interface WebMap extends Map, corePromise { + applicationProperties: any; + bookmarks: any[]; + initialViewProperties: InitialViewProperties; + loaded: boolean; + loadError: Error; + loadStatus: string; + portalItem: PortalItem; + presentation: any; + sourceVersion: WebMapSourceVersion; + tables: any[]; + widgets: any; + + load(): IPromise<any>; } - interface LayerViewConstructor { - new(properties?: LayerViewProperties): LayerView; + interface WebMapConstructor { + new(properties?: WebMapProperties): WebMap; } - export const LayerView: LayerViewConstructor; + export const WebMap: WebMapConstructor; - interface LayerViewProperties { - layer?: LayerProperties; - suspended?: boolean; - updating?: boolean; - visible?: boolean; - } - - interface CSVLayerView extends LayerView { - highlight(target?: Graphic | Graphic[]): any; - queryExtent(params?: Query): IPromise<any>; - queryFeatureCount(params?: Query): IPromise<any>; - queryFeatures(params?: Query): IPromise<any>; - queryObjectIds(params?: Query): IPromise<any>; - } - - interface CSVLayerViewConstructor { - new(properties?: CSVLayerViewProperties): CSVLayerView; - } - - export const CSVLayerView: CSVLayerViewConstructor; - - interface CSVLayerViewProperties extends LayerViewProperties { - - } - - interface FeatureLayerView extends LayerView { - highlight(target?: Graphic | Graphic[] | number | number[]): any; - queryExtent(params?: Query): IPromise<any>; - queryFeatureCount(params?: Query): IPromise<any>; - queryFeatures(params?: Query): IPromise<any>; - queryObjectIds(params?: Query): IPromise<any>; - } - - interface FeatureLayerViewConstructor { - new(properties?: FeatureLayerViewProperties): FeatureLayerView; - } - - export const FeatureLayerView: FeatureLayerViewConstructor; - - interface FeatureLayerViewProperties extends LayerViewProperties { - - } - - interface GraphicsLayerView extends LayerView { - highlight(target?: Graphic | Graphic[] | number | number[]): any; - queryGraphics(): IPromise<any>; - } - - interface GraphicsLayerViewConstructor { - new(properties?: GraphicsLayerViewProperties): GraphicsLayerView; - } - - export const GraphicsLayerView: GraphicsLayerViewConstructor; - - interface GraphicsLayerViewProperties extends LayerViewProperties { - - } - - interface ImageryLayerView extends LayerView { - pixelData: ImageryLayerViewPixelData; - } - - interface ImageryLayerViewConstructor { - new(properties?: ImageryLayerViewProperties): ImageryLayerView; - } - - export const ImageryLayerView: ImageryLayerViewConstructor; - - interface ImageryLayerViewProperties extends LayerViewProperties { - pixelData?: ImageryLayerViewPixelData; - } - - interface SceneLayerView extends LayerView { - highlight(target?: Graphic | Graphic[] | number | number[]): any; - queryExtent(params?: Query): IPromise<any>; - queryFeatureCount(params?: Query): IPromise<any>; - queryFeatures(params?: Query): IPromise<any>; - queryObjectIds(params?: Query): IPromise<any>; - } - - interface SceneLayerViewConstructor { - new(properties?: SceneLayerViewProperties): SceneLayerView; - } - - export const SceneLayerView: SceneLayerViewConstructor; - - interface SceneLayerViewProperties extends LayerViewProperties { - - } - - interface StreamLayerView extends Accessor, Evented { - connectionError: Error; - connectionStatus: string; - filter: StreamLayerViewFilter; - graphics: Collection; - - connect(): IPromise<any>; - disconnect(): void; - updateFilter(filter: StreamLayerViewUpdateFilterFilter): IPromise<any>; - - on(name: "data-received", eventHandler: StreamLayerViewDataReceivedEventHandler): IHandle; - on(name: "data-received", modifiers: string[], eventHandler: StreamLayerViewDataReceivedEventHandler): IHandle; - } - - interface StreamLayerViewConstructor { - new(properties?: StreamLayerViewProperties): StreamLayerView; - } - - export const StreamLayerView: StreamLayerViewConstructor; - - interface StreamLayerViewProperties { - connectionError?: Error; - connectionStatus?: string; - filter?: StreamLayerViewFilter; - graphics?: Collection | any[]; - } - - interface UI extends Accessor { - container: any; - height: number; - padding: any; - view: MapView | SceneView; - width: number; - - add(component: Widget | any | string | any | any, position?: string | any): void; - empty(position?: string): void; - move(component: Widget | any | string | any | any, position?: string): void; - remove(component: any | any[]): void; - } - - interface UIConstructor { - new(properties?: UIProperties): UI; - } - - export const UI: UIConstructor; - - interface UIProperties { - container?: any; - height?: number; - padding?: any | number; - view?: MapView | SceneView; - width?: number; - } - - interface DefaultUI extends UI { - components: string[]; - } - - interface DefaultUIConstructor { - new(properties?: DefaultUIProperties): DefaultUI; - } - - export const DefaultUI: DefaultUIConstructor; - - interface DefaultUIProperties extends UIProperties { - components?: string[]; + interface WebMapProperties extends MapProperties { + applicationProperties?: any; + bookmarks?: any[]; + initialViewProperties?: InitialViewPropertiesProperties; + loaded?: boolean; + loadError?: Error; + loadStatus?: string; + portalItem?: PortalItemProperties; + presentation?: any; + sourceVersion?: WebMapSourceVersion; + tables?: any[]; + widgets?: any; } interface InitialViewProperties extends Accessor, corePromise { spatialReference: SpatialReference; viewpoint: Viewpoint; - clone(): this; + clone(): InitialViewProperties; } interface InitialViewPropertiesConstructor { @@ -7689,10 +9363,56 @@ declare namespace __esri { viewpoint?: ViewpointProperties; } + export interface WebMapSourceVersion { + major: number; + minor: number; + } + + interface WebScene extends Map, corePromise { + clippingArea: Extent; + clippingEnabled: boolean; + heightModelInfo: HeightModelInfo; + initialViewProperties: websceneInitialViewProperties; + loaded: boolean; + loadError: Error; + loadStatus: string; + portalItem: PortalItem; + presentation: Presentation; + sourceVersion: WebSceneSourceVersion; + + load(): IPromise<any>; + save(options?: WebSceneSaveOptions): IPromise<PortalItem>; + saveAs(portalItem: PortalItem, options?: WebSceneSaveAsOptions): IPromise<PortalItem>; + toJSON(): any; + updateFrom(view: SceneView, options?: WebSceneUpdateFromOptions): void; + } + + interface WebSceneConstructor { + new(properties?: WebSceneProperties): WebScene; + + + fromJSON(json: any): any; + } + + export const WebScene: WebSceneConstructor; + + interface WebSceneProperties extends MapProperties { + clippingArea?: ExtentProperties; + clippingEnabled?: boolean; + heightModelInfo?: HeightModelInfoProperties; + initialViewProperties?: websceneInitialViewPropertiesProperties; + loaded?: boolean; + loadError?: Error; + loadStatus?: string; + portalItem?: PortalItemProperties; + presentation?: PresentationProperties; + sourceVersion?: WebSceneSourceVersion; + } + interface Environment extends Accessor { lighting: Lighting; - clone(): this; + clone(): Environment; } interface EnvironmentConstructor { @@ -7711,7 +9431,7 @@ declare namespace __esri { viewingMode: string; viewpoint: Viewpoint; - clone(): this; + clone(): websceneInitialViewProperties; } interface websceneInitialViewPropertiesConstructor { @@ -7732,7 +9452,7 @@ declare namespace __esri { directShadowsEnabled: boolean; displayUTCOffset: number; - clone(): this; + clone(): Lighting; } interface LightingConstructor { @@ -7742,15 +9462,15 @@ declare namespace __esri { export const Lighting: LightingConstructor; interface LightingProperties { - date?: Date; + date?: DateProperties; directShadowsEnabled?: boolean; displayUTCOffset?: number; } interface Presentation extends Accessor { - slides: Collection; + slides: Collection<Slide>; - clone(): this; + clone(): Presentation; } interface PresentationConstructor { @@ -7760,42 +9480,119 @@ declare namespace __esri { export const Presentation: PresentationConstructor; interface PresentationProperties { - slides?: Collection | any[]; + slides?: CollectionProperties<SlideProperties>; } interface Slide extends Accessor { - basemap: Basemap; + basemap: Basemap | string; description: SlideDescription; environment: Environment; id: string; thumbnail: SlideThumbnail; title: SlideTitle; viewpoint: Viewpoint; - visibleLayers: SlideVisibleLayers; + visibleLayers: Collection<SlideVisibleLayers>; - applyTo(view: SceneView, options?: SlideApplyToOptions): IPromise<any>; - clone(): this; - updateFrom(view: SceneView, options?: SlideUpdateFromOptions): IPromise<any>; + applyTo(view: SceneView, options?: SlideApplyToOptions): IPromise<Slide>; + clone(): Slide; + updateFrom(view: SceneView, options?: SlideUpdateFromOptions): IPromise<Slide>; } interface SlideConstructor { new(properties?: SlideProperties): Slide; - createFrom(view: SceneView, options?: SlideCreateFromOptions): IPromise<any>; + createFrom(view: SceneView, options?: SlideCreateFromOptions): IPromise<Slide>; } export const Slide: SlideConstructor; interface SlideProperties { - basemap?: Basemap | string; + basemap?: BasemapProperties | string; description?: SlideDescriptionProperties; environment?: EnvironmentProperties; id?: string; thumbnail?: SlideThumbnailProperties; title?: SlideTitleProperties; viewpoint?: ViewpointProperties; - visibleLayers?: SlideVisibleLayers; + visibleLayers?: CollectionProperties<SlideVisibleLayersProperties>; + } + + export interface SlideApplyToOptions { + animate: boolean; + speedFactor?: number; + duration?: number; + maxDuration?: number; + easing?: string | EasingFunction; + } + + export interface SlideCreateFromOptions { + screenshot: SlideCreateFromOptionsScreenshot; + } + + export interface SlideCreateFromOptionsScreenshot { + format: string; + quality: number; + width: number; + height: number; + } + + export interface SlideDescriptionProperties { + text?: string; + } + export interface SlideDescription extends Accessor { + text?: string; + } + + export interface SlideThumbnailProperties { + url?: string; + } + export interface SlideThumbnail extends Accessor { + url?: string; + } + + export interface SlideTitleProperties { + text?: string; + } + export interface SlideTitle extends Accessor { + text?: string; + } + + export interface SlideUpdateFromOptions { + screenshot: SlideUpdateFromOptionsScreenshot; + } + + export interface SlideUpdateFromOptionsScreenshot { + format: string; + quality: number; + width: number; + height: number; + } + + export interface SlideVisibleLayersProperties { + id?: string; + } + export interface SlideVisibleLayers extends Accessor { + id: string; + } + + export interface WebSceneSaveAsOptions { + folder?: PortalFolder; + ignoreUnsupported?: boolean; + } + + export interface WebSceneSaveOptions { + ignoreUnsupported?: boolean; + } + + export interface WebSceneSourceVersion { + major: number; + minor: number; + } + + export interface WebSceneUpdateFromOptions { + environmentExcluded?: boolean; + viewpointExcluded?: boolean; } interface Attribution extends Widget { @@ -7812,10 +9609,23 @@ declare namespace __esri { export const Attribution: AttributionConstructor; interface AttributionProperties extends WidgetProperties { - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: AttributionViewModel; } + interface AttributionViewModel { + attributionText: string; + itemDelimiter: string; + state: string; + view: MapView | SceneView; + } + + interface AttributionViewModelConstructor { + new(properties?: any): AttributionViewModel; + } + + export const AttributionViewModel: AttributionViewModelConstructor; + interface BasemapGallery extends Widget { activeBasemap: Basemap; source: LocalBasemapsSource | PortalBasemapsSource; @@ -7834,13 +9644,63 @@ declare namespace __esri { interface BasemapGalleryProperties extends WidgetProperties { activeBasemap?: BasemapProperties; source?: LocalBasemapsSource | PortalBasemapsSource; - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: BasemapGalleryViewModelProperties; } + interface BasemapGalleryItem { + basemap: Basemap; + error: Error; + state: string; + view: MapView | SceneView; + } + + export const BasemapGalleryItem: BasemapGalleryItem; + + interface BasemapGalleryViewModel extends Accessor { + activeBasemap: Basemap; + items: Collection<BasemapGalleryItem>; + source: LocalBasemapsSource | PortalBasemapsSource; + state: string; + view: MapView | SceneView; + + basemapEquals(basemap1: Basemap, basemap2: Basemap): boolean; + } + + interface BasemapGalleryViewModelConstructor { + new(properties?: BasemapGalleryViewModelProperties): BasemapGalleryViewModel; + } + + export const BasemapGalleryViewModel: BasemapGalleryViewModelConstructor; + + interface BasemapGalleryViewModelProperties { + activeBasemap?: BasemapProperties; + items?: CollectionProperties<BasemapGalleryItem>; + source?: LocalBasemapsSource | PortalBasemapsSource; + state?: string; + view?: MapViewProperties | SceneViewProperties; + } + + interface LocalBasemapsSource { + basemaps: Collection<Basemap>; + state: string; + } + + export const LocalBasemapsSource: LocalBasemapsSource; + + interface PortalBasemapsSource { + basemaps: Collection<Basemap>; + filterFunction: Function; + portal: Portal; + query: any | string; + state: string; + } + + export const PortalBasemapsSource: PortalBasemapsSource; + interface BasemapToggle extends Widget { activeBasemap: Basemap; - nextBasemap: Basemap; + nextBasemap: Basemap | string; titleVisible: boolean; view: MapView | SceneView; viewModel: BasemapToggleViewModel; @@ -7857,27 +9717,52 @@ declare namespace __esri { interface BasemapToggleProperties extends WidgetProperties { activeBasemap?: BasemapProperties; - nextBasemap?: Basemap | string; + nextBasemap?: BasemapProperties | string; titleVisible?: boolean; - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: BasemapToggleViewModelProperties; } + interface BasemapToggleViewModel extends Accessor, Evented { + activeBasemap: Basemap; + nextBasemap: Basemap | string; + state: string; + view: MapView | SceneView; + + toggle(): void; + } + + interface BasemapToggleViewModelConstructor { + new(properties?: BasemapToggleViewModelProperties): BasemapToggleViewModel; + + + getThumbnailUrl(basemap: Basemap): string; + } + + export const BasemapToggleViewModel: BasemapToggleViewModelConstructor; + + interface BasemapToggleViewModelProperties { + activeBasemap?: BasemapProperties; + nextBasemap?: BasemapProperties | string; + state?: string; + view?: MapViewProperties | SceneViewProperties; + } + interface ColorSlider extends Accessor, Widgette { handlesVisible: boolean; - histogram: any; + histogram: HistogramResult; histogramVisible: boolean; histogramWidth: number; labelsVisible: boolean; maxValue: number; minValue: number; numHandles: number; - statistics: any; + statistics: ColorSliderStatistics; statisticsVisible: boolean; syncedHandles: boolean; ticksVisible: boolean; values: ColorSliderValues[]; - visualVariable: any; + visualVariable: ColorVisualVariable; } interface ColorSliderConstructor { @@ -7888,19 +9773,32 @@ declare namespace __esri { interface ColorSliderProperties extends WidgetteProperties { handlesVisible?: boolean; - histogram?: any; + histogram?: HistogramResult; histogramVisible?: boolean; histogramWidth?: number; labelsVisible?: boolean; maxValue?: number; minValue?: number; numHandles?: number; - statistics?: any; + statistics?: ColorSliderStatistics; statisticsVisible?: boolean; syncedHandles?: boolean; ticksVisible?: boolean; values?: ColorSliderValues[]; - visualVariable?: any; + visualVariable?: ColorVisualVariable; + } + + export interface ColorSliderStatistics { + avg: number; + max: number; + min: number; + stddev: number; + } + + export interface ColorSliderValues { + color: Color; + value: number; + label: string; } interface Compass extends Widget { @@ -7918,15 +9816,35 @@ declare namespace __esri { export const Compass: CompassConstructor; interface CompassProperties extends WidgetProperties { - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: CompassViewModelProperties; } + interface CompassViewModel extends Accessor { + orientation: any; + state: string; + view: MapView | SceneView; + + reset(): void; + } + + interface CompassViewModelConstructor { + new(properties?: CompassViewModelProperties): CompassViewModel; + } + + export const CompassViewModel: CompassViewModelConstructor; + + interface CompassViewModelProperties { + orientation?: any; + state?: string; + view?: MapViewProperties | SceneViewProperties; + } + interface Expand extends Widget { autoCollapse: boolean; collapseIconClass: string; collapseTooltip: string; - content: any; + content: Node | string | Widget; expanded: boolean; expandIconClass: string; expandTooltip: string; @@ -7950,15 +9868,35 @@ declare namespace __esri { autoCollapse?: boolean; collapseIconClass?: string; collapseTooltip?: string; - content?: any | string | Widget; + content?: Node | string | WidgetProperties; expanded?: boolean; expandIconClass?: string; expandTooltip?: string; iconNumber?: string; - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: ExpandViewModelProperties; } + interface ExpandViewModel extends Accessor { + autoCollapse: boolean; + expanded: boolean; + state: string; + view: MapView | SceneView; + } + + interface ExpandViewModelConstructor { + new(properties?: ExpandViewModelProperties): ExpandViewModel; + } + + export const ExpandViewModel: ExpandViewModelConstructor; + + interface ExpandViewModelProperties { + autoCollapse?: boolean; + expanded?: boolean; + state?: string; + view?: MapViewProperties | SceneViewProperties; + } + interface Home extends Widget { view: MapView | SceneView; viewModel: HomeViewModel; @@ -7975,15 +9913,36 @@ declare namespace __esri { export const Home: HomeConstructor; interface HomeProperties extends WidgetProperties { - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: HomeViewModelProperties; viewpoint?: ViewpointProperties; } + interface HomeViewModel extends Accessor, Evented { + state: string; + view: MapView | SceneView; + viewpoint: Viewpoint; + + go(): void; + } + + interface HomeViewModelConstructor { + new(properties?: HomeViewModelProperties): HomeViewModel; + } + + export const HomeViewModel: HomeViewModelConstructor; + + interface HomeViewModelProperties { + state?: string; + view?: MapViewProperties | SceneViewProperties; + viewpoint?: ViewpointProperties; + } + interface LayerList extends Widget { createActionsFunction: Function; listItemCreatedFunction: Function; - operationalItems: Collection; + operationalItems: Collection<ListItem>; + statusIndicatorsVisible: boolean; view: MapView | SceneView; viewModel: LayerListViewModel; @@ -8000,11 +9959,61 @@ declare namespace __esri { interface LayerListProperties extends WidgetProperties { createActionsFunction?: Function; listItemCreatedFunction?: Function; - operationalItems?: Collection | any[]; - view?: MapView | SceneView; + operationalItems?: CollectionProperties<ListItem>; + statusIndicatorsVisible?: boolean; + view?: MapViewProperties | SceneViewProperties; viewModel?: LayerListViewModelProperties; } + interface LayerListViewModel extends Accessor { + createActionsFunction: Function; + listItemCreatedFunction: Function; + operationalItems: Collection<ListItem>; + state: string; + view: MapView | SceneView; + + triggerAction(action: Action, item: ListItem): void; + } + + interface LayerListViewModelConstructor { + new(properties?: LayerListViewModelProperties): LayerListViewModel; + } + + export const LayerListViewModel: LayerListViewModelConstructor; + + interface LayerListViewModelProperties { + createActionsFunction?: Function; + listItemCreatedFunction?: Function; + operationalItems?: CollectionProperties<ListItem>; + state?: string; + view?: MapViewProperties | SceneViewProperties; + } + + interface ListItem { + actionsOpen: boolean; + actionsSections: Collection<Collection<Action>>; + children: Collection<ListItem>; + error: Error; + layer: Layer; + layerView: LayerView; + open: boolean; + parent: ListItem; + title: string; + updating: boolean; + view: MapView | SceneView; + visibilityMode: string; + visible: boolean; + visibleAtCurrentScale: boolean; + + clone(): ListItem; + } + + interface ListItemConstructor { + new(): ListItem; + } + + export const ListItem: ListItemConstructor; + interface Legend extends Widget { layerInfos: LegendLayerInfos[]; view: MapView | SceneView; @@ -8020,7 +10029,12 @@ declare namespace __esri { interface LegendProperties extends WidgetProperties { layerInfos?: LegendLayerInfos[]; - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; + } + + export interface LegendLayerInfos { + title?: string; + layer: Layer; } interface Locate extends Widget { @@ -8044,10 +10058,26 @@ declare namespace __esri { geolocationOptions?: any; goToLocationEnabled?: boolean; graphic?: GraphicProperties; - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: LocateViewModelProperties; } + interface LocateViewModel extends Accessor, Evented, GeolocationPositioning { + state: string; + + locate(): IPromise<any>; + } + + interface LocateViewModelConstructor { + new(properties?: LocateViewModelProperties): LocateViewModel; + } + + export const LocateViewModel: LocateViewModelConstructor; + + interface LocateViewModelProperties extends GeolocationPositioningProperties { + state?: string; + } + interface NavigationToggle extends Widget { layout: string; view: SceneView; @@ -8069,9 +10099,31 @@ declare namespace __esri { viewModel?: NavigationToggleViewModelProperties; } - interface Popup extends Accessor, Widgette, Evented { - actions: Collection; - content: string; + interface NavigationToggleViewModel extends Accessor { + navigationMode: string; + state: string; + view: SceneView; + + toggle(): void; + } + + interface NavigationToggleViewModelConstructor { + new(properties?: NavigationToggleViewModelProperties): NavigationToggleViewModel; + } + + export const NavigationToggleViewModel: NavigationToggleViewModelConstructor; + + interface NavigationToggleViewModelProperties { + navigationMode?: string; + state?: string; + view?: SceneViewProperties; + } + + interface Popup extends Widget, Evented { + actions: Collection<Action>; + autoCloseEnabled: boolean; + collapsed: boolean; + content: string | Node; currentDockPosition: string; dockEnabled: boolean; dockOptions: PopupDockOptions; @@ -8085,12 +10137,14 @@ declare namespace __esri { title: string; view: MapView | SceneView; viewModel: PopupViewModel; + visible: boolean; clear(): void; close(): void; next(): PopupViewModel; open(options?: PopupOpenOptions): void; previous(): PopupViewModel; + render(): any; reposition(): void; triggerAction(actionIndex: number): void; } @@ -8101,9 +10155,11 @@ declare namespace __esri { export const Popup: PopupConstructor; - interface PopupProperties extends WidgetteProperties { - actions?: Collection | any[]; - content?: string | any; + interface PopupProperties extends WidgetProperties { + actions?: CollectionProperties<ActionProperties>; + autoCloseEnabled?: boolean; + collapsed?: boolean; + content?: string | Node; currentDockPosition?: string; dockEnabled?: boolean; dockOptions?: PopupDockOptions; @@ -8115,8 +10171,80 @@ declare namespace __esri { selectedFeature?: GraphicProperties; selectedFeatureIndex?: number; title?: string; - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: PopupViewModelProperties; + visible?: boolean; + } + + interface PopupViewModel extends Accessor, Evented { + actions: Collection<Collection<Action>>; + autoCloseEnabled: boolean; + content: string | Node; + featureCount: number; + features: Graphic[]; + highlightEnabled: boolean; + location: Point; + pendingPromisesCount: number; + promiseCount: number; + promises: IPromise<any>[]; + selectedFeature: Graphic; + selectedFeatureIndex: number; + state: string; + title: string; + view: MapView | SceneView; + visible: boolean; + + clear(): void; + next(): PopupViewModel; + previous(): PopupViewModel; + triggerAction(actionIndex: number): void; + } + + interface PopupViewModelConstructor { + new(properties?: PopupViewModelProperties): PopupViewModel; + } + + export const PopupViewModel: PopupViewModelConstructor; + + interface PopupViewModelProperties { + actions?: CollectionProperties<CollectionProperties<ActionProperties>>; + autoCloseEnabled?: boolean; + content?: string | Node; + featureCount?: number; + features?: GraphicProperties[]; + highlightEnabled?: boolean; + location?: PointProperties; + pendingPromisesCount?: number; + promiseCount?: number; + promises?: IPromise<any>[]; + selectedFeature?: GraphicProperties; + selectedFeatureIndex?: number; + state?: string; + title?: string; + view?: MapViewProperties | SceneViewProperties; + visible?: boolean; + } + + export interface PopupDockOptions { + breakpoint?: boolean | PopupDockOptionsBreakpoint; + buttonEnabled?: boolean; + position?: string | Function; + } + + export interface PopupDockOptionsBreakpoint { + width?: number; + height?: number; + } + + export interface PopupOpenOptions { + title?: string; + content?: string; + location?: Geometry; + features?: Graphic[]; + promises?: IPromise<any>[]; + featureMenuOpen?: boolean; + updateLocationEnabled?: boolean; + collapsed?: boolean; } interface Print extends Widget { @@ -8139,6 +10267,26 @@ declare namespace __esri { viewModel?: PrintViewModelProperties; } + interface PrintViewModel extends Accessor { + printServiceUrl: string; + updateDelay: number; + view: MapView; + + print(printTemplate: PrintTemplate): IPromise<any>; + } + + interface PrintViewModelConstructor { + new(properties?: PrintViewModelProperties): PrintViewModel; + } + + export const PrintViewModel: PrintViewModelConstructor; + + interface PrintViewModelProperties { + printServiceUrl?: string; + updateDelay?: number; + view?: MapViewProperties; + } + interface ScaleBar extends Widget { style: string; unit: string; @@ -8161,12 +10309,26 @@ declare namespace __esri { viewModel?: ScaleBarViewModelProperties; } + interface ScaleBarViewModel extends Accessor { + view: MapView; + } + + interface ScaleBarViewModelConstructor { + new(properties?: ScaleBarViewModelProperties): ScaleBarViewModel; + } + + export const ScaleBarViewModel: ScaleBarViewModelConstructor; + + interface ScaleBarViewModelProperties { + view?: MapViewProperties; + } + interface Search extends Widget { activeSource: FeatureLayer | Locator; activeSourceIndex: number; allPlaceholder: string; autoSelect: boolean; - defaultSource: any | any; + defaultSource: LocatorSource | FeatureLayerSource; maxResults: number; maxSuggestions: number; minSuggestCharacters: number; @@ -8179,9 +10341,9 @@ declare namespace __esri { searchAllEnabled: boolean; searching: boolean; searchTerm: string; - selectedResult: any; - sources: Collection; - suggestions: any[]; + selectedResult: SearchResult; + sources: Collection<FeatureLayerSource | LocatorSource>; + suggestions: SuggestResult[]; suggestionsEnabled: boolean; view: MapView | SceneView; viewModel: SearchViewModel; @@ -8190,8 +10352,8 @@ declare namespace __esri { clear(): void; focus(): void; render(): any; - search(searchTerm?: string | Geometry | any | number[][]): IPromise<any>; - suggest(value?: string): IPromise<any>; + search(searchTerm?: string | Geometry | SuggestResult | number[][]): IPromise<SearchResponse>; + suggest(value?: string): IPromise<SuggestResponse>; } interface SearchConstructor { @@ -8201,11 +10363,11 @@ declare namespace __esri { export const Search: SearchConstructor; interface SearchProperties extends WidgetProperties { - activeSource?: FeatureLayer | Locator; + activeSource?: FeatureLayerProperties | LocatorProperties; activeSourceIndex?: number; allPlaceholder?: string; autoSelect?: boolean; - defaultSource?: any | any; + defaultSource?: LocatorSource | FeatureLayerSource; maxResults?: number; maxSuggestions?: number; minSuggestCharacters?: number; @@ -8218,17 +10380,366 @@ declare namespace __esri { searchAllEnabled?: boolean; searching?: boolean; searchTerm?: string; - selectedResult?: any; - sources?: Collection | any[]; - suggestions?: any[]; + selectedResult?: SearchResult; + sources?: CollectionProperties<FeatureLayerSource | LocatorSource>; + suggestions?: SuggestResult[]; suggestionsEnabled?: boolean; - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: SearchViewModelProperties; } + interface SearchViewModel extends Accessor, Evented { + activeSource: FeatureLayer | Locator; + activeSourceIndex: number; + allPlaceholder: string; + autoSelect: boolean; + defaultSource: SearchViewModelFeatureLayerSource | SearchViewModelLocatorSource; + maxInputLength: number; + maxResults: number; + maxSuggestions: number; + minSuggestCharacters: number; + placeholder: string; + popupEnabled: boolean; + popupOpenOnSelect: boolean; + popupTemplate: PopupTemplate; + resultGraphic: Graphic; + resultGraphicEnabled: boolean; + results: any[]; + searchAllEnabled: boolean; + searchTerm: string; + selectedResult: any; + sources: Collection<FeatureLayerSource | LocatorSource>; + suggestionDelay: number; + suggestions: SearchViewModelSuggestResult[]; + suggestionsEnabled: boolean; + view: MapView | SceneView; + + clear(): void; + search(searchTerm?: string | Geometry | SearchViewModelSuggestResult | number[][]): IPromise<SearchViewModelSearchResponse>; + suggest(value?: string): IPromise<SearchViewModelSuggestResponse>; + + on(name: "search-clear", eventHandler: SearchViewModelSearchClearEventHandler): IHandle; + on(name: "search-clear", modifiers: string[], eventHandler: SearchViewModelSearchClearEventHandler): IHandle; + on(name: "search-start", eventHandler: SearchViewModelSearchStartEventHandler): IHandle; + on(name: "search-start", modifiers: string[], eventHandler: SearchViewModelSearchStartEventHandler): IHandle; + on(name: "suggest-start", eventHandler: SearchViewModelSuggestStartEventHandler): IHandle; + on(name: "suggest-start", modifiers: string[], eventHandler: SearchViewModelSuggestStartEventHandler): IHandle; + on(name: "load", eventHandler: SearchViewModelLoadEventHandler): IHandle; + on(name: "load", modifiers: string[], eventHandler: SearchViewModelLoadEventHandler): IHandle; + on(name: "search-complete", eventHandler: SearchViewModelSearchCompleteEventHandler): IHandle; + on(name: "search-complete", modifiers: string[], eventHandler: SearchViewModelSearchCompleteEventHandler): IHandle; + on(name: "select-result", eventHandler: SearchViewModelSelectResultEventHandler): IHandle; + on(name: "select-result", modifiers: string[], eventHandler: SearchViewModelSelectResultEventHandler): IHandle; + on(name: "suggest-complete", eventHandler: SearchViewModelSuggestCompleteEventHandler): IHandle; + on(name: "suggest-complete", modifiers: string[], eventHandler: SearchViewModelSuggestCompleteEventHandler): IHandle; + } + + interface SearchViewModelConstructor { + new(properties?: SearchViewModelProperties): SearchViewModel; + } + + export const SearchViewModel: SearchViewModelConstructor; + + interface SearchViewModelProperties { + activeSource?: FeatureLayerProperties | LocatorProperties; + activeSourceIndex?: number; + allPlaceholder?: string; + autoSelect?: boolean; + defaultSource?: SearchViewModelFeatureLayerSource | SearchViewModelLocatorSource; + maxInputLength?: number; + maxResults?: number; + maxSuggestions?: number; + minSuggestCharacters?: number; + placeholder?: string; + popupEnabled?: boolean; + popupOpenOnSelect?: boolean; + popupTemplate?: PopupTemplateProperties; + resultGraphic?: GraphicProperties; + resultGraphicEnabled?: boolean; + results?: any[]; + searchAllEnabled?: boolean; + searchTerm?: string; + selectedResult?: any; + sources?: CollectionProperties<FeatureLayerSource | LocatorSource>; + suggestionDelay?: number; + suggestions?: SearchViewModelSuggestResult[]; + suggestionsEnabled?: boolean; + view?: MapViewProperties | SceneViewProperties; + } + + export interface SearchViewModelFeatureLayerSource { + popup: Popup; + autoNavigate: boolean; + exactMatch: boolean; + featureLayer: FeatureLayer; + filter: SearchViewModelFeatureLayerSourceFilter; + maxResults: number; + maxSuggestions: number; + minSuggestCharacters: number; + name: string; + outFields: string[]; + placeholder: string; + displayField: string; + popupEnabled: boolean; + popupOpenOnSelect: boolean; + prefix: string; + resultGraphicEnabled: boolean; + resultSymbol: Symbol; + searchFields: string[]; + suffix: string; + suggestionsEnabled: boolean; + suggestionTemplate: string; + withinViewEnabled: boolean; + zoomScale: number; + } + + export interface SearchViewModelLoadEvent { + } + + export interface SearchViewModelLocatorSource { + placeholder: string; + autoNavigate: boolean; + countryCode: string; + filter: SearchViewModelLocatorSourceFilter; + localSearchOptions: SearchViewModelLocatorSourceLocalSearchOptions; + locationToAddressDistance: number; + locator: Locator; + maxResults: number; + maxSuggestions: number; + minSuggestCharacters: number; + name: string; + outFields: string[]; + categories: string[]; + popup: Popup; + popupEnabled: boolean; + popupOpenOnSelect: boolean; + prefix: string; + resultGraphicEnabled: boolean; + resultSymbol: Symbol; + searchTemplate: string; + singleLineFieldName: string; + suggestionsEnabled: boolean; + suffix: string; + withinViewEnabled: boolean; + zoomScale: number; + } + + export interface SearchViewModelSearchClearEvent { + } + + export interface SearchViewModelSearchCompleteEvent { + activeSourceIndex: number; + errors: Error[]; + numResults: number; + results: SearchViewModelSearchCompleteEventResults[]; + searchTerm: string; + } + + export interface SearchViewModelSearchResponse { + activeSourceIndex: number; + errors: Error[]; + numResults: number; + searchTerm: string; + results: SearchViewModelSearchResponseResults[]; + } + + export interface SearchViewModelSearchResult { + extent: Extent; + feature: Graphic; + name: string; + } + + export interface SearchViewModelSearchStartEvent { + } + + export interface SearchViewModelSelectResultEvent { + result: SearchViewModelSelectResultEventResult; + source: any; + sourceIndex: number; + } + + export interface SearchViewModelSuggestCompleteEvent { + activeSourceIndex: number; + errors: Error[]; + numResults: number; + results: SearchViewModelSuggestCompleteEventResults[]; + searchTerm: string; + } + + export interface SearchViewModelSuggestResponse { + activeSourceIndex: number; + errors: Error[]; + numResults: number; + searchTerm: string; + results: SearchViewModelSuggestResponseResults[]; + } + + export interface SearchViewModelSuggestResult { + key: string; + text: string; + sourceIndex: number; + } + + export interface SearchViewModelSuggestStartEvent { + } + + export interface SearchViewModelFeatureLayerSourceFilter { + where: string; + geometry: Geometry; + } + + export interface SearchViewModelLocatorSourceFilter { + where: string; + geometry: Geometry; + } + + export interface SearchViewModelLocatorSourceLocalSearchOptions { + distance: number; + minScale: number; + } + + export interface SearchViewModelSearchCompleteEventResults { + results: SearchResult[]; + sourceIndex: number; + source: any[]; + } + + export interface SearchViewModelSearchResponseResults { + results: SearchViewModelSearchResult[]; + sourceIndex: number; + source: any; + } + + export interface SearchViewModelSelectResultEventResult { + extent: Extent; + feature: Graphic; + name: string; + } + + export interface SearchViewModelSuggestCompleteEventResults { + results: SearchViewModelSuggestResult[]; + sourceIndex: number; + source: any; + } + + export interface SearchViewModelSuggestResponseResults { + results: SearchViewModelSuggestResult[]; + sourceIndex: number; + source: any; + } + + export interface FeatureLayerSource { + popup: Popup; + autoNavigate: boolean; + exactMatch: boolean; + featureLayer: FeatureLayer; + filter: FeatureLayerSourceFilter; + maxResults: number; + maxSuggestions: number; + minSuggestCharacters: number; + name: string; + outFields: string[]; + placeholder: string; + displayField: string; + popupEnabled: boolean; + popupOpenOnSelect: boolean; + prefix: string; + resultGraphicEnabled: boolean; + resultSymbol: Symbol; + searchFields: string[]; + suffix: string; + suggestionsEnabled: boolean; + suggestionTemplate: string; + withinViewEnabled: boolean; + zoomScale: number; + } + + export interface LocatorSource { + placeholder: string; + autoNavigate: boolean; + countryCode: string; + filter: LocatorSourceFilter; + localSearchOptions: LocatorSourceLocalSearchOptions; + locationToAddressDistance: number; + locator: Locator; + maxResults: number; + maxSuggestions: number; + minSuggestCharacters: number; + name: string; + outFields: string[]; + categories: string[]; + popup: Popup; + popupEnabled: boolean; + popupOpenOnSelect: boolean; + prefix: string; + resultGraphicEnabled: boolean; + resultSymbol: Symbol; + searchTemplate: string; + singleLineFieldName: string; + suggestionsEnabled: boolean; + suffix: string; + withinViewEnabled: boolean; + zoomScale: number; + } + + export interface SearchResponse { + activeSourceIndex: number; + errors: Error[]; + numResults: number; + searchTerm: string; + results: SearchResponseResults[]; + } + + export interface SearchResult { + extent: Extent; + feature: Graphic; + name: string; + } + + export interface SuggestResponse { + activeSourceIndex: number; + errors: Error[]; + numResults: number; + searchTerm: string; + results: SuggestResponseResults[]; + } + + export interface SuggestResult { + key: string; + text: string; + sourceIndex: number; + } + + export interface FeatureLayerSourceFilter { + where: string; + geometry: Geometry; + } + + export interface LocatorSourceFilter { + where: string; + geometry: Geometry; + } + + export interface LocatorSourceLocalSearchOptions { + distance: number; + minScale: number; + } + + export interface SearchResponseResults { + results: SearchResult[]; + sourceIndex: number; + source: any; + } + + export interface SuggestResponseResults { + results: SuggestResult[]; + sourceIndex: number; + source: any; + } + interface SizeSlider extends Accessor, Widgette { handlesVisible: boolean; - histogram: any; + histogram: HistogramResult; histogramVisible: boolean; histogramWidth: number; labelsVisible: boolean; @@ -8236,11 +10747,12 @@ declare namespace __esri { maxValue: number; minSize: number; minValue: number; - statistics: any; + statistics: SizeSliderStatistics; statisticsVisible: boolean; + symbol: SimpleMarkerSymbol | SimpleLineSymbol; ticksVisible: boolean; values: number[]; - visualVariable: any; + visualVariable: SizeVisualVariable; } interface SizeSliderConstructor { @@ -8251,7 +10763,7 @@ declare namespace __esri { interface SizeSliderProperties extends WidgetteProperties { handlesVisible?: boolean; - histogram?: any; + histogram?: HistogramResult; histogramVisible?: boolean; histogramWidth?: number; labelsVisible?: boolean; @@ -8259,13 +10771,77 @@ declare namespace __esri { maxValue?: number; minSize?: number; minValue?: number; - statistics?: any; + statistics?: SizeSliderStatistics; statisticsVisible?: boolean; + symbol?: SimpleMarkerSymbolProperties | SimpleLineSymbolProperties; ticksVisible?: boolean; values?: number[]; - visualVariable?: any; + visualVariable?: SizeVisualVariable; } + export interface SizeSliderStatistics { + avg?: number; + max: number; + min: number; + } + + interface SketchViewModel extends Accessor, Evented { + graphic: Graphic; + pointSymbol: SimpleMarkerSymbol; + polygonSymbol: SimpleFillSymbol; + polylineSymbol: SimpleLineSymbol; + state: string; + view: MapView; + + create(drawAction: string): void; + reset(): void; + } + + interface SketchViewModelConstructor { + new(properties?: SketchViewModelProperties): SketchViewModel; + } + + export const SketchViewModel: SketchViewModelConstructor; + + interface SketchViewModelProperties { + graphic?: GraphicProperties; + pointSymbol?: SimpleMarkerSymbolProperties; + polygonSymbol?: SimpleFillSymbolProperties; + polylineSymbol?: SimpleLineSymbolProperties; + state?: string; + view?: MapViewProperties; + } + + interface GeolocationPositioning { + geolocationOptions: any; + goToLocationEnabled: boolean; + graphic: Graphic; + view: MapView | SceneView; + } + + interface GeolocationPositioningConstructor { + new(): GeolocationPositioning; + } + + export const GeolocationPositioning: GeolocationPositioningConstructor; + + interface GeolocationPositioningProperties { + geolocationOptions?: any; + goToLocationEnabled?: boolean; + graphic?: GraphicProperties; + view?: MapViewProperties | SceneViewProperties; + } + + interface widget { + accessibleHandler(): Function; + join(...classNames: string[]): string; + renderable(propertyName?: string | string[]): Function; + tsx(selector: string, properties?: any, children?: any): any; + vmEvent(eventNames: string | string[]): Function; + } + + export const widget: widget; + interface Track extends Widget { geolocationOptions: any; goToLocationEnabled: boolean; @@ -8290,458 +10866,10 @@ declare namespace __esri { goToLocationEnabled?: boolean; graphic?: GraphicProperties; tracking?: boolean; - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; viewModel?: TrackViewModelProperties; } - interface UnivariateColorSizeSlider extends Accessor, Widgette { - handlesVisible: boolean; - histogram: any; - histogramVisible: boolean; - histogramWidth: number; - labelsVisible: boolean; - maxSize: number; - maxValue: number; - minSize: number; - minValue: number; - statistics: any; - statisticsVisible: boolean; - ticksVisible: boolean; - values: number[]; - visualVariables: any[]; - } - - interface UnivariateColorSizeSliderConstructor { - new(properties?: UnivariateColorSizeSliderProperties): UnivariateColorSizeSlider; - } - - export const UnivariateColorSizeSlider: UnivariateColorSizeSliderConstructor; - - interface UnivariateColorSizeSliderProperties extends WidgetteProperties { - handlesVisible?: boolean; - histogram?: any; - histogramVisible?: boolean; - histogramWidth?: number; - labelsVisible?: boolean; - maxSize?: number; - maxValue?: number; - minSize?: number; - minValue?: number; - statistics?: any; - statisticsVisible?: boolean; - ticksVisible?: boolean; - values?: number[]; - visualVariables?: any[]; - } - - interface Widget extends Accessor, Evented { - container: string; - destroyed: boolean; - id: string; - - destroy(): void; - own(handles: any[]): void; - postInitialize(): void; - renderNow(): void; - scheduleRender(): void; - startup(): void; - } - - interface WidgetConstructor { - new(properties?: WidgetProperties): Widget; - } - - export const Widget: WidgetConstructor; - - interface WidgetProperties { - container?: string | any; - destroyed?: boolean; - id?: string; - } - - interface Zoom extends Widget { - view: MapView | SceneView; - viewModel: ZoomViewModel; - - render(): any; - zoomIn(): void; - zoomOut(): void; - } - - interface ZoomConstructor { - new(properties?: ZoomProperties): Zoom; - } - - export const Zoom: ZoomConstructor; - - interface ZoomProperties extends WidgetProperties { - view?: MapView | SceneView; - viewModel?: ZoomViewModelProperties; - } - - interface AttributionViewModel { - attributionText: string; - itemDelimiter: string; - state: string; - view: MapView | SceneView; - } - - interface AttributionViewModelConstructor { - new(properties?: any): AttributionViewModel; - } - - export const AttributionViewModel: AttributionViewModelConstructor; - - interface BasemapGalleryViewModel extends Accessor { - activeBasemap: Basemap; - items: Collection; - source: LocalBasemapsSource | PortalBasemapsSource; - state: string; - view: MapView | SceneView; - - basemapEquals(basemap1: Basemap, basemap2: Basemap): boolean; - } - - interface BasemapGalleryViewModelConstructor { - new(properties?: BasemapGalleryViewModelProperties): BasemapGalleryViewModel; - } - - export const BasemapGalleryViewModel: BasemapGalleryViewModelConstructor; - - interface BasemapGalleryViewModelProperties { - activeBasemap?: BasemapProperties; - items?: Collection | any[]; - source?: LocalBasemapsSource | PortalBasemapsSource; - state?: string; - view?: MapView | SceneView; - } - - interface BasemapToggleViewModel extends Accessor, Evented { - activeBasemap: Basemap; - nextBasemap: Basemap; - state: string; - view: MapView | SceneView; - - toggle(): void; - } - - interface BasemapToggleViewModelConstructor { - new(properties?: BasemapToggleViewModelProperties): BasemapToggleViewModel; - - - getThumbnailUrl(basemap: Basemap): string; - } - - export const BasemapToggleViewModel: BasemapToggleViewModelConstructor; - - interface BasemapToggleViewModelProperties { - activeBasemap?: BasemapProperties; - nextBasemap?: Basemap | string; - state?: string; - view?: MapView | SceneView; - } - - interface CompassViewModel extends Accessor { - orientation: any; - state: string; - view: MapView | SceneView; - - reset(): void; - } - - interface CompassViewModelConstructor { - new(properties?: CompassViewModelProperties): CompassViewModel; - } - - export const CompassViewModel: CompassViewModelConstructor; - - interface CompassViewModelProperties { - orientation?: any; - state?: string; - view?: MapView | SceneView; - } - - interface ExpandViewModel extends Accessor { - autoCollapse: boolean; - expanded: boolean; - state: string; - view: MapView | SceneView; - } - - interface ExpandViewModelConstructor { - new(properties?: ExpandViewModelProperties): ExpandViewModel; - } - - export const ExpandViewModel: ExpandViewModelConstructor; - - interface ExpandViewModelProperties { - autoCollapse?: boolean; - expanded?: boolean; - state?: string; - view?: MapView | SceneView; - } - - interface HomeViewModel extends Accessor, Evented { - state: string; - view: MapView | SceneView; - viewpoint: Viewpoint; - - go(): void; - } - - interface HomeViewModelConstructor { - new(properties?: HomeViewModelProperties): HomeViewModel; - } - - export const HomeViewModel: HomeViewModelConstructor; - - interface HomeViewModelProperties { - state?: string; - view?: MapView | SceneView; - viewpoint?: ViewpointProperties; - } - - interface LayerListViewModel extends Accessor { - createActionsFunction: Function; - listItemCreatedFunction: Function; - operationalItems: Collection; - state: string; - view: MapView | SceneView; - - triggerAction(action: Action, item: ListItem): void; - } - - interface LayerListViewModelConstructor { - new(properties?: LayerListViewModelProperties): LayerListViewModel; - } - - export const LayerListViewModel: LayerListViewModelConstructor; - - interface LayerListViewModelProperties { - createActionsFunction?: Function; - listItemCreatedFunction?: Function; - operationalItems?: Collection | any[]; - state?: string; - view?: MapView | SceneView; - } - - interface ListItem { - actionsOpen: boolean; - actionsSections: Collection; - children: Collection; - error: Error; - layer: Layer; - layerView: LayerView; - open: boolean; - title: string; - updating: boolean; - view: MapView | SceneView; - visibilityMode: string; - visible: boolean; - visibleAtCurrentScale: boolean; - - clone(): this; - } - - interface ListItemConstructor { - new(): ListItem; - } - - export const ListItem: ListItemConstructor; - - interface LocateViewModel extends Accessor, Evented, GeolocationPositioning { - state: string; - - locate(): IPromise<any>; - } - - interface LocateViewModelConstructor { - new(properties?: LocateViewModelProperties): LocateViewModel; - } - - export const LocateViewModel: LocateViewModelConstructor; - - interface LocateViewModelProperties extends GeolocationPositioningProperties { - state?: string; - } - - interface NavigationToggleViewModel extends Accessor { - navigationMode: string; - state: string; - view: SceneView; - - toggle(): void; - } - - interface NavigationToggleViewModelConstructor { - new(properties?: NavigationToggleViewModelProperties): NavigationToggleViewModel; - } - - export const NavigationToggleViewModel: NavigationToggleViewModelConstructor; - - interface NavigationToggleViewModelProperties { - navigationMode?: string; - state?: string; - view?: SceneViewProperties; - } - - interface PrintViewModel extends Accessor { - printServiceUrl: string; - updateDelay: number; - view: MapView; - - print(printTemplate: PrintTemplate): IPromise<any>; - } - - interface PrintViewModelConstructor { - new(properties?: PrintViewModelProperties): PrintViewModel; - } - - export const PrintViewModel: PrintViewModelConstructor; - - interface PrintViewModelProperties { - printServiceUrl?: string; - updateDelay?: number; - view?: MapViewProperties; - } - - interface PopupViewModel extends Accessor, Evented { - actions: Collection; - content: string; - featureCount: number; - features: Graphic[]; - highlightEnabled: boolean; - location: Point; - pendingPromisesCount: number; - promises: IPromise<any>[]; - selectedFeature: Graphic; - selectedFeatureIndex: number; - state: string; - title: string; - view: MapView | SceneView; - - clear(): void; - next(): PopupViewModel; - previous(): PopupViewModel; - triggerAction(actionIndex: number): void; - } - - interface PopupViewModelConstructor { - new(properties?: PopupViewModelProperties): PopupViewModel; - } - - export const PopupViewModel: PopupViewModelConstructor; - - interface PopupViewModelProperties { - actions?: Collection | any[]; - content?: string | any; - featureCount?: number; - features?: GraphicProperties[]; - highlightEnabled?: boolean; - location?: PointProperties; - pendingPromisesCount?: number; - promises?: IPromise<any>[]; - selectedFeature?: GraphicProperties; - selectedFeatureIndex?: number; - state?: string; - title?: string; - view?: MapView | SceneView; - } - - interface ScaleBarViewModel extends Accessor { - view: MapView; - } - - interface ScaleBarViewModelConstructor { - new(properties?: ScaleBarViewModelProperties): ScaleBarViewModel; - } - - export const ScaleBarViewModel: ScaleBarViewModelConstructor; - - interface ScaleBarViewModelProperties { - view?: MapViewProperties; - } - - interface SearchViewModel extends Accessor, Evented { - activeSource: FeatureLayer | Locator; - activeSourceIndex: number; - allPlaceholder: string; - autoSelect: boolean; - defaultSource: any | any; - maxInputLength: number; - maxResults: number; - maxSuggestions: number; - minSuggestCharacters: number; - placeholder: string; - popupEnabled: boolean; - popupOpenOnSelect: boolean; - popupTemplate: PopupTemplate; - resultGraphic: Graphic; - resultGraphicEnabled: boolean; - results: any[]; - searchAllEnabled: boolean; - searchTerm: string; - selectedResult: any; - sources: Collection; - suggestionDelay: number; - suggestions: any[]; - suggestionsEnabled: boolean; - view: MapView | SceneView; - - cancelSuggest(): void; - clear(): void; - search(searchTerm?: string | Geometry | any | number[][]): IPromise<any>; - suggest(value?: string): IPromise<any>; - - on(name: "suggest-complete", eventHandler: SearchViewModelSuggestCompleteEventHandler): IHandle; - on(name: "suggest-complete", modifiers: string[], eventHandler: SearchViewModelSuggestCompleteEventHandler): IHandle; - on(name: "search-clear", eventHandler: SearchViewModelSearchClearEventHandler): IHandle; - on(name: "search-clear", modifiers: string[], eventHandler: SearchViewModelSearchClearEventHandler): IHandle; - on(name: "search-start", eventHandler: SearchViewModelSearchStartEventHandler): IHandle; - on(name: "search-start", modifiers: string[], eventHandler: SearchViewModelSearchStartEventHandler): IHandle; - on(name: "suggest-start", eventHandler: SearchViewModelSuggestStartEventHandler): IHandle; - on(name: "suggest-start", modifiers: string[], eventHandler: SearchViewModelSuggestStartEventHandler): IHandle; - on(name: "load", eventHandler: SearchViewModelLoadEventHandler): IHandle; - on(name: "load", modifiers: string[], eventHandler: SearchViewModelLoadEventHandler): IHandle; - on(name: "search-complete", eventHandler: SearchViewModelSearchCompleteEventHandler): IHandle; - on(name: "search-complete", modifiers: string[], eventHandler: SearchViewModelSearchCompleteEventHandler): IHandle; - on(name: "select-result", eventHandler: SearchViewModelSelectResultEventHandler): IHandle; - on(name: "select-result", modifiers: string[], eventHandler: SearchViewModelSelectResultEventHandler): IHandle; - } - - interface SearchViewModelConstructor { - new(properties?: SearchViewModelProperties): SearchViewModel; - } - - export const SearchViewModel: SearchViewModelConstructor; - - interface SearchViewModelProperties { - activeSource?: FeatureLayer | Locator; - activeSourceIndex?: number; - allPlaceholder?: string; - autoSelect?: boolean; - defaultSource?: any | any; - maxInputLength?: number; - maxResults?: number; - maxSuggestions?: number; - minSuggestCharacters?: number; - placeholder?: string; - popupEnabled?: boolean; - popupOpenOnSelect?: boolean; - popupTemplate?: PopupTemplateProperties; - resultGraphic?: GraphicProperties; - resultGraphicEnabled?: boolean; - results?: any[]; - searchAllEnabled?: boolean; - searchTerm?: string; - selectedResult?: any; - sources?: Collection | any[]; - suggestionDelay?: number; - suggestions?: any[]; - suggestionsEnabled?: boolean; - view?: MapView | SceneView; - } - interface TrackViewModel extends Accessor, Evented, GeolocationPositioning { state: string; tracking: boolean; @@ -8761,6 +10889,119 @@ declare namespace __esri { tracking?: boolean; } + interface UnivariateColorSizeSlider extends Accessor, Widgette { + handlesVisible: boolean; + histogram: HistogramResult; + histogramVisible: boolean; + histogramWidth: number; + labelsVisible: boolean; + maxSize: number; + maxValue: number; + minSize: number; + minValue: number; + statistics: UnivariateColorSizeSliderStatistics; + statisticsVisible: boolean; + ticksVisible: boolean; + values: number[]; + visualVariables: any[]; + } + + interface UnivariateColorSizeSliderConstructor { + new(properties?: UnivariateColorSizeSliderProperties): UnivariateColorSizeSlider; + } + + export const UnivariateColorSizeSlider: UnivariateColorSizeSliderConstructor; + + interface UnivariateColorSizeSliderProperties extends WidgetteProperties { + handlesVisible?: boolean; + histogram?: HistogramResult; + histogramVisible?: boolean; + histogramWidth?: number; + labelsVisible?: boolean; + maxSize?: number; + maxValue?: number; + minSize?: number; + minValue?: number; + statistics?: UnivariateColorSizeSliderStatistics; + statisticsVisible?: boolean; + ticksVisible?: boolean; + values?: number[]; + visualVariables?: any[]; + } + + export interface UnivariateColorSizeSliderStatistics { + avg: number; + max: number; + min: number; + stddev: number; + } + + interface Widget extends Accessor, Evented { + container: string | HTMLElement; + destroyed: boolean; + id: string; + + destroy(): void; + own(handles: WatchHandle | WatchHandle[]): void; + postInitialize(): void; + renderNow(): void; + scheduleRender(): void; + startup(): void; + } + + interface WidgetConstructor { + new(properties?: WidgetProperties): Widget; + } + + export const Widget: WidgetConstructor; + + interface WidgetProperties { + container?: string | HTMLElement; + destroyed?: boolean; + id?: string; + } + + interface Widgette { + container: string | HTMLElement; + visible: boolean; + + destroy(): void; + on(type: string, listener: Function): any; + } + + interface WidgetteConstructor { + new(): Widgette; + } + + export const Widgette: WidgetteConstructor; + + interface WidgetteProperties { + container?: string | HTMLElement; + visible?: boolean; + } + + interface Zoom extends Widget { + layout: string; + view: MapView | SceneView; + viewModel: ZoomViewModel; + + render(): any; + zoomIn(): void; + zoomOut(): void; + } + + interface ZoomConstructor { + new(properties?: ZoomProperties): Zoom; + } + + export const Zoom: ZoomConstructor; + + interface ZoomProperties extends WidgetProperties { + layout?: string; + view?: MapViewProperties | SceneViewProperties; + viewModel?: ZoomViewModelProperties; + } + interface ZoomViewModel extends Accessor { canZoomIn: boolean; canZoomOut: boolean; @@ -8781,1652 +11022,110 @@ declare namespace __esri { canZoomIn?: boolean; canZoomOut?: boolean; state?: string; - view?: MapView | SceneView; + view?: MapViewProperties | SceneViewProperties; } - interface Evented { - hasEventListener(type: string): boolean; - on(type: string, listener: EventHandler): IHandle; - } - - interface EventedConstructor { - new(): Evented; - } - - export const Evented: EventedConstructor; - - interface JSONSupport { - toJSON(): any; - } - - interface JSONSupportConstructor { - new(): JSONSupport; - - - fromJSON(json: any): any; - } - - export const JSONSupport: JSONSupportConstructor; - - interface Loadable { - loadError: Error; - loadStatus: string; - loadWarnings: any[]; - - always(callbackOrErrback?: Function): IPromise<any>; - cancelLoad(): void; - isFulfilled(): boolean; - isRejected(): boolean; - isResolved(): boolean; - load(): IPromise<any>; - otherwise(errback?: Function): IPromise<any>; - then(callback?: Function, errback?: Function, progback?: Function): IPromise<any>; - } - - interface LoadableConstructor { - new(): Loadable; - } - - export const Loadable: LoadableConstructor; - - interface LoadableProperties { - loadError?: Error; - loadStatus?: string; - loadWarnings?: any[]; - } - - interface corePromise { - always(callbackOrErrback?: Function): IPromise<any>; - isFulfilled(): boolean; - isRejected(): boolean; - isResolved(): boolean; - otherwise(errback?: Function): IPromise<any>; - then(callback?: Function, errback?: Function, progback?: Function): IPromise<any>; - } - - interface corePromiseConstructor { - new(): corePromise; - } - - export const corePromise: corePromiseConstructor; - - interface DynamicLayer { - portalItem: PortalItem; - url: string; - - fetchImage(extent: Extent, width: number, height: number, options?: DynamicLayerFetchImageOptions): IPromise<any>; - getImageUrl(extent: Extent, width: number, height: number, options?: DynamicLayerGetImageUrlOptions): IPromise<any> | string; - } - - interface DynamicLayerConstructor { - new(): DynamicLayer; - } - - export const DynamicLayer: DynamicLayerConstructor; - - interface DynamicLayerProperties { - portalItem?: PortalItemProperties; - url?: string; - } - - interface TiledLayer { - tileInfo: TileInfo; - } - - interface TiledLayerConstructor { - new(properties?: TiledLayerProperties): TiledLayer; - - fromJSON(json: any): TiledLayer; - } - - export const TiledLayer: TiledLayerConstructor; - - interface TiledLayerProperties { - tileInfo?: TileInfoProperties; - } - - interface ArcGISCachedService { - maxScale: number; - minScale: number; - tileInfo: TileInfo; - - fromJSON(json: any): any; - toJSON(): any; - } - - interface ArcGISCachedServiceConstructor { - new(properties?: ArcGISCachedServiceProperties): ArcGISCachedService; - - fromJSON(json: any): ArcGISCachedService; - } - - export const ArcGISCachedService: ArcGISCachedServiceConstructor; - - interface ArcGISCachedServiceProperties { - maxScale?: number; - minScale?: number; - tileInfo?: TileInfoProperties; - } - - interface ArcGISDynamicMapService { - allSublayers: Collection; - dpi: number; - gdbVersion: string; - imageFormat: string; - imageMaxHeight: number; - imageMaxWidth: number; - imageTransparency: boolean; - sublayers: Collection; - - createServiceSublayers(): Collection; - findSublayerById(id: number): Sublayer; - getExportImageParameters(extent: Extent, width: number, height: number, options?: ArcGISDynamicMapServiceGetExportImageParametersOptions): any; - } - - interface ArcGISDynamicMapServiceConstructor { - new(): ArcGISDynamicMapService; - } - - export const ArcGISDynamicMapService: ArcGISDynamicMapServiceConstructor; - - interface ArcGISDynamicMapServiceProperties { - allSublayers?: Collection | any[]; - dpi?: number; - gdbVersion?: string; - imageFormat?: string; - imageMaxHeight?: number; - imageMaxWidth?: number; - imageTransparency?: boolean; - sublayers?: Collection | any[]; - } - - interface ArcGISImageService { - compressionQuality: number; - compressionTolerance: number; - copyright: string; - definitionExpression: string; - domainFields: Field[]; - fields: Field[]; - format: string; - fullExtent: Extent; - hasMultidimensions: boolean; - hasRasterAttributeTable: boolean; - imageMaxHeight: number; - imageMaxWidth: number; - mosaicRule: MosaicRule; - multidimensionalInfo: any; - pixelType: string; - popupTemplate: PopupTemplate; - rasterAttributeTable: any; - rasterAttributeTableFieldPrefix: string; - rasterFields: Field[]; - renderingRule: RasterFunction; - spatialReference: SpatialReference; - url: string; - version: number; - - fetchImage(extent: Extent, width: number, height: number): IPromise<any>; - fromJSON(json: any): any; - toJSON(): any; - } - - interface ArcGISImageServiceConstructor { - new(properties?: ArcGISImageServiceProperties): ArcGISImageService; - - fromJSON(json: any): ArcGISImageService; - } - - export const ArcGISImageService: ArcGISImageServiceConstructor; - - interface ArcGISImageServiceProperties { - compressionQuality?: number; - compressionTolerance?: number; - copyright?: string; - definitionExpression?: string; - domainFields?: FieldProperties[]; - fields?: FieldProperties[]; - format?: string; - fullExtent?: ExtentProperties; - hasMultidimensions?: boolean; - hasRasterAttributeTable?: boolean; - imageMaxHeight?: number; - imageMaxWidth?: number; - mosaicRule?: MosaicRuleProperties; - multidimensionalInfo?: any; - pixelType?: string; - popupTemplate?: PopupTemplateProperties; - rasterAttributeTable?: any; - rasterAttributeTableFieldPrefix?: string; - rasterFields?: FieldProperties[]; - renderingRule?: RasterFunctionProperties; - spatialReference?: SpatialReferenceProperties; - url?: string; - version?: number; - } - - interface ArcGISMapService { - copyright: string; - fullExtent: Extent; - spatialReference: SpatialReference; - token: string; - } - - interface ArcGISMapServiceConstructor { - new(properties?: ArcGISMapServiceProperties): ArcGISMapService; - - fromJSON(json: any): ArcGISMapService; - } - - export const ArcGISMapService: ArcGISMapServiceConstructor; - - interface ArcGISMapServiceProperties { - copyright?: string; - fullExtent?: ExtentProperties; - spatialReference?: SpatialReferenceProperties; - token?: string; - } - - interface PortalLayer { - portalItem: PortalItem; - } - - interface PortalLayerConstructor { - new(properties?: PortalLayerProperties): PortalLayer; - - fromJSON(json: any): PortalLayer; - } - - export const PortalLayer: PortalLayerConstructor; - - interface PortalLayerProperties { - portalItem?: PortalItemProperties; - } - - interface ScaleRangeLayer { - maxScale: number; - minScale: number; - } - - interface ScaleRangeLayerConstructor { - new(): ScaleRangeLayer; - } - - export const ScaleRangeLayer: ScaleRangeLayerConstructor; - - interface ScaleRangeLayerProperties { - maxScale?: number; - minScale?: number; - } - - interface SceneService { - copyright: string; - layerId: number; - spatialReference: SpatialReference; - token: string; - url: string; - version: SceneServiceVersion; - } - - interface SceneServiceConstructor { - new(properties?: SceneServiceProperties): SceneService; - - fromJSON(json: any): SceneService; - } - - export const SceneService: SceneServiceConstructor; - - interface SceneServiceProperties { - copyright?: string; - layerId?: number; - spatialReference?: SpatialReferenceProperties; - token?: string; - url?: string; - version?: SceneServiceVersion; - } - - interface VisualVariablesMixin { - visualVariables: any[]; - } - - interface VisualVariablesMixinConstructor { - new(): VisualVariablesMixin; - } - - export const VisualVariablesMixin: VisualVariablesMixinConstructor; - - interface VisualVariablesMixinProperties { - visualVariables?: any[]; - } - - interface LayersMixin { - layers: Collection; - - add(layers: Layer, index?: number): void; - addMany(layers: Layer[], index?: number): void; - findLayerById(layerId: string): Layer; - remove(layer: Layer): Layer; - removeAll(): Layer[]; - removeMany(layers: Layer[]): Layer[]; - reorder(layer: Layer, index: number): Layer; - } - - interface LayersMixinConstructor { - new(): LayersMixin; - } - - export const LayersMixin: LayersMixinConstructor; - - interface LayersMixinProperties { - layers?: Collection | any[]; - } - - interface BreakpointsOwner { - breakpoints: BreakpointsOwnerBreakpoints; - heightBreakpoint: string; - orientation: string; - widthBreakpoint: string; - } - - interface BreakpointsOwnerConstructor { - new(): BreakpointsOwner; - } - - export const BreakpointsOwner: BreakpointsOwnerConstructor; - - interface BreakpointsOwnerProperties { - breakpoints?: BreakpointsOwnerBreakpoints; - heightBreakpoint?: string; - orientation?: string; - widthBreakpoint?: string; - } - - interface DOMContainer { - container: HTMLDivElement | string; - height: number; - popup: Popup; - resizing: boolean; - size: number[]; - suspended: boolean; - ui: DefaultUI; - width: number; - } - - interface DOMContainerConstructor { - new(): DOMContainer; - } - - export const DOMContainer: DOMContainerConstructor; - - interface DOMContainerProperties { - container?: HTMLDivElement | string; - height?: number; - popup?: PopupProperties; - resizing?: boolean; - size?: number[]; - suspended?: boolean; - ui?: DefaultUIProperties; - width?: number; - } - - interface Widgette { - container: string | any; - visible: boolean; - - destroy(): void; - } - - interface WidgetteConstructor { - new(): Widgette; - } - - export const Widgette: WidgetteConstructor; - - interface WidgetteProperties { - container?: string | any; - visible?: boolean; - } - - interface GeolocationPositioning { - geolocationOptions: any; - goToLocationEnabled: boolean; - graphic: Graphic; - view: MapView | SceneView; - } - - interface GeolocationPositioningConstructor { - new(): GeolocationPositioning; - } - - export const GeolocationPositioning: GeolocationPositioningConstructor; - - interface GeolocationPositioningProperties { - geolocationOptions?: any; - goToLocationEnabled?: boolean; - graphic?: GraphicProperties; - view?: MapView | SceneView; - } - - interface config { - geometryServiceUrl: string; - geoRSSServiceUrl: string; - portalUrl: string; - request: configRequest; - workers: configWorkers; - } - - export const config: config; - - interface kernel { - version: string; - } - - export const kernel: kernel; - - interface request { - esriRequest(url: string, options?: requestEsriRequestOptions): IPromise<any>; - } - - const __requestMapped: request; - export const request: typeof __requestMapped.esriRequest; - - - interface lang { - clone(elem: any): any; - } - - export const lang: lang; - - interface promiseUtils { - eachAlways(promises: IPromise<any>[] | any): IPromise<EachAlwaysResult[]> | any; - reject<T>(error?: any): IPromise<T>; - resolve<T>(value?: T): IPromise<T>; - } - - export const promiseUtils: promiseUtils; - - interface requireUtils { - when(moduleRequire: any, moduleNames: string[] | string): IPromise<any>; - } - - export const requireUtils: requireUtils; - - interface urlUtils { - addProxyRule(rule: urlUtilsAddProxyRuleRule): number; - getProxyRule(url: string): any; - urlToObject(url: string): any; - } - - export const urlUtils: urlUtils; - - interface watchUtils { - init(obj: Accessor, propertyName: string | string[], callback: WatchCallback): WatchHandle; - on(obj: Accessor, propertyName: string, eventName: string, eventHandler: Function, attachedHandler?: EventAttachedCallback, detachedHandler?: EventAttachedCallback): WatchHandle; - once(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; - pausable(obj: Accessor, propertyName: string, callback?: WatchCallback): PausableWatchHandle; - watch(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; - when(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; - whenDefined(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; - whenDefinedOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; - whenFalse(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; - whenFalseOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; - whenNot(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; - whenNotOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; - whenOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; - whenTrue(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; - whenTrueOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; - whenUndefined(obj: Accessor, propertyName: string, callback: WatchCallback): WatchHandle; - whenUndefinedOnce(obj: Accessor, propertyName: string, callback?: WatchCallback): PromisedWatchHandle; - } - - export const watchUtils: watchUtils; - - interface decorators { - aliasOf(propertyName: string): Function; - cast(propertyName: string): Function; - cast(classFunction: Function): Function; - declared<T>(baseClass: T, ...mixinClasses: any[]): T; - property(propertyMetadata?: decoratorsPropertyPropertyMetadata): Function; - subclass(declaredClass?: string): Function; - } - - export const decorators: decorators; - - interface workers { - open(client: any, modulePath: string): IPromise<any>; - } - - export const workers: workers; - - interface geometryEngine { - buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; - clip(geometry: Geometry, envelope: Extent): Geometry; - contains(geometry1: Geometry, geometry2: Geometry): boolean; - convexHull(geometry: Geometry, merge?: boolean): Geometry | Geometry[]; - crosses(geometry1: Geometry, geometry2: Geometry): boolean; - cut(geometry: Geometry, cutter: Polyline): Geometry[]; - densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): Geometry; - difference(inputGeometry: Geometry | Geometry[], subtractor: Geometry): Geometry | Geometry[]; - disjoint(geometry1: Geometry, geometry2: Geometry): boolean; - distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): number; - equals(geometry1: Geometry, geometry2: Geometry): boolean; - extendedSpatialReferenceInfo(spatialReference: SpatialReference): any; - flipHorizontal(geometry: Geometry, flipOrigin?: Point): Geometry; - flipVertical(geometry: Geometry, flipOrigin?: Point): Geometry; - generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): Geometry; - geodesicArea(geometry: Polygon, unit: string | number): number; - geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; - geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit: string | number): Geometry; - geodesicLength(geometry: Geometry, unit: string | number): number; - intersect(geometry: Geometry | Geometry[], intersector: Geometry): Geometry | Geometry[]; - intersects(geometry1: Geometry, geometry2: Geometry): boolean; - isSimple(geometry: Geometry): boolean; - nearestCoordinate(geometry: Geometry, inputPoint: Point): any; - nearestVertex(geometry: Geometry, inputPoint: Point): any; - nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): any[]; - offset(geometry: Geometry | Geometry[], offsetDistance: number, offsetUnit: string | number, joinType: string, bevelRatio?: number, flattenError?: number): Geometry | Geometry[]; - overlaps(geometry1: Geometry, geometry2: Geometry): boolean; - planarArea(geometry: Polygon, unit: string | number): number; - planarLength(geometry: Geometry, unit: string | number): number; - relate(geometry1: Geometry, geometry2: Geometry, relation: string): boolean; - rotate(geometry: Geometry, angle: number, rotationOrigin?: Point): Geometry; - simplify(geometry: Geometry): Geometry; - symmetricDifference(leftGeometry: Geometry | Geometry[], rightGeometry: Geometry): Geometry | Geometry[]; - touches(geometry1: Geometry, geometry2: Geometry): boolean; - union(geometries: Geometry[]): Geometry; - within(geometry1: Geometry, geometry2: Geometry): boolean; - } - - export const geometryEngine: geometryEngine; - - interface geometryEngineAsync { - buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): IPromise<any>; - clip(geometry: Geometry, envelope: Extent): IPromise<any>; - contains(geometry1: Geometry, geometry2: Geometry): IPromise<any>; - convexHull(geometry: Geometry, merge?: boolean): IPromise<any>; - crosses(geometry1: Geometry, geometry2: Geometry): IPromise<any>; - cut(geometry: Geometry, cutter: Polyline): IPromise<any>; - densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): IPromise<any>; - difference(inputGeometry: Geometry | Geometry[], subtractor: Geometry): IPromise<any>; - disjoint(geometry1: Geometry, geometry2: Geometry): IPromise<any>; - distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): IPromise<any>; - equals(geometry1: Geometry, geometry2: Geometry): IPromise<any>; - extendedSpatialReferenceInfo(spatialReference: SpatialReference): IPromise<any>; - flipHorizontal(geometry: Geometry, flipOrigin?: Point): IPromise<any>; - flipVertical(geometry: Geometry, flipOrigin?: Point): IPromise<any>; - generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): IPromise<any>; - geodesicArea(geometry: Polygon, unit: string | number): IPromise<any>; - geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): IPromise<any>; - geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit: string | number): IPromise<any>; - geodesicLength(geometry: Geometry, unit: string | number): IPromise<any>; - intersect(geometry: Geometry | Geometry[], intersector: Geometry): IPromise<any>; - intersects(geometry1: Geometry, geometry2: Geometry): IPromise<any>; - isSimple(geometry: Geometry): IPromise<any>; - nearestCoordinate(geometry: Geometry, inputPoint: Point): IPromise<any>; - nearestVertex(geometry: Geometry, inputPoint: Point): IPromise<any>; - nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): IPromise<any>; - offset(geometry: Geometry | Geometry[], offsetDistance: number, offsetUnit: string | number, joinType: string, bevelRatio?: number, flattenError?: number): IPromise<any>; - overlaps(geometry1: Geometry, geometry2: Geometry): IPromise<any>; - planarArea(geometry: Polygon, unit: string | number): IPromise<any>; - planarLength(geometry: Geometry, unit: string | number): IPromise<any>; - relate(geometry1: Geometry, geometry2: Geometry, relation: string): IPromise<any>; - rotate(geometry: Geometry, angle: number, rotationOrigin?: Point): IPromise<any>; - simplify(geometry: Geometry): IPromise<any>; - symmetricDifference(leftGeometry: Geometry | Geometry[], rightGeometry: Geometry): IPromise<any>; - touches(geometry1: Geometry, geometry2: Geometry): IPromise<any>; - union(geometries: Geometry[]): IPromise<any>; - within(geometry1: Geometry, geometry2: Geometry): IPromise<any>; - } - - export const geometryEngineAsync: geometryEngineAsync; - - interface jsonUtils { - fromJSON(json: any): Geometry; - getJsonType(geometry: Geometry): string; - } - - export const jsonUtils: jsonUtils; - - interface normalizeUtils { - normalizeCentralMeridian(geometries: Geometry[], geometryService?: GeometryService): IPromise<any>; - } - - export const normalizeUtils: normalizeUtils; - - interface webMercatorUtils { - canProject(source: SpatialReference | any, target: SpatialReference | any): boolean; - geographicToWebMercator(geometry: Geometry): Geometry; - lngLatToXY(long: number, lat: number): number[]; - project(geometry: Geometry, spatialReference: SpatialReference | any): Geometry; - webMercatorToGeographic(geometry: Geometry): Geometry; - xyToLngLat(x: number, y: number): number[]; - } - - export const webMercatorUtils: webMercatorUtils; - - interface color { - createContinuousRenderer(params: colorCreateContinuousRendererParams): IPromise<any>; - createVisualVariable(params: colorCreateVisualVariableParams): IPromise<any>; - } - - export const color: color; - - interface location { - createRenderer(params: locationCreateRendererParams): IPromise<any>; - } - - export const location: location; - - interface size { - createContinuousRenderer(params: sizeCreateContinuousRendererParams): IPromise<any>; - createVisualVariables(params: sizeCreateVisualVariablesParams): IPromise<any>; - } - - export const size: size; - - interface type { - createRenderer(params: typeCreateRendererParams): IPromise<any>; - } - - export const type: type; - - interface univariateColorSize { - createContinuousRenderer(params: univariateColorSizeCreateContinuousRendererParams): IPromise<any>; - createVisualVariables(params: univariateColorSizeCreateVisualVariablesParams): IPromise<any>; - } - - export const univariateColorSize: univariateColorSize; - - interface classBreaks { - classBreaks(params: classBreaksClassBreaksParams): IPromise<any>; - } - - const __classBreaksMapped: classBreaks; - export const classBreaks: typeof __classBreaksMapped.classBreaks; - - - interface histogram { - histogram(params: histogramHistogramParams): IPromise<any>; - } - - const __histogramMapped: histogram; - export const histogram: typeof __histogramMapped.histogram; - - - interface summaryStatistics { - summaryStatistics(params: summaryStatisticsSummaryStatisticsParams): IPromise<any>; - } - - const __summaryStatisticsMapped: summaryStatistics; - export const summaryStatistics: typeof __summaryStatisticsMapped.summaryStatistics; - - - interface uniqueValues { - uniqueValues(params: uniqueValuesUniqueValuesParams): IPromise<any>; - } - - const __uniqueValuesMapped: uniqueValues; - export const uniqueValues: typeof __uniqueValuesMapped.uniqueValues; - - - interface symbologyColor { - cloneScheme(scheme: any): any; - flipColors(scheme: any): any; - getSchemes(params: colorGetSchemesParams): any; - getThemes(basemap?: string | Basemap): any[]; - } - - export const symbologyColor: symbologyColor; - - interface symbologyLocation { - cloneScheme(scheme: any | any | any): any | any | any; - getSchemes(params: locationGetSchemesParams): any; - } - - export const symbologyLocation: symbologyLocation; - - interface symbologySize { - cloneScheme(scheme: any | any | any): any; - getSchemes(params: sizeGetSchemesParams): any; - } - - export const symbologySize: symbologySize; - - interface symbologyType { - cloneScheme(scheme: any | any | any): any; - getSchemes(params: typeGetSchemesParams): any; - } - - export const symbologyType: symbologyType; - - interface supportJsonUtils { - fromJSON(json: any): Renderer; - } - - export const supportJsonUtils: supportJsonUtils; - - interface symbolsSupportJsonUtils { - fromJSON(json: any): Symbol; - } - - export const symbolsSupportJsonUtils: symbolsSupportJsonUtils; - - interface externalRenderers { - add(view: SceneView, renderer: any): void; - fromRenderCoordinates(view: SceneView, srcCoordinates: number[], srcStart: number, destCoordinates: number[], destStart: number, destSpatialReference: SpatialReference, count: number): number[]; - remove(view: SceneView, renderer: any): void; - renderCoordinateTransformAt(view: SceneView, origin: number[], srcSpatialReference: SpatialReference, dest: number[]): number[]; - requestRender(view: SceneView): void; - toRenderCoordinates(view: SceneView, srcCoordinates: number[], srcStart: number, srcSpatialReference: SpatialReference, destCoordinates: number[], destStart: number, count: number): number[]; - } - - export const externalRenderers: externalRenderers; - - interface widget { - accessibleHandler(): Function; - join(...classNames: string[]): string; - renderable(propertyName?: string | string[]): Function; - tsx(selector: string, properties?: any, children?: any): any; - vmEvent(eventNames: string | string[]): Function; - } - - export const widget: widget; - - interface BasemapGalleryItem { - basemap: Basemap; - error: Error; - state: string; - view: MapView | SceneView; - } - - export const BasemapGalleryItem: BasemapGalleryItem; - - interface LocalBasemapsSource { - basemaps: Collection; - state: string; - } - - export const LocalBasemapsSource: LocalBasemapsSource; - - interface PortalBasemapsSource { - basemaps: Collection; - filterFunction: Function; - portal: Portal; - state: string; - } - - export const PortalBasemapsSource: PortalBasemapsSource; -} - -declare module "esri" { - export import PromisedWatchHandle = __esri.PromisedWatchHandle; - export import ItemCallback = __esri.ItemCallback; - - export import ItemCompareCallback = __esri.ItemCompareCallback; - - export import ItemMapCallback = __esri.ItemMapCallback; - - export import ItemReduceCallback = __esri.ItemReduceCallback; - - export import ItemTestCallback = __esri.ItemTestCallback; - - export import PortalItemFetchRelatedItemsParams = __esri.PortalItemFetchRelatedItemsParams; - - export import PortalItemUpdateParams = __esri.PortalItemUpdateParams; - - export import PortalUserAddItemParams = __esri.PortalUserAddItemParams; - - export import PortalUserFetchItemsParams = __esri.PortalUserFetchItemsParams; - - export import PortalFeaturedGroups = __esri.PortalFeaturedGroups; - - export import GroundQueryElevationOptions = __esri.GroundQueryElevationOptions; - - export import PopupTemplateExpressionInfos = __esri.PopupTemplateExpressionInfos; - - export import PopupTemplateFieldInfos = __esri.PopupTemplateFieldInfos; - - export import PopupTemplateFieldInfosFormat = __esri.PopupTemplateFieldInfosFormat; - - export import FeatureLayerApplyEditsEdits = __esri.FeatureLayerApplyEditsEdits; - - export import FeatureLayerCapabilities = __esri.FeatureLayerCapabilities; - - export import FeatureLayerCapabilitiesData = __esri.FeatureLayerCapabilitiesData; - - export import FeatureLayerCapabilitiesEditing = __esri.FeatureLayerCapabilitiesEditing; - - export import FeatureLayerCapabilitiesOperations = __esri.FeatureLayerCapabilitiesOperations; - - export import FeatureLayerCapabilitiesQuery = __esri.FeatureLayerCapabilitiesQuery; - - export import FeatureLayerCapabilitiesQueryRelated = __esri.FeatureLayerCapabilitiesQueryRelated; - - export import FeatureLayerElevationInfo = __esri.FeatureLayerElevationInfo; - - export import FeatureLayerFeatureReduction = __esri.FeatureLayerFeatureReduction; - - export import FeatureLayerGetFieldDomainOptions = __esri.FeatureLayerGetFieldDomainOptions; - - export import FeatureLayerLayerviewCreateEvent = __esri.FeatureLayerLayerviewCreateEvent; - - export import FeatureLayerLayerviewCreateEventHandler = __esri.FeatureLayerLayerviewCreateEventHandler; - - export import FeatureLayerLayerviewDestroyEvent = __esri.FeatureLayerLayerviewDestroyEvent; - - export import FeatureLayerLayerviewDestroyEventHandler = __esri.FeatureLayerLayerviewDestroyEventHandler; - - export import GraphicsLayerElevationInfo = __esri.GraphicsLayerElevationInfo; - - export import GraphicsLayerLayerviewCreateEvent = __esri.GraphicsLayerLayerviewCreateEvent; - - export import GraphicsLayerLayerviewCreateEventHandler = __esri.GraphicsLayerLayerviewCreateEventHandler; - - export import GraphicsLayerLayerviewDestroyEvent = __esri.GraphicsLayerLayerviewDestroyEvent; - - export import GraphicsLayerLayerviewDestroyEventHandler = __esri.GraphicsLayerLayerviewDestroyEventHandler; - - export import LayerFromArcGISServerUrlParams = __esri.LayerFromArcGISServerUrlParams; - - export import LayerFromPortalItemParams = __esri.LayerFromPortalItemParams; - - export import FeatureTemplateThumbnail = __esri.FeatureTemplateThumbnail; - - export import LabelClassLabelExpressionInfo = __esri.LabelClassLabelExpressionInfo; - - export import LabelSymbol3DVerticalOffsetProperties = __esri.LabelSymbol3DVerticalOffsetProperties; - export import LabelSymbol3DVerticalOffset = __esri.LabelSymbol3DVerticalOffset; - - export import QueryQuantizationParameters = __esri.QueryQuantizationParameters; - - export import ViewPadding = __esri.ViewPadding; - - export import WebMapSourceVersion = __esri.WebMapSourceVersion; - - export import WebSceneSaveAsOptions = __esri.WebSceneSaveAsOptions; - - export import WebSceneSaveOptions = __esri.WebSceneSaveOptions; - - export import WebSceneSourceVersion = __esri.WebSceneSourceVersion; - - export import WebSceneUpdateFromOptions = __esri.WebSceneUpdateFromOptions; - - export import EventHandler = __esri.EventHandler; - - export import SceneViewDragEventOrigin = __esri.SceneViewDragEventOrigin; - - export import SceneViewClickEvent = __esri.SceneViewClickEvent; - - export import SceneViewClickEventHandler = __esri.SceneViewClickEventHandler; - - export import SceneViewDoubleClickEvent = __esri.SceneViewDoubleClickEvent; - - export import SceneViewDoubleClickEventHandler = __esri.SceneViewDoubleClickEventHandler; - - export import SceneViewDragEvent = __esri.SceneViewDragEvent; - - export import SceneViewDragEventHandler = __esri.SceneViewDragEventHandler; - - export import EasingFunction = __esri.EasingFunction; - - export import SceneViewHoldEvent = __esri.SceneViewHoldEvent; - - export import SceneViewHoldEventHandler = __esri.SceneViewHoldEventHandler; - - export import SceneViewKeyDownEvent = __esri.SceneViewKeyDownEvent; - - export import SceneViewKeyDownEventHandler = __esri.SceneViewKeyDownEventHandler; - - export import SceneViewKeyUpEvent = __esri.SceneViewKeyUpEvent; - - export import SceneViewKeyUpEventHandler = __esri.SceneViewKeyUpEventHandler; - - export import SceneViewLayerviewCreateEvent = __esri.SceneViewLayerviewCreateEvent; - - export import SceneViewLayerviewCreateEventHandler = __esri.SceneViewLayerviewCreateEventHandler; - - export import SceneViewLayerviewDestroyEvent = __esri.SceneViewLayerviewDestroyEvent; - - export import SceneViewLayerviewDestroyEventHandler = __esri.SceneViewLayerviewDestroyEventHandler; - - export import SceneViewMouseWheelEvent = __esri.SceneViewMouseWheelEvent; - - export import SceneViewMouseWheelEventHandler = __esri.SceneViewMouseWheelEventHandler; - - export import SceneViewPointerDownEvent = __esri.SceneViewPointerDownEvent; - - export import SceneViewPointerDownEventHandler = __esri.SceneViewPointerDownEventHandler; - - export import SceneViewPointerMoveEvent = __esri.SceneViewPointerMoveEvent; - - export import SceneViewPointerMoveEventHandler = __esri.SceneViewPointerMoveEventHandler; - - export import SceneViewPointerUpEvent = __esri.SceneViewPointerUpEvent; - - export import SceneViewPointerUpEventHandler = __esri.SceneViewPointerUpEventHandler; - - export import SceneViewResizeEvent = __esri.SceneViewResizeEvent; - - export import SceneViewResizeEventHandler = __esri.SceneViewResizeEventHandler; - - export import SceneViewConstraintsProperties = __esri.SceneViewConstraintsProperties; - export import SceneViewConstraints = __esri.SceneViewConstraints; - - export import SceneViewConstraintsAltitudeProperties = __esri.SceneViewConstraintsAltitudeProperties; - export import SceneViewConstraintsAltitude = __esri.SceneViewConstraintsAltitude; - - export import SceneViewConstraintsClipDistanceProperties = __esri.SceneViewConstraintsClipDistanceProperties; - export import SceneViewConstraintsClipDistance = __esri.SceneViewConstraintsClipDistance; - - export import SceneViewConstraintsCollision = __esri.SceneViewConstraintsCollision; - - export import SceneViewConstraintsTiltProperties = __esri.SceneViewConstraintsTiltProperties; - export import SceneViewConstraintsTilt = __esri.SceneViewConstraintsTilt; - - export import SceneViewEnvironmentProperties = __esri.SceneViewEnvironmentProperties; - export import SceneViewEnvironment = __esri.SceneViewEnvironment; - - export import SceneViewEnvironmentAtmosphereProperties = __esri.SceneViewEnvironmentAtmosphereProperties; - export import SceneViewEnvironmentAtmosphere = __esri.SceneViewEnvironmentAtmosphere; - - export import SceneViewEnvironmentLightingProperties = __esri.SceneViewEnvironmentLightingProperties; - export import SceneViewEnvironmentLighting = __esri.SceneViewEnvironmentLighting; - - export import SceneViewGoToOptions = __esri.SceneViewGoToOptions; - - export import SceneViewHighlightOptions = __esri.SceneViewHighlightOptions; - - export import SceneViewHitTestScreenPoint = __esri.SceneViewHitTestScreenPoint; - - export import SceneViewToMapScreenPoint = __esri.SceneViewToMapScreenPoint; - - export import WatchHandle = __esri.WatchHandle; - - export import WatchCallback = __esri.WatchCallback; - - export import IdentityManagerBaseGenerateTokenOptions = __esri.IdentityManagerBaseGenerateTokenOptions; - - export import IdentityManagerBaseGetCredentialOptions = __esri.IdentityManagerBaseGetCredentialOptions; - - export import IdentityManagerBaseOAuthSignInOptions = __esri.IdentityManagerBaseOAuthSignInOptions; - - export import IdentityManagerBaseRegisterTokenProperties = __esri.IdentityManagerBaseRegisterTokenProperties; - - export import IdentityManagerBaseSetProtocolErrorHandlerHandlerFunction = __esri.IdentityManagerBaseSetProtocolErrorHandlerHandlerFunction; - - export import IdentityManagerBaseSetRedirectionHandlerHandlerFunction = __esri.IdentityManagerBaseSetRedirectionHandlerHandlerFunction; - - export import IdentityManagerBaseSignInOptions = __esri.IdentityManagerBaseSignInOptions; - - export import IdentityManagerCredentialCreateEvent = __esri.IdentityManagerCredentialCreateEvent; - - export import IdentityManagerCredentialCreateEventHandler = __esri.IdentityManagerCredentialCreateEventHandler; - - export import IdentityManagerCredentialsDestroyEvent = __esri.IdentityManagerCredentialsDestroyEvent; - - export import IdentityManagerCredentialsDestroyEventHandler = __esri.IdentityManagerCredentialsDestroyEventHandler; - - export import HandlerCallback = __esri.HandlerCallback; - - export import BaseElevationLayerFetchTileOptions = __esri.BaseElevationLayerFetchTileOptions; - - export import BaseElevationLayerLayerviewCreateEvent = __esri.BaseElevationLayerLayerviewCreateEvent; - - export import BaseElevationLayerLayerviewCreateEventHandler = __esri.BaseElevationLayerLayerviewCreateEventHandler; - - export import BaseElevationLayerLayerviewDestroyEvent = __esri.BaseElevationLayerLayerviewDestroyEvent; - - export import BaseElevationLayerLayerviewDestroyEventHandler = __esri.BaseElevationLayerLayerviewDestroyEventHandler; - - export import CSVLayerElevationInfo = __esri.CSVLayerElevationInfo; - - export import CSVLayerFeatureReduction = __esri.CSVLayerFeatureReduction; - - export import CSVLayerLayerviewCreateEvent = __esri.CSVLayerLayerviewCreateEvent; - - export import CSVLayerLayerviewCreateEventHandler = __esri.CSVLayerLayerviewCreateEventHandler; - - export import CSVLayerLayerviewDestroyEvent = __esri.CSVLayerLayerviewDestroyEvent; - - export import CSVLayerLayerviewDestroyEventHandler = __esri.CSVLayerLayerviewDestroyEventHandler; - - export import ElevationLayerQueryElevationOptions = __esri.ElevationLayerQueryElevationOptions; - - export import ElevationLayerLayerviewCreateEvent = __esri.ElevationLayerLayerviewCreateEvent; - - export import ElevationLayerLayerviewCreateEventHandler = __esri.ElevationLayerLayerviewCreateEventHandler; - - export import ElevationLayerLayerviewDestroyEvent = __esri.ElevationLayerLayerviewDestroyEvent; - - export import ElevationLayerLayerviewDestroyEventHandler = __esri.ElevationLayerLayerviewDestroyEventHandler; - - export import GeoRSSLayerLayerviewCreateEvent = __esri.GeoRSSLayerLayerviewCreateEvent; - - export import GeoRSSLayerLayerviewCreateEventHandler = __esri.GeoRSSLayerLayerviewCreateEventHandler; - - export import GeoRSSLayerLayerviewDestroyEvent = __esri.GeoRSSLayerLayerviewDestroyEvent; - - export import GeoRSSLayerLayerviewDestroyEventHandler = __esri.GeoRSSLayerLayerviewDestroyEventHandler; - - export import GroupLayerLayerviewCreateEvent = __esri.GroupLayerLayerviewCreateEvent; - - export import GroupLayerLayerviewCreateEventHandler = __esri.GroupLayerLayerviewCreateEventHandler; - - export import GroupLayerLayerviewDestroyEvent = __esri.GroupLayerLayerviewDestroyEvent; - - export import GroupLayerLayerviewDestroyEventHandler = __esri.GroupLayerLayerviewDestroyEventHandler; - - export import ImageryLayerLayerviewCreateEvent = __esri.ImageryLayerLayerviewCreateEvent; - - export import ImageryLayerLayerviewCreateEventHandler = __esri.ImageryLayerLayerviewCreateEventHandler; - - export import ImageryLayerLayerviewDestroyEvent = __esri.ImageryLayerLayerviewDestroyEvent; - - export import ImageryLayerLayerviewDestroyEventHandler = __esri.ImageryLayerLayerviewDestroyEventHandler; - - export import IntegratedMeshLayerLayerviewCreateEvent = __esri.IntegratedMeshLayerLayerviewCreateEvent; - - export import IntegratedMeshLayerLayerviewCreateEventHandler = __esri.IntegratedMeshLayerLayerviewCreateEventHandler; - - export import IntegratedMeshLayerLayerviewDestroyEvent = __esri.IntegratedMeshLayerLayerviewDestroyEvent; - - export import IntegratedMeshLayerLayerviewDestroyEventHandler = __esri.IntegratedMeshLayerLayerviewDestroyEventHandler; - - export import MapImageLayerLayerviewCreateEvent = __esri.MapImageLayerLayerviewCreateEvent; - - export import MapImageLayerLayerviewCreateEventHandler = __esri.MapImageLayerLayerviewCreateEventHandler; - - export import MapImageLayerLayerviewDestroyEvent = __esri.MapImageLayerLayerviewDestroyEvent; - - export import MapImageLayerLayerviewDestroyEventHandler = __esri.MapImageLayerLayerviewDestroyEventHandler; - - export import MapNotesLayerLayerviewCreateEvent = __esri.MapNotesLayerLayerviewCreateEvent; - - export import MapNotesLayerLayerviewCreateEventHandler = __esri.MapNotesLayerLayerviewCreateEventHandler; - - export import MapNotesLayerLayerviewDestroyEvent = __esri.MapNotesLayerLayerviewDestroyEvent; - - export import MapNotesLayerLayerviewDestroyEventHandler = __esri.MapNotesLayerLayerviewDestroyEventHandler; - - export import OpenStreetMapLayerLayerviewCreateEvent = __esri.OpenStreetMapLayerLayerviewCreateEvent; - - export import OpenStreetMapLayerLayerviewCreateEventHandler = __esri.OpenStreetMapLayerLayerviewCreateEventHandler; - - export import OpenStreetMapLayerLayerviewDestroyEvent = __esri.OpenStreetMapLayerLayerviewDestroyEvent; - - export import OpenStreetMapLayerLayerviewDestroyEventHandler = __esri.OpenStreetMapLayerLayerviewDestroyEventHandler; - - export import PointCloudLayerLayerviewCreateEvent = __esri.PointCloudLayerLayerviewCreateEvent; - - export import PointCloudLayerLayerviewCreateEventHandler = __esri.PointCloudLayerLayerviewCreateEventHandler; - - export import PointCloudLayerLayerviewDestroyEvent = __esri.PointCloudLayerLayerviewDestroyEvent; - - export import PointCloudLayerLayerviewDestroyEventHandler = __esri.PointCloudLayerLayerviewDestroyEventHandler; - - export import PointCloudLayerElevationInfo = __esri.PointCloudLayerElevationInfo; - - export import PointCloudRendererColorModulation = __esri.PointCloudRendererColorModulation; - - export import PointCloudRendererPointSizeAlgorithm = __esri.PointCloudRendererPointSizeAlgorithm; - - export import SceneLayerLayerviewCreateEvent = __esri.SceneLayerLayerviewCreateEvent; - - export import SceneLayerLayerviewCreateEventHandler = __esri.SceneLayerLayerviewCreateEventHandler; - - export import SceneLayerLayerviewDestroyEvent = __esri.SceneLayerLayerviewDestroyEvent; - - export import SceneLayerLayerviewDestroyEventHandler = __esri.SceneLayerLayerviewDestroyEventHandler; - - export import SceneLayerElevationInfo = __esri.SceneLayerElevationInfo; - - export import SceneLayerFeatureReduction = __esri.SceneLayerFeatureReduction; - - export import StreamLayerLayerviewCreateEvent = __esri.StreamLayerLayerviewCreateEvent; - - export import StreamLayerLayerviewCreateEventHandler = __esri.StreamLayerLayerviewCreateEventHandler; - - export import StreamLayerLayerviewDestroyEvent = __esri.StreamLayerLayerviewDestroyEvent; - - export import StreamLayerLayerviewDestroyEventHandler = __esri.StreamLayerLayerviewDestroyEventHandler; - - export import StreamLayerFilter = __esri.StreamLayerFilter; - - export import StreamLayerPurgeOptions = __esri.StreamLayerPurgeOptions; - - export import StreamLayerUpdateFilterFilterChanges = __esri.StreamLayerUpdateFilterFilterChanges; - - export import TileLayerLayerviewCreateEvent = __esri.TileLayerLayerviewCreateEvent; - - export import TileLayerLayerviewCreateEventHandler = __esri.TileLayerLayerviewCreateEventHandler; - - export import TileLayerLayerviewDestroyEvent = __esri.TileLayerLayerviewDestroyEvent; - - export import TileLayerLayerviewDestroyEventHandler = __esri.TileLayerLayerviewDestroyEventHandler; - - export import TileLayerFetchTileOptions = __esri.TileLayerFetchTileOptions; - - export import UnknownLayerLayerviewCreateEvent = __esri.UnknownLayerLayerviewCreateEvent; - - export import UnknownLayerLayerviewCreateEventHandler = __esri.UnknownLayerLayerviewCreateEventHandler; - - export import UnknownLayerLayerviewDestroyEvent = __esri.UnknownLayerLayerviewDestroyEvent; - - export import UnknownLayerLayerviewDestroyEventHandler = __esri.UnknownLayerLayerviewDestroyEventHandler; - - export import UnsupportedLayerLayerviewCreateEvent = __esri.UnsupportedLayerLayerviewCreateEvent; - - export import UnsupportedLayerLayerviewCreateEventHandler = __esri.UnsupportedLayerLayerviewCreateEventHandler; - - export import UnsupportedLayerLayerviewDestroyEvent = __esri.UnsupportedLayerLayerviewDestroyEvent; - - export import UnsupportedLayerLayerviewDestroyEventHandler = __esri.UnsupportedLayerLayerviewDestroyEventHandler; - - export import VectorTileLayerLayerviewCreateEvent = __esri.VectorTileLayerLayerviewCreateEvent; - - export import VectorTileLayerLayerviewCreateEventHandler = __esri.VectorTileLayerLayerviewCreateEventHandler; - - export import VectorTileLayerLayerviewDestroyEvent = __esri.VectorTileLayerLayerviewDestroyEvent; - - export import VectorTileLayerLayerviewDestroyEventHandler = __esri.VectorTileLayerLayerviewDestroyEventHandler; - - export import VectorTileLayerCurrentStyleInfo = __esri.VectorTileLayerCurrentStyleInfo; - - export import WebTileLayerLayerviewCreateEvent = __esri.WebTileLayerLayerviewCreateEvent; - - export import WebTileLayerLayerviewCreateEventHandler = __esri.WebTileLayerLayerviewCreateEventHandler; - - export import WebTileLayerLayerviewDestroyEvent = __esri.WebTileLayerLayerviewDestroyEvent; - - export import WebTileLayerLayerviewDestroyEventHandler = __esri.WebTileLayerLayerviewDestroyEventHandler; - - export import WMSLayerLayerviewCreateEvent = __esri.WMSLayerLayerviewCreateEvent; - - export import WMSLayerLayerviewCreateEventHandler = __esri.WMSLayerLayerviewCreateEventHandler; - - export import WMSLayerLayerviewDestroyEvent = __esri.WMSLayerLayerviewDestroyEvent; - - export import WMSLayerLayerviewDestroyEventHandler = __esri.WMSLayerLayerviewDestroyEventHandler; - - export import WMSLayerFetchImageOptions = __esri.WMSLayerFetchImageOptions; - - export import WMTSLayerLayerviewCreateEvent = __esri.WMTSLayerLayerviewCreateEvent; - - export import WMTSLayerLayerviewCreateEventHandler = __esri.WMTSLayerLayerviewCreateEventHandler; - - export import WMTSLayerLayerviewDestroyEvent = __esri.WMTSLayerLayerviewDestroyEvent; - - export import WMTSLayerLayerviewDestroyEventHandler = __esri.WMTSLayerLayerviewDestroyEventHandler; - - export import BaseDynamicLayerFetchImageOptions = __esri.BaseDynamicLayerFetchImageOptions; - - export import BaseDynamicLayerLayerviewCreateEvent = __esri.BaseDynamicLayerLayerviewCreateEvent; - - export import BaseDynamicLayerLayerviewCreateEventHandler = __esri.BaseDynamicLayerLayerviewCreateEventHandler; - - export import BaseDynamicLayerLayerviewDestroyEvent = __esri.BaseDynamicLayerLayerviewDestroyEvent; - - export import BaseDynamicLayerLayerviewDestroyEventHandler = __esri.BaseDynamicLayerLayerviewDestroyEventHandler; - - export import BaseTileLayerFetchTileOptions = __esri.BaseTileLayerFetchTileOptions; - - export import BaseTileLayerLayerviewCreateEvent = __esri.BaseTileLayerLayerviewCreateEvent; - - export import BaseTileLayerLayerviewCreateEventHandler = __esri.BaseTileLayerLayerviewCreateEventHandler; - - export import BaseTileLayerLayerviewDestroyEvent = __esri.BaseTileLayerLayerviewDestroyEvent; - - export import BaseTileLayerLayerviewDestroyEventHandler = __esri.BaseTileLayerLayerviewDestroyEventHandler; - - export import CodedValueDomainCodedValues = __esri.CodedValueDomainCodedValues; - - export import PixelBlockAddDataPlaneData = __esri.PixelBlockAddDataPlaneData; - - export import PixelBlockStatistics = __esri.PixelBlockStatistics; - - export import ClassBreaksRendererClassBreakInfos = __esri.ClassBreaksRendererClassBreakInfos; - - export import ClassBreaksRendererLegendOptions = __esri.ClassBreaksRendererLegendOptions; - - export import UniqueValueRendererLegendOptions = __esri.UniqueValueRendererLegendOptions; - - export import UniqueValueRendererUniqueValueInfos = __esri.UniqueValueRendererUniqueValueInfos; - - export import PointCloudClassBreaksRendererColorClassBreakInfos = __esri.PointCloudClassBreaksRendererColorClassBreakInfos; - - export import PointCloudStretchRendererStops = __esri.PointCloudStretchRendererStops; - - export import PointCloudUniqueValueRendererColorUniqueValueInfos = __esri.PointCloudUniqueValueRendererColorUniqueValueInfos; - - export import FillSymbol3DLayerOutline = __esri.FillSymbol3DLayerOutline; - - export import IconSymbol3DLayerOutline = __esri.IconSymbol3DLayerOutline; - - export import IconSymbol3DLayerResource = __esri.IconSymbol3DLayerResource; - - export import ObjectSymbol3DLayerResource = __esri.ObjectSymbol3DLayerResource; - - export import PointSymbol3DVerticalOffsetProperties = __esri.PointSymbol3DVerticalOffsetProperties; - export import PointSymbol3DVerticalOffset = __esri.PointSymbol3DVerticalOffset; - - export import Symbol3DStyleOrigin = __esri.Symbol3DStyleOrigin; - - export import TextSymbol3DLayerFont = __esri.TextSymbol3DLayerFont; - - export import TextSymbol3DLayerHalo = __esri.TextSymbol3DLayerHalo; - - export import LineCallout3DBorderProperties = __esri.LineCallout3DBorderProperties; - export import LineCallout3DBorder = __esri.LineCallout3DBorder; - - export import ClosestFacilityParametersAttributeParameterValues = __esri.ClosestFacilityParametersAttributeParameterValues; - - export import GeometryServiceFromGeoCoordinateStringParams = __esri.GeometryServiceFromGeoCoordinateStringParams; - - export import GeometryServiceToGeoCoordinateStringParams = __esri.GeometryServiceToGeoCoordinateStringParams; - - export import ProjectParametersTransformation = __esri.ProjectParametersTransformation; - - export import LocatorAddressToLocationsParams = __esri.LocatorAddressToLocationsParams; - - export import LocatorAddressesToLocationsParams = __esri.LocatorAddressesToLocationsParams; - - export import LocatorSuggestLocationsParams = __esri.LocatorSuggestLocationsParams; - - export import PrintTemplateExportOptions = __esri.PrintTemplateExportOptions; - - export import PrintTemplateLayoutOptions = __esri.PrintTemplateLayoutOptions; - - export import MapViewDragEventOrigin = __esri.MapViewDragEventOrigin; - - export import MapViewClickEvent = __esri.MapViewClickEvent; - - export import MapViewClickEventHandler = __esri.MapViewClickEventHandler; - - export import MapViewDoubleClickEvent = __esri.MapViewDoubleClickEvent; - - export import MapViewDoubleClickEventHandler = __esri.MapViewDoubleClickEventHandler; - - export import MapViewDragEvent = __esri.MapViewDragEvent; - - export import MapViewDragEventHandler = __esri.MapViewDragEventHandler; - - export import MapViewHoldEvent = __esri.MapViewHoldEvent; - - export import MapViewHoldEventHandler = __esri.MapViewHoldEventHandler; - - export import MapViewKeyDownEvent = __esri.MapViewKeyDownEvent; - - export import MapViewKeyDownEventHandler = __esri.MapViewKeyDownEventHandler; - - export import MapViewKeyUpEvent = __esri.MapViewKeyUpEvent; - - export import MapViewKeyUpEventHandler = __esri.MapViewKeyUpEventHandler; - - export import MapViewLayerviewCreateEvent = __esri.MapViewLayerviewCreateEvent; - - export import MapViewLayerviewCreateEventHandler = __esri.MapViewLayerviewCreateEventHandler; - - export import MapViewLayerviewDestroyEvent = __esri.MapViewLayerviewDestroyEvent; - - export import MapViewLayerviewDestroyEventHandler = __esri.MapViewLayerviewDestroyEventHandler; - - export import MapViewConstraints = __esri.MapViewConstraints; - - export import MapViewGoToOptions = __esri.MapViewGoToOptions; - - export import MapViewHitTestScreenPoint = __esri.MapViewHitTestScreenPoint; - - export import MapViewToMapScreenPoint = __esri.MapViewToMapScreenPoint; - - export import MapViewMouseWheelEvent = __esri.MapViewMouseWheelEvent; - - export import MapViewMouseWheelEventHandler = __esri.MapViewMouseWheelEventHandler; - - export import MapViewPointerDownEvent = __esri.MapViewPointerDownEvent; - - export import MapViewPointerDownEventHandler = __esri.MapViewPointerDownEventHandler; - - export import MapViewPointerMoveEvent = __esri.MapViewPointerMoveEvent; - - export import MapViewPointerMoveEventHandler = __esri.MapViewPointerMoveEventHandler; - - export import MapViewPointerUpEvent = __esri.MapViewPointerUpEvent; - - export import MapViewPointerUpEventHandler = __esri.MapViewPointerUpEventHandler; - - export import MapViewResizeEvent = __esri.MapViewResizeEvent; - - export import MapViewResizeEventHandler = __esri.MapViewResizeEventHandler; - - export import AttributeParamValue = __esri.AttributeParamValue; - - export import ConfigurationTaskGetDataWorkspaceDetailsParams = __esri.ConfigurationTaskGetDataWorkspaceDetailsParams; - - export import ConfigurationTaskGetUserJobQueryDetailsParams = __esri.ConfigurationTaskGetUserJobQueryDetailsParams; - - export import AuxRecordDescription = __esri.AuxRecordDescription; - - export import JobCreationParameters = __esri.JobCreationParameters; - - export import JobQueryParameters = __esri.JobQueryParameters; - - export import JobTaskAddEmbeddedAttachmentParams = __esri.JobTaskAddEmbeddedAttachmentParams; - - export import JobTaskAddLinkedAttachmentParams = __esri.JobTaskAddLinkedAttachmentParams; - - export import JobTaskAddLinkedRecordParams = __esri.JobTaskAddLinkedRecordParams; - - export import JobTaskAssignJobsParams = __esri.JobTaskAssignJobsParams; - - export import JobTaskCloseJobsParams = __esri.JobTaskCloseJobsParams; - - export import JobTaskCreateDependencyParams = __esri.JobTaskCreateDependencyParams; - - export import JobTaskCreateHoldParams = __esri.JobTaskCreateHoldParams; - - export import JobTaskCreateJobVersionParams = __esri.JobTaskCreateJobVersionParams; - - export import JobTaskDeleteAttachmentParams = __esri.JobTaskDeleteAttachmentParams; - - export import JobTaskDeleteDependencyParams = __esri.JobTaskDeleteDependencyParams; - - export import JobTaskDeleteJobsParams = __esri.JobTaskDeleteJobsParams; - - export import JobTaskDeleteLinkedRecordParams = __esri.JobTaskDeleteLinkedRecordParams; - - export import JobTaskGetAttachmentContentUrlParams = __esri.JobTaskGetAttachmentContentUrlParams; - - export import JobTaskListFieldValuesParams = __esri.JobTaskListFieldValuesParams; - - export import JobTaskListMultiLevelFieldValuesParams = __esri.JobTaskListMultiLevelFieldValuesParams; - - export import JobTaskLogActionParams = __esri.JobTaskLogActionParams; - - export import JobTaskQueryJobsParams = __esri.JobTaskQueryJobsParams; - - export import JobTaskQueryMultiLevelSelectedValuesParams = __esri.JobTaskQueryMultiLevelSelectedValuesParams; - - export import JobTaskReleaseHoldParams = __esri.JobTaskReleaseHoldParams; - - export import JobTaskReopenClosedJobsParams = __esri.JobTaskReopenClosedJobsParams; - - export import JobTaskSearchJobsParams = __esri.JobTaskSearchJobsParams; - - export import JobTaskUnassignJobsParams = __esri.JobTaskUnassignJobsParams; - - export import JobTaskUpdateNotesParams = __esri.JobTaskUpdateNotesParams; - - export import JobTaskUpdateRecordParams = __esri.JobTaskUpdateRecordParams; - - export import JobUpdateParameters = __esri.JobUpdateParameters; - - export import ChangeRule = __esri.ChangeRule; - - export import NotificationTaskAddChangeRuleParams = __esri.NotificationTaskAddChangeRuleParams; - - export import NotificationTaskDeleteChangeRuleParams = __esri.NotificationTaskDeleteChangeRuleParams; - - export import NotificationTaskNotifySessionParams = __esri.NotificationTaskNotifySessionParams; - - export import NotificationTaskQueryChangeRulesParams = __esri.NotificationTaskQueryChangeRulesParams; - - export import NotificationTaskRunSpatialNotificationOnHistoryParams = __esri.NotificationTaskRunSpatialNotificationOnHistoryParams; - - export import NotificationTaskSendNotificationParams = __esri.NotificationTaskSendNotificationParams; - - export import NotificationTaskSubscribeToNotificationParams = __esri.NotificationTaskSubscribeToNotificationParams; - - export import NotificationTaskUnsubscribeFromNotificationParams = __esri.NotificationTaskUnsubscribeFromNotificationParams; - - export import ReportTaskGenerateReportParams = __esri.ReportTaskGenerateReportParams; - - export import ReportTaskGetReportContentUrlParams = __esri.ReportTaskGetReportContentUrlParams; - - export import ReportTaskGetReportDataParams = __esri.ReportTaskGetReportDataParams; - - export import TokenTaskParseTokensParams = __esri.TokenTaskParseTokensParams; - - export import WorkflowTaskCanRunStepParams = __esri.WorkflowTaskCanRunStepParams; - - export import WorkflowTaskExecuteStepsParams = __esri.WorkflowTaskExecuteStepsParams; - - export import WorkflowTaskGetStepDescriptionParams = __esri.WorkflowTaskGetStepDescriptionParams; - - export import WorkflowTaskGetStepFileUrlParams = __esri.WorkflowTaskGetStepFileUrlParams; - - export import WorkflowTaskGetStepParams = __esri.WorkflowTaskGetStepParams; - - export import WorkflowTaskMarkStepsAsDoneParams = __esri.WorkflowTaskMarkStepsAsDoneParams; - - export import WorkflowTaskMoveToNextStepParams = __esri.WorkflowTaskMoveToNextStepParams; - - export import WorkflowTaskRecreateWorkflowParams = __esri.WorkflowTaskRecreateWorkflowParams; - - export import WorkflowTaskResolveConflictParams = __esri.WorkflowTaskResolveConflictParams; - - export import WorkflowTaskSetCurrentStepParams = __esri.WorkflowTaskSetCurrentStepParams; - - export import ImageryLayerViewPixelData = __esri.ImageryLayerViewPixelData; - - export import StreamLayerViewDataReceivedEvent = __esri.StreamLayerViewDataReceivedEvent; - - export import StreamLayerViewDataReceivedEventHandler = __esri.StreamLayerViewDataReceivedEventHandler; - - export import StreamLayerViewFilter = __esri.StreamLayerViewFilter; - - export import StreamLayerViewUpdateFilterFilter = __esri.StreamLayerViewUpdateFilterFilter; - - export import SlideApplyToOptions = __esri.SlideApplyToOptions; - - export import SlideCreateFromOptions = __esri.SlideCreateFromOptions; - - export import SlideCreateFromOptionsScreenshot = __esri.SlideCreateFromOptionsScreenshot; - - export import SlideDescriptionProperties = __esri.SlideDescriptionProperties; - export import SlideDescription = __esri.SlideDescription; - - export import SlideThumbnailProperties = __esri.SlideThumbnailProperties; - export import SlideThumbnail = __esri.SlideThumbnail; - - export import SlideTitleProperties = __esri.SlideTitleProperties; - export import SlideTitle = __esri.SlideTitle; - - export import SlideUpdateFromOptions = __esri.SlideUpdateFromOptions; - - export import SlideUpdateFromOptionsScreenshot = __esri.SlideUpdateFromOptionsScreenshot; - - export import SlideVisibleLayers = __esri.SlideVisibleLayers; - - export import ColorSliderValues = __esri.ColorSliderValues; - - export import LegendLayerInfos = __esri.LegendLayerInfos; - - export import PopupDockOptions = __esri.PopupDockOptions; - - export import PopupOpenOptions = __esri.PopupOpenOptions; - - export import SearchViewModelSearchCompleteEventResults = __esri.SearchViewModelSearchCompleteEventResults; - - export import SearchViewModelSearchCompleteEventResultsResults = __esri.SearchViewModelSearchCompleteEventResultsResults; - - export import SearchViewModelSelectResultEventResult = __esri.SearchViewModelSelectResultEventResult; - - export import SearchViewModelSuggestCompleteEventResults = __esri.SearchViewModelSuggestCompleteEventResults; - - export import SearchViewModelSuggestCompleteEventResultsResults = __esri.SearchViewModelSuggestCompleteEventResultsResults; - - export import SearchViewModelLoadEvent = __esri.SearchViewModelLoadEvent; - - export import SearchViewModelLoadEventHandler = __esri.SearchViewModelLoadEventHandler; - - export import SearchViewModelSearchClearEvent = __esri.SearchViewModelSearchClearEvent; - - export import SearchViewModelSearchClearEventHandler = __esri.SearchViewModelSearchClearEventHandler; - - export import SearchViewModelSearchCompleteEvent = __esri.SearchViewModelSearchCompleteEvent; - - export import SearchViewModelSearchCompleteEventHandler = __esri.SearchViewModelSearchCompleteEventHandler; - - export import SearchViewModelSearchStartEvent = __esri.SearchViewModelSearchStartEvent; - - export import SearchViewModelSearchStartEventHandler = __esri.SearchViewModelSearchStartEventHandler; - - export import SearchViewModelSelectResultEvent = __esri.SearchViewModelSelectResultEvent; - - export import SearchViewModelSelectResultEventHandler = __esri.SearchViewModelSelectResultEventHandler; - - export import SearchViewModelSuggestCompleteEvent = __esri.SearchViewModelSuggestCompleteEvent; - - export import SearchViewModelSuggestCompleteEventHandler = __esri.SearchViewModelSuggestCompleteEventHandler; - - export import SearchViewModelSuggestStartEvent = __esri.SearchViewModelSuggestStartEvent; - - export import SearchViewModelSuggestStartEventHandler = __esri.SearchViewModelSuggestStartEventHandler; - - export import DynamicLayerFetchImageOptions = __esri.DynamicLayerFetchImageOptions; - - export import DynamicLayerGetImageUrlOptions = __esri.DynamicLayerGetImageUrlOptions; - - export import ArcGISDynamicMapServiceGetExportImageParametersOptions = __esri.ArcGISDynamicMapServiceGetExportImageParametersOptions; - - export import SceneServiceVersion = __esri.SceneServiceVersion; - - export import BreakpointsOwnerBreakpoints = __esri.BreakpointsOwnerBreakpoints; - - export import configRequest = __esri.configRequest; - - export import configRequestCorsEnabledServers = __esri.configRequestCorsEnabledServers; - - export import configRequestProxyRules = __esri.configRequestProxyRules; - - export import configWorkers = __esri.configWorkers; - - export import configWorkersLoaderConfig = __esri.configWorkersLoaderConfig; - - export import requestEsriRequestOptions = __esri.requestEsriRequestOptions; - - export import EachAlwaysResult = __esri.EachAlwaysResult; - - export import urlUtilsAddProxyRuleRule = __esri.urlUtilsAddProxyRuleRule; - - export import EventAttachedCallback = __esri.EventAttachedCallback; - - export import PausableWatchHandle = __esri.PausableWatchHandle; - - export import decoratorsPropertyPropertyMetadata = __esri.decoratorsPropertyPropertyMetadata; - - export import colorCreateContinuousRendererParams = __esri.colorCreateContinuousRendererParams; - - export import colorCreateContinuousRendererParamsLegendOptions = __esri.colorCreateContinuousRendererParamsLegendOptions; - - export import colorCreateVisualVariableParams = __esri.colorCreateVisualVariableParams; - - export import colorCreateVisualVariableParamsLegendOptions = __esri.colorCreateVisualVariableParamsLegendOptions; - - export import locationCreateRendererParams = __esri.locationCreateRendererParams; - - export import sizeCreateContinuousRendererParams = __esri.sizeCreateContinuousRendererParams; - - export import sizeCreateContinuousRendererParamsLegendOptions = __esri.sizeCreateContinuousRendererParamsLegendOptions; + export type OpenStreetMapLayerLayerviewCreateEventHandler = (event: OpenStreetMapLayerLayerviewCreateEvent) => void; - export import sizeCreateVisualVariablesParams = __esri.sizeCreateVisualVariablesParams; + export type OpenStreetMapLayerLayerviewDestroyEventHandler = (event: OpenStreetMapLayerLayerviewDestroyEvent) => void; - export import sizeCreateVisualVariablesParamsLegendOptions = __esri.sizeCreateVisualVariablesParamsLegendOptions; + export type PointCloudLayerLayerviewCreateEventHandler = (event: PointCloudLayerLayerviewCreateEvent) => void; - export import typeCreateRendererParams = __esri.typeCreateRendererParams; + export type PointCloudLayerLayerviewDestroyEventHandler = (event: PointCloudLayerLayerviewDestroyEvent) => void; - export import typeCreateRendererParamsLegendOptions = __esri.typeCreateRendererParamsLegendOptions; + export type PolygonDrawActionCursorUpdateEventHandler = (event: PolygonDrawActionCursorUpdateEvent) => void; - export import univariateColorSizeCreateContinuousRendererParams = __esri.univariateColorSizeCreateContinuousRendererParams; + export type PolygonDrawActionDrawCompleteEventHandler = (event: PolygonDrawActionDrawCompleteEvent) => void; - export import univariateColorSizeCreateContinuousRendererParamsColorOptions = __esri.univariateColorSizeCreateContinuousRendererParamsColorOptions; + export type PolygonDrawActionVertexAddEventHandler = (event: PolygonDrawActionVertexAddEvent) => void; - export import univariateColorSizeCreateContinuousRendererParamsColorOptionsLegendOptions = __esri.univariateColorSizeCreateContinuousRendererParamsColorOptionsLegendOptions; + export type PolygonDrawActionVertexRemoveEventHandler = (event: PolygonDrawActionVertexRemoveEvent) => void; - export import univariateColorSizeCreateContinuousRendererParamsSizeOptions = __esri.univariateColorSizeCreateContinuousRendererParamsSizeOptions; + export type PolylineDrawActionCursorUpdateEventHandler = (event: PolylineDrawActionCursorUpdateEvent) => void; - export import univariateColorSizeCreateContinuousRendererParamsSizeOptionsLegendOptions = __esri.univariateColorSizeCreateContinuousRendererParamsSizeOptionsLegendOptions; + export type PolylineDrawActionDrawCompleteEventHandler = (event: PolylineDrawActionDrawCompleteEvent) => void; - export import univariateColorSizeCreateVisualVariablesParams = __esri.univariateColorSizeCreateVisualVariablesParams; + export type PolylineDrawActionVertexAddEventHandler = (event: PolylineDrawActionVertexAddEvent) => void; - export import univariateColorSizeCreateVisualVariablesParamsColorOptions = __esri.univariateColorSizeCreateVisualVariablesParamsColorOptions; + export type PolylineDrawActionVertexRemoveEventHandler = (event: PolylineDrawActionVertexRemoveEvent) => void; - export import univariateColorSizeCreateVisualVariablesParamsColorOptionsLegendOptions = __esri.univariateColorSizeCreateVisualVariablesParamsColorOptionsLegendOptions; + export type SceneLayerLayerviewCreateEventHandler = (event: SceneLayerLayerviewCreateEvent) => void; - export import univariateColorSizeCreateVisualVariablesParamsSizeOptions = __esri.univariateColorSizeCreateVisualVariablesParamsSizeOptions; + export type SceneLayerLayerviewDestroyEventHandler = (event: SceneLayerLayerviewDestroyEvent) => void; - export import univariateColorSizeCreateVisualVariablesParamsSizeOptionsLegendOptions = __esri.univariateColorSizeCreateVisualVariablesParamsSizeOptionsLegendOptions; + export type SceneViewClickEventHandler = (event: SceneViewClickEvent) => void; - export import classBreaksClassBreaksParams = __esri.classBreaksClassBreaksParams; + export type SceneViewDoubleClickEventHandler = (event: SceneViewDoubleClickEvent) => void; - export import histogramHistogramParams = __esri.histogramHistogramParams; + export type SceneViewDragEventHandler = (event: SceneViewDragEvent) => void; - export import summaryStatisticsSummaryStatisticsParams = __esri.summaryStatisticsSummaryStatisticsParams; + export type SceneViewHoldEventHandler = (event: SceneViewHoldEvent) => void; - export import uniqueValuesUniqueValuesParams = __esri.uniqueValuesUniqueValuesParams; + export type SceneViewKeyDownEventHandler = (event: SceneViewKeyDownEvent) => void; - export import colorGetSchemesParams = __esri.colorGetSchemesParams; + export type SceneViewKeyUpEventHandler = (event: SceneViewKeyUpEvent) => void; - export import locationGetSchemesParams = __esri.locationGetSchemesParams; + export type SceneViewLayerviewCreateEventHandler = (event: SceneViewLayerviewCreateEvent) => void; - export import sizeGetSchemesParams = __esri.sizeGetSchemesParams; + export type SceneViewLayerviewDestroyEventHandler = (event: SceneViewLayerviewDestroyEvent) => void; - export import typeGetSchemesParams = __esri.typeGetSchemesParams; + export type SceneViewMouseWheelEventHandler = (event: SceneViewMouseWheelEvent) => void; - export import JobQuery = __esri.JobQuery; + export type SceneViewPointerDownEventHandler = (event: SceneViewPointerDownEvent) => void; - export import GroupMembership = __esri.GroupMembership; + export type SceneViewPointerMoveEventHandler = (event: SceneViewPointerMoveEvent) => void; - export import JobQueryContainer = __esri.JobQueryContainer; + export type SceneViewPointerUpEventHandler = (event: SceneViewPointerUpEvent) => void; - export import Privilege = __esri.Privilege; + export type SceneViewResizeEventHandler = (event: SceneViewResizeEvent) => void; - export import DataWorkspace = __esri.DataWorkspace; + export type SearchViewModelLoadEventHandler = (event: SearchViewModelLoadEvent) => void; - export import HoldType = __esri.HoldType; + export type SearchViewModelSearchClearEventHandler = (event: SearchViewModelSearchClearEvent) => void; - export import JobPriority = __esri.JobPriority; + export type SearchViewModelSearchCompleteEventHandler = (event: SearchViewModelSearchCompleteEvent) => void; - export import JobStatus = __esri.JobStatus; + export type SearchViewModelSearchStartEventHandler = (event: SearchViewModelSearchStartEvent) => void; - export import JobType = __esri.JobType; + export type SearchViewModelSelectResultEventHandler = (event: SearchViewModelSelectResultEvent) => void; - export import ActivityType = __esri.ActivityType; + export type SearchViewModelSuggestCompleteEventHandler = (event: SearchViewModelSuggestCompleteEvent) => void; - export import NotificationType = __esri.NotificationType; + export type SearchViewModelSuggestStartEventHandler = (event: SearchViewModelSuggestStartEvent) => void; - export import AuxRecord = __esri.AuxRecord; + export type StreamLayerLayerviewCreateEventHandler = (event: StreamLayerLayerviewCreateEvent) => void; - export import AuxRecordValue = __esri.AuxRecordValue; + export type StreamLayerLayerviewDestroyEventHandler = (event: StreamLayerLayerviewDestroyEvent) => void; - export import JobVersionInfo = __esri.JobVersionInfo; + export type StreamLayerViewDataReceivedEventHandler = (event: StreamLayerViewDataReceivedEvent) => void; - export import QueryFieldInfo = __esri.QueryFieldInfo; + export type TileLayerLayerviewCreateEventHandler = (event: TileLayerLayerviewCreateEvent) => void; - export import DatasetConfiguration = __esri.DatasetConfiguration; + export type TileLayerLayerviewDestroyEventHandler = (event: TileLayerLayerviewDestroyEvent) => void; - export import WhereCondition = __esri.WhereCondition; + export type UnknownLayerLayerviewCreateEventHandler = (event: UnknownLayerLayerviewCreateEvent) => void; - export import ReportDataGroup = __esri.ReportDataGroup; + export type UnknownLayerLayerviewDestroyEventHandler = (event: UnknownLayerLayerviewDestroyEvent) => void; - export import WorkflowConflicts = __esri.WorkflowConflicts; + export type UnsupportedLayerLayerviewCreateEventHandler = (event: UnsupportedLayerLayerviewCreateEvent) => void; - export import WorkflowOption = __esri.WorkflowOption; + export type UnsupportedLayerLayerviewDestroyEventHandler = (event: UnsupportedLayerLayerviewDestroyEvent) => void; - export import WorkflowStepInfo = __esri.WorkflowStepInfo; + export type VectorTileLayerLayerviewCreateEventHandler = (event: VectorTileLayerLayerviewCreateEvent) => void; - export import StepType = __esri.StepType; + export type VectorTileLayerLayerviewDestroyEventHandler = (event: VectorTileLayerLayerviewDestroyEvent) => void; - export import WorkflowAnnotationDisplayDetails = __esri.WorkflowAnnotationDisplayDetails; + export type WebTileLayerLayerviewCreateEventHandler = (event: WebTileLayerLayerviewCreateEvent) => void; - export import WorkflowPathDisplayDetails = __esri.WorkflowPathDisplayDetails; + export type WebTileLayerLayerviewDestroyEventHandler = (event: WebTileLayerLayerviewDestroyEvent) => void; - export import WorkflowStepDisplayDetails = __esri.WorkflowStepDisplayDetails; + export type WMSLayerLayerviewCreateEventHandler = (event: WMSLayerLayerviewCreateEvent) => void; - export import ColorAndIntensity = __esri.ColorAndIntensity; + export type WMSLayerLayerviewDestroyEventHandler = (event: WMSLayerLayerviewDestroyEvent) => void; - export import RenderCamera = __esri.RenderCamera; + export type WMTSLayerLayerviewCreateEventHandler = (event: WMTSLayerLayerviewCreateEvent) => void; - export import SunLight = __esri.SunLight; + export type WMTSLayerLayerviewDestroyEventHandler = (event: WMTSLayerLayerviewDestroyEvent) => void; } declare module "esri/Basemap" { @@ -10509,6 +11208,11 @@ declare module "esri/geometry/Geometry" { export = Geometry; } +declare module "esri/geometry/HeightModelInfo" { + import HeightModelInfo = __esri.HeightModelInfo; + export = HeightModelInfo; +} + declare module "esri/geometry/Multipoint" { import Multipoint = __esri.Multipoint; export = Multipoint; @@ -10609,6 +11313,11 @@ declare module "esri/layers/IntegratedMeshLayer" { export = IntegratedMeshLayer; } +declare module "esri/layers/KMLLayer" { + import KMLLayer = __esri.KMLLayer; + export = KMLLayer; +} + declare module "esri/layers/Layer" { import Layer = __esri.Layer; export = Layer; @@ -10729,6 +11438,11 @@ declare module "esri/layers/support/InheritedDomain" { export = InheritedDomain; } +declare module "esri/layers/support/KMLSublayer" { + import KMLSublayer = __esri.KMLSublayer; + export = KMLSublayer; +} + declare module "esri/layers/support/LabelClass" { import LabelClass = __esri.LabelClass; export = LabelClass; @@ -11379,6 +12093,26 @@ declare module "esri/views/ui/DefaultUI" { export = DefaultUI; } +declare module "esri/views/2d/draw/Draw" { + import Draw = __esri.Draw; + export = Draw; +} + +declare module "esri/views/2d/draw/PointDrawAction" { + import PointDrawAction = __esri.PointDrawAction; + export = PointDrawAction; +} + +declare module "esri/views/2d/draw/PolylineDrawAction" { + import PolylineDrawAction = __esri.PolylineDrawAction; + export = PolylineDrawAction; +} + +declare module "esri/views/2d/draw/PolygonDrawAction" { + import PolygonDrawAction = __esri.PolygonDrawAction; + export = PolygonDrawAction; +} + declare module "esri/webmap/InitialViewProperties" { import InitialViewProperties = __esri.InitialViewProperties; export = InitialViewProperties; @@ -11589,6 +12323,11 @@ declare module "esri/widgets/Zoom/ZoomViewModel" { export = ZoomViewModel; } +declare module "esri/widgets/Sketch/SketchViewModel" { + import SketchViewModel = __esri.SketchViewModel; + export = SketchViewModel; +} + declare module "esri/core/Evented" { import Evented = __esri.Evented; export = Evented; @@ -11699,6 +12438,11 @@ declare module "esri/request" { export = request; } +declare module "esri/core/Error" { + import Error = __esri.Error; + export = Error; +} + declare module "esri/core/lang" { import lang = __esri.lang; export = lang; From a2f96b65de2ea0f212fb7ba5d0950e608f22a0c8 Mon Sep 17 00:00:00 2001 From: Roy Xue <xljroy@gmail.com> Date: Mon, 2 Oct 2017 14:48:43 -0700 Subject: [PATCH 57/67] [react-table]Add react-table (#20122) * Add react-table * Remove readme from project link * Change string type --- types/react-table/index.d.ts | 509 ++++++++++++++++++++++++ types/react-table/react-table-tests.tsx | 57 +++ types/react-table/tsconfig.json | 24 ++ types/react-table/tslint.json | 1 + 4 files changed, 591 insertions(+) create mode 100644 types/react-table/index.d.ts create mode 100644 types/react-table/react-table-tests.tsx create mode 100644 types/react-table/tsconfig.json create mode 100644 types/react-table/tslint.json diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts new file mode 100644 index 0000000000..b62315459e --- /dev/null +++ b/types/react-table/index.d.ts @@ -0,0 +1,509 @@ +// Type definitions for react-table 6.5 +// Project: https://github.com/react-tools/react-table +// Definitions by: Roy Xue <https://github.com/royxue> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +import * as React from 'react'; + +export type ReactTableFunction = () => void; +export type AccessorFunction = (row: object) => any; +export type Accessor = string | string[] | object | AccessorFunction; +export type Aggregator = (values: any, rows: any) => any; +export type TableCellRenderer = ((data: any, column: any) => React.ReactNode) | React.ReactNode; +export type FilterRender = (params: { column: Column, filter: any, onFilterChange: ReactTableFunction, key?: string }) => React.ReactElement<any>; + +export type ComponentPropsGetter0 = (finalState: any, rowInfo: undefined, column: undefined, instance?: any) => object | undefined; +export type ComponentPropsGetterR = (finalState: any, rowInfo?: RowInfo, column?: undefined, instance?: any) => object | undefined; +export type ComponentPropsGetterC = (finalState: any, rowInfo?: undefined, column?: Column, instance?: any) => object | undefined; +export type ComponentPropsGetterRC = (finalState: any, rowInfo?: RowInfo, column?: Column, instance?: any) => object | undefined; + +export type FilterFunction = (filter: any, row: any, column: any) => boolean; +export type SubComponentFunction = (rowInfo: RowInfo) => React.ReactNode; +export type PageChangeFunction = (page: number) => void; +export type PageSizeChangeFunction = (newPageSize: number, newPage: number) => void; +export type SortedChangeFunction = (column: any, additive: boolean) => void; +export type FilteredChangeFunction = (column: any, value: any, pivotColumn: any) => void; +export type ExpandedChangeFunction = (column: any, event: any, isTouch: boolean) => void; + +/** NOTE: to many configuration ways (only true values are confusing) */ +export interface SortingRule { + id: string; + sort?: 'desc' | 'asc'; + asc?: true; + desc?: true; +} + +export interface TableProps extends + Partial<TextProps>, + Partial<ComponentDecoratorProps>, + Partial<ControlledStateCallbackProps>, + Partial<PivotingProps>, + Partial<ControlledStateOverrideProps>, + Partial<ComponentProps> { + /** Default: [] */ + data: any[]; + + /** Default: false */ + loading: boolean; + + /** Default: false */ + showPagination: boolean; + + /** Default: false */ + manual: boolean; + + /** Default: false */ + showPageSizeOptions: boolean; + + /** Default: [5, 10, 20, 25, 50, 100] */ + pageSizeOptions: number[]; + + /** Default: 20 */ + defaultPageSize: number; + + /** + * Default: undefined + * Otherwise take value from 'pageSize' if defined + * @TODO: add minRows to react-table defaultProps even if undefined + */ + minRows: number; + + /** Default: true */ + showPageJump: boolean; + + /** Default: true */ + collapseOnSortingChange: boolean; + + /** Default: true */ + collapseOnPageChange: boolean; + + /** Default: true */ + collapseOnDataChange: boolean; + + /** Default: false */ + freezeWhenExpanded: boolean; + + /** Default: [] */ + defaultSorting: SortingRule[]; + + /** Default: false */ + showFilters: boolean; + + /** Default: [] */ + defaultFiltering: any[]; + + /** Default: ... */ + defaultFilterMethod: FilterFunction; + + /** Default: true */ + resizable: boolean; + + /** Default: false */ + filterable: boolean; + + /** Default: [] */ + defaultResizing: any[]; + + /** On change. */ + onChange: ReactTableFunction; + + /** + * Default: string + * Adding a -striped className to ReactTable will slightly color odd numbered rows for legibility + * Adding a -highlight className to ReactTable will highlight any row as you hover over it + */ + className: string; + + /** Default: {} */ + style: object; + + /** Global Column Defaults */ + column: Partial<GlobalColumn>; + + /** Array of all Available Columns */ + columns?: Column[]; + + /** Expander defaults. */ + expanderDefaults: Partial<ExpanderDefaults>; + + /** Privot defaults. */ + pivotDefaults: Partial<PivotDefaults>; +} + +export interface ControlledStateOverrideProps { + /** Default: undefined */ + page: number; + + /** Default: undefined */ + pageSize: number; + + /** Default: undefined */ + sorting: number; + + /** Sub component */ + SubComponent: SubComponentFunction; +} + +export interface PivotingProps { + /** Default: undefined */ + pivotBy: string[]; + + /** Default: 200 */ + pivotColumnWidth: number; + + /** Default: _pivotVal */ + pivotValKey: string; + + /** Default: _pivotID */ + pivotIDKey: string; + + /** Default: _subRows */ + subRowsKey: string; + + /** + * Default: {} - Pivoting State Overrides (see Fully Controlled Component section) + * @example { 4: true } + * @example { 5: { 9: true }, 10: true } + */ + expandedRows: ExpandedRows; + + /** Default: ??? - Pivoting State Callbacks */ + onExpandRow: ReactTableFunction; +} + +export interface ExpandedRows { + [idx: number]: boolean | ExpandedRows; +} + +export interface ControlledStateCallbackProps { + onPageChange: PageChangeFunction; + onPageSizeChange: PageSizeChangeFunction; + onSortedChange: SortedChangeFunction; + onFilteredChange: FilteredChangeFunction; + onExpandedChange: ExpandedChangeFunction; +} + +export interface ComponentDecoratorProps { + getProps: ComponentPropsGetterRC | ComponentPropsGetterC | ComponentPropsGetter0; + getTableProps: ComponentPropsGetter0; + getTheadGroupProps: ComponentPropsGetter0; + getTheadGroupTrProps: ComponentPropsGetter0; + getTheadGroupThProps: ComponentPropsGetterC; + getTheadProps: ComponentPropsGetter0; + getTheadTrProps: ComponentPropsGetter0; + getTheadThProps: ComponentPropsGetterC; + getTheadFilterProps: ComponentPropsGetter0; + getTheadFilterTrProps: ComponentPropsGetter0; + getTheadFilterThProps: ComponentPropsGetterC; + getTbodyProps: ComponentPropsGetter0; + getTrGroupProps: ComponentPropsGetterR | ComponentPropsGetter0; + getTrProps: ComponentPropsGetterR | ComponentPropsGetter0; + + /** + * @TODO not exists in react-table but in the docs + */ + // getThProps: ComponentPropsGetter + getTdProps: ComponentPropsGetterRC | ComponentPropsGetterR; + getTfootProps: ComponentPropsGetter0; + getTfootTrProps: ComponentPropsGetter0; + + /** + * @TODO not exists in react-table but in the docs + */ + // getTfootThProps: ComponentPropsGetter + getPaginationProps: ComponentPropsGetter0; + getLoadingProps: ComponentPropsGetter0; + getNoDataProps: ComponentPropsGetter0; + getResizerProps: ComponentPropsGetter0; +} + +export interface ComponentProps { + TableComponent: React.ReactType; + TheadComponent: React.ReactType; + TbodyComponent: React.ReactType; + TrGroupComponent: React.ReactType; + TrComponent: React.ReactType; + ThComponent: React.ReactType; + TdComponent: React.ReactType; + TfootComponent: React.ReactType; + ExpanderComponent: React.ReactType; + PaginationComponent: React.ReactType; + PreviousComponent: React.ReactType; + NextComponent: React.ReactType; + LoadingComponent: React.ReactType; + NoDataComponent: React.ReactType; + ResizerComponent: React.ReactType; +} + +export interface TextProps { + /** Default: 'Previous' */ + previousText: string; + + /** Default: 'Next' */ + nextText: string; + + /** Default: 'Loading...' */ + loadingText: string; + + /** Default: 'No rows found' */ + noDataText: string; + + /** Default: 'Page' */ + pageText: string; + + /** Default: 'of' */ + ofText: string; + + /** Default: 'rows' */ + rowsText: string; +} + +export interface GlobalColumn extends + Column.Basics, + Column.CellProps, + Column.FilterProps, + Column.FooterProps, + Column.HeaderProps { +} + +export namespace Column { + /** Basic column props */ + interface Basics { + /** Default: true */ + sortable: boolean; + + /** Default: true */ + show: boolean; + + /** Default: 100 */ + minWidth: number; + } + + /** Configuration of a columns cell section */ + interface CellProps { + /** + * Default: undefined + * A function that returns a primitive, or JSX / React Component + * + * @example 'Cell Value' + * @example ({data, column}) => <div>Cell Value</div>, + */ + render: TableCellRenderer; + + /** + * Set the classname of the `td` element of the column + * @default string + */ + className: string; + + /** + * Set the style of the `td` element of the column + * @default {} + */ + style: object; + + /** + * @default () => ({}) + */ + getProps: ReactTableFunction; + } + + /** Configuration of a columns header section */ + interface HeaderProps { + /** + * Default: undefined + * A function that returns a primitive, or JSX / React Component + * + * @example 'Header Name' + * @example ({data, column}) => <div>Header Name</div>, + */ + header: TableCellRenderer; + + /** + * Set the classname of the `th` element of the column + * @default string + */ + headerClassName: string; + + /** + * Default: {} + * Set the style of the `th` element of the column + */ + headerStyle: object; + + /** + * Default: (state, rowInfo, column, instance) => ({}) + * A function that returns props to decorate the `th` element of the column + */ + getHeaderProps: ReactTableFunction; + } + + /** Configuration of a columns footer section */ + interface FooterProps { + /** + * Default: undefined + * A function that returns a primitive, or JSX / React Component + * + * @example 'Footer Name' + * @example ({data, column}) => <div>Footer Name</div>, + */ + footer: TableCellRenderer; + + /** + * Default: string + * Set the classname of the `td` element of the column's footer + */ + footerClassName: string; + + /** + * Default: {} + * Set the style of the `td` element of the column's footer + */ + footerStyle: object; + + /** + * Default: (state, rowInfo, column, instance) => ({}) + * A function that returns props to decorate the `th` element of the column + */ + getFooterProps: ReactTableFunction; + } + + /** Filtering related column props */ + interface FilterProps { + /** Default: undefined */ + filterMethod: ReactTableFunction; + + /** Default: false */ + hideFilter: boolean; + + /** Default: ... */ + filterRender: FilterRender; + } +} + +export interface ExpanderDefaults { + /** Default: false */ + sortable: boolean; + + /** Default: 35 */ + width: number; + + /** Default: true */ + hideFilter: boolean; + + /** Will be overriden in methods.js to display ExpanderComponent */ + render: TableCellRenderer; +} + +export interface PivotDefaults { + /** Will be overriden in methods.js to display ExpanderComponent */ + render: TableCellRenderer; +} + +export interface Column extends + Partial<Column.Basics>, + Partial<Column.CellProps>, + Partial<Column.FilterProps>, + Partial<Column.FooterProps>, + Partial<Column.HeaderProps> { + /** + * Property name as string or Accessor + * @example: 'myProperty' + * @example ["a.b", "c"] + * @example ["a", "b", "c"] + * @example {"a": {"b": {"c": $}}} + * @example (row) => row.propertyName + */ + accessor?: Accessor; + + /** + * Conditional - A unique ID is required if the accessor is not a string or if you would like to override the column name used in server-side calls + * @example 'myProperty' + */ + id?: string; + + /** + * No description + * @example (values, rows) => _.round(_.mean(values)) + * @example (values, rows) => _.sum(values) + */ + aggregate?: Aggregator; + + /** + * Default: undefined - A hardcoded width for the column. This overrides both min and max width options + */ + width?: number; + + /** + * Default: undefined - A maximum width for this column. + * @default undefined + */ + maxWidth?: number; + + /** + * Turns this column into a special column for specifying expander and pivot column options. + * If this option is true and there is NOT a pivot column, the `expanderDefaults` options will be applied on top of the column options. + * If this option is true and there IS a pivot column, the `pivotDefaults` options will be applied on top of the column options. + * Adding a column with the `expander` option set will allow you to rearrange expander and pivot column orderings in the table. + * It will also let you specify rendering of the header (and header group if this special column is placed in the `columns` option of another column) and the rendering of the expander itself. + */ + expander?: boolean; + + /** Header Groups only */ + columns?: any[]; +} + +export interface ColumnRenderProps { + /** Sorted data. */ + data: any[]; + + /** The column. */ + column: Column; +} + +export interface RowRenderProps extends Partial<RowInfo> { + /** Whenever the current row is expanded */ + isExpanded?: boolean; + + /** The current cell value */ + value?: any; +} + +export interface RowInfo { + /** Original row from your data */ + row: any; + + /** The post-accessed values from the original row */ + rowValues: any; + + /** The index of the row */ + index: number; + + /** The index of the row relative to the current page */ + viewIndex: number; + + /** The nesting depth (zero-indexed) */ + level: number; + + /** The nesting path of the row */ + nestingPath: number[]; + + /** A boolean stating if the row is an aggregation row */ + aggregated: boolean; + + /** An array of any expandable sub-rows contained in this row */ + subRows: any[]; +} + +export interface FinalState extends TableProps { + startRow: number; + endRow: number; + pageRows: number; + padRows: number; + hasColumnFooter: boolean; + canPrevious: boolean; + canNext: boolean; + rowMinWidth: number; +} + +export class ReactTable extends React.Component<Partial<TableProps>> {} diff --git a/types/react-table/react-table-tests.tsx b/types/react-table/react-table-tests.tsx new file mode 100644 index 0000000000..3069785b6e --- /dev/null +++ b/types/react-table/react-table-tests.tsx @@ -0,0 +1,57 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; + +// Import React Table +import { ReactTable } from "react-table"; +import "react-table/react-table.css"; + +const columns = [ + { + Header: "Name", + columns: [ + {Header: "First Name", accessor: "firstName"}, + {Header: "Last Name", id: "lastName"} + ] + }, + { + Header: "Info", + columns: [ + {Header: "Age", accessor: "age"}, + {Header: "Status", accessor: "status"} + ] + }, + { + Header: 'Stats', + columns: [ + {Header: "Visits", accessor: "visits"} + ] + } +]; + +const Component = (props: {}) => { + const data = [ + {firstName: "plastic", lastName: "leather", age: 1, visits: 87, progress: 53}, + {firstName: "eggs", lastName: "quartz", age: 13, visits: 78, progress: 82}, + {firstName: "wash", lastName: "wrench", age: 29, visits: 75, progress: 49}, + {firstName: "introduction", lastName: "impression", age: 2, visits: 35, progress: 51}, + {firstName: "steel", lastName: "difference", age: 9, visits: 64, progress: 94}, + {firstName: "snakes", lastName: "corn", age: 17, visits: 55, progress: 47}, + {firstName: "ocean", lastName: "definition", age: 26, visits: 17, progress: 22}, + {firstName: "drawing", lastName: "fifth", age: 15, visits: 84, progress: 12}, + {firstName: "silver", lastName: "riddle", age: 15, visits: 59, progress: 24}, + {firstName: "surprise", lastName: "zinc", age: 23, visits: 7, progress: 48}, + {firstName: "riddle", lastName: "information", age: 2, visits: 63, progress: 3} + ]; + return ( + <div> + <ReactTable + data={data} + columns={columns} + defaultPageSize={10} + /> + <br /> + </div> + ); +}; + +ReactDOM.render(<Component />, document.getElementById("root")); diff --git a/types/react-table/tsconfig.json b/types/react-table/tsconfig.json new file mode 100644 index 0000000000..d137af14a2 --- /dev/null +++ b/types/react-table/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-table-tests.tsx" + ] +} diff --git a/types/react-table/tslint.json b/types/react-table/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-table/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 91c21b794a2c7fa3319915ef716c2f895745a7fd Mon Sep 17 00:00:00 2001 From: Matt Traynham <skitch920@gmail.com> Date: Mon, 2 Oct 2017 17:49:43 -0400 Subject: [PATCH 58/67] Updating webpack-merge to v4 (#20136) --- types/webpack-merge/index.d.ts | 43 +++++++----- types/webpack-merge/tsconfig.json | 4 +- types/webpack-merge/tslint.json | 1 + types/webpack-merge/v0/index.d.ts | 25 +++++++ types/webpack-merge/v0/tsconfig.json | 26 ++++++++ types/webpack-merge/v0/webpack-merge-tests.ts | 12 ++++ types/webpack-merge/webpack-merge-tests.ts | 65 ++++++++++++++++--- 7 files changed, 149 insertions(+), 27 deletions(-) create mode 100644 types/webpack-merge/tslint.json create mode 100644 types/webpack-merge/v0/index.d.ts create mode 100644 types/webpack-merge/v0/tsconfig.json create mode 100644 types/webpack-merge/v0/webpack-merge-tests.ts diff --git a/types/webpack-merge/index.d.ts b/types/webpack-merge/index.d.ts index a939a2ed53..421737ccaf 100644 --- a/types/webpack-merge/index.d.ts +++ b/types/webpack-merge/index.d.ts @@ -1,25 +1,34 @@ -// Type definitions for webpack-merge +// Type definitions for webpack-merge 4.1 // Project: https://github.com/survivejs/webpack-merge -// Definitions by: Simon Hartcher <https://github.com/deevus> +// Definitions by: Simon Hartcher <https://github.com/deevus>, Matt Traynham <https://github.com/mtraynham> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -///<reference types="webpack" /> +import webpack = require('webpack'); -declare module "webpack-merge" { - import { Configuration } from "webpack"; +export = webpackMerge; + +declare const webpackMerge: webpackMerge.WebpackMerge; + +declare namespace webpackMerge { + type CustomizeArrayFunction = (a: any[], b: any[], key: string) => any[] | null | undefined; + type CustomizeObjectFunction = (a: {}, b: {}, key: string) => {} | null | undefined; + type UniqueFunction = (field: string, fields: string[], keyFn: (field: any) => string) => CustomizeArrayFunction; + interface CustomizeOptions { + customizeArray?: CustomizeArrayFunction | UniqueFunction; + customizeObject?: CustomizeObjectFunction; + } + type ConfigurationMergeFunction = (...configs: webpack.Configuration[]) => webpack.Configuration; + type ConfigurationMergeConfigFunction = (customizeOptions: CustomizeOptions) => ConfigurationMergeFunction; + type MergeFunction = ConfigurationMergeFunction | ConfigurationMergeConfigFunction; + type MergeStrategy = 'prepend' | 'append' | 'replace'; interface WebpackMerge { - /** - * Merge multiple webpack configurations into one. - */ - (...configs: Configuration[]): Configuration; - - /** - * Merge multiple webpack configurations into one, with smart merging of loaders. - */ - smart(...configs: Configuration[]): Configuration; + (...configs: webpack.Configuration[]): webpack.Configuration; + (customizeOptions: CustomizeOptions): ConfigurationMergeFunction; + unique: UniqueFunction; + smart: ConfigurationMergeFunction; + multiple: ConfigurationMergeFunction; + strategy(options: {[field: string]: MergeStrategy}): ConfigurationMergeFunction; + smartStrategy(options: {[key: string]: MergeStrategy}): ConfigurationMergeFunction; } - - const merge: WebpackMerge; - export = merge; } diff --git a/types/webpack-merge/tsconfig.json b/types/webpack-merge/tsconfig.json index f2368dc89d..78589b444b 100644 --- a/types/webpack-merge/tsconfig.json +++ b/types/webpack-merge/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "webpack-merge-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/webpack-merge/tslint.json b/types/webpack-merge/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/webpack-merge/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/webpack-merge/v0/index.d.ts b/types/webpack-merge/v0/index.d.ts new file mode 100644 index 0000000000..a939a2ed53 --- /dev/null +++ b/types/webpack-merge/v0/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for webpack-merge +// Project: https://github.com/survivejs/webpack-merge +// Definitions by: Simon Hartcher <https://github.com/deevus> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +///<reference types="webpack" /> + +declare module "webpack-merge" { + import { Configuration } from "webpack"; + + interface WebpackMerge { + /** + * Merge multiple webpack configurations into one. + */ + (...configs: Configuration[]): Configuration; + + /** + * Merge multiple webpack configurations into one, with smart merging of loaders. + */ + smart(...configs: Configuration[]): Configuration; + } + + const merge: WebpackMerge; + export = merge; +} diff --git a/types/webpack-merge/v0/tsconfig.json b/types/webpack-merge/v0/tsconfig.json new file mode 100644 index 0000000000..aedaa9a44e --- /dev/null +++ b/types/webpack-merge/v0/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "webpack-merge": ["webpack-merge/v0"], + "webpack-merge/*": ["webpack-merge/v0/*"] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "webpack-merge-tests.ts" + ] +} \ No newline at end of file diff --git a/types/webpack-merge/v0/webpack-merge-tests.ts b/types/webpack-merge/v0/webpack-merge-tests.ts new file mode 100644 index 0000000000..4c9c4adca4 --- /dev/null +++ b/types/webpack-merge/v0/webpack-merge-tests.ts @@ -0,0 +1,12 @@ +import merge = require("webpack-merge"); +import { Configuration } from "webpack"; + +const a: Configuration = { + entry: "test.js" +} +const b: Configuration = { + devtool: "source-map" +} + +const c = merge(a, b); +const d = merge.smart(a, b); diff --git a/types/webpack-merge/webpack-merge-tests.ts b/types/webpack-merge/webpack-merge-tests.ts index 4c9c4adca4..d7180a6950 100644 --- a/types/webpack-merge/webpack-merge-tests.ts +++ b/types/webpack-merge/webpack-merge-tests.ts @@ -1,12 +1,61 @@ -import merge = require("webpack-merge"); -import { Configuration } from "webpack"; +import _ = require('lodash'); +import { Configuration, HotModuleReplacementPlugin, Plugin } from 'webpack'; +import webpackMerge = require('webpack-merge'); const a: Configuration = { - entry: "test.js" -} + entry: 'test.js' +}; const b: Configuration = { - devtool: "source-map" -} + devtool: 'source-map' +}; -const c = merge(a, b); -const d = merge.smart(a, b); +const c: Configuration = webpackMerge(a, b); +const d: Configuration = webpackMerge.smart(a, b); +const e: Configuration = webpackMerge.multiple(a, b); +const f: Configuration = webpackMerge( + { + customizeArray(x: any[], y: any[], key: string): any[] | undefined { + if (key === 'extensions') { + return _.uniq([...x, ...y]); + } + // Fall back to default merging + return undefined; + }, + customizeObject(x: {}, y: {}, key: string): {} | undefined { + if (key === 'module') { + // Custom merging + return _.merge({}, x, y); + } + + // Fall back to default merging + return undefined; + } + } +)(a, b); +const g: Configuration = webpackMerge({ + customizeArray: webpackMerge.unique( + 'plugins', + ['HotModuleReplacementPlugin'], + (plugin: Plugin) => plugin.constructor && plugin.constructor.name + ) +})({ + plugins: [ + new HotModuleReplacementPlugin() + ] +}, { + plugins: [ + new HotModuleReplacementPlugin() + ] +}); +const h: Configuration = webpackMerge.strategy( + { + entry: 'prepend', // or 'replace', defaults to 'append' + 'module.loaders': 'prepend' + } +)(a, b); +const i: Configuration = webpackMerge.smartStrategy( + { + entry: 'prepend', // or 'replace' + 'module.loaders': 'prepend' + } +)(a, b); From 13cd8f2c5c1f049c1369f6fbf78bd6d0c5a00cc9 Mon Sep 17 00:00:00 2001 From: Bradley Ayers <bradley.ayers@gmail.com> Date: Tue, 3 Oct 2017 08:50:33 +1100 Subject: [PATCH 59/67] Add pg-ears 1.0 (#20152) --- types/pg-ears/index.d.ts | 24 ++++++++++++++++++++++++ types/pg-ears/pg-ears-tests.ts | 11 +++++++++++ types/pg-ears/tsconfig.json | 22 ++++++++++++++++++++++ types/pg-ears/tslint.json | 1 + 4 files changed, 58 insertions(+) create mode 100644 types/pg-ears/index.d.ts create mode 100644 types/pg-ears/pg-ears-tests.ts create mode 100644 types/pg-ears/tsconfig.json create mode 100644 types/pg-ears/tslint.json diff --git a/types/pg-ears/index.d.ts b/types/pg-ears/index.d.ts new file mode 100644 index 0000000000..d3fdaadf89 --- /dev/null +++ b/types/pg-ears/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for pg-ears 1.0 +// Project: https://github.com/doesdev/pg-ears +// Definitions by: Bradley Ayers <https://github.com/bradleyayers> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { ClientConfig } from "pg"; + +interface PgEars { + listen( + channel: string, + cb: (err: Error | null, payload?: string) => void + ): null; + notify(channel: string, payload: any, cb?: (err: Error) => void): void; +} + +declare function pg_ears( + opts: ClientConfig & { + maxAttempts?: number; + // Interval between connection retries, in milliseconds. + checkInterval?: number; + } +): PgEars; + +export = pg_ears; diff --git a/types/pg-ears/pg-ears-tests.ts b/types/pg-ears/pg-ears-tests.ts new file mode 100644 index 0000000000..7dbb8efbc6 --- /dev/null +++ b/types/pg-ears/pg-ears-tests.ts @@ -0,0 +1,11 @@ +import PgEars = require("pg-ears"); + +const pgEars = PgEars({ + checkInterval: 10000, + maxAttempts: 6 * 60 * 24, + host: "example.com", + port: 5432, + database: "example", + user: "postgres", + password: "" +}); diff --git a/types/pg-ears/tsconfig.json b/types/pg-ears/tsconfig.json new file mode 100644 index 0000000000..58f2ea0adf --- /dev/null +++ b/types/pg-ears/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", + "pg-ears-tests.ts" + ] +} diff --git a/types/pg-ears/tslint.json b/types/pg-ears/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pg-ears/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 563022d9a6b6aa894424c049fa57ab1177c866c4 Mon Sep 17 00:00:00 2001 From: Samer Albahra <salbahra@gmail.com> Date: Mon, 2 Oct 2017 16:51:37 -0500 Subject: [PATCH 60/67] Add Intercom Web API Typings (#20200) * Add Intercom Web Typings * Fix definitions URL --- types/intercom-web/index.d.ts | 57 ++++++++++++++++++++++ types/intercom-web/intercom-web-tests.ts | 62 ++++++++++++++++++++++++ types/intercom-web/tsconfig.json | 22 +++++++++ types/intercom-web/tslint.json | 1 + 4 files changed, 142 insertions(+) create mode 100755 types/intercom-web/index.d.ts create mode 100755 types/intercom-web/intercom-web-tests.ts create mode 100755 types/intercom-web/tsconfig.json create mode 100644 types/intercom-web/tslint.json diff --git a/types/intercom-web/index.d.ts b/types/intercom-web/index.d.ts new file mode 100755 index 0000000000..1eb038bd07 --- /dev/null +++ b/types/intercom-web/index.d.ts @@ -0,0 +1,57 @@ +// Type definitions for Intercom Web API 2.8 +// Project: https://docs.intercom.io/ +// configure-intercom-for-your-product-or-site/ +// customize-the-intercom-messenger/the-intercom-javascript-api +// Definitions by: Andrew Fong <https://github.com/fongandrew> +// Samer Albahra <https://github.com/salbahra> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace Intercom_ { + interface IntercomSettings { + app_id?: string; + email?: string; + created_at?: number; + name?: string; + user_id?: string; + user_hash?: string; + widget?: { + activator?: string; + }; + company?: { + id: string|number, + name: string, + created_at: number, + plan?: string, + monthly_spend?: number, + [index: string]: any; + }; + } + + type IntercomCommand = 'boot' + |'shutdown' + |'update' + |'hide' + |'show' + |'showMessages' + |'showNewMessage' + |'onHide' + |'onShow' + |'onActivatorClick' + |'trackEvent'; + + interface IntercomStatic { + (command: 'boot', param: IntercomSettings): void; + (command: 'shutdown' | 'hide' | 'show' | 'showMessages'): void; + (command: 'update', param?: IntercomSettings): void; + (command: 'showNewMessage', param?: string): void; + (command: 'onHide' | 'onShow' | 'onActivatorClick', param?: () => void): void; + (command: 'trackEvent', tag?: string, metadata?: any): void; + (command: IntercomCommand, param1?: any, param2?: any): void; + } +} + +declare var Intercom: Intercom_.IntercomStatic; +declare var intercomSettings: Intercom_.IntercomSettings; +interface Window { + intercomSettings: Intercom_.IntercomSettings; +} diff --git a/types/intercom-web/intercom-web-tests.ts b/types/intercom-web/intercom-web-tests.ts new file mode 100755 index 0000000000..22eeddc8fa --- /dev/null +++ b/types/intercom-web/intercom-web-tests.ts @@ -0,0 +1,62 @@ +/* + From https://docs.intercom.io/configure-intercom-for-your-product-or-site/ + customize-the-intercom-messenger/the-intercom-javascript-api +*/ +intercomSettings = { + email: "example@example.com", + name: "John Doe", + user_id: "123", + created_at: 1234567890, + app_id: "YOUR_APP_ID", + widget: { + activator: "#Intercom" + } +}; + +Intercom('boot', intercomSettings); +Intercom('shutdown'); +Intercom('update'); +Intercom('update', intercomSettings); +Intercom('hide'); +Intercom('show'); +Intercom('showMessages'); +Intercom('showNewMessage'); +Intercom('showNewMessage', 'pre-populated content'); +Intercom('onHide', () => { /* Do stuff */ }); +Intercom('onActivatorClick', () => { /* Do stuff */ }); +Intercom('trackEvent', 'invited-friend'); + +const metadata = { + invitee_email: 'pi@example.org', + invite_code: 'ADDAFRIEND' +}; +Intercom('trackEvent', 'invited-friend', metadata); + +/* + From https://docs.intercom.io/configure-intercom-for-your-product-or-site/ + customize-intercom-to-be-about-your-users/ + group-your-users-by-company +*/ +intercomSettings = { + email: "example@example.com", + created_at: 1457552104, + app_id: "pi3243fa", + company: { + id: '123', + name: 'Intercorp', + created_at: 1234567890, + plan: 'pro', + monthly_spend: 10, + upgraded_at: 1424941688 + } +}; + +/* + From https://docs.intercom.io/configure-intercom-for-your-product-or-site/ + staying-secure/enable-secure-mode-on-your-web-product +*/ +intercomSettings = { + app_id: "pi3243fa", + user_id: "12345", + user_hash: "775c502lcc1087d12398571837c" +}; diff --git a/types/intercom-web/tsconfig.json b/types/intercom-web/tsconfig.json new file mode 100755 index 0000000000..d11c606183 --- /dev/null +++ b/types/intercom-web/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", + "intercom-web-tests.ts" + ] +} diff --git a/types/intercom-web/tslint.json b/types/intercom-web/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/intercom-web/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From 65c3042950942b52565081a51bb4be6470cea6ab Mon Sep 17 00:00:00 2001 From: segayuu <segayuu@gmail.com> Date: Tue, 3 Oct 2017 07:05:45 +0900 Subject: [PATCH 61/67] [bluebird] Added tslint.json. (#19816) * Added tslint.json * Merge commit from source fork (#2) * Add setVisible to iFrame control * Initial API without namespaces. * Did more work on typings. * Final changes to the typings. * add className prop and make manager prop optional * [jquery.fancytree] added enableUpdate method (reference http://www.wwwendt.de/tech/fancytree/doc/jsdoc/Fancytree.html#enableUpdate) * Fix typo (any -> all) for everyWhere description * Minor Pixi.js updates to v4.5.5 * mfiles: Added missing CLSID constants * Reduce strictness of types for redux actions to reduce false positives * Set required tsc version for depended package * Update to index.d.ts Added change suggested by @pocesar * Updated test to reflect remote changes Second class, remoteBool to test for remote is boolean * mfiles: Added support for application platform property * bootstrap-datepicker - append all available datepicker events * Update Ignite UI typing definition according the latest 17.1 build * Added 'static' to Model.remoteMethod Integrated the remoteMethod ideas from https://github.com/Sequoia/loopback-type-definitions/blob/master/loopback.d.ts into the existing type Improves remoteMethod composition and checking. No impact on other types * add lost options member add comments * Updating comment in remoteMethod JSDoc Added simple test for remoteMethod * Fixing dtslint issues * Fixed errors from running tests. Travis CI should pass now * Updated test example with real parameters * update ColorWrap types * change type name * feat(prettier): update to version 1.7 * [angular-strap] updated all options to 2.3.8 * [angular-strap] added tslint and resolved linting issues * Remove moved file * Add separate process event contexts * export all interfaces from pdfjs-dist * Fix lint errors * Typo fix * Add editorState param to event handlers * Fix parse_response type and use lookup type * Change stage direction to proper case * [react-data-grid] Added openCellEditor signature to ReactDataGrid instance * Add remaining missing Xrm.Page.data.process methods * Add new label type for X/YAxis * Add contribution name * Update definitions for @types/angular-loading-bar to be accurate * Formatting update * Adding type for the function instead of just Function * Adding a test * Try to fix tests for angular-loading-bar types * feat(react-native-elements): pull from iRoachie * Update Label type * Support multiple colors / styles Winston supports configuring multiple styles rather than a single color. For example you could winston.addColors( { error: ['white', 'underline', 'bgRed'] }); * feat(react-native-element): add multiple components The work is not yet completed, however there are several components provided and the rest will be completed in the next few days. * fix(react-native-elements): unneeded breaking imports * Update d3-geo to version 1.7.1 Includes geoNaturalEarth1 and geoNaturalEarth1Raw * Type definitions for react-mce 0.6. * Use generic defaults. * Reduce TypeScript version to 2.3 * feat(react-native-elements): add rating component * feat(react-native-elements): add SearchBar component * webpack: improve loader context typings emitError() and emitWarning() both can accept an Error as well, for exposing caught Errors. See: https://github.com/webpack/webpack/blob/master/lib/NormalModule.js#L115 Added relevant type tests. * fix: do not make use of es6's Map and Set this should fix #16587 * feat(react-native-elements): add SideMenu component * feat(react-native-elements): add Slider component * feat(react-native-elements): add SocialIcons component * feat(react-native-elements): add SwipeDeck component * feat(react-native-elements): add Tabs component * feat(react-native-elements): add Tile component * feat(react-native-elements): add utility exports * docs(react-native-elements): remove deprecated message * first pass at the electron-winstaller declaration * lint * Adding definitions for prosemirror-table * Added minArea to DragBoxOptions (https://openlayers.org/en/latest/apidoc/ol.interaction.DragBox.html) * added minArea to test * Remove myself from list of maintainers * stripe-v3: Add basic typings for createSource method * stripe-v3: Lint SourceOptions * stripe-v3: Conert tabs to spaces * Add ChartFontOptions to global Chart.js options * angular-ui-router: Can't export a string literal (#19839) * angular-gridster: Can't export a string literal (#19842) * react-router/v2: Fix default export of object (#19849) * history/v2 and /v3: Fix export default of object (#19847) * Add definitions for W3C Web USB API * logat: Fix export (#19848) * adal: Fix export style (#19838) * strophe: Fix export (#19850) * express-brute-mongo: Fix export (#19851) * argparse: Remove unnecessary type parameters (#19843) * Support conditional values in Vega * Add onLoad animation configuration Alluded to here in documentation: https://formidable.com/open-source/victory/docs/victory-stack Code references: https://github.com/FormidableLabs/victory-core/blob/e28d4b81eaa0b303d88d7c3124aec4c77d8c9970/src/victory-util/default-transitions.js#L5 https://github.com/FormidableLabs/victory-core/blob/e28d4b81eaa0b303d88d7c3124aec4c77d8c9970/src/victory-util/default-transitions.js#L19 * Fix restify declarations to comply with standard lint rules. This change requires TypeScript 2.2 because the type 'object' did not exist in 2.1. * hopscotch small fixes, no breaking changes * fix typo fix typo * bull: added missing method "promote" from bull v3 to typings * Minor fixes from review * stripe-v3: Lint * types for tabulator * Ramda: disable no-unnecessary-generics (#19785) * fixing tests * adding more test * Merge PR #19726: [react-data-grid] Added getValidateFilterValues signature to GridProps * [react-data-grid] Added getValidateFilterValues signature to GridProps * Add resizerClassName * More verbose definition for pathOr * strictNullChecks: true --- types/bluebird/tslint.json | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 types/bluebird/tslint.json diff --git a/types/bluebird/tslint.json b/types/bluebird/tslint.json new file mode 100644 index 0000000000..55713db673 --- /dev/null +++ b/types/bluebird/tslint.json @@ -0,0 +1,29 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "ban-types": false, + "comment-format": false, + "dt-header": false, + "max-line-length": false, + "member-access": false, + "no-consecutive-blank-lines": false, + "no-padding": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-generics": false, + "no-var-keyword": false, + "no-void-expression": false, + "one-line": false, + "only-arrow-functions": false, + "prefer-const": false, + "prefer-method-signature": false, + "semicolon": false, + "space-before-function-paren": false, + "strict-export-declare-modifiers": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} \ No newline at end of file From 2233a0eee6071846fd8b1c29e40e966b5c01d091 Mon Sep 17 00:00:00 2001 From: Andrew Goodale <andrewhgoodale@gmail.com> Date: Mon, 2 Oct 2017 18:06:51 -0400 Subject: [PATCH 62/67] Allow projects to use React declarations without the DOM lib dependency. (#20005) --- types/react/global.d.ts | 176 ++++++++++++++++++++++++++++++++++++++++ types/react/index.d.ts | 2 + 2 files changed, 178 insertions(+) create mode 100644 types/react/global.d.ts diff --git a/types/react/global.d.ts b/types/react/global.d.ts new file mode 100644 index 0000000000..8ebeb64bad --- /dev/null +++ b/types/react/global.d.ts @@ -0,0 +1,176 @@ +/* +React projects that don't include the DOM library need these interfaces to compile. +React Native applications use React, but there is no DOM available. The JavaScript runtime +is ES6/ES2015 only. These definitions allow such projects to compile with only `--lib ES6`. +*/ + +interface Event { } +interface AnimationEvent extends Event { } +interface ClipboardEvent extends Event { } +interface CompositionEvent extends Event { } +interface DragEvent extends Event { } +interface FocusEvent extends Event { } +interface KeyboardEvent extends Event { } +interface MouseEvent extends Event { } +interface TouchEvent extends Event { } +interface TransitionEvent extends Event { } +interface UIEvent extends Event { } +interface WheelEvent extends Event { } + +interface EventTarget { } +interface Document { } +interface DataTransfer { } +interface StyleMedia { } + +interface Element { } + +interface HTMLElement extends Element { } +interface HTMLAnchorElement extends HTMLElement { } +interface HTMLAreaElement extends HTMLElement { } +interface HTMLAudioElement extends HTMLElement { } +interface HTMLBaseElement extends HTMLElement { } +interface HTMLBodyElement extends HTMLElement { } +interface HTMLBRElement extends HTMLElement { } +interface HTMLButtonElement extends HTMLElement { } +interface HTMLCanvasElement extends HTMLElement { } +interface HTMLDivElement extends HTMLElement { } +interface HTMLDListElement extends HTMLElement { } +interface HTMLEmbedElement extends HTMLElement { } +interface HTMLFieldSetElement extends HTMLElement { } +interface HTMLFormElement extends HTMLElement { } +interface HTMLHeadingElement extends HTMLElement { } +interface HTMLHeadElement extends HTMLElement { } +interface HTMLHRElement extends HTMLElement { } +interface HTMLTableColElement extends HTMLElement { } +interface HTMLDataListElement extends HTMLElement { } +interface HTMLHtmlElement extends HTMLElement { } +interface HTMLIFrameElement extends HTMLElement { } +interface HTMLImageElement extends HTMLElement { } +interface HTMLInputElement extends HTMLElement { } +interface HTMLModElement extends HTMLElement { } +interface HTMLLabelElement extends HTMLElement { } +interface HTMLLegendElement extends HTMLElement { } +interface HTMLLIElement extends HTMLElement { } +interface HTMLLinkElement extends HTMLElement { } +interface HTMLMapElement extends HTMLElement { } +interface HTMLMetaElement extends HTMLElement { } +interface HTMLObjectElement extends HTMLElement { } +interface HTMLOListElement extends HTMLElement { } +interface HTMLOptGroupElement extends HTMLElement { } +interface HTMLOptionElement extends HTMLElement { } +interface HTMLParagraphElement extends HTMLElement { } +interface HTMLParamElement extends HTMLElement { } +interface HTMLPreElement extends HTMLElement { } +interface HTMLProgressElement extends HTMLElement { } +interface HTMLQuoteElement extends HTMLElement { } +interface HTMLScriptElement extends HTMLElement { } +interface HTMLSelectElement extends HTMLElement { } +interface HTMLSourceElement extends HTMLElement { } +interface HTMLSpanElement extends HTMLElement { } +interface HTMLStyleElement extends HTMLElement { } +interface HTMLTableElement extends HTMLElement { } +interface HTMLTableSectionElement extends HTMLElement { } +interface HTMLTableDataCellElement extends HTMLElement { } +interface HTMLTextAreaElement extends HTMLElement { } +interface HTMLTableSectionElement extends HTMLElement { } +interface HTMLTableHeaderCellElement extends HTMLElement { } +interface HTMLTableSectionElement extends HTMLElement { } +interface HTMLTitleElement extends HTMLElement { } +interface HTMLTableRowElement extends HTMLElement { } +interface HTMLTrackElement extends HTMLElement { } +interface HTMLUListElement extends HTMLElement { } +interface HTMLVideoElement extends HTMLElement { } +interface HTMLTableColElement extends HTMLElement { } +interface HTMLDataListElement extends HTMLElement { } +interface HTMLHtmlElement extends HTMLElement { } +interface HTMLIFrameElement extends HTMLElement { } +interface HTMLImageElement extends HTMLElement { } +interface HTMLInputElement extends HTMLElement { } +interface HTMLModElement extends HTMLElement { } +interface HTMLLabelElement extends HTMLElement { } +interface HTMLLegendElement extends HTMLElement { } +interface HTMLLIElement extends HTMLElement { } +interface HTMLLinkElement extends HTMLElement { } +interface HTMLMapElement extends HTMLElement { } +interface HTMLMetaElement extends HTMLElement { } +interface HTMLObjectElement extends HTMLElement { } +interface HTMLOListElement extends HTMLElement { } +interface HTMLOptGroupElement extends HTMLElement { } +interface HTMLOptionElement extends HTMLElement { } +interface HTMLParagraphElement extends HTMLElement { } +interface HTMLParamElement extends HTMLElement { } +interface HTMLPreElement extends HTMLElement { } +interface HTMLProgressElement extends HTMLElement { } +interface HTMLQuoteElement extends HTMLElement { } +interface HTMLScriptElement extends HTMLElement { } +interface HTMLSelectElement extends HTMLElement { } +interface HTMLSourceElement extends HTMLElement { } +interface HTMLSpanElement extends HTMLElement { } +interface HTMLStyleElement extends HTMLElement { } +interface HTMLTableElement extends HTMLElement { } +interface HTMLTableSectionElement extends HTMLElement { } +interface HTMLTableDataCellElement extends HTMLElement { } +interface HTMLTextAreaElement extends HTMLElement { } +interface HTMLTableSectionElement extends HTMLElement { } +interface HTMLTableHeaderCellElement extends HTMLElement { } +interface HTMLTableSectionElement extends HTMLElement { } +interface HTMLTitleElement extends HTMLElement { } +interface HTMLTableRowElement extends HTMLElement { } +interface HTMLTrackElement extends HTMLElement { } +interface HTMLUListElement extends HTMLElement { } +interface HTMLVideoElement extends HTMLElement { } + +interface SVGElement extends Element { } +interface SVGSVGElement extends SVGElement { } +interface SVGCircleElement extends SVGElement { } +interface SVGClipPathElement extends SVGElement { } +interface SVGDefsElement extends SVGElement { } +interface SVGDescElement extends SVGElement { } +interface SVGEllipseElement extends SVGElement { } +interface SVGFEBlendElement extends SVGElement { } +interface SVGFEColorMatrixElement extends SVGElement { } +interface SVGFEComponentTransferElement extends SVGElement { } +interface SVGFECompositeElement extends SVGElement { } +interface SVGFEConvolveMatrixElement extends SVGElement { } +interface SVGFEDiffuseLightingElement extends SVGElement { } +interface SVGFEDisplacementMapElement extends SVGElement { } +interface SVGFEDistantLightElement extends SVGElement { } +interface SVGFEFloodElement extends SVGElement { } +interface SVGFEFuncAElement extends SVGElement { } +interface SVGFEFuncBElement extends SVGElement { } +interface SVGFEFuncGElement extends SVGElement { } +interface SVGFEFuncRElement extends SVGElement { } +interface SVGFEGaussianBlurElement extends SVGElement { } +interface SVGFEImageElement extends SVGElement { } +interface SVGFEMergeElement extends SVGElement { } +interface SVGFEMergeNodeElement extends SVGElement { } +interface SVGFEMorphologyElement extends SVGElement { } +interface SVGFEOffsetElement extends SVGElement { } +interface SVGFEPointLightElement extends SVGElement { } +interface SVGFESpecularLightingElement extends SVGElement { } +interface SVGFESpotLightElement extends SVGElement { } +interface SVGFETileElement extends SVGElement { } +interface SVGFETurbulenceElement extends SVGElement { } +interface SVGFilterElement extends SVGElement { } +interface SVGForeignObjectElement extends SVGElement { } +interface SVGGElement extends SVGElement { } +interface SVGImageElement extends SVGElement { } +interface SVGLineElement extends SVGElement { } +interface SVGLinearGradientElement extends SVGElement { } +interface SVGMarkerElement extends SVGElement { } +interface SVGMaskElement extends SVGElement { } +interface SVGMetadataElement extends SVGElement { } +interface SVGPathElement extends SVGElement { } +interface SVGPatternElement extends SVGElement { } +interface SVGPolygonElement extends SVGElement { } +interface SVGPolylineElement extends SVGElement { } +interface SVGRadialGradientElement extends SVGElement { } +interface SVGRectElement extends SVGElement { } +interface SVGStopElement extends SVGElement { } +interface SVGSwitchElement extends SVGElement { } +interface SVGSymbolElement extends SVGElement { } +interface SVGTextElement extends SVGElement { } +interface SVGTextPathElement extends SVGElement { } +interface SVGTSpanElement extends SVGElement { } +interface SVGUseElement extends SVGElement { } +interface SVGViewElement extends SVGElement { } diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 56d417319a..f3b2d30884 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -47,6 +47,8 @@ React.cloneElement(element, <{ isDisabled?: boolean } & React.Attributes>{ }); */ +/// <reference path="global.d.ts" /> + type NativeAnimationEvent = AnimationEvent; type NativeClipboardEvent = ClipboardEvent; type NativeCompositionEvent = CompositionEvent; From 2fba16f44bb597395f69f2a762cc2c2111c6254e Mon Sep 17 00:00:00 2001 From: Seth Westphal <westy92@users.noreply.github.com> Date: Mon, 2 Oct 2017 17:11:46 -0500 Subject: [PATCH 63/67] Add OpenTok Archive layout options. (#20218) * Add OpenTok Archive layout options. * Fix styesheet type. --- types/opentok/index.d.ts | 12 ++++++++++++ types/opentok/opentok-tests.ts | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/types/opentok/index.d.ts b/types/opentok/index.d.ts index 4667324d2e..85b9794316 100644 --- a/types/opentok/index.d.ts +++ b/types/opentok/index.d.ts @@ -33,6 +33,18 @@ declare module 'opentok' { hasAudio?: boolean; hasVideo?: boolean; outputMode?: OutputMode; + layout?: ArchiveLayoutOptions; + } + + export type ArchiveLayoutOptions = PredefinedArchiveLayoutOptions | CustomArchiveLayoutOptions; + + export interface PredefinedArchiveLayoutOptions { + type: 'bestFit' | 'pip' | 'verticalPresentation' | 'horizontalPresentation'; + } + + export interface CustomArchiveLayoutOptions { + type: 'custom'; + stylesheet: string; } export type MediaMode = 'relayed' | 'routed'; diff --git a/types/opentok/opentok-tests.ts b/types/opentok/opentok-tests.ts index e1df18c6ea..c0f93f333f 100644 --- a/types/opentok/opentok-tests.ts +++ b/types/opentok/opentok-tests.ts @@ -28,6 +28,21 @@ const archiveOptions: OpenTok.ArchiveOptions = { outputMode: 'individual', }; +const archiveCustomLayoutOptions: OpenTok.ArchiveOptions = { + outputMode: 'composed', + layout: { + type: 'custom', + stylesheet: 'derp', + } +}; + +const archivePredefinedLayoutOptions: OpenTok.ArchiveOptions = { + outputMode: 'composed', + layout: { + type: 'pip', + } +}; + client.startArchive('SESSION_ID', archiveOptions, (err: Error, archive: OpenTok.Archive) => { if (err) return console.log(err); console.log(archive.id); From e54b30fafcb1444325778d198123966bcde8e589 Mon Sep 17 00:00:00 2001 From: Steven <steven@ceriously.com> Date: Tue, 3 Oct 2017 06:08:01 +0700 Subject: [PATCH 64/67] react-dom: Upgrade to v16.0.0 (#20065) * Add hydrate method * Add hydrate to react-dom-tests.ts * Fix whitespace * Create shared interface for `render` and `hydrate` * Add renderToNodeStream and renderToStaticNodeStream methods in ReactDomServer * Add proper nodejs.readablestream * Add react-dom v15 for backwards compatibility * Add proper baseUrl for react-dom/v15 * Change react test _interval type to NodeJS.Timer * Export the renderer interface * Change react/v15 to use NodeJS.Timer --- types/react-dom/index.d.ts | 61 ++--- types/react-dom/react-dom-tests.ts | 5 + types/react-dom/server/index.d.ts | 17 ++ types/react-dom/v15/index.d.ts | 70 ++++++ types/react-dom/v15/node-stream/index.d.ts | 18 ++ types/react-dom/v15/react-dom-tests.ts | 155 ++++++++++++ types/react-dom/v15/server/index.d.ts | 24 ++ types/react-dom/v15/test-utils/index.d.ts | 276 +++++++++++++++++++++ types/react-dom/v15/tsconfig.json | 34 +++ types/react-dom/v15/tslint.json | 9 + types/react/test/index.ts | 2 +- types/react/v15/test/index.ts | 2 +- 12 files changed, 642 insertions(+), 31 deletions(-) create mode 100644 types/react-dom/v15/index.d.ts create mode 100644 types/react-dom/v15/node-stream/index.d.ts create mode 100644 types/react-dom/v15/react-dom-tests.ts create mode 100644 types/react-dom/v15/server/index.d.ts create mode 100644 types/react-dom/v15/test-utils/index.d.ts create mode 100644 types/react-dom/v15/tsconfig.json create mode 100644 types/react-dom/v15/tslint.json diff --git a/types/react-dom/index.d.ts b/types/react-dom/index.d.ts index 796314e19f..35e4b20550 100644 --- a/types/react-dom/index.d.ts +++ b/types/react-dom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React (react-dom) 15.5 +// Type definitions for React (react-dom) 16.0 // Project: http://facebook.github.io/react/ // Definitions by: Asana <https://asana.com> // AssureSign <http://www.assuresign.com> @@ -17,37 +17,11 @@ import { export function findDOMNode<E extends Element>(instance: ReactInstance): E; export function findDOMNode(instance: ReactInstance): Element; - -export function render<P extends DOMAttributes<T>, T extends Element>( - element: DOMElement<P, T>, - container: Element | null, - callback?: (element: T) => any -): T; -export function render<P>( - element: SFCElement<P>, - container: Element | null, - callback?: () => any -): void; -export function render<P, T extends Component<P, ComponentState>>( - element: CElement<P, T>, - container: Element | null, - callback?: (component: T) => any -): T; -export function render<P>( - element: ReactElement<P>, - container: Element | null, - callback?: (component?: Component<P, ComponentState> | Element) => any -): Component<P, ComponentState> | Element | void; -export function render<P>( - parentComponent: Component<any>, - element: SFCElement<P>, - container: Element, - callback?: () => any -): void; - export function unmountComponentAtNode(container: Element): boolean; export const version: string; +export const render: Renderer; +export const hydrate: Renderer; export function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void; export function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void; @@ -68,3 +42,32 @@ export function unstable_renderSubtreeIntoContainer<P>( element: ReactElement<P>, container: Element, callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void; + +export interface Renderer { + <P extends DOMAttributes<T>, T extends Element>( + element: DOMElement<P, T>, + container: Element | null, + callback?: (element: T) => any + ): T; + <P>( + element: SFCElement<P>, + container: Element | null, + callback?: () => any + ): void; + <P, T extends Component<P, ComponentState>>( + element: CElement<P, T>, + container: Element | null, + callback?: (component: T) => any + ): T; + <P>( + element: ReactElement<P>, + container: Element | null, + callback?: (component?: Component<P, ComponentState> | Element) => any + ): Component<P, ComponentState> | Element | void; + <P>( + parentComponent: Component<any>, + element: SFCElement<P>, + container: Element, + callback?: () => any + ): void; +} diff --git a/types/react-dom/react-dom-tests.ts b/types/react-dom/react-dom-tests.ts index 865d74e386..08eac7afdb 100644 --- a/types/react-dom/react-dom-tests.ts +++ b/types/react-dom/react-dom-tests.ts @@ -15,6 +15,11 @@ describe('ReactDOM', () => { ReactDOM.render(React.createElement('div'), rootElement); }); + it('hydrate', () => { + const rootElement = document.createElement('div'); + ReactDOM.hydrate(React.createElement('div'), rootElement); + }); + it('unmounts', () => { const rootElement = document.createElement('div'); ReactDOM.render(React.createElement('div'), rootElement); diff --git a/types/react-dom/server/index.d.ts b/types/react-dom/server/index.d.ts index 7d45ecbeee..53bbca7250 100644 --- a/types/react-dom/server/index.d.ts +++ b/types/react-dom/server/index.d.ts @@ -1,3 +1,5 @@ +/// <reference types="node" /> + import { ReactElement } from 'react'; /** @@ -12,6 +14,13 @@ import { ReactElement } from 'react'; */ export function renderToString(element: ReactElement<any>): string; +/** + * Render a React element to its initial HTML. Returns a Readable stream that outputs + * an HTML string. The HTML output by this stream is exactly equal to what + * `ReactDOMServer.renderToString()` would return. + */ +export function renderToNodeStream(element: ReactElement<any>): NodeJS.ReadableStream; + /** * Similar to `renderToString`, except this doesn't create extra DOM attributes * such as `data-reactid`, that React uses internally. This is useful if you want @@ -19,6 +28,14 @@ export function renderToString(element: ReactElement<any>): string; * attributes can save lots of bytes. */ export function renderToStaticMarkup(element: ReactElement<any>): string; + +/** + * Similar to `renderToNodeStream`, except this doesn't create extra DOM attributes + * such as `data-reactid`, that React uses internally. The HTML output by this stream + * is exactly equal to what `ReactDOMServer.renderToStaticMarkup()` would return. + */ +export function renderToStaticNodeStream(element: ReactElement<any>): NodeJS.ReadableStream; + export const version: string; export as namespace ReactDOMServer; diff --git a/types/react-dom/v15/index.d.ts b/types/react-dom/v15/index.d.ts new file mode 100644 index 0000000000..796314e19f --- /dev/null +++ b/types/react-dom/v15/index.d.ts @@ -0,0 +1,70 @@ +// Type definitions for React (react-dom) 15.5 +// Project: http://facebook.github.io/react/ +// Definitions by: Asana <https://asana.com> +// AssureSign <http://www.assuresign.com> +// Microsoft <https://microsoft.com> +// MartynasZilinskas <https://github.com/MartynasZilinskas> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export as namespace ReactDOM; + +import { + ReactInstance, Component, ComponentState, + ReactElement, SFCElement, CElement, + DOMAttributes, DOMElement +} from 'react'; + +export function findDOMNode<E extends Element>(instance: ReactInstance): E; +export function findDOMNode(instance: ReactInstance): Element; + +export function render<P extends DOMAttributes<T>, T extends Element>( + element: DOMElement<P, T>, + container: Element | null, + callback?: (element: T) => any +): T; +export function render<P>( + element: SFCElement<P>, + container: Element | null, + callback?: () => any +): void; +export function render<P, T extends Component<P, ComponentState>>( + element: CElement<P, T>, + container: Element | null, + callback?: (component: T) => any +): T; +export function render<P>( + element: ReactElement<P>, + container: Element | null, + callback?: (component?: Component<P, ComponentState> | Element) => any +): Component<P, ComponentState> | Element | void; +export function render<P>( + parentComponent: Component<any>, + element: SFCElement<P>, + container: Element, + callback?: () => any +): void; + +export function unmountComponentAtNode(container: Element): boolean; + +export const version: string; + +export function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void; +export function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void; +export function unstable_batchedUpdates(callback: () => any): void; + +export function unstable_renderSubtreeIntoContainer<P extends DOMAttributes<T>, T extends Element>( + parentComponent: Component<any>, + element: DOMElement<P, T>, + container: Element, + callback?: (element: T) => any): T; +export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>( + parentComponent: Component<any>, + element: CElement<P, T>, + container: Element, + callback?: (component: T) => any): T; +export function unstable_renderSubtreeIntoContainer<P>( + parentComponent: Component<any>, + element: ReactElement<P>, + container: Element, + callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void; diff --git a/types/react-dom/v15/node-stream/index.d.ts b/types/react-dom/v15/node-stream/index.d.ts new file mode 100644 index 0000000000..ff24c8a939 --- /dev/null +++ b/types/react-dom/v15/node-stream/index.d.ts @@ -0,0 +1,18 @@ +import { ReactElement } from 'react'; + +/** + * Render a ReactElement to its initial HTML. This should only be used on the + * server. + * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostream + */ +export function renderToStream(element: ReactElement<any>): any; + +/** + * Similar to renderToStream, except this doesn't create extra DOM attributes + * such as data-react-id that React uses internally. + * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostaticstream + */ +export function renderToStaticStream(element: ReactElement<any>): any; +export const version: string; + +export as namespace ReactDOMNodeStream; diff --git a/types/react-dom/v15/react-dom-tests.ts b/types/react-dom/v15/react-dom-tests.ts new file mode 100644 index 0000000000..865d74e386 --- /dev/null +++ b/types/react-dom/v15/react-dom-tests.ts @@ -0,0 +1,155 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import * as ReactDOMServer from 'react-dom/server'; +import * as ReactDOMNodeStream from 'react-dom/node-stream'; +import * as ReactTestUtils from 'react-dom/test-utils'; + +declare function describe(desc: string, f: () => void): void; +declare function it(desc: string, f: () => void): void; + +class TestComponent extends React.Component { } + +describe('ReactDOM', () => { + it('render', () => { + const rootElement = document.createElement('div'); + ReactDOM.render(React.createElement('div'), rootElement); + }); + + it('unmounts', () => { + const rootElement = document.createElement('div'); + ReactDOM.render(React.createElement('div'), rootElement); + ReactDOM.unmountComponentAtNode(rootElement); + }); + + it('find dom node', () => { + const rootElement = document.createElement('div'); + ReactDOM.render(React.createElement('div'), rootElement); + ReactDOM.findDOMNode(rootElement); + }); +}); + +describe('ReactDOMServer', () => { + it('renderToString', () => { + const content: string = ReactDOMServer.renderToString(React.createElement('div')); + }); + + it('renderToStaticMarkup', () => { + const content: string = ReactDOMServer.renderToStaticMarkup(React.createElement('div')); + }); +}); + +describe('ReactDOMNodeStream', () => { + it('renderToStream', () => { + const content: any = ReactDOMNodeStream.renderToStream(React.createElement('div')); + }); + + it('renderToStaticStream', () => { + const content: any = ReactDOMNodeStream.renderToStaticStream(React.createElement('div')); + }); +}); + +describe('React dom test utils', () => { + it('Simulate', () => { + const element = document.createElement('div'); + const dom = ReactDOM.render( + React.createElement('input', { type: 'text' }), + element + ) as Element; + const node = ReactDOM.findDOMNode(dom) as HTMLInputElement; + + node.value = 'giraffe'; + ReactTestUtils.Simulate.change(node); + ReactTestUtils.Simulate.keyDown(node, { key: "Enter", keyCode: 13, which: 13 }); + }); + + it('renderIntoDocument', () => { + const element = React.createElement('input', { type: 'text' }); + ReactTestUtils.renderIntoDocument(element); + }); + + it('mockComponent', () => { + ReactTestUtils.mockComponent(TestComponent, 'div'); + }); + + it('isElement', () => { + const element = React.createElement(TestComponent); + const isReactElement: boolean = ReactTestUtils.isElement(element); + }); + + it('isElementOfType', () => { + const element = React.createElement(TestComponent); + const isReactElement: boolean = ReactTestUtils.isElementOfType(element, TestComponent); + }); + + it('isDOMComponent', () => { + const element = React.createElement('div'); + const instance = ReactTestUtils.renderIntoDocument(element) as HTMLDivElement; + const isDOMElement: boolean = ReactTestUtils.isDOMComponent(instance); + }); + + it('isCompositeComponent', () => { + const element = React.createElement(TestComponent); + const instance: TestComponent = ReactTestUtils.renderIntoDocument(element); + const isCompositeComponent: boolean = ReactTestUtils.isCompositeComponent(instance); + }); + + it('isCompositeComponentWithType', () => { + const element = React.createElement(TestComponent); + const instance: TestComponent = ReactTestUtils.renderIntoDocument(element); + const isCompositeComponent: boolean = ReactTestUtils.isCompositeComponentWithType(instance, TestComponent); + }); + + it('findAllInRenderedTree', () => { + const component = ReactTestUtils.renderIntoDocument(React.createElement(TestComponent)); + ReactTestUtils.findAllInRenderedTree(component, (i: React.ReactInstance) => true); + }); + + it('scryRenderedDOMComponentsWithClass', () => { + const component = ReactTestUtils.renderIntoDocument(React.createElement(TestComponent)); + ReactTestUtils.scryRenderedDOMComponentsWithClass(component, 'class'); + }); + + it('findRenderedDOMComponentWithClass', () => { + const component = ReactTestUtils.renderIntoDocument(React.createElement(TestComponent)); + ReactTestUtils.findRenderedDOMComponentWithClass(component, 'class'); + }); + + it('scryRenderedDOMComponentsWithTag', () => { + const component = ReactTestUtils.renderIntoDocument(React.createElement(TestComponent)); + ReactTestUtils.scryRenderedDOMComponentsWithTag(component, 'div'); + }); + + it('findRenderedDOMComponentWithTag', () => { + const component = ReactTestUtils.renderIntoDocument(React.createElement(TestComponent)); + ReactTestUtils.findRenderedDOMComponentWithTag(component, 'tag'); + }); + + it('scryRenderedComponentsWithType', () => { + const component = ReactTestUtils.renderIntoDocument(React.createElement(TestComponent)); + ReactTestUtils.scryRenderedComponentsWithType(component, TestComponent); + }); + + it('findRenderedComponentWithType', () => { + const component = ReactTestUtils.renderIntoDocument(React.createElement(TestComponent)); + ReactTestUtils.findRenderedComponentWithType(component, TestComponent); + }); + + describe('Shallow Rendering', () => { + it('createRenderer', () => { + const component = React.createElement(TestComponent); + const shallowRenderer = ReactTestUtils.createRenderer(); + }); + + it('shallowRenderer.render', () => { + const component = React.createElement(TestComponent); + const shallowRenderer = ReactTestUtils.createRenderer(); + shallowRenderer.render(component); + }); + + it('shallowRenderer.getRenderOutput', () => { + const component = React.createElement(TestComponent); + const shallowRenderer = ReactTestUtils.createRenderer(); + shallowRenderer.getRenderOutput(); + }); + }); +}); diff --git a/types/react-dom/v15/server/index.d.ts b/types/react-dom/v15/server/index.d.ts new file mode 100644 index 0000000000..7d45ecbeee --- /dev/null +++ b/types/react-dom/v15/server/index.d.ts @@ -0,0 +1,24 @@ +import { ReactElement } from 'react'; + +/** + * Render a React element to its initial HTML. This should only be used on the server. + * React will return an HTML string. You can use this method to generate HTML on the server + * and send the markup down on the initial request for faster page loads and to allow search + * engines to crawl your pages for SEO purposes. + * + * If you call `ReactDOM.render()` on a node that already has this server-rendered markup, + * React will preserve it and only attach event handlers, allowing you + * to have a very performant first-load experience. + */ +export function renderToString(element: ReactElement<any>): string; + +/** + * Similar to `renderToString`, except this doesn't create extra DOM attributes + * such as `data-reactid`, that React uses internally. This is useful if you want + * to use React as a simple static page generator, as stripping away the extra + * attributes can save lots of bytes. + */ +export function renderToStaticMarkup(element: ReactElement<any>): string; +export const version: string; + +export as namespace ReactDOMServer; diff --git a/types/react-dom/v15/test-utils/index.d.ts b/types/react-dom/v15/test-utils/index.d.ts new file mode 100644 index 0000000000..05362460d4 --- /dev/null +++ b/types/react-dom/v15/test-utils/index.d.ts @@ -0,0 +1,276 @@ +import { + AbstractView, Component, ComponentClass, + ReactElement, ReactInstance, ClassType, + DOMElement, SFCElement, CElement, + ReactHTMLElement, DOMAttributes, SFC +} from 'react'; + +import * as ReactTestUtils from "."; + +export interface OptionalEventProperties { + bubbles?: boolean; + cancelable?: boolean; + currentTarget?: EventTarget; + defaultPrevented?: boolean; + eventPhase?: number; + isTrusted?: boolean; + nativeEvent?: Event; + preventDefault?(): void; + stopPropagation?(): void; + target?: EventTarget; + timeStamp?: Date; + type?: string; +} + +export interface SyntheticEventData extends OptionalEventProperties { + altKey?: boolean; + button?: number; + buttons?: number; + clientX?: number; + clientY?: number; + changedTouches?: TouchList; + charCode?: boolean; + clipboardData?: DataTransfer; + ctrlKey?: boolean; + deltaMode?: number; + deltaX?: number; + deltaY?: number; + deltaZ?: number; + detail?: number; + getModifierState?(key: string): boolean; + key?: string; + keyCode?: number; + locale?: string; + location?: number; + metaKey?: boolean; + pageX?: number; + pageY?: number; + relatedTarget?: EventTarget; + repeat?: boolean; + screenX?: number; + screenY?: number; + shiftKey?: boolean; + targetTouches?: TouchList; + touches?: TouchList; + view?: AbstractView; + which?: number; +} + +export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void; + +export interface MockedComponentClass { + new (): any; +} + +export interface ShallowRenderer { + /** + * After `shallowRenderer.render()` has been called, returns shallowly rendered output. + */ + getRenderOutput<E extends ReactElement<any>>(): E; + /** + * After `shallowRenderer.render()` has been called, returns shallowly rendered output. + */ + getRenderOutput(): ReactElement<any>; + /** + * Similar to `ReactDOM.render` but it doesn't require DOM and only renders a single level deep. + */ + render(element: ReactElement<any>, context?: any): void; + unmount(): void; +} + +/** + * Simulate an event dispatch on a DOM node with optional `eventData` event data. + * `Simulate` has a method for every event that React understands. + */ +export namespace Simulate { + const abort: EventSimulator; + const animationEnd: EventSimulator; + const animationIteration: EventSimulator; + const animationStart: EventSimulator; + const blur: EventSimulator; + const canPlay: EventSimulator; + const canPlayThrough: EventSimulator; + const change: EventSimulator; + const click: EventSimulator; + const compositionEnd: EventSimulator; + const compositionStart: EventSimulator; + const compositionUpdate: EventSimulator; + const contextMenu: EventSimulator; + const copy: EventSimulator; + const cut: EventSimulator; + const doubleClick: EventSimulator; + const drag: EventSimulator; + const dragEnd: EventSimulator; + const dragEnter: EventSimulator; + const dragExit: EventSimulator; + const dragLeave: EventSimulator; + const dragOver: EventSimulator; + const dragStart: EventSimulator; + const drop: EventSimulator; + const durationChange: EventSimulator; + const emptied: EventSimulator; + const encrypted: EventSimulator; + const ended: EventSimulator; + const error: EventSimulator; + const focus: EventSimulator; + const input: EventSimulator; + const invalid: EventSimulator; + const keyDown: EventSimulator; + const keyPress: EventSimulator; + const keyUp: EventSimulator; + const load: EventSimulator; + const loadStart: EventSimulator; + const loadedData: EventSimulator; + const loadedMetadata: EventSimulator; + const mouseDown: EventSimulator; + const mouseEnter: EventSimulator; + const mouseLeave: EventSimulator; + const mouseMove: EventSimulator; + const mouseOut: EventSimulator; + const mouseOver: EventSimulator; + const mouseUp: EventSimulator; + const paste: EventSimulator; + const pause: EventSimulator; + const play: EventSimulator; + const playing: EventSimulator; + const progress: EventSimulator; + const rateChange: EventSimulator; + const scroll: EventSimulator; + const seeked: EventSimulator; + const seeking: EventSimulator; + const select: EventSimulator; + const stalled: EventSimulator; + const submit: EventSimulator; + const suspend: EventSimulator; + const timeUpdate: EventSimulator; + const touchCancel: EventSimulator; + const touchEnd: EventSimulator; + const touchMove: EventSimulator; + const touchStart: EventSimulator; + const transitionEnd: EventSimulator; + const volumeChange: EventSimulator; + const waiting: EventSimulator; + const wheel: EventSimulator; +} + +/** + * Render a React element into a detached DOM node in the document. __This function requires a DOM__. + */ +export function renderIntoDocument<T extends Element>( + element: DOMElement<any, T>): T; +export function renderIntoDocument( + element: SFCElement<any>): void; +export function renderIntoDocument<T extends Component<any>>( + element: CElement<any, T>): T; +export function renderIntoDocument<P>( + element: ReactElement<P>): Component<P> | Element | void; + +/** + * Pass a mocked component module to this method to augment it with useful methods that allow it to + * be used as a dummy React component. Instead of rendering as usual, the component will become + * a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children. + */ +export function mockComponent( + mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils; + +/** + * Returns `true` if `element` is any React element. + */ +export function isElement(element: any): boolean; + +/** + * Returns `true` if `element` is a React element whose type is of a React `componentClass`. + */ +export function isElementOfType<T extends HTMLElement>( + element: ReactElement<any>, type: string): element is ReactHTMLElement<T>; +/** + * Returns `true` if `element` is a React element whose type is of a React `componentClass`. + */ +export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>( + element: ReactElement<any>, type: string): element is DOMElement<P, T>; +/** + * Returns `true` if `element` is a React element whose type is of a React `componentClass`. + */ +export function isElementOfType<P>( + element: ReactElement<any>, type: SFC<P>): element is SFCElement<P>; +/** + * Returns `true` if `element` is a React element whose type is of a React `componentClass`. + */ +export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>( + element: ReactElement<any>, type: ClassType<P, T, C>): element is CElement<P, T>; + +/** + * Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`). + */ +export function isDOMComponent(instance: ReactInstance): instance is Element; +/** + * Returns `true` if `instance` is a user-defined component, such as a class or a function. + */ +export function isCompositeComponent(instance: ReactInstance): instance is Component<any>; +/** + * Returns `true` if `instance` is a component whose type is of a React `componentClass`. + */ +export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>( + instance: ReactInstance, type: ClassType<any, T, C>): boolean; + +/** + * Traverse all components in `tree` and accumulate all components where + * `test(component)` is `true`. This is not that useful on its own, but it's used + * as a primitive for other test utils. + */ +export function findAllInRenderedTree( + root: Component<any>, + fn: (i: ReactInstance) => boolean): ReactInstance[]; + +/** + * Finds all DOM elements of components in the rendered tree that are + * DOM components with the class name matching `className`. + */ +export function scryRenderedDOMComponentsWithClass( + root: Component<any>, + className: string): Element[]; +/** + * Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result, + * and returns that one result, or throws exception if there is any other + * number of matches besides one. + */ +export function findRenderedDOMComponentWithClass( + root: Component<any>, + className: string): Element; + +/** + * Finds all DOM elements of components in the rendered tree that are + * DOM components with the tag name matching `tagName`. + */ +export function scryRenderedDOMComponentsWithTag( + root: Component<any>, + tagName: string): Element[]; +/** + * Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result, + * and returns that one result, or throws exception if there is any other + * number of matches besides one. + */ +export function findRenderedDOMComponentWithTag( + root: Component<any>, + tagName: string): Element; + +/** + * Finds all instances of components with type equal to `componentClass`. + */ +export function scryRenderedComponentsWithType<T extends Component, C extends ComponentClass>( + root: Component<any>, + type: ClassType<any, T, C>): T[]; + +/** + * Same as `scryRenderedComponentsWithType()` but expects there to be one result + * and returns that one result, or throws exception if there is any other + * number of matches besides one. + */ +export function findRenderedComponentWithType<T extends Component, C extends ComponentClass>( + root: Component<any>, + type: ClassType<any, T, C>): T; + +/** + * Call this in your tests to create a shallow renderer. + */ +export function createRenderer(): ShallowRenderer; diff --git a/types/react-dom/v15/tsconfig.json b/types/react-dom/v15/tsconfig.json new file mode 100644 index 0000000000..6cba48934f --- /dev/null +++ b/types/react-dom/v15/tsconfig.json @@ -0,0 +1,34 @@ +{ + "files": [ + "index.d.ts", + "react-dom-tests.ts", + "server/index.d.ts", + "node-stream/index.d.ts", + "test-utils/index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "paths": { + "react": [ + "react/v15" + ], + "react-dom": [ + "react-dom/v15" + ] + }, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/react-dom/v15/tslint.json b/types/react-dom/v15/tslint.json new file mode 100644 index 0000000000..8179a3659a --- /dev/null +++ b/types/react-dom/v15/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "dt-header": false, + "no-unnecessary-generics": false, + "no-unnecessary-type-assertion": false + } +} \ No newline at end of file diff --git a/types/react/test/index.ts b/types/react/test/index.ts index f2ce7db821..a798863cd4 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -496,7 +496,7 @@ class Timer extends React.Component<{}, TimerState> { state = { secondsElapsed: 0 }; - private _interval: number; + private _interval: NodeJS.Timer; tick() { this.setState((prevState, props) => ({ secondsElapsed: prevState.secondsElapsed + 1 diff --git a/types/react/v15/test/index.ts b/types/react/v15/test/index.ts index b76e541849..a7a4c97ba4 100644 --- a/types/react/v15/test/index.ts +++ b/types/react/v15/test/index.ts @@ -498,7 +498,7 @@ class Timer extends React.Component<{}, TimerState> { state = { secondsElapsed: 0 }; - private _interval: number; + private _interval: NodeJS.Timer; tick() { this.setState((prevState, props) => ({ secondsElapsed: prevState.secondsElapsed + 1 From 5235261b564d79130c6e964ff8521916f378b6b5 Mon Sep 17 00:00:00 2001 From: Andy <anhans@microsoft.com> Date: Mon, 2 Oct 2017 16:19:47 -0700 Subject: [PATCH 65/67] baidumap-web-sdk: Add tsconfig options required by dtslint (#20208) --- types/baidumap-web-sdk/tsconfig.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/baidumap-web-sdk/tsconfig.json b/types/baidumap-web-sdk/tsconfig.json index 6af444e434..7b0c7c4913 100644 --- a/types/baidumap-web-sdk/tsconfig.json +++ b/types/baidumap-web-sdk/tsconfig.json @@ -8,6 +8,11 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, From 958ccb60c6528d0fb4c4ebe740d85050eec63060 Mon Sep 17 00:00:00 2001 From: Max Battcher <me@worldmaker.net> Date: Mon, 2 Oct 2017 23:40:05 -0400 Subject: [PATCH 66/67] Simplify PouchDB Attachments interfaces (#20213) Make a cleaner separation between Stub attachments and non-Stub attachments (here called FullAttachment). New Attachment is then the union type of StubAttachment and FullAttachment. Renamed the previous Attachment to AttachmentData to better reflect what's it purpose is. (Would love to make it more generic, but there's not a great way to key off of `{ attachment: true, binary: true }` in the options stacks right now.) Remove PutAttachment because it now better handled by FullAttachment. Furthermore, you can db.put StubAttachments when round-tripping documents, so PutAttachment was too strict. Added simple round-trip tests to avoid that strictness problem moving forward. --- types/pouchdb-core/index.d.ts | 62 ++++++++++++++++-------- types/pouchdb-core/pouchdb-core-tests.ts | 20 ++++++++ 2 files changed, 62 insertions(+), 20 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index bc5cb66ce9..4314644b58 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -107,7 +107,7 @@ declare namespace PouchDB { type AttachmentId = string; type RevisionId = string; type Availability = 'available' | 'compacted' | 'not compacted' | 'missing'; - type Attachment = string | Blob | Buffer; + type AttachmentData = string | Blob | Buffer; interface Options { ajax?: Configuration.RemoteRequesterConfiguration; @@ -178,28 +178,55 @@ declare namespace PouchDB { _attachments?: Attachments; } - interface AttachmentResponse { + /** + * Stub attachments are returned by PouchDB by default (attachments option set to false) + */ + interface StubAttachment { + /** + * Mime type of the attachment + */ content_type: string; - /** MD5 hash, starts with "md5-" prefix */ + /** + * Database digest of the attachment + */ digest: string; - /** Only present if `attachments` was `false`. */ - stub?: boolean; + /** + * Attachment is a stub + */ + stub: true; - /** Only present if `attachments` was `false`. */ - length?: number; + /** + * Length of the attachment + */ + length: number; + } + + /** + * Full attachments are used to create new attachments or returned when the attachments option + * is true. + */ + interface FullAttachment { + /** + * Mime type of the attachment + */ + content_type: string; + + /** MD5 hash, starts with "md5-" prefix; populated by PouchDB for new attachments */ + digest?: string; /** - * Only present if `attachments` was `true`. * {string} if `binary` was `false` * {Blob|Buffer} if `binary` was `true` */ - data?: Attachment; + data: AttachmentData; } + type Attachment = StubAttachment | FullAttachment; + interface Attachments { - [attachmentId: string]: AttachmentResponse; + [attachmentId: string]: Attachment; } type NewDocument<Content extends {}> = Content; @@ -217,18 +244,13 @@ declare namespace PouchDB { /** You can update an existing doc using _rev */ _rev?: RevisionId; - _attachments?: {[attachmentId: string]: PutAttachment}; + _attachments?: Attachments; }; type PutDocument<Content extends {}> = PostDocument<Content> & ChangesMeta & { _id?: DocumentId; }; - interface PutAttachment { - content_type: string; - data: Attachment; - } - interface AllDocsOptions extends Options { /** Include attachment data for each document. * @@ -725,7 +747,7 @@ declare namespace PouchDB { putAttachment(docId: Core.DocumentId, attachmentId: Core.AttachmentId, rev: Core.RevisionId, - attachment: Core.Attachment, + attachment: Core.AttachmentData, type: string, callback: Core.Callback<Core.Response>): void; @@ -737,7 +759,7 @@ declare namespace PouchDB { putAttachment(docId: Core.DocumentId, attachmentId: Core.AttachmentId, rev: Core.RevisionId, - attachment: Core.Attachment, + attachment: Core.AttachmentData, type: string): Promise<Core.Response>; /** @@ -747,7 +769,7 @@ declare namespace PouchDB { */ putAttachment(docId: Core.DocumentId, attachmentId: Core.AttachmentId, - attachment: Core.Attachment, + attachment: Core.AttachmentData, type: string, callback: Core.Callback<Core.Response>): void; @@ -758,7 +780,7 @@ declare namespace PouchDB { */ putAttachment(docId: Core.DocumentId, attachmentId: Core.AttachmentId, - attachment: Core.Attachment, + attachment: Core.AttachmentData, type: string): Promise<Core.Response>; /** Get attachment data */ diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index 95e98fb2ad..523eed7d04 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -122,6 +122,9 @@ function testBasics() { db.info((error, result) => { }); + // "Round-trippable": can put back a document from get + db.get('id').then(doc => db.put(doc)); + PouchDB.debug.enable('*'); } @@ -236,11 +239,28 @@ function heterogeneousGenericsDatabase(db: PouchDB.Database) { thud: boolean; } + // Attachment test + db.put<Cat>({ + _attachments: { + ['meme.gif']: { + content_type: 'image/gif', + data: new Blob(['fake example']) + } + }, + meow: 'roar' + }); + db.allDocs<Cat>({ startkey: 'cat/', endkey: 'cat/\uffff', include_docs: true }) .then(cats => { for (const row of cats.rows) { if (row.doc) { row.doc.meow; // $ExpectType string + + // Round-trip test + db.put(row.doc); + db.put<Cat>(row.doc); + // Generic strictness test + db.put<Boot>(row.doc); // $ExpectError } } }); From 33844ff8a59bc8e5dcebe786a1e98f310900bbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Tr=C3=A9ny?= <simon.treny@gmail.com> Date: Tue, 3 Oct 2017 09:59:31 +0200 Subject: [PATCH 67/67] Fix type of NativeSyntheticEvent.timeStamp --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 16abbe3f6b..1f777fde22 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -365,7 +365,7 @@ interface NativeSyntheticEvent<T> { preventDefault(): void stopPropagation(): void target: NodeHandle - timeStamp: Date + timeStamp: number type: string }