From f50cf7b56f9a0a2a26903e7bc1708346a713f5d8 Mon Sep 17 00:00:00 2001 From: Cerberuser Date: Thu, 12 Jul 2018 14:41:20 +0700 Subject: [PATCH 001/738] Cytoscape: animation fixes, layout interface usage (#27209) --- types/cytoscape/cytoscape-tests.ts | 21 ++++++++++++++ types/cytoscape/index.d.ts | 46 ++++++++++++++++-------------- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/types/cytoscape/cytoscape-tests.ts b/types/cytoscape/cytoscape-tests.ts index 3d80506185..394851623d 100644 --- a/types/cytoscape/cytoscape-tests.ts +++ b/types/cytoscape/cytoscape-tests.ts @@ -489,6 +489,27 @@ eles.style(eles.style()); aliases(eles.style, eles.css); aliases(ele.renderedCss, ele.renderedStyle); +nodes.forEach((child) => { + child.animate({ + position: node.position(), + duration: 300, + complete: () => { + console.log(child.id()); + } + }); +}); + +nodes.animate({ + renderedPosition: node.position() +}, { + style: { backgroundColor: 'red' }, + duration: 1000, + queue: true, + complete: () => console.log('end'), + step: () => console.log('step'), + easing: 'ease-in-out-quint' +}); + eles.anySame(nodes); aliases(eles.contains, eles.has); aliases(eles.allAreNeighbors, eles.allAreNeighbours); diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 13b0b38ba8..9b56a2fd43 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -915,7 +915,7 @@ declare namespace cytoscape { /** An object containing centring options from which the graph will be animated. */ center?: CenterOptions; /** easing - A transition-timing-function easing style string that shapes the animation progress curve. */ - easing?: string; // TODO: explicit type + easing?: Css.TransitionTimingFunction; /** duration - The duration of the animation in milliseconds. */ duration?: number; @@ -995,7 +995,7 @@ declare namespace cytoscape { * An analogue to run a layout on a subset of the graph exists as eles.layout(). * http://js.cytoscape.org/#cy.layout */ - layout(layout: LayoutOptions): LayoutManipulation; + layout(layout: LayoutOptions): Layouts; /** * Get a new layout, which can be used to algorithmically * position the nodes in the graph. @@ -1008,8 +1008,8 @@ declare namespace cytoscape { * Note that you must call layout.run() in order for it to affect the graph. * An analogue to make a layout on a subset of the graph exists as eles.makeLayout(). */ - makeLayout(options: LayoutOptions): LayoutManipulation; - createLayout(options: LayoutOptions): LayoutManipulation; + makeLayout(options: LayoutOptions): Layouts; + createLayout(options: LayoutOptions): Layouts; } /** @@ -1798,9 +1798,9 @@ declare namespace cytoscape { * * @param options The layout options. */ - layout(options: LayoutOptions): LayoutManipulation; - makeLayout(options: LayoutOptions): LayoutManipulation; - createLayout(options: LayoutOptions): LayoutManipulation; + layout(options: LayoutOptions): Layouts; + makeLayout(options: LayoutOptions): Layouts; + createLayout(options: LayoutOptions): Layouts; } /** @@ -1813,7 +1813,7 @@ declare namespace cytoscape { animationDuration?: number; // easing of animation, if enabled animationEasing?: number; - // collection of elements involved in the layout; set by cy.layout() or eles.layout() + // collection of elements involved in the layout; set by cy.layout() or eles.layout(s) eles: CollectionArgument; // whether to fit the viewport to the graph fit?: boolean; @@ -2063,19 +2063,15 @@ declare namespace cytoscape { /** A function to call each time the animation steps. */ step?(): void; /** A transition-timing-function easing style string that shapes the animation progress curve. */ - easing?(): void; + easing?: Css.TransitionTimingFunction; } - interface ElementAnimateOptionPos { + interface ElementAnimateOptionPos extends ElementAnimateOptionsBase { /** A position to which the elements will be animated. */ - position?: Position; - /** A rendered position to which the elements will be animated. */ - renderedPosition?: Position; + position: Position; } - interface ElementAnimateOptionRen { - /** A position to which the elements will be animated. */ - position?: Position; + interface ElementAnimateOptionRen extends ElementAnimateOptionsBase { /** A rendered position to which the elements will be animated. */ - renderedPosition?: Position; + renderedPosition: Position; } interface CollectionAnimation { /** @@ -2083,7 +2079,7 @@ declare namespace cytoscape { * @param options An object containing the details of the animation. * http://js.cytoscape.org/#eles.animate */ - animate(options: ElementAnimateOptionPos | ElementAnimateOptionRen): this; + animate(options: ElementAnimateOptionPos | ElementAnimateOptionRen, params?: ElementAnimateOptionsBase): this; /** * Add a delay between animations for the elements. * @param duration How long the delay should be in milliseconds. @@ -2104,7 +2100,7 @@ declare namespace cytoscape { */ clearQueue(): this; } - interface SingularAnimationOptions { + interface SingularAnimationOptionsBase { /** A position to which the elements will be animated. */ position: Position; /** A rendered position to which the elements will be animated. */ @@ -2114,7 +2110,15 @@ declare namespace cytoscape { /** The duration of the animation in milliseconds. */ duration: number; /** A transition-timing-function easing style string that shapes the animation progress curve. */ - easing(): void; + easing: Css.TransitionTimingFunction; + } + interface SingularAnimationOptionsPos extends SingularAnimationOptionsBase { + /** A position to which the elements will be animated. */ + position: Position; + } + interface SingularAnimationOptionsRen extends SingularAnimationOptionsBase { + /** A rendered position to which the elements will be animated. */ + renderedPosition: Position; } interface SingularAnimation { /** @@ -2125,7 +2129,7 @@ declare namespace cytoscape { * Get an animation for the element. * @param options An object containing the details of the animation. */ - animation(options: SingularAnimationOptions): AnimationManipulation; + animation(options: SingularAnimationOptionsRen | SingularAnimationOptionsPos): AnimationManipulation; /** * Get a delay animation for the element. From 564afc514b44ab34df6da6a470e583e75e9a5465 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Thu, 12 Jul 2018 00:41:46 -0700 Subject: [PATCH 002/738] office.js: add important note for auth.getaccesstokenasync (#27196) --- types/office-js/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 92a0c5aa44..3256cf234b 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -752,6 +752,8 @@ declare namespace Office { interface Auth { /** * Calls the Azure Active Directory V 2.0 endpoint to get an access token to your add-in's web application. Allows add-ins to identify users. Server side code can use this token to access Microsoft Graph for the add-in's web application by using the {@link https://docs.microsoft.com/azure/active-directory/develop/active-directory-v2-protocols-oauth-on-behalf-of | "on behalf of" OAuth flow}. + * + * Important: In Outlook, this API is not supported if the add-in is loaded in an Outlook.com or Gmail mailbox. * * @remarks * From fdcf6759667864a3929015f265b977a3b703f37c Mon Sep 17 00:00:00 2001 From: Alex Jerabek <38896772+AlexJerabek@users.noreply.github.com> Date: Thu, 12 Jul 2018 00:42:49 -0700 Subject: [PATCH 003/738] [office-js] Adding conversationID descriptions to Message subclasses (#27157) * Adding conversationID descriptions to Message subclasses * Fixing spelling --- types/office-js/index.d.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 3256cf234b..e44bf07c3c 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -10167,6 +10167,22 @@ declare namespace Office { *
HostsExcel, OneNote, Outlook, PowerPoint, Word
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
*/ cc: Recipients; + /** + * Gets an identifier for the email conversation that contains a particular message. + * + * You can get an integer for this property if your mail app is activated in read forms or responses in compose forms. If subsequently the user changes the subject of the reply message, upon sending the reply, the conversation ID for that message will change and that value you obtained earlier will no longer apply. + * + * You get null for this property for a new item in a compose form. If the user sets a subject and saves the item, the conversationId property will return a value. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
+ */ + conversationId: string; /** * Gets the date and time that an item was created. Read mode only. * @@ -11047,6 +11063,22 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read */ cc: EmailAddressDetails[]; + /** + * Gets an identifier for the email conversation that contains a particular message. + * + * You can get an integer for this property if your mail app is activated in read forms or responses in compose forms. If subsequently the user changes the subject of the reply message, upon sending the reply, the conversation ID for that message will change and that value you obtained earlier will no longer apply. + * + * You get null for this property for a new item in a compose form. If the user sets a subject and saves the item, the conversationId property will return a value. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
+ */ + conversationId: string; /** * Gets the date and time that an item was created. Read mode only. * From a6c82d0c3ff15630f902bd272b3dcfadc398168e Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Thu, 12 Jul 2018 08:43:15 +0100 Subject: [PATCH 004/738] [domready] Update to 1.0, apply lint rules, fix common mistakes (#27181) * Apply standard lint rules to domready. * Apply strict null checks to domready. * Return value of callback is not used so declare it void. * Set domready version number. domready types are up to date as of domready 1.0.8. --- types/domready/domready-tests.ts | 4 +- types/domready/index.d.ts | 6 +-- types/domready/tsconfig.json | 4 +- types/domready/tslint.json | 78 +------------------------------- 4 files changed, 8 insertions(+), 84 deletions(-) diff --git a/types/domready/domready-tests.ts b/types/domready/domready-tests.ts index 01be4213f4..6c5e126bf3 100644 --- a/types/domready/domready-tests.ts +++ b/types/domready/domready-tests.ts @@ -1,5 +1,5 @@ import domready = require("domready"); -domready(function () { +domready(() => { // dom is loaded! -}) \ No newline at end of file +}); diff --git a/types/domready/index.d.ts b/types/domready/index.d.ts index 9548757894..6f9ea3a0a7 100644 --- a/types/domready/index.d.ts +++ b/types/domready/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for domready +// Type definitions for domready 1.0 // Project: https://github.com/ded/domready // Definitions by: Christian Holm Nielsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function domready(callback: () => any) : void; +declare function domready(callback: () => void): void; export = domready; -export as namespace domready; \ No newline at end of file +export as namespace domready; diff --git a/types/domready/tsconfig.json b/types/domready/tsconfig.json index 1495d185a6..4b4263f4b1 100644 --- a/types/domready/tsconfig.json +++ b/types/domready/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -20,4 +20,4 @@ "index.d.ts", "domready-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/domready/tslint.json b/types/domready/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/domready/tslint.json +++ b/types/domready/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } From d13bcd14972b1769bb268bfa10572a58f341d141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Musia=C5=82?= <38978723+pmusial9@users.noreply.github.com> Date: Thu, 12 Jul 2018 09:43:31 +0200 Subject: [PATCH 005/738] Add export of ScrollbarPresenceParams (#27162) --- types/react-virtualized/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index c5a1a60aaa..2714e9a93c 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -65,7 +65,8 @@ export { ScrollParams, SectionRenderedParams, SizeAndPositionData, - VisibleCellRange + VisibleCellRange, + ScrollbarPresenceParams } from "./dist/es/Grid"; export { InfiniteLoader, From 5fe390b1fae5f654fec560fccb83dc12c4f914cd Mon Sep 17 00:00:00 2001 From: Klaus Sevensleeper Date: Thu, 12 Jul 2018 09:44:11 +0200 Subject: [PATCH 006/738] [joi] Add missing type to ObjectSchema::pattern() (#27152) * added missing type to ObjectSchema::pattern() * changed version as requested by reviewer --- types/joi/index.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index dbf60400b9..12aa17b643 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for joi v13.3.0 +// Type definitions for joi v13.4.0 // Project: https://github.com/hapijs/joi // Definitions by: Bart van der Schoor // Laurence Dougal Myers @@ -753,8 +753,11 @@ export interface ObjectSchema extends AnySchema { /** * Specify validation rules for unknown keys matching a pattern. + * + * @param pattern - a pattern that can be either a regular expression or a joi schema that will be tested against the unknown key names + * @param schema - the schema object matching keys must validate against */ - pattern(regex: RegExp, schema: SchemaLike): this; + pattern(pattern: RegExp | SchemaLike, schema: SchemaLike): this; /** * Defines an all-or-nothing relationship between keys where if one of the peers is present, all of them are required as well. From 4f0cd5c74abeb24a5af2a56b2d61ea65a7ec0f74 Mon Sep 17 00:00:00 2001 From: Jared Meek Date: Thu, 12 Jul 2018 08:44:37 +0100 Subject: [PATCH 007/738] add typings for custom logger support (#27102) --- types/dd-trace/dd-trace-tests.ts | 4 ++++ types/dd-trace/index.d.ts | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/types/dd-trace/dd-trace-tests.ts b/types/dd-trace/dd-trace-tests.ts index 6281802d36..18f5daae10 100644 --- a/types/dd-trace/dd-trace-tests.ts +++ b/types/dd-trace/dd-trace-tests.ts @@ -5,6 +5,10 @@ const tracer = ddTrace.init({ service: 'MyLovelyService', hostname: 'localhost', port: 8126, + logger: { + debug: msg => { }, + error: err => { } + } }); tracer diff --git a/types/dd-trace/index.d.ts b/types/dd-trace/index.d.ts index 7ce1e89b09..11bcdb42f2 100644 --- a/types/dd-trace/index.d.ts +++ b/types/dd-trace/index.d.ts @@ -91,6 +91,16 @@ interface TracerOptions { * @default true */ plugins?: boolean; + + /** + * Custom logger to be used by the tracer (if debug = true), + * should support debug() and error() methods + * see https://datadog.github.io/dd-trace-js/#custom-logging__anchor + */ + logger?: { + debug: (message: string) => void + error: (err: Error) => void + }; } interface ExperimentalOptions { @@ -135,5 +145,5 @@ interface TraceOptions { /** * Global tags that should be assigned to every span. */ - tags?: { [key: string]: any; } | string; + tags?: { [key: string]: any } | string; } From a49828a7753c46ad9c179f4ea969cd388d195cb1 Mon Sep 17 00:00:00 2001 From: MBillemaz Date: Thu, 12 Jul 2018 09:46:06 +0200 Subject: [PATCH 008/738] Add properties to react-widgets/DropdownList (#27042) * Add properties to react-widgets/DropdownList * Add createOption message on DropdownListMessages --- types/react-widgets/index.d.ts | 1 + types/react-widgets/lib/DropdownList.d.ts | 28 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/types/react-widgets/index.d.ts b/types/react-widgets/index.d.ts index f02d9f016d..8115208fa8 100644 --- a/types/react-widgets/index.d.ts +++ b/types/react-widgets/index.d.ts @@ -4,6 +4,7 @@ // Balázs Sándor // Frode Hansen // Andrew Makarov +// Maxime Billemaz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/react-widgets/lib/DropdownList.d.ts b/types/react-widgets/lib/DropdownList.d.ts index eea9b3d534..644d0c4873 100644 --- a/types/react-widgets/lib/DropdownList.d.ts +++ b/types/react-widgets/lib/DropdownList.d.ts @@ -2,16 +2,25 @@ import * as React from 'react'; import { ReactWidgetsCommonDropdownProps, AutoFocus } from './CommonProps'; interface DropdownListProps extends ReactWidgetsCommonDropdownProps, AutoFocus { + + /** + * Allow to create a new option on the data list. + */ + allowCreate?: boolean | 'onFilter' /** * The current value of the DropdownList. This can be an object (such as a member of the * data array) or a primitive value, hinted to by the valueField. The widget value does not * need to be in the data array; widgets can have values that are not in their list. */ value?: any; - /** - * Default value. - */ + /** + * Default value. + */ defaultValue?: any; + /** + * Create event Handler that is called when a new option is added to the data list. + */ + onCreate?: (value: any) => void; /** * Change event Handler that is called when the value is changed. */ @@ -40,6 +49,10 @@ interface DropdownListProps extends ReactWidgetsCommonDropdownProps string); + /** + * Text to display for the create option + * @default: "Create option {text}" + */ + createOption?: string | ((props: DropdownListProps) => string); } -interface DropdownList extends React.ReactElement {} -interface DropdownListClass extends React.ComponentClass {} +interface DropdownList extends React.ReactElement { } +interface DropdownListClass extends React.ComponentClass { } declare var DropdownList: DropdownListClass; export = DropdownList; From d06c96e1d270f82a0e6ac5664b0c9ea4a68ecd84 Mon Sep 17 00:00:00 2001 From: SebasWebDev Date: Thu, 12 Jul 2018 09:46:34 +0200 Subject: [PATCH 009/738] @types/paper | Added missing method in Group.hitTestAll (#27189) * @types/paper | Added missing method in Group.hitTestAll http://paperjs.org/reference/group/#hittestall-point * @types/paper | Added name in 'Definitions by' section in header --- types/paper/index.d.ts | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 5b3e46a146..e942fcec2e 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for Paper.js v0.9.24 +// Type definitions for Paper.js v0.11.5 // Project: http://paperjs.org/ -// Definitions by: Clark Stevenson , Jon Lucas +// Definitions by: Clark Stevenson , +// Jon Lucas , +// Sebastian Lopez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped type NativeMouseEvent = MouseEvent; @@ -1408,6 +1410,25 @@ declare module paper { */ hitTest(point: Point, options?: { tolerance?: number; class?: string; fill?: boolean; stroke?: boolean; segments?: boolean; curves?: boolean; handles?: boolean; ends?: boolean; bounds?: boolean; center?: boolean; guides?: boolean; selected?: boolean; match?: (hit: HitResult) => boolean; }): HitResult; + /** + * Perform a hit-test on the items contained within the project at the location of the specified point, returning all found hits. + * The options object allows you to control the specifics of the hit-test and may contain a combination of the following values: + * @param point - the point where the hit-test should be performed + * @param options.tolerance -the tolerance of the hit-test in points. Can also be controlled through paperScope.settings.hitTolerance + * @param options.class - only hit-test again a certain item class and its sub-classes: Group, Layer, Path, CompoundPath, Shape, Raster, PlacedSymbol, PointText, etc. + * @param options.fill - hit-test the fill of items. + * @param options.stroke - hit-test the stroke of path items, taking into account the setting of stroke color and width. + * @param options.segments - hit-test for segment.point of Path items. + * @param options.curves - hit-test the curves of path items, without taking the stroke color or width into account. + * @param options.handles - hit-test for the handles. (segment.handleIn / segment.handleOut) of path segments. + * @param options.ends - only hit-test for the first or last segment points of open path items. + * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). + * @param options.center - hit-test the rectangle.center of the bounding rectangle of items (item.bounds). + * @param options.guides - hit-test items that have Item#guide set to true. + * @param options.selected - only hit selected items. + */ + hitTestAll(point: Point, options?: { tolerance?: number; class?: string; fill?: boolean; stroke?: boolean; segments?: boolean; curves?: boolean; handles?: boolean; ends?: boolean; bounds?: boolean; center?: boolean; guides?: boolean; selected?: boolean; match?: (hit: HitResult) => boolean; }): HitResult[]; + /** * Checks whether the item matches the criteria described by the given object, by iterating over all of its properties and matching against their values through matches(name, compare). * See project.getItems(match) for a selection of illustrated examples. @@ -3237,7 +3258,7 @@ declare module paper { * Deselects all selected items in the project. */ deselectAll(): void; - + /** * Adds the specified layer at the end of the this project’s layers list. */ From c61b1db6eb1d45546d6e88af964d10f73aed309b Mon Sep 17 00:00:00 2001 From: Andrew Moss Date: Thu, 12 Jul 2018 08:47:06 +0100 Subject: [PATCH 010/738] lolex: Fix install() method parameters (#27193) lolex.install() can take a Date or a number (see https://github.com/sinonjs/lolex#var-clock--lolexinstallconfig) - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). If changing an existing definition: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/sinonjs/lolex#var-clock--lolexinstallconfig - [x] Increase the version number in the header if appropriate. - [x] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`. --- types/lolex/index.d.ts | 2 +- types/lolex/lolex-tests.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index fc6dcc3b4b..1727c97ad3 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -184,7 +184,7 @@ export interface LolexInstallOpts { /** * Installs lolex with the specified unix epoch (default: 0) */ - now?: number; + now?: number | Date; /** * An array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick diff --git a/types/lolex/lolex-tests.ts b/types/lolex/lolex-tests.ts index 4de6ecc7a6..f698eac3cc 100644 --- a/types/lolex/lolex-tests.ts +++ b/types/lolex/lolex-tests.ts @@ -25,6 +25,15 @@ lolex.install({ toFake: ["setTimeout", "nextTick", "hrtime"] }); +lolex.install({ + advanceTimeDelta: 20, + loopLimit: 10, + now: new Date(0), + shouldAdvanceTime: true, + target: {}, + toFake: ["setTimeout", "nextTick", "hrtime"] +}); + const browserNow: number = browserClock.now; const browserDate: Date = new browserClock.Date(); From ef67b11c634d867178441dace899ccb9d1d1fb7d Mon Sep 17 00:00:00 2001 From: Amardeepsingh Date: Thu, 12 Jul 2018 00:47:49 -0700 Subject: [PATCH 011/738] added null to possible return types for get method in url-search-params (#27183) --- types/url-search-params/index.d.ts | 2 +- types/url-search-params/url-search-params-tests.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/url-search-params/index.d.ts b/types/url-search-params/index.d.ts index 42cca9ca21..c58357a909 100644 --- a/types/url-search-params/index.d.ts +++ b/types/url-search-params/index.d.ts @@ -9,7 +9,7 @@ declare class URLSearchParams { append(name: string, value: any): void; delete(name: string): void; entries(): Iterator; - get(name: string): string; + get(name: string): string | null; getAll(name: string): string[]; has(name: string): boolean; keys(): Iterator; diff --git a/types/url-search-params/url-search-params-tests.ts b/types/url-search-params/url-search-params-tests.ts index 94664f5a5c..c468c692d0 100644 --- a/types/url-search-params/url-search-params-tests.ts +++ b/types/url-search-params/url-search-params-tests.ts @@ -11,6 +11,8 @@ params.entries(); params.get("b"); +params.get("d"); + params.getAll("b"); params.has("b"); From fdaf4dada6a62eb9dbb6fe72408aaae0208a5f44 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 12 Jul 2018 04:48:42 -0300 Subject: [PATCH 012/738] [electron-packager] v12 introduces a promise-based API to deprecate using callbacks (#27200) Please fill in this template. - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). Select one of these and delete the others: If changing an existing definition: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: - Docs: https://github.com/electron-userland/electron-packager/blob/a43c90ca9d4c0d5f380354a2544585f7d0a46240/docs/api.md - Commit: https://github.com/electron-userland/electron-packager/commit/a43c90ca9d4c0d5f380354a2544585f7d0a46240#diff-0f426376b964e609c5c4618eb8bed3b2 - [x] Increase the version number in the header if appropriate. - ~~[ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`.~~ --- .../electron-packager-tests.ts | 43 +++++++++++++++---- types/electron-packager/index.d.ts | 18 +++++++- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/types/electron-packager/electron-packager-tests.ts b/types/electron-packager/electron-packager-tests.ts index f956910b78..06cadf97f0 100644 --- a/types/electron-packager/electron-packager-tests.ts +++ b/types/electron-packager/electron-packager-tests.ts @@ -2,7 +2,7 @@ import packager = require("electron-packager"); function callback(err: Error, appPaths: string[]) { const msg = err.message; - const index = appPaths.indexOf("test"); + const index = appPaths.indexOf("test"); } function completeFunction(buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) { @@ -13,6 +13,8 @@ function ignoreFunction(path: string) { return true; } +// this is the obsolete API and will be removed in a future version + packager({ dir: ".", name: "myapplication", @@ -30,6 +32,29 @@ packager({ } }, callback); +function onCompleted(appPaths: string | string[]) { +} + +function onError(error: Error) { +} + +packager({ + dir: ".", + name: "myapplication", + platform: "win32", + arch: "all", + electronVersion: "0.34.0", + win32metadata: { + CompanyName: "Acme CO", + FileDescription: "My application", + OriginalFilename: "myapp.exe", + ProductName: "Application", + InternalName: "roadrunner", + "requested-execution-level": "highestAvailable", + "application-manifest": "manifest.xml" + } +}).then(onCompleted).catch(onError); + packager({ dir: ".", name: "myapplication", @@ -44,7 +69,7 @@ packager({ "requested-execution-level": "requireAdministrator", "application-manifest": "manifest.xml" } -}, callback); +}).then(onCompleted).catch(onError); packager({ dir: ".", @@ -52,14 +77,14 @@ packager({ platform: "all", arch: "all", electronVersion: "0.34.0" -}, callback); +}).then(onCompleted).catch(onError); packager({ dir: ".", name: "myapplication", electronVersion: "0.34.0", all: true -}, callback); +}).then(onCompleted).catch(onError); packager({ dir: ".", @@ -67,7 +92,7 @@ packager({ electronVersion: "0.34.0", arch: "arm64", executableName: "myapp" -}, callback); +}).then(onCompleted).catch(onError); packager({ dir: ".", @@ -110,7 +135,7 @@ packager({ "requested-execution-level": "asInvoker", "application-manifest": "manifest.xml" } -}, callback); +}).then(onCompleted).catch(onError); packager({ dir: ".", @@ -142,7 +167,7 @@ packager({ extendInfo: "plist.txt", helperBundleId: "23223f", osxSign: true -}, callback); +}).then(onCompleted).catch(onError); packager({ dir: ".", @@ -161,7 +186,7 @@ packager({ ignore: ignoreFunction, packageManager: "cnpm", platform: "linux" -}, callback); +}).then(onCompleted).catch(onError); packager({ dir: ".", @@ -192,4 +217,4 @@ packager({ "myapp2" ] }] -}, callback); +}).then(onCompleted).catch(onError); diff --git a/types/electron-packager/index.d.ts b/types/electron-packager/index.d.ts index 6e430ecdb2..0e438ebc6e 100644 --- a/types/electron-packager/index.d.ts +++ b/types/electron-packager/index.d.ts @@ -1,14 +1,28 @@ -// Type definitions for electron-packager 10.1 +// Type definitions for electron-packager 12.0 // Project: https://github.com/electron-userland/electron-packager // Definitions by: Maxime LUCE // Juan Jimenez-Anca // John Kleinschmidt +// Brendan Forster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// export = electronPackager; +/** + * This will: + * - Find or download the correct release of Electron + * - Use that version of electron to create a app in /-- + * + * You should be able to launch the app on the platform you built for. If not, check your settings and try again. + * + * @param opts - Options to configure packaging. + * + * @returns A promise containing the path(s) to the newly created application(s) + */ +declare function electronPackager(opts: electronPackager.Options): Promise; + /** * This will: * - Find or download the correct release of Electron @@ -18,6 +32,8 @@ export = electronPackager; * * @param opts - Options to configure packaging. * @param callback - Callback which is called when packaging is done or an error occured. + * + * @deprecated since version 12.0 */ declare function electronPackager(opts: electronPackager.Options, callback: electronPackager.finalCallback): void; From d9bf730cb2d0400a72583a0a43f09715d8a1e1c9 Mon Sep 17 00:00:00 2001 From: Tyler Jones Date: Thu, 12 Jul 2018 00:49:11 -0700 Subject: [PATCH 013/738] Update stripe Card's `object` to be typed with 'card' string literal (#27199) This allows differentiating between a BankAccount and Card payment method when using type unions, which are leveraged by the stripe typings. See https://stripe.com/docs/api#card_object-object --- types/stripe/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 7507c1a13a..420869592d 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -10,6 +10,7 @@ // Thomas Bruun // Gal Talmor // Hunter Tunnicliff +// Tyler Jones // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -4338,7 +4339,7 @@ declare namespace Stripe { /** * Value is 'card' */ - object: string; + object: 'card'; /** * The card number From dfe05a96d68413ba114ff0bef1d0a95803f2fcf4 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 12 Jul 2018 09:49:45 +0200 Subject: [PATCH 014/738] @types/jest: toMatchSnapshot updated for property matchers (#27170) --- types/jest/index.d.ts | 7 ++++++- types/jest/jest-tests.ts | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index e32b9f05f0..68fab8c1b8 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -394,7 +394,7 @@ declare namespace jest { * * @param actual The value to apply matchers against. */ - (actual: any): Matchers; + (actual: T): Matchers; /** * Matches anything but null or undefined. You can use it inside `toEqual` or `toBeCalledWith` instead * of a literal value. For example, if you want to check that a mock function is called with a @@ -651,6 +651,11 @@ declare namespace jest { * Used to check that a JavaScript object matches a subset of the properties of an object */ toMatchObject(expected: {} | any[]): R; + /** + * This ensures that a value matches the most recent snapshot with property matchers. + * Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information. + */ + toMatchSnapshot(propertyMatchers: Partial, snapshotName?: string): R; /** * This ensures that a value matches the most recent snapshot. * Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information. diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index c54ebc3369..b502644cdd 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -610,6 +610,12 @@ describe("", () => { expect({}).toMatchSnapshot(); expect({}).toMatchSnapshot("snapshotName"); + expect({ abc: "def" }).toMatchSnapshot({ abc: expect.any(String) }, "snapshotName"); + expect({ + one: 1, + two: "2", + date: new Date(), + }).toMatchSnapshot({ one: expect.any(Number), date: expect.any(Date) }); expect(jest.fn()).toReturn(); From b9edcc9c513da152883bb9dc3f5eb337e6f23f77 Mon Sep 17 00:00:00 2001 From: Felipe Vaz Date: Thu, 12 Jul 2018 02:50:37 -0500 Subject: [PATCH 015/738] Added two missing props sortColumn and sortDirection (#27197) --- types/react-data-grid/index.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index 82070c673c..9c6ca297eb 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -130,6 +130,17 @@ declare namespace AdazzleReactDataGrid { * @param sortDirection The direction to sort ('ASC'/'DESC'/'NONE') */ onGridSort?: (sortColumn: string, sortDirection: 'ASC' | 'DESC' | 'NONE') => void + + /** + * Initial sorting direction + */ + sortDirection?: 'ASC' | 'DESC' | 'NONE' + + /** + * key of the initial sorted column + */ + sortColumn?: string + /** * Called when the user filters a column by some value. * Should restrict the rows in rowGetter to only things that match the filter. From 3a82a6c2326f311825f746cb096457f004add713 Mon Sep 17 00:00:00 2001 From: robmandoe <39183315+robmandoe@users.noreply.github.com> Date: Thu, 12 Jul 2018 17:50:51 +1000 Subject: [PATCH 016/738] add enableRetinaScaling to StaticCanvas options (#27208) enableRetinaScaling was missing from the StaticCanvas options. We need this option for our project to compile without errors and function properly. --- types/fabric/fabric-impl.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index 4d01868b59..9163569fff 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -851,6 +851,12 @@ interface IStaticCanvasOptions { * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas */ allowTouchScrolling?: boolean; + + /** + * When true, canvas is scaled by devicePixelRatio for better rendering on retina screens + */ + enableRetinaScaling?: boolean; + /** * Indicates whether this canvas will use image smoothing, this is on by default in browsers */ From fe5462429b26a32cc4aa0ead207e39a3387558a2 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 12 Jul 2018 10:51:35 +0300 Subject: [PATCH 017/738] Add textTransform style prop (#27210) --- types/react-native/index.d.ts | 1 + types/react-native/test/index.tsx | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 3ad2d62367..3b44a980b3 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -766,6 +766,7 @@ export interface TextStyleIOS extends ViewStyle { letterSpacing?: number; textDecorationColor?: string; textDecorationStyle?: "solid" | "double" | "dotted" | "dashed"; + textTransform?: "none" | "capitalize" | "uppercase" | "lowercase"; writingDirection?: "auto" | "ltr" | "rtl"; } diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 0199d4f14e..705b4707cf 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -676,6 +676,10 @@ class StylePropsTest extends React.PureComponent { // tintColor="green" // width={200} /> + + + Text + ); } From 94a86215f328ccb1b21935202d085ef75289c52a Mon Sep 17 00:00:00 2001 From: Daniel Zlotin Date: Thu, 12 Jul 2018 10:52:09 +0300 Subject: [PATCH 018/738] react-native-navigation v2.x.x is fully TypeScript (#27202) --- notNeededPackages.json | 6 + types/react-native-navigation/index.d.ts | 315 ------------------ .../react-native-navigation-tests.tsx | 216 ------------ types/react-native-navigation/tsconfig.json | 24 -- types/react-native-navigation/tslint.json | 1 - 5 files changed, 6 insertions(+), 556 deletions(-) delete mode 100644 types/react-native-navigation/index.d.ts delete mode 100644 types/react-native-navigation/react-native-navigation-tests.tsx delete mode 100644 types/react-native-navigation/tsconfig.json delete mode 100644 types/react-native-navigation/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 46be03a056..6b80437697 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1194,6 +1194,12 @@ "sourceRepoURL": "https://github.com/react-native-community/react-native-modal", "asOfVersion": "4.1.1" }, + { + "libraryName": "react-native-navigation", + "typingsPackageName": "react-native-navigation", + "sourceRepoURL": "https://github.com/wix/react-native-navigation", + "asOfVersion": "2.0.0" + }, { "libraryName": "react-split-pane", "typingsPackageName": "react-split-pane", diff --git a/types/react-native-navigation/index.d.ts b/types/react-native-navigation/index.d.ts deleted file mode 100644 index 0b115935be..0000000000 --- a/types/react-native-navigation/index.d.ts +++ /dev/null @@ -1,315 +0,0 @@ -// Type definitions for react-native-navigation 1.1 -// Project: https://github.com/wix/react-native-navigation -// Definitions by: Egor Shulga -// Jason Merino -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 - -import * as React from 'react'; - -export namespace Navigation { - function registerComponent(screenID: string, generator: () => React.ComponentType, store?: any, provider?: any, options?: any): void; - function startTabBasedApp(params: TabBasedApp): void; - function startSingleScreenApp(params: SingleScreenApp): void; - function showModal(params: ModalScreen): void; - function dismissModal(params?: { animationType?: 'none' | 'slide-down' }): void; - function dismissAllModals(params?: { animationType?: 'none' | 'slide-down' }): void; - function showLightBox(params?: LightBox): void; - function dismissLightBox(): void; - function handleDeepLink(params?: { link: string; payload?: string; }): void; - function registerScreen(screenId: string, generator: () => React.ComponentType): void; - function getCurrentlyVisibleScreenId(): Promise; - function isAppLaunched(): Promise; -} - -export interface TabBasedApp { - tabs: TabScreen[]; - tabsStyle?: { - tabBarButtonColor?: string; - tabBarSelectedButtonColor?: string; - tabBarBackgroundColor?: string; - initialTabIndex?: number; - }; - appStyle?: { - orientation?: 'auto' | 'landscape' | 'portrait'; - bottomTabBadgeTextColor?: string; - bottomTabBadgeBackgroundColor?: string; - backButtonImage?: any; - hideBackButtonTitle?: boolean; - }; - drawer?: Drawer; - passProps?: object; - animationType?: 'none' | 'slide-down' | 'fade'; -} - -export interface IconInsets { - top?: number; - left?: number; - bottom?: number; - right?: number; -} - -export interface TabScreen { - label?: string; - screen: string; - icon?: any; - iconInsets?: IconInsets; - selectedIcon?: any; - title?: string; - navigatorStyle?: NavigatorStyle; - navigatorButtons?: NavigatorButtons; - titleImage?: any; -} - -export interface SingleScreenApp { - screen: Screen; - drawer?: Drawer; - passProps?: object; - animationType?: 'none' | 'slide-down' | 'fade'; - appStyle?: { - orientation?: 'auto' | 'landscape' | 'portrait'; - backButtonImage?: any; - hideBackButtonTitle?: boolean; - }; -} - -export interface Screen { - screen: string; - title?: string; - navigatorStyle?: NavigatorStyle; - navigatorButtons?: NavigatorButtons; - overrideBackPress?: boolean; -} - -export interface ModalScreen extends Screen { - passProps?: object; - animationType?: 'slide-up' | 'none'; -} - -export interface ResetScreen

extends Screen { - passProps?: P; - animated?: boolean; - animationType?: 'fade' | 'slide-horizontal'; -} - -export interface PushedScreen

extends ResetScreen

{ - titleImage?: any; - backButtonTitle?: string; - backButtonHidden?: boolean; - previewView?: React.Component | number; - previewHeight?: number; - previewCommit?: boolean; - previewActions?: Action[]; -} - -export interface Action { - id: string; - title: string; - style?: 'selected' | 'destructive'; - actions: Action[]; -} - -export interface LightBox { - screen: string; - passProps?: object; - style?: { - backgroundBlur?: 'dark' | 'light' | 'xlight' | 'none'; - backgroundColor?: string; - }; - adjustSoftInput?: 'nothing' | 'pan' | 'resize' | 'unspecified'; -} - -export interface NavigatorEvent { - id: 'willAppear' | 'didAppear' | 'willDisappear' | 'didDisappear' | 'willCommitPreview' | 'backPress' | 'bottomTabSelected' | 'bottomTabReselected' | string; - type: 'NavBarButtonPress' | 'DeepLink'; -} - -export class Navigator { - push

(params: PushedScreen

): void; - pop(params?: { animated?: boolean; animationType?: 'fade' | 'slide-horizontal'; }): void; - popToRoot(params?: { animated?: boolean; animationType?: 'fade' | 'slide-horizontal'; }): void; - resetTo

(params: PushedScreen

): void; - showModal(params: ModalScreen): void; - dismissModal(params?: { animationType?: 'none' | 'slide-down' }): void; - dismissAllModals(params?: { animationType?: 'none' | 'slide-down' }): void; - showLightBox(params: LightBox): void; - dismissLightBox(): void; - showInAppNotification(params?: { screen: string; passProps?: object; autoDismissTimerSec?: number }): void; - handleDeepLink(params: { link: string }): void; - setButtons(params: NavigatorButtons & { animated?: boolean }): void; - setTitle(params: { title: string }): void; - setSubTitle(params: { subtitle: string }): void; - toggleDrawer(params: { side: 'left' | 'right'; animated?: boolean; to?: 'open' | 'closed' }): void; - setDrawerEnabled(params: { side: 'left' | 'right'; enabled: boolean }): void; - toggleTabs(params: { to: 'hidden' | 'shown'; animated?: boolean }): void; - setTabBadge(params?: { tabIndex?: number; badge: number | null; badgeColor?: string; }): void; - setTabButton(params?: { tabIndex?: number; icon?: any; selectedIcon?: any; label?: string; }): void; - switchToTab(params?: { tabIndex?: number }): void; - toggleNavBar(params: { to: 'hidden' | 'shown'; animated?: boolean }): void; - setOnNavigatorEvent(callback: (event: NavigatorEvent) => void): void; - addOnNavigatorEvent(callback: (event: NavigatorEvent) => void): () => void; - screenIsCurrentlyVisible(): Promise; - setStyle(params: NavigatorStyle): void; -} - -export class ScreenVisibilityListener { - constructor(params: ScreenVisibilityListenerParams); - register(): void; - unregister(): void; -} - -export class NativeEventsReceiver { - constructor(); - appLaunched(callback: () => void): void; -} - -export interface ScreenVisibilityListenerParams { - willAppear?: (params: ListenerParams) => void; - didAppear?: (params: ListenerParams) => void; - willDisappear?: (params: ListenerParams) => void; - didDisappear?: (params: ListenerParams) => void; -} - -export interface ListenerParams { - screen: string; - startTime: number; - endTime: number; - commandType: string; -} - -export interface NavigationComponentProps { - navigator: Navigator; -} - -export interface NavigatorStyle { - navBarTextColor?: string; - navBarTextFontSize?: number; - navBarTextFontFamily?: string; - navBarBackgroundColor?: string; - navBarCustomView?: string; - navBarComponentAlignment?: 'center' | 'fill'; - navBarCustomViewInitialProps?: object; - navBarButtonColor?: string; - topBarElevationShadowEnabled?: boolean; - navBarHidden?: boolean; - navBarHideOnScroll?: boolean; - navBarTranslucent?: boolean; - navBarTransparent?: boolean; - navBarNoBorder?: boolean; - drawUnderNavBar?: boolean; - drawUnderTabBar?: boolean; - navBarBlur?: boolean; - tabBarHidden?: boolean; - statusBarHidden?: boolean; - statusBarTextColorScheme?: string; - navBarSubtitleColor?: string; - navBarSubtitleFontFamily?: string; - navBarSubtitleFontSize?: number; - screenBackgroundColor?: string; - orientation?: 'auto' | 'landscape' | 'portrait'; - disabledButtonColor?: string; - // iOS only - statusBarTextColorSchemeSingleScreen?: string; - statusBarHideWithNavBar?: boolean; - statusBarBlur?: boolean; - disabledBackGesture?: boolean; - disabledSimultaneousGesture?: boolean; - screenBackgroundImageName?: string; - rootBackgroundImageName?: string; - navBarButtonFontSize?: number; - navBarButtonFontWeight?: string | number; - navBarLeftButtonFontSize?: number; - navBarLeftButtonColor?: string; - navBarLeftButtonFontWeight?: string | number; - navBarRightButtonFontSize?: number; - navBarRightButtonColor?: string; - navBarRightButtonFontWeight?: string | number; - topBarShadowColor?: string; - topBarShadowOpacity?: number; - topBarShadowOffset?: number; - topBarShadowRadius?: number; - preferredContentSize?: { width: number, height: number }; - modalPresentationStyle?: 'formSheet' | 'pageSheet' | 'overFullScreen' | 'overCurrentContext' | 'fullScreen'; - largeTitle?: boolean; - // Android only - navigationBarColor?: string; - navBarTitleTextCentered?: boolean; - navBarButtonFontFamily?: string; - statusBarColor?: string; - drawUnderStatusBar?: boolean; - collapsingToolBarImage?: object; - collapsingToolBarCollapsedColor?: string; - navBarTextFontBold?: boolean; - navBarHeight?: number; - navBarTopPadding?: number; - topTabsHeight?: number; - topBarBorderColor?: string; - topBarBorderWidth?: number; -} - -export interface NavigatorButtons { - leftButtons?: NavigatorButton[]; - rightButtons?: NavigatorButton[]; - fab?: FABAndroid; -} - -export type IdAndroid = 'back' | 'cancel' | 'accept' | 'sideMenu'; - -export type SystemItemIOS = 'done' | 'cancel' | 'edit' | 'save' | 'add' | - 'flexibleSpace' | 'fixedSpace' | 'compose' | 'reply' | 'action' | 'organize' | - 'bookmarks' | 'search' | 'refresh' | 'stop' | 'camera' | 'trash' | 'play' | - 'pause' | 'rewind' | 'fastForward' | 'undo' | 'redo'; - -export type ShowAsActionAndroid = 'ifRoom' | 'always' | 'withText' | 'never'; - -export interface NavigatorButton { - id: string | IdAndroid; - title?: string; - icon?: any; - component?: string; - passProps?: object; - testID?: string; - disabled?: boolean; - disableIconTint?: boolean; - buttonColor?: string; - buttonFontSize?: number; - buttonFontWeight?: string | number; - systemItem?: SystemItemIOS; - showAsAction?: ShowAsActionAndroid; -} - -export interface FABAndroid { - collapsedId?: string; - collapsedIcon?: any; - collapsedIconColor?: string; - expendedId?: string; - expendedIcon?: any; - expendedIconColor?: string; - backgroundColor?: string; - actions?: NavigatorButton[]; -} - -export interface Drawer { - left?: { - screen: string; - passProps?: any; - disableOpenGesture?: boolean; - fixedWidth?: number; - }; - right?: { - screen: string; - passProps?: any; - disableOpenGesture?: boolean; - fixedWidth?: number; - }; - style?: { - drawerShadow?: boolean; - contentOverlayColor?: string; - leftDrawerWidth?: number; - rightDrawerWidth?: number; - shouldStretchDrawer?: boolean; - }; - type?: string; - animationType?: string; - disableOpenGesture?: boolean; -} diff --git a/types/react-native-navigation/react-native-navigation-tests.tsx b/types/react-native-navigation/react-native-navigation-tests.tsx deleted file mode 100644 index 0a3d593a2b..0000000000 --- a/types/react-native-navigation/react-native-navigation-tests.tsx +++ /dev/null @@ -1,216 +0,0 @@ -import * as React from 'react'; -import { Text, View } from 'react-native'; -import { - Navigation, - NavigationComponentProps, - NavigatorStyle, - NavigatorButtons, - NavigatorEvent, - NativeEventsReceiver, -} from 'react-native-navigation'; - -type Props = NavigationComponentProps & { height: number }; - -class Screen1 extends React.Component { - constructor(props: Props) { - super(props); - this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent); - } - - onNavigatorEvent = (event: NavigatorEvent) => { - if (event.id === 'willAppear') { - console.log('will appear'); - } else if (event.type === 'NavBarButtonPress' && event.id === 'sideMenu') { - console.log('side menu pressed'); - } - } - - static navigatorButtons: NavigatorButtons = { - leftButtons: [{ - id: 'sideMenu' - }] - }; - - componentDidMount() { - this.props.navigator.push({ - screen: 'example.Screen2', - overrideBackPress: false, - passProps: { name: 'Henrik' }, - }); - this.props.navigator.setTabBadge({ badge: null }); - } - - render() { - return ( - - Screen 1 - - ); - } -} - -interface Screen2OwnProps { - name: string; -} - -type Screen2Props = Screen2OwnProps & NavigationComponentProps; - -class Screen2 extends React.Component { - static navigatorStyle: NavigatorStyle = { - drawUnderNavBar: true, - navBarTranslucent: true - }; - - componentDidMount() { - this.props.navigator.resetTo({ screen: 'example.Screen1' }); - } - - render() { - return ( - - Screen 2 - Hello {this.props.name} - - ); - } -} - -const Drawer = (props: NavigationComponentProps) => { - return ( - - Drawer - - ); -}; - -interface TestProviderProps { - test: string; -} - -class TestProvider extends React.Component { - getChildContext() { - return { - test: this.props.test - }; - } - - render() { - return this.props.children; - } -} - -Navigation.registerComponent('example.Screen1', () => Screen1, {}, TestProvider, {test: "test"}); -Navigation.registerComponent('example.Screen2', () => Screen2); -Navigation.registerComponent('example.Drawer', () => Drawer); - -Navigation.isAppLaunched().then(appLaunched => { - if (appLaunched) { - startApp(); // App is launched -> show UI - } - new NativeEventsReceiver().appLaunched(startApp); // App hasn't been launched yet -> show the UI only when needed. -}); - -function startApp() { - // do something here -} - -Navigation.startTabBasedApp({ - tabs: [ - { - label: 'One', - screen: 'example.FirstTabScreen', - icon: require('../img/one.png'), - selectedIcon: require('../img/one_selected.png'), - iconInsets: { - top: 6, - left: 0, - bottom: -6, - right: 0 - }, - title: 'Screen One', - titleImage: {}, - navigatorStyle: {}, - navigatorButtons: {}, - }, - { - label: 'Two', - screen: 'example.SecondTabScreen', - icon: require('../img/two.png'), - selectedIcon: require('../img/two_selected.png'), - title: 'Screen Two' - } - ], - tabsStyle: { - tabBarButtonColor: '#ffff00', - tabBarSelectedButtonColor: '#ff9900', - tabBarBackgroundColor: '#551A8B', - initialTabIndex: 1, - }, - appStyle: { - orientation: 'portrait', - bottomTabBadgeTextColor: 'red', - bottomTabBadgeBackgroundColor: 'green', - backButtonImage: {}, - hideBackButtonTitle: true - }, - drawer: { - left: { - screen: 'example.FirstSideMenu', - passProps: {}, - fixedWidth: 500, - }, - right: { - screen: 'example.SecondSideMenu', - passProps: {}, - fixedWidth: 500, - }, - style: { - drawerShadow: true, - contentOverlayColor: 'rgba(0,0,0,0.25)', - leftDrawerWidth: 50, - rightDrawerWidth: 50, - shouldStretchDrawer: true - }, - type: 'MMDrawer', - animationType: 'door', - - disableOpenGesture: false - }, - passProps: {}, - animationType: 'slide-down' -}); - -Navigation.startSingleScreenApp({ - screen: { - screen: 'example.WelcomeScreen', - title: 'Welcome', - navigatorStyle: {}, - navigatorButtons: {} - }, - drawer: { - left: { - screen: 'example.FirstSideMenu', - passProps: {}, - disableOpenGesture: false, - fixedWidth: 500 - }, - right: { - screen: 'example.SecondSideMenu', - passProps: {}, - disableOpenGesture: false, - fixedWidth: 500 - }, - style: { - drawerShadow: true, - contentOverlayColor: 'rgba(0,0,0,0.25)', - leftDrawerWidth: 50, - rightDrawerWidth: 50 - }, - type: 'MMDrawer', - animationType: 'door', - - disableOpenGesture: false - }, - passProps: {}, - animationType: 'slide-down' -}); diff --git a/types/react-native-navigation/tsconfig.json b/types/react-native-navigation/tsconfig.json deleted file mode 100644 index a8e66bb44a..0000000000 --- a/types/react-native-navigation/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react-native" - }, - "files": [ - "index.d.ts", - "react-native-navigation-tests.tsx" - ] -} \ No newline at end of file diff --git a/types/react-native-navigation/tslint.json b/types/react-native-navigation/tslint.json deleted file mode 100644 index 486c3a94ef..0000000000 --- a/types/react-native-navigation/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json", "rules": {"no-unnecessary-generics": false} } From bcb71bbf2945c59e2afb02697639e2432c6ca68d Mon Sep 17 00:00:00 2001 From: Emilio Martinez Date: Thu, 12 Jul 2018 00:52:43 -0700 Subject: [PATCH 019/738] feat(webpack): fill Compiler- and Compilation-related fs types (#27117) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Please fill in this template. - [X] Use a meaningful title for the pull request. Include the name of the package modified. - [X] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [X] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [X] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). Select one of these and delete the others: If changing an existing definition: - [X] Provide a URL to documentation or source code which provides context for the suggested changes: (See bottom of description) - [X] Increase the version number in the header if appropriate. - [X] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`. --- Changes in this PR are related to a few Webpack Compiler and Compilation properties. Adds definitions for following file timestamp properties: * `Compiler.fileTimestamps`. See https://github.com/webpack/webpack/blob/v4.15.1/lib/Compiler.js#L138. * `Compiler.contextTimestamps`. See https://github.com/webpack/webpack/blob/v4.15.1/lib/Compiler.js#L140. * `Compilation.fileTimestamps`. See https://github.com/webpack/webpack/blob/v4.15.1/lib/Compilation.js#L467. * `Compilation.contextTimestamps`. See https://github.com/webpack/webpack/blob/v4.15.1/lib/Compilation.js#L469. Adds definitions for the following file system properties: * `Compiler.inputFileSystem` — Roughly a subset of `fs` read features. See https://github.com/webpack/enhanced-resolve/blob/v4.1.0/lib/NodeJsInputFileSystem.js and https://github.com/webpack/memory-fs/blob/v0.4.1/lib/MemoryFileSystem.js. * `Compiler.outputFileSystem` — Roughly a subset of `fs` output features. See https://github.com/webpack/webpack/blob/v4.15.1/lib/node/NodeOutputFileSystem.js#L9:7. Both file system properties above, while initialized as `null`, have their value set almost immediately right after by Webpack, making them generally not `null` by the time the Compiler can be accessed. See https://github.com/webpack/webpack/blob/master/lib/webpack.js#L34. --- types/webpack/index.d.ts | 27 ++++++++++++++++++++++++++- types/webpack/webpack-tests.ts | 23 +++++++++++++++++++---- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index da6d84cc1e..d9db284ae8 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -947,6 +947,8 @@ declare namespace webpack { childrenCounters: any; usedChunkIds: any; usedModuleIds: any; + fileTimestamps: Map; + contextTimestamps: Map; getStats(): Stats; addModule(module: CompilationModule, cacheGroup: any): any; // tslint:disable-next-line:ban-types @@ -1017,6 +1019,26 @@ declare namespace webpack { invalidate(): void; } + interface InputFileSystem { + purge(): void; + readFile(path: string, callback: (err: Error, contents: Buffer) => void): void; + readFileSync(path: string): Buffer; + readlink(path: string, callback: (err: Error, linkString: string) => void): void; + readlinkSync(path: string): string; + stat(path: string, callback: (err: Error, stats: any) => void): void; + statSync(path: string): any; + } + + interface OutputFileSystem { + join(...paths: string[]): string; + mkdir(path: string, callback: (err: Error) => void): void; + mkdirp(path: string, callback: (err: Error) => void): void; + purge(): void; + rmdir(path: string, callback: (err: Error) => void): void; + unlink(path: string, callback: (err: Error) => void): void; + writeFile(path: string, data: any, callback: (err: Error) => void): void; + } + class Compiler extends Tapable implements ICompiler { constructor(); @@ -1025,7 +1047,10 @@ declare namespace webpack { name: string; options: Configuration; - outputFileSystem: any; + inputFileSystem: InputFileSystem; + outputFileSystem: OutputFileSystem; + fileTimestamps: Map; + contextTimestamps: Map; run(handler: Compiler.Handler): void; watch(watchOptions: Compiler.WatchOptions, handler: Compiler.Handler): Compiler.Watching; } diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index 5a41905b8d..1e1a95fe97 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -158,11 +158,26 @@ declare const require: any; declare const path: any; configuration = { plugins: [ - function(this: webpack.Compiler) { - this.plugin("done", stats => { - require("fs").writeFileSync( + function apply(this: webpack.Compiler) { + const prevTimestamps = new Map(); + const startTime = Date.now(); + + this.hooks.emit.tap("SomePlugin", (compilation: webpack.compilation.Compilation) => { + for (const filepath in compilation.fileTimestamps.keys()) { + const prevTimestamp = prevTimestamps.get(filepath) || startTime; + const newTimestamp = compilation.fileTimestamps.get(filepath) || Infinity; + if (prevTimestamp < newTimestamp) { + this.inputFileSystem.readFileSync(filepath).toString('utf-8'); + } + } + }); + + this.hooks.afterEmit.tapAsync("afterEmit", (stats, callback) => { + this.outputFileSystem.writeFile( path.join(__dirname, "...", "stats.json"), - JSON.stringify(stats.toJson())); + JSON.stringify(stats.getStats().toJson()), + callback + ); }); } ] From d360bc9e009c58230bcf327c53410f9d550b3273 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Thu, 12 Jul 2018 13:25:20 +0100 Subject: [PATCH 020/738] Added johnnyreilly to webpack related definitions to speed reviewing up (#27218) --- types/enhanced-resolve/index.d.ts | 4 +++- types/tapable/index.d.ts | 1 + types/uglify-js/index.d.ts | 4 +++- types/webpack/index.d.ts | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/enhanced-resolve/index.d.ts b/types/enhanced-resolve/index.d.ts index 1cf3a3397a..0a82a4263e 100644 --- a/types/enhanced-resolve/index.d.ts +++ b/types/enhanced-resolve/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for enhanced-resolve v3.0.0 // Project: https://github.com/webpack/enhanced-resolve.git -// Definitions by: e-cloud , Onigoetz +// Definitions by: e-cloud +// Onigoetz +// John Reilly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/tapable/index.d.ts b/types/tapable/index.d.ts index 14d7cf9587..891279e0e5 100644 --- a/types/tapable/index.d.ts +++ b/types/tapable/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for tapable v1.0.0 // Project: https://github.com/webpack/tapable.git // Definitions by: e-cloud +// John Reilly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/uglify-js/index.d.ts b/types/uglify-js/index.d.ts index 8778975020..7589ba8e86 100644 --- a/types/uglify-js/index.d.ts +++ b/types/uglify-js/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for UglifyJS 3.0 // Project: https://github.com/mishoo/UglifyJS2 -// Definitions by: Alan Agius , Tanguy Krotoff +// Definitions by: Alan Agius +// Tanguy Krotoff +// John Reilly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index d9db284ae8..6770160a77 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -13,6 +13,7 @@ // Dennis George // Christophe Hurpeau // ZSkycat +// John Reilly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 9b620df22c37549316e1a44428ac48f6a3c619f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 12 Jul 2018 15:46:13 +0200 Subject: [PATCH 021/738] [react-tracking] The callback variant also passes arguments. --- types/react-tracking/index.d.ts | 2 +- .../test/react-tracking-with-types-tests.tsx | 7 ++++++- .../test/react-tracking-without-types-tests.tsx | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/react-tracking/index.d.ts b/types/react-tracking/index.d.ts index 8117fb3336..8705a32781 100644 --- a/types/react-tracking/index.d.ts +++ b/types/react-tracking/index.d.ts @@ -50,7 +50,7 @@ interface Options { process?(ownTrackingData: T): T | Falsy; } -export type TrackingInfo = T | ((props: P, state: S) => T); +export type TrackingInfo = T | ((props: P, state: S, args: any[any]) => T); // Duplicated from ES6 lib to remove the `void` typing, otherwise `track` can’t be used as a HOC function that passes // through a JSX component that be used without casting. diff --git a/types/react-tracking/test/react-tracking-with-types-tests.tsx b/types/react-tracking/test/react-tracking-with-types-tests.tsx index 76c9ccb5b5..a840216af0 100644 --- a/types/react-tracking/test/react-tracking-with-types-tests.tsx +++ b/types/react-tracking/test/react-tracking-with-types-tests.tsx @@ -30,10 +30,15 @@ class ClassPage extends React.Component { // ... other stuff } + @track((_props, _state, [e]: [React.MouseEvent]) => ({ event: `drag started at ${e.screenX}x${e.screenY}` })) + handleDrag(event: React.MouseEvent) { + // no-op + } + @track((props, state) => ({ event: `got ${props.someProp} and clicked ${state.isClicked}` })) render() { return ( - ); diff --git a/types/react-tracking/test/react-tracking-without-types-tests.tsx b/types/react-tracking/test/react-tracking-without-types-tests.tsx index 02a89d929c..a3cf2b4330 100644 --- a/types/react-tracking/test/react-tracking-without-types-tests.tsx +++ b/types/react-tracking/test/react-tracking-without-types-tests.tsx @@ -14,6 +14,11 @@ class ClassPage extends React.Component { // ... other stuff } + @track((_props, _state, [e]) => ({ event: `drag started at ${e.screenX}x${e.screenY}` })) + handleDrag(event: any) { + // no-op + } + // Only need to cast this to `any` because the settings for this project is to disallow implicit `any`. @track((props: any, state: any) => ({ event: `got ${props.someProp} and clicked ${state.isClicked}` })) render() { From 8a4fefd5433a11243528edac801fdcf19917ef0f Mon Sep 17 00:00:00 2001 From: Tyler Jones Date: Thu, 12 Jul 2018 09:21:53 -0700 Subject: [PATCH 022/738] Stripe card's cardholder name can be null (#27206) See example response in https://stripe.com/docs/api#retrieve_card --- types/stripe/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 420869592d..0704eef970 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -4398,7 +4398,7 @@ declare namespace Stripe { /** * Cardholder name */ - name: string; + name: string | null; /** * Uniquely identifies this particular card number. You can use this attribute to check From e8dcdd9186fd6fe180721ac2c684c8979a2ffc01 Mon Sep 17 00:00:00 2001 From: James Greenaway Date: Thu, 12 Jul 2018 17:22:25 +0100 Subject: [PATCH 023/738] Use ComponentType rather than ComponentClass in grid-styled definitions (#27192) * Use ComponentType rather than ComponentClass Update grid-styled BoxProps to accept React component classes or stateless functions * Increment version number * Fix missed type --- types/grid-styled/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/grid-styled/index.d.ts b/types/grid-styled/index.d.ts index af969b0cec..81c11df405 100644 --- a/types/grid-styled/index.d.ts +++ b/types/grid-styled/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for grid-styled 4.1 +// Type definitions for grid-styled 4.2 // Project: https://github.com/jxnblk/grid-styled // Definitions by: Anton Vasin // Victor Orlov @@ -8,7 +8,7 @@ export type Omit = Pick; -import { ComponentClass } from "react"; +import { ComponentType } from "react"; import { StyledComponentClass } from "styled-components"; export type ResponsiveProp = number | string | Array; @@ -39,7 +39,7 @@ export interface BoxProps extends Omit, "width" | "wrap" | "is"> { flex?: ResponsiveProp; order?: ResponsiveProp; - is?: string | ComponentClass; + is?: string | ComponentType; alignSelf?: ResponsiveProp; } @@ -77,4 +77,4 @@ export const theme: Theme; export type DivProps = Omit, "ref"> & { innerRef?: (el: HTMLDivElement) => any; }; -export const div: ComponentClass; +export const div: ComponentType; From 1a07f27101934e730eb8286c1d7b27309a237489 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 13 Jul 2018 01:23:46 +0900 Subject: [PATCH 024/738] [@types/Bluebird] Make iterative methods rigid types without type parameters. (#27216) * Resolve bluebird(Array) method * upgrade typescript version from bluebird-global * move testfile Reason: There are too many type definition files depending on jquery and it can not be managed. * upgrade typescript version from bluebird require packages * fix lint error: use-default-type-parameter --- types/acl/index.d.ts | 3 +- types/amqplib/index.d.ts | 2 +- types/asana/index.d.ts | 5 +- types/auth0/index.d.ts | 4 +- types/blue-tape/blue-tape-tests.ts | 2 - types/blue-tape/index.d.ts | 2 +- types/bluebird-global/index.d.ts | 2 +- .../test/jquery-tests.ts} | 2 +- types/bluebird-global/tsconfig.json | 3 +- types/bluebird-retry/index.d.ts | 2 +- types/bluebird/bluebird-tests.ts | 62 +++++++++++-------- types/bluebird/index.d.ts | 32 ++++------ types/bookshelf/index.d.ts | 2 +- types/bull/index.d.ts | 2 +- types/consolidate/index.d.ts | 4 +- types/consolidate/tslint.json | 1 + types/db-migrate-base/index.d.ts | 2 +- types/db-migrate-pg/index.d.ts | 2 +- types/dts-generator/index.d.ts | 2 +- types/epilogue/index.d.ts | 2 +- types/exceljs/exceljs-tests.ts | 3 +- types/fs-extra-promise/index.d.ts | 2 +- types/hexo-fs/hexo-fs-tests.ts | 32 +++++----- types/hexo-fs/index.d.ts | 2 +- types/inline-css/index.d.ts | 5 +- types/ioredis/index.d.ts | 2 +- types/jackrabbit/index.d.ts | 2 +- types/java/java-tests.ts | 4 +- types/jquery/tsconfig.json | 1 - types/karma-coverage/index.d.ts | 2 +- types/karma-webpack/index.d.ts | 2 +- types/karma/index.d.ts | 2 +- types/knex-postgis/index.d.ts | 2 +- types/knex/index.d.ts | 2 +- types/mock-knex/index.d.ts | 2 +- types/move-concurrently/index.d.ts | 2 +- types/node-mysql-wrapper/index.d.ts | 2 +- types/orientjs/index.d.ts | 2 +- types/project-oxford/index.d.ts | 2 +- types/promise-ftp/index.d.ts | 2 +- types/promise-sftp/index.d.ts | 2 +- types/redlock/index.d.ts | 2 +- types/redlock/v2/index.d.ts | 2 +- types/request-promise/index.d.ts | 2 +- types/restling/index.d.ts | 2 +- types/retry-as-promised/index.d.ts | 2 +- types/schwifty/index.d.ts | 2 +- types/sequelize-fixtures/index.d.ts | 2 +- types/sequelize/index.d.ts | 4 +- types/sequelize/v3/index.d.ts | 6 +- types/simple-oauth2/index.d.ts | 2 +- types/supertest-as-promised/index.d.ts | 2 +- types/umzug/index.d.ts | 2 +- types/viewporter/viewporter-tests.ts | 2 +- types/waterline/index.d.ts | 2 +- types/x-ray/index.d.ts | 2 +- 56 files changed, 124 insertions(+), 127 deletions(-) rename types/{jquery/test/bluebird-global-tests.ts => bluebird-global/test/jquery-tests.ts} (75%) diff --git a/types/acl/index.d.ts b/types/acl/index.d.ts index 43de3f5369..3f4df31aa2 100644 --- a/types/acl/index.d.ts +++ b/types/acl/index.d.ts @@ -2,9 +2,8 @@ // Project: https://github.com/optimalbits/node_acl // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 -/// /// /// diff --git a/types/amqplib/index.d.ts b/types/amqplib/index.d.ts index 269ed0112e..9ad6d9ceda 100644 --- a/types/amqplib/index.d.ts +++ b/types/amqplib/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/squaremo/amqp.node // Definitions by: Michael Nahkies , Ab Reitsma , Nicolás Fantone , Nick Zelei // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/asana/index.d.ts b/types/asana/index.d.ts index 9bbfb62508..4a0ce5a05f 100644 --- a/types/asana/index.d.ts +++ b/types/asana/index.d.ts @@ -2,10 +2,7 @@ // Project: https://github.com/Asana/node-asana // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - +// TypeScript Version: 2.8 import * as Promise from 'bluebird'; declare namespace asana { diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 18cc086ed8..e03ad5aa06 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/auth0/node-auth0 // Definitions by: Wilson Hobbs , Seth Westphal , Amiram Korach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as Promise from 'bluebird'; @@ -264,7 +264,7 @@ export interface CreateClientGrant { scope: string[]; } -export type Strategy = +export type Strategy = 'ad' | 'adfs' | 'amazon' | 'dropbox' | 'bitbucket' | 'aol' | 'auth0-adldap' | 'auth0-oidc' | 'auth0' | 'baidu' | 'bitly' | 'box' | 'custom' | 'daccount' | 'dwolla' | 'email' | 'evernote-sandbox' | 'evernote' | 'exact' | 'facebook' | 'fitbit' | 'flickr' | 'github' | diff --git a/types/blue-tape/blue-tape-tests.ts b/types/blue-tape/blue-tape-tests.ts index c34bc6e32c..526142158b 100644 --- a/types/blue-tape/blue-tape-tests.ts +++ b/types/blue-tape/blue-tape-tests.ts @@ -1,5 +1,3 @@ -/// - import tape = require('blue-tape'); import P = require('bluebird'); diff --git a/types/blue-tape/index.d.ts b/types/blue-tape/index.d.ts index c2d2d50ab5..b086124695 100644 --- a/types/blue-tape/index.d.ts +++ b/types/blue-tape/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/spion/blue-tape // Definitions by: Haoqun Jiang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/bluebird-global/index.d.ts b/types/bluebird-global/index.d.ts index 6b22cb7114..0d8ac4eeb3 100644 --- a/types/bluebird-global/index.d.ts +++ b/types/bluebird-global/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/petkaantonov/bluebird // Definitions by: d-ph // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /* * 1. Why use `bluebird-global` instead of `bluebird`? diff --git a/types/jquery/test/bluebird-global-tests.ts b/types/bluebird-global/test/jquery-tests.ts similarity index 75% rename from types/jquery/test/bluebird-global-tests.ts rename to types/bluebird-global/test/jquery-tests.ts index 3b7f58e9cd..c4c98fadfc 100644 --- a/types/jquery/test/bluebird-global-tests.ts +++ b/types/bluebird-global/test/jquery-tests.ts @@ -1,4 +1,4 @@ -/// +/// // Pulls in bluebird-global to test compatibility. // Fixes https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26328. diff --git a/types/bluebird-global/tsconfig.json b/types/bluebird-global/tsconfig.json index d037429e0d..aa19fd3cda 100644 --- a/types/bluebird-global/tsconfig.json +++ b/types/bluebird-global/tsconfig.json @@ -19,6 +19,7 @@ }, "files": [ "index.d.ts", - "bluebird-global-tests.ts" + "bluebird-global-tests.ts", + "test/jquery-tests.ts" ] } \ No newline at end of file diff --git a/types/bluebird-retry/index.d.ts b/types/bluebird-retry/index.d.ts index b7ba96495d..7192ff90a3 100644 --- a/types/bluebird-retry/index.d.ts +++ b/types/bluebird-retry/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/jut-io/bluebird-retry // Definitions by: Pascal Vomhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import Promise = require('bluebird'); diff --git a/types/bluebird/bluebird-tests.ts b/types/bluebird/bluebird-tests.ts index e5a39714d1..7330bd5b31 100644 --- a/types/bluebird/bluebird-tests.ts +++ b/types/bluebird/bluebird-tests.ts @@ -590,25 +590,39 @@ obj = fooProm.toJSON(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barProm = fooArrProm.spread((one: Foo, two: Bar, twotwo: Foo) => { +barProm = fooArrProm.spread((one: Foo, two: Foo, twotwo: Foo) => { return bar; }); // - - - - - - - - - - - - - - - - - -barProm = fooArrProm.spread((one: Foo, two: Bar, twotwo: Foo) => { +barProm = fooArrProm.spread((one: Foo, two: Foo, twotwo: Foo) => { return barThen; }); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// TODO fix collection inference +fooArrProm = fooArrProm.all(); + +// $ExpectType Bluebird +fooProm.all(); -barArrProm = fooProm.all(); fooInspectionPromise = fooProm.reflect(); -barProm = fooProm.any(); -barArrProm = fooProm.some(num); -barProm = fooProm.race(); + +fooProm = fooArrProm.any(); + +// $ExpectType Bluebird +fooProm.any(); + +fooArrProm = fooArrProm.some(num); + +// $ExpectType Bluebird +fooProm.some(num); + +fooProm = fooArrProm.race(); + +// $ExpectType Bluebird +fooProm.race(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -649,21 +663,19 @@ Promise.all([fooProm, barProm, fooProm]).then(result => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// TODO fix collection inference - -barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { +barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { return bar; }); -barArrProm = fooArrProm.map((item: Foo) => { +barArrProm = fooArrProm.map((item: Foo) => { return bar; }); -barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { +barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { return bar; }, { concurrency: 1 }); -barArrProm = fooArrProm.map((item: Foo) => { +barArrProm = fooArrProm.map((item: Foo) => { return bar; }, { concurrency: 1 @@ -671,37 +683,37 @@ barArrProm = fooArrProm.map((item: Foo) => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barArrProm = fooArrProm.mapSeries((item: Foo, index: number, arrayLength: number) => { +barArrProm = fooArrProm.mapSeries((item: Foo, index: number, arrayLength: number) => { return bar; }); -barArrProm = fooArrProm.mapSeries((item: Foo) => { +barArrProm = fooArrProm.mapSeries((item: Foo) => { return bar; }); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barProm = fooArrProm.reduce((memo: Bar, item: Foo, index: number, arrayLength: number) => { +barProm = fooArrProm.reduce((memo: Bar, item: Foo, index: number, arrayLength: number) => { return memo; }); -barProm = fooArrProm.reduce((memo: Bar, item: Foo) => { +barProm = fooArrProm.reduce((memo: Bar, item: Foo) => { return memo; }, bar); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooArrProm = fooArrProm.filter((item: Foo, index: number, arrayLength: number) => { +fooArrProm = fooArrProm.filter((item: Foo, index: number, arrayLength: number) => { return bool; }); -fooArrProm = fooArrProm.filter((item: Foo) => { +fooArrProm = fooArrProm.filter((item: Foo) => { return bool; }); -fooArrProm = fooArrProm.filter((item: Foo, index: number, arrayLength: number) => { +fooArrProm = fooArrProm.filter((item: Foo, index: number, arrayLength: number) => { return bool; }, { concurrency: 1 }); -fooArrProm = fooArrProm.filter((item: Foo) => { +fooArrProm = fooArrProm.filter((item: Foo) => { return bool; }, { concurrency: 1 @@ -709,10 +721,10 @@ fooArrProm = fooArrProm.filter((item: Foo) => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooArrProm = fooArrProm.each((item: Foo): Bar => bar); -fooArrProm = fooArrProm.each((item: Foo, index: number): Bar => index ? bar : null); -fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Bar => bar); -fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Promise => barProm); +fooArrProm = fooArrProm.each((item: Foo): Bar => bar); +fooArrProm = fooArrProm.each((item: Foo, index: number): Bar => index ? bar : null); +fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Bar => bar); +fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Promise => barProm); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/types/bluebird/index.d.ts b/types/bluebird/index.d.ts index 1e49e04f51..f6a869c392 100644 --- a/types/bluebird/index.d.ts +++ b/types/bluebird/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/petkaantonov/bluebird // Definitions by: Leonard Hecker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /*! * The code following this comment originates from: @@ -36,6 +36,8 @@ */ type CatchFilter = (new (...args: any[]) => E) | ((error: E) => boolean) | (object & E); +type IterableItem = R extends Iterable ? U : never; +type IterableOrNever = R extends Iterable ? R : never; declare class Bluebird implements PromiseLike, Bluebird.Inspection { /** @@ -453,14 +455,12 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { /** * Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers. */ - spread(fulfilledHandler: (...values: W[]) => U | PromiseLike): Bluebird; - spread(fulfilledHandler: (...args: any[]) => U | PromiseLike): Bluebird; + spread(fulfilledHandler: (...values: Array>) => U | PromiseLike): Bluebird; /** * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - // TODO type inference from array-resolving promise? - all(): Bluebird; + all(): Bluebird>; /** * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. @@ -471,48 +471,42 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { /** * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - // TODO type inference from array-resolving promise? - any(): Bluebird; + any(): Bluebird>; /** * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - // TODO type inference from array-resolving promise? - some(count: number): Bluebird; + some(count: number): Bluebird>; /** * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - // TODO type inference from array-resolving promise? - race(): Bluebird; + race(): Bluebird>; /** * Same as calling `Bluebird.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - // TODO type inference from array-resolving promise? - map(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike, options?: Bluebird.ConcurrencyOption): Bluebird; + map(mapper: (item: IterableItem, index: number, arrayLength: number) => U | PromiseLike, options?: Bluebird.ConcurrencyOption): Bluebird ? U[] : never>; /** * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - // TODO type inference from array-resolving promise? - reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Bluebird; + reduce(reducer: (memo: U, item: IterableItem, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Bluebird ? U : never>; /** * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - // TODO type inference from array-resolving promise? - filter(filterer: (item: U, index: number, arrayLength: number) => boolean | PromiseLike, options?: Bluebird.ConcurrencyOption): Bluebird; + filter(filterer: (item: IterableItem, index: number, arrayLength: number) => boolean | PromiseLike, options?: Bluebird.ConcurrencyOption): Bluebird>; /** * Same as calling ``Bluebird.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - each(iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike): Bluebird; + each(iterator: (item: IterableItem, index: number, arrayLength: number) => U | PromiseLike): Bluebird>; /** * Same as calling ``Bluebird.mapSeries(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - mapSeries(iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike): Bluebird; + mapSeries(iterator: (item: IterableItem, index: number, arrayLength: number) => U | PromiseLike): Bluebird ? U[] : never>; /** * Cancel this `promise`. Will not do anything if this promise is already settled or if the cancellation feature has not been enabled diff --git a/types/bookshelf/index.d.ts b/types/bookshelf/index.d.ts index c151e81624..7467b3178f 100644 --- a/types/bookshelf/index.d.ts +++ b/types/bookshelf/index.d.ts @@ -2,7 +2,7 @@ // Project: http://bookshelfjs.org/ // Definitions by: Andrew Schurman , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import Knex = require('knex'); import knex = require('knex'); diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index cdef279acb..17780d7d97 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -8,7 +8,7 @@ // Oleg Repin // David Koblas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as Redis from "ioredis"; import * as Promise from "bluebird"; diff --git a/types/consolidate/index.d.ts b/types/consolidate/index.d.ts index bfe432214f..23f431d8f8 100644 --- a/types/consolidate/index.d.ts +++ b/types/consolidate/index.d.ts @@ -2,13 +2,13 @@ // Project: https://github.com/visionmedia/consolidate.js // Definitions by: Carlos Ballesteros Velasco , Theo Sherry , Nicolas Henry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 // Imported from: https://github.com/soywiz/typescript-node-definitions/consolidate.d.ts /// -/// +import Promise = require("bluebird"); declare var cons: Consolidate; diff --git a/types/consolidate/tslint.json b/types/consolidate/tslint.json index a41bf5d19a..a403f5da2b 100644 --- a/types/consolidate/tslint.json +++ b/types/consolidate/tslint.json @@ -4,6 +4,7 @@ "adjacent-overload-signatures": false, "array-type": false, "arrow-return-shorthand": false, + "await-promise": false, "ban-types": false, "callable-types": false, "comment-format": false, diff --git a/types/db-migrate-base/index.d.ts b/types/db-migrate-base/index.d.ts index a881fa6a06..c1c9189a50 100644 --- a/types/db-migrate-base/index.d.ts +++ b/types/db-migrate-base/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/db-migrate/db-migrate-base // Definitions by: nickiannone // Definitions: https://github.com/nickiannone/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/db-migrate-pg/index.d.ts b/types/db-migrate-pg/index.d.ts index 09cba26317..71726463e4 100644 --- a/types/db-migrate-pg/index.d.ts +++ b/types/db-migrate-pg/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/db-migrate/pg // Definitions by: nickiannone // Definitions: https://github.com/nickiannone/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as pg from "pg"; import * as DbMigrateBase from "db-migrate-base"; diff --git a/types/dts-generator/index.d.ts b/types/dts-generator/index.d.ts index 5ef99eb2b0..d4d730850c 100644 --- a/types/dts-generator/index.d.ts +++ b/types/dts-generator/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/SitePen/dts-generator#readme // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import ts = require('typescript'); import Bluebird = require('bluebird'); diff --git a/types/epilogue/index.d.ts b/types/epilogue/index.d.ts index 3fe56b9e9f..e54f127d9e 100644 --- a/types/epilogue/index.d.ts +++ b/types/epilogue/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/dchester/epilogue // Definitions by: Satana Charuwichitratana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 import { Sequelize, diff --git a/types/exceljs/exceljs-tests.ts b/types/exceljs/exceljs-tests.ts index 684fad8719..0f5504fef0 100644 --- a/types/exceljs/exceljs-tests.ts +++ b/types/exceljs/exceljs-tests.ts @@ -1,7 +1,6 @@ import * as Excel from 'exceljs'; import * as stream from 'stream'; import * as fs from 'fs'; -import * as Bluebird from 'bluebird'; // most examples taken and adapted from README.md @@ -464,4 +463,4 @@ worksheet.commit(); workbook.commit().then(() => null); -Excel.config.setValue('promise', Bluebird); +Excel.config.setValue('promise', Promise); diff --git a/types/fs-extra-promise/index.d.ts b/types/fs-extra-promise/index.d.ts index a7222b9d5d..c2c12f6d28 100644 --- a/types/fs-extra-promise/index.d.ts +++ b/types/fs-extra-promise/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/overlookmotel/fs-extra-promise // Definitions by: midknight41 , Jason Swearingen , Hiromi Shikata // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/hexo-fs/hexo-fs-tests.ts b/types/hexo-fs/hexo-fs-tests.ts index 7bd5dc13b8..7bdd8918fb 100644 --- a/types/hexo-fs/hexo-fs-tests.ts +++ b/types/hexo-fs/hexo-fs-tests.ts @@ -558,7 +558,7 @@ it('emptyDir()', () => { return createDummyFolder(target).then(() => { return fs.emptyDir(target); - }).then(files => { + }).then>(files => { files.should.have.members([ 'e.txt', 'f.js', @@ -577,7 +577,7 @@ it('emptyDir()', () => { [join(target, 'folder', 'i.js'), false], [join(target, 'folder', '.j'), true] ]; - }).map((data: [string, boolean]) => { + }).map(data => { return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); @@ -626,7 +626,7 @@ it('emptyDir() - ignoreHidden off', () => { return createDummyFolder(target).then(() => { return fs.emptyDir(target, { ignoreHidden: false }); - }).then(files => { + }).then>(files => { files.should.have.members([ join('.hidden', 'a.txt'), join('.hidden', 'b.js'), @@ -650,7 +650,7 @@ it('emptyDir() - ignoreHidden off', () => { [join(target, 'folder', 'i.js'), false], [join(target, 'folder', '.j'), false] ]; - }).map((data: [string, boolean]) => { + }).map(data => { return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); @@ -664,7 +664,7 @@ it('emptyDir() - ignorePattern', () => { return createDummyFolder(target).then(() => { return fs.emptyDir(target, { ignorePattern: /\.js/ }); - }).then(files => { + }).then>(files => { files.should.have.members(['e.txt', join('folder', 'h.txt')]); return [ @@ -678,7 +678,7 @@ it('emptyDir() - ignorePattern', () => { [join(target, 'folder', 'i.js'), true], [join(target, 'folder', '.j'), true] ]; - }).map((data: [string, boolean]) => { + }).map(data => { return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); @@ -692,7 +692,7 @@ it('emptyDir() - exclude', () => { return createDummyFolder(target).then(() => { return fs.emptyDir(target, { exclude: ['e.txt', join('folder', 'i.js')] }); - }).then(files => { + }).then>(files => { files.should.have.members(['f.js', join('folder', 'h.txt')]); return [ @@ -706,7 +706,7 @@ it('emptyDir() - exclude', () => { [join(target, 'folder', 'i.js'), true], [join(target, 'folder', '.j'), true] ]; - }).map((data: [string, boolean]) => { + }).map(data => { return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); @@ -718,7 +718,7 @@ it('emptyDir() - exclude', () => { it('emptyDirSync()', () => { const target = join(tmpDir, 'test'); - return createDummyFolder(target).then(() => { + return createDummyFolder(target).then>(() => { const files = fs.emptyDirSync(target); files.should.have.members([ 'e.txt', @@ -738,7 +738,7 @@ it('emptyDirSync()', () => { [join(target, 'folder', 'i.js'), false], [join(target, 'folder', '.j'), true] ]; - }).map((data: [string, boolean]) => { + }).map(data => { return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); @@ -750,7 +750,7 @@ it('emptyDirSync()', () => { it('emptyDirSync() - ignoreHidden off', () => { const target = join(tmpDir, 'test'); - return createDummyFolder(target).then(() => { + return createDummyFolder(target).then>(() => { const files = fs.emptyDirSync(target, { ignoreHidden: false }); files.should.have.members([ join('.hidden', 'a.txt'), @@ -775,7 +775,7 @@ it('emptyDirSync() - ignoreHidden off', () => { [join(target, 'folder', 'i.js'), false], [join(target, 'folder', '.j'), false] ]; - }).map((data: [string, boolean]) => { + }).map(data => { return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); @@ -787,7 +787,7 @@ it('emptyDirSync() - ignoreHidden off', () => { it('emptyDirSync() - ignorePattern', () => { const target = join(tmpDir, 'test'); - return createDummyFolder(target).then(() => { + return createDummyFolder(target).then>(() => { const files = fs.emptyDirSync(target, { ignorePattern: /\.js/ }); files.should.have.members(['e.txt', join('folder', 'h.txt')]); @@ -802,7 +802,7 @@ it('emptyDirSync() - ignorePattern', () => { [join(target, 'folder', 'i.js'), true], [join(target, 'folder', '.j'), true] ]; - }).map((data: [string, boolean]) => { + }).map(data => { return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); @@ -814,7 +814,7 @@ it('emptyDirSync() - ignorePattern', () => { it('emptyDirSync() - exclude', () => { const target = join(tmpDir, 'test'); - return createDummyFolder(target).then(() => { + return createDummyFolder(target).then>(() => { const files = fs.emptyDirSync(target, { exclude: ['e.txt', join('folder', 'i.js')] }); files.should.have.members(['f.js', join('folder', 'h.txt')]); @@ -829,7 +829,7 @@ it('emptyDirSync() - exclude', () => { [join(target, 'folder', 'i.js'), true], [join(target, 'folder', '.j'), true] ]; - }).map((data: [string, boolean]) => { + }).map(data => { return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); diff --git a/types/hexo-fs/index.d.ts b/types/hexo-fs/index.d.ts index 46c7b99d64..89166b230c 100644 --- a/types/hexo-fs/index.d.ts +++ b/types/hexo-fs/index.d.ts @@ -2,7 +2,7 @@ // Project: http://hexo.io/ // Definitions by: segayuu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import Promise = require('bluebird'); import { diff --git a/types/inline-css/index.d.ts b/types/inline-css/index.d.ts index 6d43b7975d..2567e01e85 100644 --- a/types/inline-css/index.d.ts +++ b/types/inline-css/index.d.ts @@ -2,10 +2,7 @@ // Project: https://github.com/jonkemp/inline-css // Definitions by: Philip Spain // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - +// TypeScript Version: 2.8 import Promise = require('bluebird'); diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 7172f1e97d..45b334a205 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -7,7 +7,7 @@ // Shahar Mor // Whemoon Jang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /* =================== USAGE =================== import * as Redis from "ioredis"; diff --git a/types/jackrabbit/index.d.ts b/types/jackrabbit/index.d.ts index ec0ff27fa9..7be4ee23ed 100644 --- a/types/jackrabbit/index.d.ts +++ b/types/jackrabbit/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/hunterloftis/jackrabbit // Definitions by: Elvis Adomnica // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 import { Connection, Options, Message } from 'amqplib'; diff --git a/types/java/java-tests.ts b/types/java/java-tests.ts index 4c79640733..42ca007155 100644 --- a/types/java/java-tests.ts +++ b/types/java/java-tests.ts @@ -1,11 +1,11 @@ import java = require('java'); -import BluePromise = require('bluebird'); +import pify = require('pify'); java.asyncOptions = { syncSuffix: 'Sync', asyncSuffix: '', promiseSuffix: 'P', - promisify: BluePromise.promisify + promisify: pify }; // todo: figure out why promise doesn't work here /* java.registerClientP((): Promise => { diff --git a/types/jquery/tsconfig.json b/types/jquery/tsconfig.json index 40a0bc76d4..86c99c452f 100644 --- a/types/jquery/tsconfig.json +++ b/types/jquery/tsconfig.json @@ -21,7 +21,6 @@ "files": [ "index.d.ts", "jquery-tests.ts", - "test/bluebird-global-tests.ts", "test/example-tests.ts", "test/longdesc-tests.ts", "test/learn-tests.ts", diff --git a/types/karma-coverage/index.d.ts b/types/karma-coverage/index.d.ts index 03ca857449..50be80d5cf 100644 --- a/types/karma-coverage/index.d.ts +++ b/types/karma-coverage/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/karma-runner/karma-coverage // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as karma from 'karma'; import * as istanbul from 'istanbul'; diff --git a/types/karma-webpack/index.d.ts b/types/karma-webpack/index.d.ts index 73e65a39f5..f7278b64a5 100644 --- a/types/karma-webpack/index.d.ts +++ b/types/karma-webpack/index.d.ts @@ -2,7 +2,7 @@ // Project: http://github.com/webpack/karma-webpack // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import 'karma'; import * as Webpack from 'webpack'; diff --git a/types/karma/index.d.ts b/types/karma/index.d.ts index 682cb35bf2..cc4525566b 100644 --- a/types/karma/index.d.ts +++ b/types/karma/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Tanguy Krotoff // James Garbutt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/knex-postgis/index.d.ts b/types/knex-postgis/index.d.ts index b63c1f11dd..193c0aa4a5 100644 --- a/types/knex-postgis/index.d.ts +++ b/types/knex-postgis/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/jfgodoy/knex-postgis // Definitions by: Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as GeoJSON from 'geojson'; import * as Knex from 'knex'; diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 20418e1fac..c80238f259 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -7,7 +7,7 @@ // Satana Charuwichitratana // Shrey Jain // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/mock-knex/index.d.ts b/types/mock-knex/index.d.ts index bad0aadb01..8c3f022bc7 100644 --- a/types/mock-knex/index.d.ts +++ b/types/mock-knex/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/colonyamerican/mock-knex // Definitions by: Jesse Zhang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/move-concurrently/index.d.ts b/types/move-concurrently/index.d.ts index 277c1299f1..75434a4224 100644 --- a/types/move-concurrently/index.d.ts +++ b/types/move-concurrently/index.d.ts @@ -2,7 +2,7 @@ // Project: https://www.npmjs.com/package/move-concurrently // Definitions by: Melvin Groenhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 /** * Recursively moves from to to and resolves its promise when finished. If to already exists then the promise will be rejected with an EEXIST error. diff --git a/types/node-mysql-wrapper/index.d.ts b/types/node-mysql-wrapper/index.d.ts index 170ff5eca0..82170b4704 100644 --- a/types/node-mysql-wrapper/index.d.ts +++ b/types/node-mysql-wrapper/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/nodets/node-mysql-wrapper // Definitions by: Makis Maropoulos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/orientjs/index.d.ts b/types/orientjs/index.d.ts index 19f615efd0..31980678bb 100644 --- a/types/orientjs/index.d.ts +++ b/types/orientjs/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/orientechnologies/orientjs // Definitions by: [Saeed Tabrizi] // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 // Last Update : 20-7-2017 // Compatible with Orientdb >= 2.2.15 and orientjs >= 2.2.x features . diff --git a/types/project-oxford/index.d.ts b/types/project-oxford/index.d.ts index f84676c94c..83c73da3f7 100644 --- a/types/project-oxford/index.d.ts +++ b/types/project-oxford/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/felixrieseberg/project-oxford // Definitions by: Scott Southwood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/promise-ftp/index.d.ts b/types/promise-ftp/index.d.ts index 9253b4d093..23aa5333e0 100644 --- a/types/promise-ftp/index.d.ts +++ b/types/promise-ftp/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/realtymaps/promise-ftp // Definitions by: coolreader18 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 /// diff --git a/types/promise-sftp/index.d.ts b/types/promise-sftp/index.d.ts index 05d941856e..fc75bd9bee 100644 --- a/types/promise-sftp/index.d.ts +++ b/types/promise-sftp/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/realtymaps/promise-sftp // Definitions by: coolreader18 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 /// diff --git a/types/redlock/index.d.ts b/types/redlock/index.d.ts index 27e6784886..9b3af6d0b7 100644 --- a/types/redlock/index.d.ts +++ b/types/redlock/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Ilya Mochalov // BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as Promise from 'bluebird'; import { EventEmitter } from 'events'; diff --git a/types/redlock/v2/index.d.ts b/types/redlock/v2/index.d.ts index d683ec83a4..9ca431c449 100644 --- a/types/redlock/v2/index.d.ts +++ b/types/redlock/v2/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mike-marcacci/node-redlock // Definitions by: Ilya Mochalov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as redis from 'redis'; import * as Promise from 'bluebird'; diff --git a/types/request-promise/index.d.ts b/types/request-promise/index.d.ts index 8b2382d049..895213e770 100644 --- a/types/request-promise/index.d.ts +++ b/types/request-promise/index.d.ts @@ -5,7 +5,7 @@ // Aya Morisawa // Matt R. Wilson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import request = require('request'); import http = require('http'); diff --git a/types/restling/index.d.ts b/types/restling/index.d.ts index 79bc2d8c2c..b4f03a6633 100644 --- a/types/restling/index.d.ts +++ b/types/restling/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/lucasfeliciano/restling // Definitions by: Alessandro vergani // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as Promise from "bluebird"; import * as Restler from "restler"; diff --git a/types/retry-as-promised/index.d.ts b/types/retry-as-promised/index.d.ts index 429e0bb6d1..6287827def 100644 --- a/types/retry-as-promised/index.d.ts +++ b/types/retry-as-promised/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mickhansen/retry-as-promised // Definitions by: Florian Oellerich // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import Promise = require('bluebird'); diff --git a/types/schwifty/index.d.ts b/types/schwifty/index.d.ts index e95de1af55..9ac2556c2b 100644 --- a/types/schwifty/index.d.ts +++ b/types/schwifty/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/hapipal/schwifty // Definitions by: ozum // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 // HELP NEEDED: If possible, find a better way to define Server.models, Request.models and ResponseToolkit.models // They are dynamic types extended from SchwiftyModel. diff --git a/types/sequelize-fixtures/index.d.ts b/types/sequelize-fixtures/index.d.ts index 06e7aaf157..773bb43982 100644 --- a/types/sequelize-fixtures/index.d.ts +++ b/types/sequelize-fixtures/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/domasx2/sequelize-fixtures // Definitions by: Christian Schwarz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as Sequelize from "sequelize"; diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index f003b77731..ecbdba3602 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -15,7 +15,7 @@ // Nick Schultz // Thomas Breleur // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 // Based on original work by: samuelneff @@ -5263,7 +5263,7 @@ declare namespace sequelize { * Set to true or a string with the attribute name you want to use to enable. */ version?: boolean | string; - + /** * Throws an error when no records found */ diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts index 11b6775846..484edd089d 100644 --- a/types/sequelize/v3/index.d.ts +++ b/types/sequelize/v3/index.d.ts @@ -6,7 +6,7 @@ // Nick Mueller // James D. Callahan III // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 // Based on original work by: samuelneff @@ -3140,7 +3140,7 @@ declare namespace sequelize { /** * Shortcut for types used in FindOptions.attributes */ - type FindOptionsAttributesArray = Array; + type FindOptionsAttributesArray = Array; /** * Options that are passed to any model creating a SELECT query @@ -6183,7 +6183,7 @@ declare namespace sequelize { camelizeIf(str: string, condition: boolean): string; underscoredIf(str: string, condition: boolean): string; - + _: SequelizeLoDash; /** diff --git a/types/simple-oauth2/index.d.ts b/types/simple-oauth2/index.d.ts index f5f7659b99..21718c0722 100644 --- a/types/simple-oauth2/index.d.ts +++ b/types/simple-oauth2/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Michael Müller , // Troy Lamerton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import Bluebird = require("bluebird"); diff --git a/types/supertest-as-promised/index.d.ts b/types/supertest-as-promised/index.d.ts index f88c80eaba..1b12d57b0f 100644 --- a/types/supertest-as-promised/index.d.ts +++ b/types/supertest-as-promised/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/WhoopInc/supertest-as-promised // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as supertest from "supertest"; import * as superagent from "superagent"; diff --git a/types/umzug/index.d.ts b/types/umzug/index.d.ts index b60028c566..f74c5933be 100644 --- a/types/umzug/index.d.ts +++ b/types/umzug/index.d.ts @@ -4,7 +4,7 @@ // Margus Lamp // Troy McKinnon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import { EventEmitter } from 'events'; import Sequelize = require("sequelize"); diff --git a/types/viewporter/viewporter-tests.ts b/types/viewporter/viewporter-tests.ts index 94df0749fa..59fa5cd20f 100644 --- a/types/viewporter/viewporter-tests.ts +++ b/types/viewporter/viewporter-tests.ts @@ -109,7 +109,7 @@ function test_swipey() { var canvas = $('canvas')[0]; var context = canvas.getContext('2d'); var iOS = (/iphone|ipad/i).test(navigator.userAgent); - var pointers = new Map(); + var pointers = new Map(); // handle resizing / rotating of the viewport var width, height; $(window).bind(viewporter.ACTIVE ? 'viewportchange' : 'resize', function () { diff --git a/types/waterline/index.d.ts b/types/waterline/index.d.ts index a3aa7c04ee..b0a23d8e5a 100644 --- a/types/waterline/index.d.ts +++ b/types/waterline/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/balderdashy/waterline // Definitions by: Alexandro Libertino // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/x-ray/index.d.ts b/types/x-ray/index.d.ts index 271155ef94..345059a8eb 100644 --- a/types/x-ray/index.d.ts +++ b/types/x-ray/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/lapwinglabs/x-ray#readme // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// From 532aedc04db38f80c795eef8e2ccd2d512ad3c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20P=C3=A9rez=20Batanero?= Date: Thu, 12 Jul 2018 18:24:20 +0200 Subject: [PATCH 025/738] Add ignoreUnavailable param to delete indices (#27215) --- types/elasticsearch/elasticsearch-tests.ts | 7 +++++++ types/elasticsearch/index.d.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/types/elasticsearch/elasticsearch-tests.ts b/types/elasticsearch/elasticsearch-tests.ts index 35b4e39798..85574e3c91 100644 --- a/types/elasticsearch/elasticsearch-tests.ts +++ b/types/elasticsearch/elasticsearch-tests.ts @@ -44,6 +44,13 @@ client.indices.delete({ }, (error) => { }); +client.indices.delete({ + index: 'test_index', + ignoreUnavailable: true +}).then((body) => { +}, (error) => { +}); + client.deleteByQuery({ index: 'test_index', type: 'test_type', diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index 2cfd14f689..c791db72c3 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -1143,6 +1143,7 @@ export interface IndicesDeleteParams extends GenericParams { timeout?: TimeSpan; masterTimeout?: TimeSpan; index: NameList; + ignoreUnavailable?: boolean; } export interface IndicesDeleteAliasParams extends GenericParams { From 251bfc8c1a4808ef7f33b048383798fa71a36914 Mon Sep 17 00:00:00 2001 From: Benedict Etzel Date: Thu, 12 Jul 2018 18:25:00 +0200 Subject: [PATCH 026/738] [react-i18next] Update for 7.8.0 (#27186) * react-i18next: Support ReactNode parents in Trans * react-i18next: Support defaults-style Trans for 7.8.0 --- types/react-i18next/index.d.ts | 3 ++- types/react-i18next/src/trans.d.ts | 9 ++++++++- types/react-i18next/test/react-i18next-tests.tsx | 11 +++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/types/react-i18next/index.d.ts b/types/react-i18next/index.d.ts index 5ea0e7cb91..3f019617c1 100644 --- a/types/react-i18next/index.d.ts +++ b/types/react-i18next/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for react-i18next 7.6 +// Type definitions for react-i18next 7.8 // Project: https://github.com/i18next/react-i18next // Definitions by: Giedrius Grabauskas // Simon Baumann +// Benedict Etzel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/react-i18next/src/trans.d.ts b/types/react-i18next/src/trans.d.ts index c5652315c7..3ef535cf5d 100644 --- a/types/react-i18next/src/trans.d.ts +++ b/types/react-i18next/src/trans.d.ts @@ -5,13 +5,20 @@ export interface TOptions { [key: string]: any; } +export interface Values { + [key: string]: any; +} + export interface TransProps { i18nKey?: string; count?: number; - parent?: string; + parent?: React.ReactNode | (() => React.ReactNode); i18n?: i18n; t?: TranslationFunction; tOptions?: TOptions; + defaults?: string; + values?: Values; + components?: React.ReactNode[]; } export default class Trans extends React.Component { } diff --git a/types/react-i18next/test/react-i18next-tests.tsx b/types/react-i18next/test/react-i18next-tests.tsx index 7f49913c44..d3afe7643a 100644 --- a/types/react-i18next/test/react-i18next-tests.tsx +++ b/types/react-i18next/test/react-i18next-tests.tsx @@ -114,12 +114,23 @@ loadNamespaces({components: [App], i18n}).then(() => { ; ; ; +}/>; +

}/>; ; ; ; ; +placeholder + ]} + values={{ + universe: "World" + }} +/>; type Key = "view" | "nav"; From 5831bb2199fdd1b39857223e414a7a0143a1bdda Mon Sep 17 00:00:00 2001 From: ikokostya Date: Thu, 12 Jul 2018 19:25:37 +0300 Subject: [PATCH 027/738] [got] Body type must be an object in GotJSONOptions (#27168) * Revert "[got] Allow primitive types in JSON body for POST requests (#27109)" This reverts commit 03eede695193d0d78291cee1262f7d59aa7fd4f9. * [got] Add link to issue with json body type * Improve comment --- types/got/got-tests.ts | 16 ---------------- types/got/index.d.ts | 3 ++- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/types/got/got-tests.ts b/types/got/got-tests.ts index a05812be8d..1eb2d89aa8 100644 --- a/types/got/got-tests.ts +++ b/types/got/got-tests.ts @@ -84,22 +84,6 @@ got.patch('todomvc.com', {hostname: 'todomvc'}).then(response => str = response. got.head('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body); got.delete('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body); -// Allow primitive types as JSON body. -{ - got.post('todomvc.com', { - json: true, - body: 1 - }); - got.post('todomvc.com', { - json: true, - body: null - }); - got.post('todomvc.com', { - json: true, - body: 'str' - }); -} - got.stream('todomvc.com').pipe(fs.createWriteStream('index.html')); fs.createReadStream('index.html').pipe(got.stream.get('todomvc.com')); diff --git a/types/got/index.d.ts b/types/got/index.d.ts index 6b44aab339..86a3d42131 100644 --- a/types/got/index.d.ts +++ b/types/got/index.d.ts @@ -100,7 +100,8 @@ declare namespace got { } interface GotJSONOptions extends GotOptions { - body?: any; + // Body must be an object or array. See https://github.com/sindresorhus/got/issues/511 + body?: object; form?: boolean; json: true; } From 0db033ec96f78d1964799f19970641da0854c7f5 Mon Sep 17 00:00:00 2001 From: WEBER Logan Date: Thu, 12 Jul 2018 18:26:49 +0200 Subject: [PATCH 028/738] fix(serialport): missing includeDelimiter option for delimiter parser (#27222) Please fill in this template. - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). Select one of these and delete the others: If changing an existing definition: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://node-serialport.github.io/utilities/parser-delimiter_delimiter.js.html - [ ] Increase the version number in the header if appropriate. - [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`. --- types/serialport/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/serialport/index.d.ts b/types/serialport/index.d.ts index 1e8aa9faa5..2f5f8fc55d 100644 --- a/types/serialport/index.d.ts +++ b/types/serialport/index.d.ts @@ -87,7 +87,7 @@ declare namespace SerialPort { constructor(); } class Delimiter extends Stream.Transform { - constructor(options: {delimiter: string | Buffer | number[]}); + constructor(options: {delimiter: string | Buffer | number[], includeDelimiter?: boolean}); } class Readline extends Delimiter { constructor(options: {delimiter: string | Buffer | number[], encoding?: 'ascii'|'utf8'|'utf16le'|'ucs2'|'base64'|'binary'|'hex'}); From 35835aa27530188255ddfafd49dea35a24f88d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Thu, 12 Jul 2018 18:30:10 +0200 Subject: [PATCH 029/738] [react-navigation] Adding support for parameters in NavigationInjectedProps (#27226) * Adding a failing test for getParam This demonstrates that typing of `navigation.getParam` works when a parameter type is provided. This fails with the following error: ``` ERROR: 559:54 expect TypeScript@next compile error: Argument of type '"title"' is not assignable to parameter of type '"unknown"'. ``` * Making test pass --- types/react-navigation/index.d.ts | 4 ++-- types/react-navigation/react-navigation-tests.tsx | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 02dc72d98f..be2e84a345 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -1160,8 +1160,8 @@ export const HeaderBackButton: React.ComponentClass; */ export const Header: React.ComponentClass; -export interface NavigationInjectedProps { - navigation: NavigationScreenProp; +export interface NavigationInjectedProps

{ + navigation: NavigationScreenProp; } export function withNavigation( diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 40aa75cbc3..f6f6aa3681 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -550,3 +550,13 @@ const MyFocusedComponentWithNavigationFocus = withNavigationFocus { const backButtonRef = ref; }} />; + +// Test Screen with params + +interface MyScreenParams { title: string; } +class MyScreen extends React.Component> { + render() { + const title = this.props.navigation.getParam('title'); + return +

+ )} + /> + ( +
+

Gandalf

+ + +
+ )} + /> + ( +
+

Dumbledore

+ +
+ )} + /> + + )} + /> +); diff --git a/types/react-albus/tsconfig.json b/types/react-albus/tsconfig.json new file mode 100644 index 0000000000..23dcedc16b --- /dev/null +++ b/types/react-albus/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-albus-tests.tsx" + ] +} diff --git a/types/react-albus/tslint.json b/types/react-albus/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-albus/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b2bbdd82410fa7b289de92ad909e7d27f6389934 Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Sun, 15 Jul 2018 20:32:52 +0100 Subject: [PATCH 079/738] Add type declarations for stream-shift. (#27295) --- types/stream-shift/index.d.ts | 10 ++++++++++ types/stream-shift/stream-shift-tests.ts | 6 ++++++ types/stream-shift/tsconfig.json | 23 +++++++++++++++++++++++ types/stream-shift/tslint.json | 1 + 4 files changed, 40 insertions(+) create mode 100644 types/stream-shift/index.d.ts create mode 100644 types/stream-shift/stream-shift-tests.ts create mode 100644 types/stream-shift/tsconfig.json create mode 100644 types/stream-shift/tslint.json diff --git a/types/stream-shift/index.d.ts b/types/stream-shift/index.d.ts new file mode 100644 index 0000000000..5b26fd3217 --- /dev/null +++ b/types/stream-shift/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for stream-shift 1.0 +// Project: https://github.com/mafintosh/stream-shift +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare function shift(stream: NodeJS.ReadableStream): Buffer | string | null; + +export = shift; diff --git a/types/stream-shift/stream-shift-tests.ts b/types/stream-shift/stream-shift-tests.ts new file mode 100644 index 0000000000..391419df96 --- /dev/null +++ b/types/stream-shift/stream-shift-tests.ts @@ -0,0 +1,6 @@ +import shift = require("stream-shift"); +import { createReadStream, createWriteStream } from "fs"; + +const stream = createReadStream(__filename); + +const x: Buffer | string | null = shift(stream); diff --git a/types/stream-shift/tsconfig.json b/types/stream-shift/tsconfig.json new file mode 100644 index 0000000000..59db2bfad5 --- /dev/null +++ b/types/stream-shift/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "stream-shift-tests.ts" + ] +} diff --git a/types/stream-shift/tslint.json b/types/stream-shift/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/stream-shift/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c3293bdfe3d6536ca8b124ff2db1dddb124578b0 Mon Sep 17 00:00:00 2001 From: Ben O'Sullivan Date: Mon, 16 Jul 2018 05:34:22 +1000 Subject: [PATCH 080/738] Added typings for websocket-async (#27293) * Added typings for websocket-async * Updated in accordance with linter * Update tsconfig.json --- types/websocket-async/index.d.ts | 87 +++++++++++++++++++ types/websocket-async/tsconfig.json | 26 ++++++ types/websocket-async/tslint.json | 1 + .../websocket-async/websocket-async-tests.ts | 4 + 4 files changed, 118 insertions(+) create mode 100644 types/websocket-async/index.d.ts create mode 100644 types/websocket-async/tsconfig.json create mode 100644 types/websocket-async/tslint.json create mode 100644 types/websocket-async/websocket-async-tests.ts diff --git a/types/websocket-async/index.d.ts b/types/websocket-async/index.d.ts new file mode 100644 index 0000000000..36bb12e08e --- /dev/null +++ b/types/websocket-async/index.d.ts @@ -0,0 +1,87 @@ +// Type definitions for websocket-async 1.3 +// Project: https://github.com/jcao219/websocket-async +// Definitions by: Ben O'Sullivan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Typescript Version: 2.7 + +/** + * An asynchronous WebSocket client. + * @example + * // Set up connection. + * const webSocketClient = new WebSocketClient; + * // Connect. + * await webSocketClient.connect('ws://www.example.com/'); + * // Send is synchronous. + * webSocketClient.send('Hello!'); + * // Receive is asynchronous. + * console.log(await webSocketClient.receive()); + * // See if there are any more messages received. + * if (webSocketClient.dataAvailable !== 0) { + * console.log(await webSocketClient.receive()); + * } + * // Close the connection. + * await webSocketClient.disconnect(); + */ +declare class WebSocketClient { + _socket: WebSocket; + + _closeEvent: CloseEvent | null; + + _receiveCallbacksQueue: Array<{ resolve: (data: any) => void, reject: (reason: any) => void }>; + + _receiveDataQueue: any[]; + + constructor(); + + /** + * Whether a connection is currently open. + * @returns true if the connection is open. + */ + connected(): boolean; + + /** + * The number of messages available to receive. + * @returns The number of queued messages that can be retrieved with {@link #receive} + */ + dataAvailable(): number; + + /** + * Sets up a WebSocket connection to specified url. Resolves when the + * connection is established. Can be called again to reconnect to any url. + */ + connect(url: string, protocols?: string): Promise; + + /** + * Send data through the websocket. + * Must be connected. See {@link #connected}. + */ + send(data: any): void; + + /** + * Asynchronously receive data from the websocket. + * Resolves immediately if there is buffered, unreceived data. + * Otherwise, resolves with the next rececived message, + * or rejects if disconnected. + * @returns A promise that resolves with the data received. + */ + receive(): Promise; + + /** + * Initiates the close handshake if there is an active connection. + * Returns a promise that will never reject. + * The promise resolves once the WebSocket connection is closed. + */ + disconnect(code?: number, reason?: string): Promise; + + /** + * Sets up the event listeners, which do the bulk of the work. + */ + private _setupListenersOnConnect(): Promise; + + /** + * Resets the receive arrays and close events, called in the constructor + */ + private _reset(): void; +} + +export default WebSocketClient; diff --git a/types/websocket-async/tsconfig.json b/types/websocket-async/tsconfig.json new file mode 100644 index 0000000000..78b5de7ea6 --- /dev/null +++ b/types/websocket-async/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5", + "es2015.promise", + "webworker" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "websocket-async-tests.ts" + ] +} diff --git a/types/websocket-async/tslint.json b/types/websocket-async/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/websocket-async/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/websocket-async/websocket-async-tests.ts b/types/websocket-async/websocket-async-tests.ts new file mode 100644 index 0000000000..f32192be95 --- /dev/null +++ b/types/websocket-async/websocket-async-tests.ts @@ -0,0 +1,4 @@ +import WebSocketClient from 'websocket-async'; + +const connection = new WebSocketClient(); +connection.connect(''); From 40ed9ae071f2114d629e1036b70cb141c2ad96ae Mon Sep 17 00:00:00 2001 From: Ika Date: Mon, 16 Jul 2018 03:34:50 +0800 Subject: [PATCH 081/738] feat(find-parent-dir): initial commit (#27290) --- .../find-parent-dir/find-parent-dir-tests.ts | 19 +++++++++++++++++++ types/find-parent-dir/index.d.ts | 19 +++++++++++++++++++ types/find-parent-dir/tsconfig.json | 16 ++++++++++++++++ types/find-parent-dir/tslint.json | 3 +++ 4 files changed, 57 insertions(+) create mode 100644 types/find-parent-dir/find-parent-dir-tests.ts create mode 100644 types/find-parent-dir/index.d.ts create mode 100644 types/find-parent-dir/tsconfig.json create mode 100644 types/find-parent-dir/tslint.json diff --git a/types/find-parent-dir/find-parent-dir-tests.ts b/types/find-parent-dir/find-parent-dir-tests.ts new file mode 100644 index 0000000000..31b3307377 --- /dev/null +++ b/types/find-parent-dir/find-parent-dir-tests.ts @@ -0,0 +1,19 @@ +/// + +import findParentDir = require("find-parent-dir"); + +let parentDir: string | null; + +findParentDir(__dirname, ".git", (err, dir) => { + if (err) { + console.error("error", err); + } else { + parentDir = dir; + } +}); + +try { + parentDir = findParentDir.sync(__dirname, ".git"); +} catch (err) { + console.error("error", err); +} diff --git a/types/find-parent-dir/index.d.ts b/types/find-parent-dir/index.d.ts new file mode 100644 index 0000000000..0302255198 --- /dev/null +++ b/types/find-parent-dir/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for find-parent-dir 0.3 +// Project: https://github.com/thlorenz/find-parent-dir +// Definitions by: Ika +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Finds the first parent directory that contains a given file or directory. + */ +declare function findParentDir( + currentFullPath: string, + clue: string, + cb: (err: any, dir: string | null) => void +): void; + +declare namespace findParentDir { + function sync(currentFullPath: string, clue: string): string | null; +} + +export = findParentDir; diff --git a/types/find-parent-dir/tsconfig.json b/types/find-parent-dir/tsconfig.json new file mode 100644 index 0000000000..83c817d86c --- /dev/null +++ b/types/find-parent-dir/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "find-parent-dir-tests.ts"] +} diff --git a/types/find-parent-dir/tslint.json b/types/find-parent-dir/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/find-parent-dir/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From e06903040a0412463231421cb8883a1cd73fe909 Mon Sep 17 00:00:00 2001 From: Ika Date: Mon, 16 Jul 2018 03:35:11 +0800 Subject: [PATCH 082/738] feat(find-project-root): initial commit (#27291) --- .../find-project-root-tests.ts | 7 +++++ types/find-project-root/index.d.ts | 27 +++++++++++++++++++ types/find-project-root/tsconfig.json | 16 +++++++++++ types/find-project-root/tslint.json | 3 +++ 4 files changed, 53 insertions(+) create mode 100644 types/find-project-root/find-project-root-tests.ts create mode 100644 types/find-project-root/index.d.ts create mode 100644 types/find-project-root/tsconfig.json create mode 100644 types/find-project-root/tslint.json diff --git a/types/find-project-root/find-project-root-tests.ts b/types/find-project-root/find-project-root-tests.ts new file mode 100644 index 0000000000..b77d7846d0 --- /dev/null +++ b/types/find-project-root/find-project-root-tests.ts @@ -0,0 +1,7 @@ +/// + +import findProjectRoot = require("find-project-root"); + +const root: string | null = findProjectRoot(process.cwd(), { + maxDepth: 12 +}); diff --git a/types/find-project-root/index.d.ts b/types/find-project-root/index.d.ts new file mode 100644 index 0000000000..a541c1f982 --- /dev/null +++ b/types/find-project-root/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for find-project-root 1.1 +// Project: https://github.com/kirstein/find-project-root +// Definitions by: Ika +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Finds the project root by custom markers + */ +declare function findProjectRoot( + path: string, + options?: findProjectRoot.Options +): null | string; + +declare namespace findProjectRoot { + interface Options { + /** + * total number of levels the algorithm can traverse + */ + maxDepth?: number; + /** + * markers that it will search for + */ + markers?: string[]; + } +} + +export = findProjectRoot; diff --git a/types/find-project-root/tsconfig.json b/types/find-project-root/tsconfig.json new file mode 100644 index 0000000000..1e727f9025 --- /dev/null +++ b/types/find-project-root/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "find-project-root-tests.ts"] +} diff --git a/types/find-project-root/tslint.json b/types/find-project-root/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/find-project-root/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 2550b11007a6d863184167f38fa67ddb60443fdc Mon Sep 17 00:00:00 2001 From: Marcin Tomczyk Date: Sun, 15 Jul 2018 21:38:16 +0200 Subject: [PATCH 083/738] Add types for jexl@1.1 by TechnologyAdvice; new owner TomFrost (#27269) --- types/jexl/index.d.ts | 113 +++++++++++++++++++++++++++++++++++++++ types/jexl/jexl-tests.ts | 77 ++++++++++++++++++++++++++ types/jexl/tsconfig.json | 23 ++++++++ types/jexl/tslint.json | 1 + 4 files changed, 214 insertions(+) create mode 100644 types/jexl/index.d.ts create mode 100644 types/jexl/jexl-tests.ts create mode 100644 types/jexl/tsconfig.json create mode 100644 types/jexl/tslint.json diff --git a/types/jexl/index.d.ts b/types/jexl/index.d.ts new file mode 100644 index 0000000000..953702346c --- /dev/null +++ b/types/jexl/index.d.ts @@ -0,0 +1,113 @@ +// Type definitions for jexl 1.1 +// Project: https://github.com/TechnologyAdvice/jexl +// Definitions by: Marcin Tomczyk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +// Currently maintained by https://github.com/TomFrost/Jexl + +type TransformFunction = (value: any, args?: object) => any; + +type BinaryOpFunction = (left: any, right: any) => any; + +type UnaryOpFunction = (right: any) => any; + +type EvalCallbackFunction = (err: Error | null, result: any) => void; + +/** + * Jexl is the Javascript Expression Language, capable of parsing and + * evaluating basic to complex expression strings, combined with advanced + * xpath-like drilldown into native Javascript objects. + */ +declare class Jexl { + /** + * Adds a binary operator to Jexl at the specified precedence. The higher the + * precedence, the earlier the operator is applied in the order of operations. + * For example, * has a higher precedence than +, because multiplication comes + * before division. + * + * Please see grammar.js for a listing of all default operators and their + * precedence values in order to choose the appropriate precedence for the + * new operator. + * @param operator The operator string to be added + * @param precedence The operator's precedence + * @param fn A function to run to calculate the result. The function + * will be called with two arguments: left and right, denoting the values + * on either side of the operator. It should return either the resulting + * value, or a Promise that resolves with the resulting value. + */ + addBinaryOp(operator: string, precedence: number, fn: BinaryOpFunction): void; + + /** + * Adds a unary operator to Jexl. Unary operators are currently only supported + * on the left side of the value on which it will operate. + * @param operator The operator string to be added + * @param fn A function to run to calculate the result. The function + * will be called with one argument: the literal value to the right of the + * operator. It should return either the resulting value, or a Promise + * that resolves with the resulting value. + */ + addUnaryOp(operator: string, fn: UnaryOpFunction): void; + + /** + * Adds or replaces a transform function in this Jexl instance. + * @param name The name of the transform function, as it will be used + * within Jexl expressions + * @param fn The function to be executed when this transform is + * invoked. It will be provided with two arguments: + * - {*} value: The value to be transformed + * - {{}} args: The arguments for this transform + * - {function} cb: A callback function to be called with an error + * if the transform fails, or a null first argument and the + * transformed value as the second argument on success. + */ + addTransform(name: string, fn: TransformFunction): void; + + /** + * Syntactic sugar for calling {@link #Jexl:addTransform} repeatedly. This function + * accepts a map of one or more transform names to their transform function. + * @param map A map of transform names to transform functions + */ + addTransforms(map: { [key: string]: TransformFunction }): void; + + /** + * Retrieves a previously set transform function. + * @param name The name of the transform function + * @returns The transform function + */ + getTransform(name: string): TransformFunction; + + /** + * Evaluates a Jexl string within an optional context. + * @param expression The Jexl expression to be evaluated + * @param context A mapping of variables to values, which will be + * made accessible to the Jexl expression when evaluating it + * @param cb An optional callback function to be executed when + * evaluation is complete. It will be supplied with two arguments: + * - err: Present if an error occurred + * - result: The result of the evaluation + * @returns resolves with the result of the evaluation. Note that + * if a callback is supplied, the returned promise will already have + * a '.catch' attached to it in order to pass the error to the callback. + */ + eval(expression: string, context?: object, cb?: EvalCallbackFunction): Promise; + + /** + * Removes a binary or unary operator from the Jexl grammar. + * @param operator The operator string to be removed + */ + removeOp(operator: string): void; +} + +/** + * Jexl is the Javascript Expression Language, capable of parsing and + * evaluating basic to complex expression strings, combined with advanced + * xpath-like drilldown into native Javascript objects. + */ +declare class BuildableJexl extends Jexl { + Jexl: { new(): Jexl }; +} + +declare const exportJexl: BuildableJexl; + +export = exportJexl; diff --git a/types/jexl/jexl-tests.ts b/types/jexl/jexl-tests.ts new file mode 100644 index 0000000000..df55bba69e --- /dev/null +++ b/types/jexl/jexl-tests.ts @@ -0,0 +1,77 @@ +import * as jexl from "jexl"; + +const context = { + name: {first: 'Sterling', last: 'Archer'}, + assoc: [ + {first: 'Lana', last: 'Kane'}, + {first: 'Cyril', last: 'Figgis'}, + {first: 'Pam', last: 'Poovey'} + ], + age: 36 +}; + +// Filter an array +// Output: Kane +// $ExpectType Promise +jexl.eval('assoc[.first == "Lana"].last', context); + +// Do math +// Output: 72 +// $ExpectType Promise +jexl.eval('age * (3 - 1)', context, (err, res) => { +}); + +// Concatenate +// Output: Sterling Archer +// $ExpectType Promise +jexl.eval('name.first + " " + name["la" + "st"]', context); + +// Compound +// Output: true +// $ExpectType Promise +jexl.eval('assoc[.last == "Figgis"].first == "Cyril" && assoc[.last == "Poovey"].first == "Pam"', context); + +// Use array indexes +// Output: Cyril Figgis +// $ExpectType Promise +jexl.eval('assoc[1]', context, (err, res) => { +}); + +// Use conditional logic +// Output: working +// $ExpectType Promise +jexl.eval('age > 62 ? "retired" : "working"', context); + +// Transform +// $ExpectType void +jexl.addTransform('upper', (val) => { + return val.toUpperCase(); +}); +// Output: DUCHESS ARCHER +// $ExpectType Promise +jexl.eval('"duchess"|upper + " " + name.last|upper', context); + +// Transform asynchronously, with arguments +// $ExpectType void +jexl.addTransform('getStat', (val, stat) => { + return Promise.resolve('Test'); // Returns a promise +}); +// Output: 184 +// $ExpectType Promise +jexl.eval('name.last|getStat("weight")', context, (err, res) => { +}); + +// Add your own (a)synchronous operators +// Here's a case-insensitive string equality +// $ExpectType void +jexl.addBinaryOp('_=', 20, (left, right) => { + return left.toLowerCase() === right.toLowerCase(); +}); +// Output: true +// $ExpectType Promise +jexl.eval('"Guest" _= "gUeSt"'); + +const newJexlInstance = new jexl.Jexl(); + +// $ExpectType Promise +newJexlInstance.eval("true == true"); diff --git a/types/jexl/tsconfig.json b/types/jexl/tsconfig.json new file mode 100644 index 0000000000..8db678a16d --- /dev/null +++ b/types/jexl/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jexl-tests.ts" + ] +} diff --git a/types/jexl/tslint.json b/types/jexl/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jexl/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 215cb1970b3c998bac688396c6cd9756b446055b Mon Sep 17 00:00:00 2001 From: Andrew Debens Date: Sun, 15 Jul 2018 20:38:59 +0100 Subject: [PATCH 084/738] [classnames] Supporting ES6 & commonjs module imports (#27127) * Updating classnames types for es6 and node imports * Fixing linting --- types/classnames/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/classnames/index.d.ts b/types/classnames/index.d.ts index 40e3ce835c..0c3502d4dd 100644 --- a/types/classnames/index.d.ts +++ b/types/classnames/index.d.ts @@ -21,7 +21,9 @@ interface ClassArray extends Array { } // tslint:disable-line no-emp type ClassNamesFn = (...classes: ClassValue[]) => string; -declare const classNames: ClassNamesFn; +type ClassNamesExport = ClassNamesFn & { default: ClassNamesFn }; + +declare const classNames: ClassNamesExport; export = classNames; export as namespace classNames; From 606b1af8e1fb34a4a016c030840b3893747a0a32 Mon Sep 17 00:00:00 2001 From: sparklellama Date: Mon, 16 Jul 2018 05:42:15 +1000 Subject: [PATCH 085/738] Add access to numer.js options (#27159) Not possible to set options for numeral.js with current .d.ts. Adding the following seems to get it working on my project so hoping it can be included at the DefinitelyTyped end. --- types/numeral/index.d.ts | 11 ++++++++++- types/numeral/numeral-tests.ts | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/types/numeral/index.d.ts b/types/numeral/index.d.ts index 3a22584b3c..16d5a68692 100644 --- a/types/numeral/index.d.ts +++ b/types/numeral/index.d.ts @@ -22,6 +22,14 @@ interface NumeralJSLocale { }; } +interface NumeralJSOptions { + currentLocale: string; + zeroFormat: string; + nullFormat: string; + defaultFormat: string; + scalePercentBy100: boolean; +} + type RoundingFunction = (value: number) => number; // http://numeraljs.com/#custom-formats @@ -41,7 +49,8 @@ interface Numeral { (value?: any): Numeral; version: string; isNumeral: boolean; - + options: NumeralJSOptions; + /** * This function sets the current locale. If no arguments are passed in, * it will simply return the current global locale key. diff --git a/types/numeral/numeral-tests.ts b/types/numeral/numeral-tests.ts index b58d6e7411..79f66efed4 100644 --- a/types/numeral/numeral-tests.ts +++ b/types/numeral/numeral-tests.ts @@ -90,3 +90,8 @@ numeral.locale('fr'); // return the current locale numeral.locale(); // 'fr' + +// test changing an option +numeral.options.scalePercentBy100 = false +numeral(50).formatCurrency('0%') +// '50%' \ No newline at end of file From 11bb84af8c205a3242dd8ef70713452d02146784 Mon Sep 17 00:00:00 2001 From: Emilio Martinez Date: Sun, 15 Jul 2018 12:43:04 -0700 Subject: [PATCH 086/738] feat(html-webpack-plugin): add html-webpack-plugin hook definitions (#27135) --- .../html-webpack-plugin-tests.ts | 14 ++++ types/html-webpack-plugin/index.d.ts | 76 ++++++++++++++++++- 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/types/html-webpack-plugin/html-webpack-plugin-tests.ts b/types/html-webpack-plugin/html-webpack-plugin-tests.ts index b80ea9e6b0..60f1faf023 100644 --- a/types/html-webpack-plugin/html-webpack-plugin-tests.ts +++ b/types/html-webpack-plugin/html-webpack-plugin-tests.ts @@ -1,4 +1,5 @@ import HtmlWebpackPlugin = require('html-webpack-plugin'); +import { Compiler, compilation } from 'webpack'; new HtmlWebpackPlugin(); @@ -25,3 +26,16 @@ const optionsArray: HtmlWebpackPlugin.Options[] = [ ]; const plugins: HtmlWebpackPlugin[] = optionsArray.map(options => new HtmlWebpackPlugin(options)); + +// Webpack plugin `apply` function +function apply(compiler: Compiler) { + compiler.hooks.compilation.tap('SomeWebpackPlugin', (compilation: compilation.Compilation) => { + ( compilation.hooks).htmlWebpackPluginAfterHtmlProcessing.tap( + 'MyPlugin', + (data) => { + data.html += 'The Magic Footer'; + return data; + } + ); + }); +} diff --git a/types/html-webpack-plugin/index.d.ts b/types/html-webpack-plugin/index.d.ts index c3db12f4e7..74c7d31073 100644 --- a/types/html-webpack-plugin/index.d.ts +++ b/types/html-webpack-plugin/index.d.ts @@ -6,7 +6,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import { Plugin } from 'webpack'; +import { Plugin, compilation } from 'webpack'; +import { AsyncSeriesWaterfallHook } from 'tapable'; import { Options as HtmlMinifierOptions } from 'html-minifier'; export = HtmlWebpackPlugin; @@ -84,8 +85,81 @@ declare namespace HtmlWebpackPlugin { [option: string]: any; } + interface Hooks extends compilation.CompilationHooks { + htmlWebpackPluginBeforeHtmlGeneration: AsyncSeriesWaterfallHook<{ + assets: { + publicPath: string; + js: EntryObject[]; + css: EntryObject[]; + }; + outputName: string; + plugin: HtmlWebpackPlugin; + }>; + htmlWebpackPluginBeforeHtmlProcessing: AsyncSeriesWaterfallHook<{ + html: string; + assets: { + publicPath: string; + js: EntryObject[]; + css: EntryObject[]; + }; + outputName: string; + plugin: HtmlWebpackPlugin; + }>; + htmlWebpackPluginAfterHtmlProcessing: AsyncSeriesWaterfallHook<{ + html: string; + assets: { + publicPath: string; + js: EntryObject[]; + css: EntryObject[]; + }; + outputName: string; + plugin: HtmlWebpackPlugin; + }>; + htmlWebpackPluginAlterAssetTags: AsyncSeriesWaterfallHook<{ + head: HtmlTagObject[]; + body: HtmlTagObject[]; + outputName: string; + plugin: HtmlWebpackPlugin; + }>; + htmlWebpackPluginAfterEmit: AsyncSeriesWaterfallHook<{ + html: string; + outputName: string; + plugin: HtmlWebpackPlugin; + }>; + } + /** @deprecated use MinifyOptions */ type MinifyConfig = MinifyOptions; /** @deprecated use Options */ type Config = Options; } + +interface EntryObject { + /** Webpack entry or chunk name */ + entryName: string; + /** Entry or chunk path */ + path: string; +} + +interface HtmlTagObject { + /** + * Attributes of the html tag + * E.g. `{'disabled': true, 'value': 'demo'}` + */ + attributes: { + [attributeName: string]: string | boolean; + }; + /** + * Wether this html must not contain innerHTML + * @see https://www.w3.org/TR/html5/syntax.html#void-elements + */ + voidTag: boolean; + /** + * The tag name e.g. `'div'` + */ + tagName: string; + /** + * Inner HTML The + */ + innerHTML?: string; +} From 2ace47c40477cda37a8bb2e8d04ecce62d3f1ab3 Mon Sep 17 00:00:00 2001 From: Allison Shaw Date: Sun, 15 Jul 2018 14:43:32 -0500 Subject: [PATCH 087/738] Update index.d.ts (#27158) Expose the public GenericOptions const to users. --- types/canvas-gauges/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/canvas-gauges/index.d.ts b/types/canvas-gauges/index.d.ts index e5b4f69047..3c3a617ed7 100644 --- a/types/canvas-gauges/index.d.ts +++ b/types/canvas-gauges/index.d.ts @@ -118,6 +118,8 @@ declare namespace CanvasGauges { barProgress?: boolean, barShadow?: number } + + export const GenericOptions: GenericOptions; export interface RadialGaugeOptions extends GenericOptions { ticksAngle?: number, From ec15c9c9a30e8249843a37b910940c37ec42fb90 Mon Sep 17 00:00:00 2001 From: Adam Binford Date: Sun, 15 Jul 2018 15:44:07 -0400 Subject: [PATCH 088/738] Expanded allowable redux version (#27156) --- types/react-redux-toastr/index.d.ts | 4 ++-- types/react-redux-toastr/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react-redux-toastr/index.d.ts b/types/react-redux-toastr/index.d.ts index 7c9f30b056..8f18abc73b 100644 --- a/types/react-redux-toastr/index.d.ts +++ b/types/react-redux-toastr/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-redux-toastr 7.0.0 +// Type definitions for react-redux-toastr 7.1 // Project: https://github.com/diegoddox/react-redux-toastr // Definitions by: Aleksandar Ivanov // Artyom Stukans @@ -7,7 +7,7 @@ // TypeScript Version: 2.8 import { Component } from 'react'; -import { Action, ActionCreator, Reducer } from 'redux'; +import { Action, Reducer } from 'redux'; export type iconType = 'success' | 'info' | 'warning' | 'error'; export type positionType = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'; diff --git a/types/react-redux-toastr/package.json b/types/react-redux-toastr/package.json index 6d68bf2f9b..998f8e9b38 100644 --- a/types/react-redux-toastr/package.json +++ b/types/react-redux-toastr/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "redux": "^3.6.0" + "redux": "^3.6.0 || ^4.0.0" } } From fc1bfd0f9e783ee42c90bc4336d2fe3074110e7c Mon Sep 17 00:00:00 2001 From: Jonathan Skeate Date: Sun, 15 Jul 2018 15:44:37 -0400 Subject: [PATCH 089/738] [material-ui] Add placeholder, title to TextFieldProps (#27082) --- types/material-ui/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 21ee89c329..649a058156 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -1908,6 +1908,8 @@ declare namespace __MaterialUI { minlength?: string; step?: number; autoComplete?: string; + placeholder?: string; + title?: string; } export class TextField extends React.Component { blur(): void; From 4ca4cba9ea80496e918443ba2634562494ea190d Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Sun, 15 Jul 2018 21:45:29 +0200 Subject: [PATCH 090/738] [react-select]: add typings for valueComponent prop (#27145) --- types/react-select/index.d.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index 377dad4495..fd4d543dd3 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -12,6 +12,7 @@ // Anton Novik // David Schkalee // Arthur Udalov +// Sebastian Silbermann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -27,6 +28,7 @@ export class Async extends React.Component extends React.Component> { } export type OptionComponentType = React.ComponentType>; +export type ValueComponentType = React.ComponentType>; export type HandlerRendererResult = JSX.Element | null | false; @@ -217,6 +219,17 @@ export interface ArrowRendererProps { isOpen: boolean; } +export interface ValueComponentProps { + disabled: ReactSelectProps['disabled']; + id: string; + instancePrefix: string; + onClick: OnValueClickHandler | null; + onRemove?: SelectValueHandler; + placeholder: ReactSelectProps['placeholder']; + value: Option; + values?: Array>; +} + export interface ReactSelectProps extends React.Props> { /** * text to display when `allowCreate` is true. @@ -552,7 +565,7 @@ export interface ReactSelectProps extends React.Props; + valueComponent?: ValueComponentType; /** * optional style to apply to the component wrapper From d37a85553f2889034e84f328dbf8b333bbe8f212 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Sun, 15 Jul 2018 21:46:24 +0200 Subject: [PATCH 091/738] Add github-url-to-object (#27229) Please fill in this template. - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). - [x] The package does not already provide its own types, or cannot have its `.d.ts` files generated via `--declaration` - [x] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. - [x] Create it with `dts-gen --dt`, not by basing it on an existing project. - [x] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, `strictNullChecks`, and `strictFunctionTypes` set to `true`. --- .../github-url-to-object-tests.ts | 5 ++++ types/github-url-to-object/index.d.ts | 25 +++++++++++++++++++ types/github-url-to-object/tsconfig.json | 23 +++++++++++++++++ types/github-url-to-object/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 types/github-url-to-object/github-url-to-object-tests.ts create mode 100644 types/github-url-to-object/index.d.ts create mode 100644 types/github-url-to-object/tsconfig.json create mode 100644 types/github-url-to-object/tslint.json diff --git a/types/github-url-to-object/github-url-to-object-tests.ts b/types/github-url-to-object/github-url-to-object-tests.ts new file mode 100644 index 0000000000..a6de7f1355 --- /dev/null +++ b/types/github-url-to-object/github-url-to-object-tests.ts @@ -0,0 +1,5 @@ +import gh = require('github-url-to-object'); + +gh('github:monkey/business'); // $ExpectType Result | null +gh('https://ghe.example.com:heroku/heroku-flags.git', {enterprise: true}); // $ExpectType Result | null +gh({url: 'git+https://github.com/monkey/business.git'}); // $ExpectType Result | null diff --git a/types/github-url-to-object/index.d.ts b/types/github-url-to-object/index.d.ts new file mode 100644 index 0000000000..a46ca93dd7 --- /dev/null +++ b/types/github-url-to-object/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for github-url-to-object 4.0 +// Project: https://github.com/zeke/github-url-to-object#readme +// Definitions by: Klaus Meinhardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace gh { + interface Options { + enterprise?: boolean; + } + interface Result { + user: string; + repo: string; + branch: string; + https_url: string; + tarball_url: string; + clone_url: string; + travis_url: string; + api_url: string; + zip_url: string; + } +} + +declare function gh(url: string | {url: string}, options?: gh.Options): gh.Result | null; + +export = gh; diff --git a/types/github-url-to-object/tsconfig.json b/types/github-url-to-object/tsconfig.json new file mode 100644 index 0000000000..d25b3d0527 --- /dev/null +++ b/types/github-url-to-object/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "github-url-to-object-tests.ts" + ] +} diff --git a/types/github-url-to-object/tslint.json b/types/github-url-to-object/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/github-url-to-object/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6c93547985f4df775496ce2aa388e42a40c833e6 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Sun, 15 Jul 2018 21:46:51 +0200 Subject: [PATCH 092/738] add parse-github-url (#27230) Please fill in this template. - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). - [x] The package does not already provide its own types, or cannot have its `.d.ts` files generated via `--declaration` - [x] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. - [x] Create it with `dts-gen --dt`, not by basing it on an existing project. - [x] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, `strictNullChecks`, and `strictFunctionTypes` set to `true`. --- types/parse-github-url/index.d.ts | 23 +++++++++++++++++++ .../parse-github-url-tests.ts | 3 +++ types/parse-github-url/tsconfig.json | 23 +++++++++++++++++++ types/parse-github-url/tslint.json | 1 + 4 files changed, 50 insertions(+) create mode 100644 types/parse-github-url/index.d.ts create mode 100644 types/parse-github-url/parse-github-url-tests.ts create mode 100644 types/parse-github-url/tsconfig.json create mode 100644 types/parse-github-url/tslint.json diff --git a/types/parse-github-url/index.d.ts b/types/parse-github-url/index.d.ts new file mode 100644 index 0000000000..c5793277e8 --- /dev/null +++ b/types/parse-github-url/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for parse-github-url 1.0 +// Project: https://github.com/jonschlinkert/parse-github-url +// Definitions by: Klaus Meinhardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Url } from 'url'; + +declare namespace gh { + interface Result extends Url { + filepath: string | null; + owner: string | null; + name: string | null; + repo: string | null; + repository: string | null; + branch: string; + } +} + +declare function gh(url: string): gh.Result | null; + +export = gh; diff --git a/types/parse-github-url/parse-github-url-tests.ts b/types/parse-github-url/parse-github-url-tests.ts new file mode 100644 index 0000000000..7c5a7c50f7 --- /dev/null +++ b/types/parse-github-url/parse-github-url-tests.ts @@ -0,0 +1,3 @@ +import gh = require('parse-github-url'); + +gh('github:monkey/business'); // $ExpectType Result | null diff --git a/types/parse-github-url/tsconfig.json b/types/parse-github-url/tsconfig.json new file mode 100644 index 0000000000..e5a7fcab63 --- /dev/null +++ b/types/parse-github-url/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "parse-github-url-tests.ts" + ] +} diff --git a/types/parse-github-url/tslint.json b/types/parse-github-url/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parse-github-url/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6e4e25a30e33a2269253b572c26dceffcdbf89c3 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Sun, 15 Jul 2018 21:47:32 +0200 Subject: [PATCH 093/738] add git-url-parse (#27233) --- types/git-url-parse/git-url-parse-tests.ts | 8 ++++ types/git-url-parse/index.d.ts | 48 ++++++++++++++++++++++ types/git-url-parse/tsconfig.json | 23 +++++++++++ types/git-url-parse/tslint.json | 1 + 4 files changed, 80 insertions(+) create mode 100644 types/git-url-parse/git-url-parse-tests.ts create mode 100644 types/git-url-parse/index.d.ts create mode 100644 types/git-url-parse/tsconfig.json create mode 100644 types/git-url-parse/tslint.json diff --git a/types/git-url-parse/git-url-parse-tests.ts b/types/git-url-parse/git-url-parse-tests.ts new file mode 100644 index 0000000000..41fd0bd0f0 --- /dev/null +++ b/types/git-url-parse/git-url-parse-tests.ts @@ -0,0 +1,8 @@ +import gitUrlParse = require('git-url-parse'); + +gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git"); // $ExpectType GitUrl +gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git").toString(); // $ExpectType string +gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git").toString('git+ssh'); // $ExpectType string + +gitUrlParse.stringify(gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git")); // $ExpectType string +gitUrlParse.stringify(gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git"), 'https'); // $ExpectType string diff --git a/types/git-url-parse/index.d.ts b/types/git-url-parse/index.d.ts new file mode 100644 index 0000000000..5c1d14ba7a --- /dev/null +++ b/types/git-url-parse/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for git-url-parse 9.0 +// Project: https://github.com/IonicaBizau/git-url-parse +// Definitions by: Klaus Meinhardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace gitUrlParse { + interface GitUrl { + /** An array with the url protocols (usually it has one element). */ + protocols: string[]; + port: number | null; + /** The url domain (including subdomains). */ + resource: string; + /** The authentication user (usually for ssh urls). */ + user: string; + pathname: string; + hash: string; + search: string; + href: string; + protocol: string; + /** The oauth token (could appear in the https urls). */ + token: string; + /** The Git provider (e.g. `"github.com"`). */ + source: string; + /** The repository owner. */ + owner: string; + /** The repository name. */ + name: string; + /** The repository ref (e.g., "master" or "dev"). */ + ref: string; + /** A filepath relative to the repository root. */ + filepath: string; + /** The type of filepath in the url ("blob" or "tree"). */ + filepathtype: string; + /** The owner and name values in the `owner/name` format. */ + full_name: string; + /** The organization the owner belongs to. This is CloudForge specific. */ + organization: string; + /** Whether to add the `.git` suffix or not. */ + git_suffix?: boolean; + toString(type?: string): string; + } + + function stringify(url: GitUrl, type?: string): string; +} + +declare function gitUrlParse(url: string): gitUrlParse.GitUrl; + +export = gitUrlParse; diff --git a/types/git-url-parse/tsconfig.json b/types/git-url-parse/tsconfig.json new file mode 100644 index 0000000000..0261055b6f --- /dev/null +++ b/types/git-url-parse/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "git-url-parse-tests.ts" + ] +} diff --git a/types/git-url-parse/tslint.json b/types/git-url-parse/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/git-url-parse/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b56eb29ea66f803f5c5ae8099f5de354a03968fe Mon Sep 17 00:00:00 2001 From: Ben Grynhaus Date: Sun, 15 Jul 2018 22:47:55 +0300 Subject: [PATCH 094/738] Added types for 'css-to-style' (#27253) --- types/css-to-style/css-to-style-tests.ts | 9 +++++++++ types/css-to-style/index.d.ts | 9 +++++++++ types/css-to-style/tsconfig.json | 16 ++++++++++++++++ types/css-to-style/tslint.json | 1 + 4 files changed, 35 insertions(+) create mode 100644 types/css-to-style/css-to-style-tests.ts create mode 100644 types/css-to-style/index.d.ts create mode 100644 types/css-to-style/tsconfig.json create mode 100644 types/css-to-style/tslint.json diff --git a/types/css-to-style/css-to-style-tests.ts b/types/css-to-style/css-to-style-tests.ts new file mode 100644 index 0000000000..ede5ae8f06 --- /dev/null +++ b/types/css-to-style/css-to-style-tests.ts @@ -0,0 +1,9 @@ +import toStyle from "css-to-style"; + +toStyle(); // $ExpectError + +toStyle({}); // $ExpectError + +toStyle(1); // $ExpectError + +toStyle(''); // $ExpectType CSSStyleDeclaration diff --git a/types/css-to-style/index.d.ts b/types/css-to-style/index.d.ts new file mode 100644 index 0000000000..eb450341f9 --- /dev/null +++ b/types/css-to-style/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for css-to-style 1.2 +// Project: https://github.com/jacobbuck/css-to-style +// Definitions by: Ben Grynhaus +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare function toStyle(cssText: string): CSSStyleDeclaration; + +export default toStyle; diff --git a/types/css-to-style/tsconfig.json b/types/css-to-style/tsconfig.json new file mode 100644 index 0000000000..8b3a9292b3 --- /dev/null +++ b/types/css-to-style/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es5", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "css-to-style-tests.ts"] +} diff --git a/types/css-to-style/tslint.json b/types/css-to-style/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/css-to-style/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 504902e9747994992b7fe7f2bdbd8f3cf3681229 Mon Sep 17 00:00:00 2001 From: Sebastian Lenz Date: Mon, 16 Jul 2018 18:51:24 +0200 Subject: [PATCH 095/738] Add third parameter `parent` to matchPath, add prop `sensitive` to Route (#27336) * Add third parameter `parent` to matchPath MathPath takes a third parameter, see https://github.com/ReactTraining/react-router/blob/master/packages/react-router/modules/matchPath.js#L28 * Add prop `sensitive` to Route Routes accept the prop `sensitive`, see https://reacttraining.com/react-router/web/api/Route/sensitive-bool --- types/react-router/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 4b0f45853f..05d5fe30bb 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -78,6 +78,7 @@ export interface RouteProps { children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; path?: string; exact?: boolean; + sensitive?: boolean; strict?: boolean; } export class Route extends React.Component { } @@ -115,7 +116,7 @@ export interface match

{ // Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html export type Omit = Pick>; -export function matchPath

(pathname: string, props: RouteProps): match

| null; +export function matchPath

(pathname: string, props: RouteProps, parent?: match

| null): match

| null; export function generatePath(pattern: string, params?: { [paramName: string]: string | number | boolean }): string; From 91f8a6b7d1ef61cc543d0901dcc004b846283345 Mon Sep 17 00:00:00 2001 From: Sindre Date: Mon, 16 Jul 2018 20:09:10 +0200 Subject: [PATCH 096/738] auto-bind definitions (#27299) * auto-bind definitions * auto-bind: fix lint errors * auto-bind: PR feedback, fix import syntax in tests --- types/auto-bind/auto-bind-tests.ts | 65 ++++++++++++++++++++++++++++++ types/auto-bind/index.d.ts | 25 ++++++++++++ types/auto-bind/tsconfig.json | 23 +++++++++++ types/auto-bind/tslint.json | 1 + 4 files changed, 114 insertions(+) create mode 100644 types/auto-bind/auto-bind-tests.ts create mode 100644 types/auto-bind/index.d.ts create mode 100644 types/auto-bind/tsconfig.json create mode 100644 types/auto-bind/tslint.json diff --git a/types/auto-bind/auto-bind-tests.ts b/types/auto-bind/auto-bind-tests.ts new file mode 100644 index 0000000000..2c3754e09d --- /dev/null +++ b/types/auto-bind/auto-bind-tests.ts @@ -0,0 +1,65 @@ +import autoBind = require("auto-bind"); + +const emptyConfig: autoBind.AutoBindOptions = {}; +const onlyIncludeInConfig: autoBind.AutoBindOptions = { + include: [] +}; +const onlyExcludeInConfig: autoBind.AutoBindOptions = { + exclude: [] +}; +const emptyArraysInConfig: autoBind.AutoBindOptions = { + include: [], + exclude: [] +}; +const regexConfig: autoBind.AutoBindOptions = { + include: [/test[123]/], + exclude: [/test[123]/, /^regex[123]$/] +}; +const stringConfig: autoBind.AutoBindOptions = { + include: ["test"], + exclude: ["123", "abc"] +}; +const mixConfig: autoBind.AutoBindOptions = { + include: ["test", /test[123]/], + exclude: ["123", /test[123]/] +}; + +class TestConfigs { + constructor() { + // no config + autoBind(this); + autoBind.react(this); + + // empty configs + autoBind(this, emptyConfig); + autoBind.react(this, emptyConfig); + + // include only configs + autoBind(this, onlyIncludeInConfig); + autoBind.react(this, onlyIncludeInConfig); + + // exclude only configs + autoBind(this, onlyExcludeInConfig); + autoBind.react(this, onlyExcludeInConfig); + + // empty array configs + autoBind(this, emptyArraysInConfig); + autoBind.react(this, emptyArraysInConfig); + + // regex configs + autoBind(this, regexConfig); + autoBind.react(this, regexConfig); + + // string configs + autoBind(this, stringConfig); + autoBind.react(this, stringConfig); + + // mix configs + autoBind(this, mixConfig); + autoBind.react(this, mixConfig); + } + + shutUpNoUnnecessaryClass() { + // noop + } +} diff --git a/types/auto-bind/index.d.ts b/types/auto-bind/index.d.ts new file mode 100644 index 0000000000..9b91fb3da6 --- /dev/null +++ b/types/auto-bind/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for auto-bind 1.2 +// Project: https://github.com/sindresorhus/auto-bind#readme +// Definitions by: Sindre Seppola +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare namespace autoBind { + interface AutoBindOptions { + include?: Array; + exclude?: Array; + } + + type AutoBindFunction = ( + self: selfT, + options?: AutoBindOptions + ) => selfT; +} + +interface AutoBindModule + extends autoBind.AutoBindFunction { + react: autoBind.AutoBindFunction; +} + +declare const autoBind: AutoBindModule; +export = autoBind; diff --git a/types/auto-bind/tsconfig.json b/types/auto-bind/tsconfig.json new file mode 100644 index 0000000000..d9589cadad --- /dev/null +++ b/types/auto-bind/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "auto-bind-tests.ts" + ] +} diff --git a/types/auto-bind/tslint.json b/types/auto-bind/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/auto-bind/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 11ef4f5d38ee557563198dc2397473f9b27a16c8 Mon Sep 17 00:00:00 2001 From: YangusKhan <9inchsamurai@gmail.com> Date: Mon, 16 Jul 2018 15:05:49 -0600 Subject: [PATCH 097/738] remove the module declaration from the base slate package to simplify importing --- types/slate-base64-serializer/index.d.ts | 10 +- .../slate-base64-serializer-tests.ts | 4 +- types/slate-html-serializer/index.d.ts | 22 +- types/slate-plain-serializer/index.d.ts | 10 +- .../slate-plain-serializer-tests.ts | 4 +- types/slate-react/index.d.ts | 72 +- types/slate-react/slate-react-tests.tsx | 8 +- types/slate/index.d.ts | 1413 +++++++++-------- types/slate/slate-tests.ts | 4 +- 9 files changed, 774 insertions(+), 773 deletions(-) diff --git a/types/slate-base64-serializer/index.d.ts b/types/slate-base64-serializer/index.d.ts index 86f626fc86..6d356aa1c3 100644 --- a/types/slate-base64-serializer/index.d.ts +++ b/types/slate-base64-serializer/index.d.ts @@ -3,9 +3,9 @@ // Definitions by: Brandon Shelton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import { Slate } from "slate"; +import { Value, Node } from "slate"; -export function deserialize(string: string, options?: object): Slate.Value; -export function deserializeNode(string: string, options?: object): Slate.Node; -export function serialize(value: Slate.Value, options?: object): string; -export function serializeNode(node: Slate.Node, options?: object): string; +export function deserialize(string: string, options?: object): Value; +export function deserializeNode(string: string, options?: object): Node; +export function serialize(value: Value, options?: object): string; +export function serializeNode(node: Node, options?: object): string; diff --git a/types/slate-base64-serializer/slate-base64-serializer-tests.ts b/types/slate-base64-serializer/slate-base64-serializer-tests.ts index 3d1b2888b6..680bcf62bd 100644 --- a/types/slate-base64-serializer/slate-base64-serializer-tests.ts +++ b/types/slate-base64-serializer/slate-base64-serializer-tests.ts @@ -1,6 +1,6 @@ import * as Base64 from "slate-base64-serializer"; -import { Slate } from "slate"; +import { Value } from "slate"; -const val = Slate.Value.create(); +const val = Value.create(); const serialized = Base64.serialize(val); const deserialized = Base64.deserialize(serialized); diff --git a/types/slate-html-serializer/index.d.ts b/types/slate-html-serializer/index.d.ts index eb9290955a..cee3041d69 100644 --- a/types/slate-html-serializer/index.d.ts +++ b/types/slate-html-serializer/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 import * as React from 'react'; -import { Slate } from 'slate'; +import { BlockProperties, ValueJSON, Value, Node, Mark, Leaf } from 'slate'; export interface Rule { deserialize?: (el: Element, next: (elements: Element[] | NodeList | Array) => any) => any; @@ -13,28 +13,28 @@ export interface Rule { export interface HtmlOptions { rules?: Rule[]; - defaultBlock?: Slate.BlockProperties; + defaultBlock?: BlockProperties; parseHtml?: (html: string) => HTMLElement; } export default class Html { constructor(options?: HtmlOptions); - deserialize(html: string, options: { toJSON: true }): Slate.ValueJSON; - deserialize(html: string, options?: { toJSON?: false }): Slate.Value; + deserialize(html: string, options: { toJSON: true }): ValueJSON; + deserialize(html: string, options?: { toJSON?: false }): Value; - serialize(value: Slate.Value, options?: { render?: true }): string; - serialize(value: Slate.Value, options: { render: false }): Element[]; + serialize(value: Value, options?: { render?: true }): string; + serialize(value: Value, options: { render: false }): Element[]; protected rules: Rule[]; - protected defaultBlock: Slate.BlockProperties; + protected defaultBlock: BlockProperties; protected parseHtml: (html: string) => HTMLElement; - protected deserializeElements: (elements: HTMLElement[]) => Slate.Node[]; + protected deserializeElements: (elements: HTMLElement[]) => Node[]; protected deserializeElement: (element: HTMLElement) => any; - protected deserializeMark: (mark: Slate.Mark) => Slate.Node[]; + protected deserializeMark: (mark: Mark) => Node[]; - protected serializeNode: (node: Slate.Node) => string; - protected serializeLeaf: (leaf: Slate.Leaf) => string; + protected serializeNode: (node: Node) => string; + protected serializeLeaf: (leaf: Leaf) => string; protected serializeString: (string: string) => string; } diff --git a/types/slate-plain-serializer/index.d.ts b/types/slate-plain-serializer/index.d.ts index 778f523168..b781b4f9e7 100644 --- a/types/slate-plain-serializer/index.d.ts +++ b/types/slate-plain-serializer/index.d.ts @@ -3,13 +3,13 @@ // Definitions by: Brandon Shelton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import { Slate } from 'slate'; +import { BlockProperties, MarkProperties, Value } from 'slate'; export interface DeserializeOptions { toJson?: boolean; - defaultBlock?: Slate.BlockProperties; - defaultMarks?: Slate.MarkProperties[] | Set; + defaultBlock?: BlockProperties; + defaultMarks?: MarkProperties[] | Set; } -export function deserialize(string: string, options?: DeserializeOptions): Slate.Value; -export function serialize(value: Slate.Value): string; +export function deserialize(string: string, options?: DeserializeOptions): Value; +export function serialize(value: Value): string; diff --git a/types/slate-plain-serializer/slate-plain-serializer-tests.ts b/types/slate-plain-serializer/slate-plain-serializer-tests.ts index 7d7db6ff84..c7b7f97e07 100644 --- a/types/slate-plain-serializer/slate-plain-serializer-tests.ts +++ b/types/slate-plain-serializer/slate-plain-serializer-tests.ts @@ -1,6 +1,6 @@ import * as Plain from "slate-plain-serializer"; -import { Slate } from "slate"; +import { Value } from "slate"; -const val = Slate.Value.create(); +const val = Value.create(); const serialized = Plain.serialize(val); const deserialized = Plain.deserialize(serialized); diff --git a/types/slate-react/index.d.ts b/types/slate-react/index.d.ts index 492156363a..3ef179a14b 100644 --- a/types/slate-react/index.d.ts +++ b/types/slate-react/index.d.ts @@ -7,7 +7,7 @@ // Brandon Shelton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import { Slate } from 'slate'; +import { Mark, Node, Block, Change, Schema, Value, Stack } from 'slate'; import * as Immutable from 'immutable'; import * as React from 'react'; @@ -20,9 +20,9 @@ export interface RenderMarkProps { attributes: RenderAttributes; children: React.ReactNode; editor: Editor; - mark: Slate.Mark; - marks: Immutable.Set; - node: Slate.Node; + mark: Mark; + marks: Immutable.Set; + node: Node; offset: number; text: string; } @@ -33,26 +33,26 @@ export interface RenderNodeProps { editor: Editor; isSelected: boolean; key: string; - node: Slate.Block; - parent: Slate.Node; + node: Block; + parent: Node; } export interface Plugin { - onBeforeInput?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onBlur?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onFocus?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onClick?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onCopy?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onCut?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onDrop?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onKeyDown?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onKeyUp?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onPaste?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onSelect?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onChange?: (change: Slate.Change) => any; + onBeforeInput?: (event: Event, change: Change, editor: Editor) => Change | void; + onBlur?: (event: Event, change: Change, editor: Editor) => Change | void; + onFocus?: (event: Event, change: Change, editor: Editor) => Change | void; + onClick?: (event: Event, change: Change, editor: Editor) => Change | void; + onCopy?: (event: Event, change: Change, editor: Editor) => Change | void; + onCut?: (event: Event, change: Change, editor: Editor) => Change | void; + onDrop?: (event: Event, change: Change, editor: Editor) => Change | void; + onKeyDown?: (event: Event, change: Change, editor: Editor) => Change | void; + onKeyUp?: (event: Event, change: Change, editor: Editor) => Change | void; + onPaste?: (event: Event, change: Change, editor: Editor) => Change | void; + onSelect?: (event: Event, change: Change, editor: Editor) => Change | void; + onChange?: (change: Change) => any; renderEditor?: (props: RenderAttributes, editor: Editor) => object | void; - schema?: Slate.Schema; - decorateNode?: (node: Slate.Node) => Slate.Range[] | void; + schema?: Schema; + decorateNode?: (node: Node) => Range[] | void; renderMark?: (props: RenderMarkProps) => any; renderNode?: (props: RenderNodeProps) => any; renderPlaceholder?: (props: RenderAttributes) => any; @@ -61,16 +61,16 @@ export interface Plugin { } export interface BasicEditorProps { - value: Slate.Value; + value: Value; autoCorrect?: boolean; autoFocus?: boolean; className?: string; - onChange?: (change: Slate.Change) => any; + onChange?: (change: Change) => any; placeholder?: any; plugins?: Plugin[]; readOnly?: boolean; role?: string; - schema?: Slate.Schema; + schema?: Schema; spellCheck?: boolean; style?: { [key: string]: string }; tabIndex?: number; @@ -80,29 +80,29 @@ export interface BasicEditorProps { export type EditorProps = BasicEditorProps & Plugin; export interface EditorState { - schema: Slate.Schema; - value: Slate.Value; - stack: Slate.Stack; // [TODO] define stack + schema: Schema; + value: Value; + stack: Stack; // [TODO] define stack } export class Editor extends React.Component { - schema: Slate.Schema; - value: Slate.Value; - stack: Slate.Stack; + schema: Schema; + value: Value; + stack: Stack; // Instance Methods blur(): void; - change(fn: (change: Slate.Change) => any): void; + change(fn: (change: Change) => any): void; change(...args: any[]): void; focus(): void; } export type SlateType = 'fragment' | 'html' | 'node' | 'rich' | 'text' | 'files'; -export function findDOMNode(node: Slate.Node): Element; -export function findDOMRange(range: Slate.Range): Range; -export function findNode(element: Element, value: Slate.Value): Slate.Node; -export function findRange(selection: Selection, value: Slate.Value): Slate.Range; -export function getEventRange(event: Event, value: Slate.Value): Slate.Range; -export function getEventTransfer(event: Event): { type: SlateType; node: Slate.Node }; +export function findDOMNode(node: Node): Element; +export function findDOMRange(range: Range): Range; +export function findNode(element: Element, value: Value): Node; +export function findRange(selection: Selection, value: Value): Range; +export function getEventRange(event: Event, value: Value): Range; +export function getEventTransfer(event: Event): { type: SlateType; node: Node }; export function setEventTransfer(event: Event, type: SlateType, data: any): void; diff --git a/types/slate-react/slate-react-tests.tsx b/types/slate-react/slate-react-tests.tsx index f576ea580c..074f6caa9b 100644 --- a/types/slate-react/slate-react-tests.tsx +++ b/types/slate-react/slate-react-tests.tsx @@ -1,9 +1,9 @@ import { Editor, Plugin, EditorProps } from "slate-react"; -import { Slate } from "slate"; +import { Change, Value } from "slate"; import * as React from "react"; class MyPlugin implements Plugin { - onChange(change: Slate.Change): void { + onChange(change: Change): void { change.blur(); } } @@ -11,14 +11,14 @@ class MyPlugin implements Plugin { const myPlugin = new MyPlugin(); interface MyEditorState { - value: Slate.Value; + value: Value; } class MyEditor extends React.Component { constructor(props: EditorProps) { super(props); this.state = { - value: Slate.Value.create() + value: Value.create() }; } diff --git a/types/slate/index.d.ts b/types/slate/index.d.ts index b73746414d..91fc084056 100644 --- a/types/slate/index.d.ts +++ b/types/slate/index.d.ts @@ -8,714 +8,715 @@ // TypeScript Version: 2.3 import * as Immutable from 'immutable'; -export namespace Slate { - interface Data { - [key: string]: any; - } +export interface Data { + [key: string]: any; +} - interface RulesByNodeType { - [key: string]: Rules; - } +export interface RulesByNodeType { + [key: string]: Rules; +} - interface KindsAndTypes { +export interface KindsAndTypes { + kinds?: string[]; + types?: string[]; +} + +export type InvalidReason = + | 'child_kind_invalid' + | 'child_required' + | 'child_type_invalid' + | 'child_unknown' + | 'first_child_kind_invalid' + | 'first_child_type_invalid' + | 'last_child_kind_invalid' + | 'last_child_type_invalid' + | 'node_data_invalid' + | 'node_is_void_invalid' + | 'node_mark_invalid' + | 'node_text_invalid' + | 'parent_kind_invalid' + | 'parent_type_invalid'; + +export interface Rules { + data?: { + [key: string]: (v: any) => boolean; + }; + first?: KindsAndTypes; + isVoid?: boolean; + last?: KindsAndTypes; + nodes?: Array<{ kinds?: string[]; types?: string[]; - } - - type InvalidReason = - | 'child_kind_invalid' - | 'child_required' - | 'child_type_invalid' - | 'child_unknown' - | 'first_child_kind_invalid' - | 'first_child_type_invalid' - | 'last_child_kind_invalid' - | 'last_child_type_invalid' - | 'node_data_invalid' - | 'node_is_void_invalid' - | 'node_mark_invalid' - | 'node_text_invalid' - | 'parent_kind_invalid' - | 'parent_type_invalid'; - - interface Rules { - data?: { - [key: string]: (v: any) => boolean; - }; - first?: KindsAndTypes; - isVoid?: boolean; - last?: KindsAndTypes; - nodes?: Array<{ - kinds?: string[]; - types?: string[]; - min?: number; - max?: number; - }>; - normalize?: ( - change: Change, - reason: InvalidReason, - context: { [key: string]: any } - ) => void; - parent?: KindsAndTypes; - text?: RegExp; - } - - interface SchemaProperties { - document?: Rules; - blocks?: RulesByNodeType; - inlines?: RulesByNodeType; - } - - class Schema extends Immutable.Record({}) { - document: Rules; - blocks: RulesByNodeType; - inlines: RulesByNodeType; - - static create(properties: SchemaProperties | Schema): Schema; - static fromJSON(object: SchemaProperties): Schema; - static isSchema(maybeSchema: any): maybeSchema is Schema; - - toJSON(): SchemaProperties; - } - - interface ValueProperties { - document?: Document; - selection?: Range; - history?: History; - schema?: Schema; - data?: Data; - decorations?: Immutable.List | null; - } - - interface ValueJSON { - document?: DocumentJSON; - selection?: Range; - history?: History; - schema?: Schema; - data?: Data; - decorations?: Immutable.List | null; - object?: 'value'; - } - - class Value extends Immutable.Record({}) { - document: Document; - selection: Range; - history: History; - schema: Schema; - data: Data; - object: 'value'; - decorations: Immutable.List | null; - - readonly anchorText: Text; - readonly focusText: Text; - readonly startText: Text; - readonly endText: Text; - - readonly anchorBlock: Block; - readonly focusBlock: Block; - readonly startBlock: Block; - readonly endBlock: Block; - - readonly marks: Immutable.Set; - readonly activeMarks: Immutable.Set; - readonly blocks: Immutable.List; - readonly fragment: Document; - readonly inlines: Immutable.List; - readonly text: Immutable.List; - readonly characters: Immutable.List; - readonly hasUndos: boolean; - readonly hasRedos: boolean; - - readonly anchorKey: string; - readonly focusKey: string; - readonly startKey: string; - readonly endKey: string; - readonly anchorOffset: number; - readonly focusOffset: number; - readonly startOffset: number; - readonly endOffset: number; - readonly isBackward: boolean; - readonly isBlurred: boolean; - readonly isCollapsed: boolean; - readonly isExpanded: boolean; - readonly isFocused: boolean; - readonly isForward: boolean; - - static create(properties?: ValueProperties | Value): Value; - static fromJSON(properties: ValueJSON): Value; - static isValue(maybeValue: any): maybeValue is Value; - - change(): Change; - toJSON(): ValueJSON; - } - - interface DocumentProperties { - nodes?: Immutable.List | Node[]; - key?: string; - data?: Immutable.Map | { [key: string]: any }; - } - - interface DocumentJSON { - nodes?: NodeJSON[]; - key?: string; - data?: { [key: string]: any }; - object?: 'document'; - } - - class Document extends BaseNode< - DataMap - > { - object: 'document'; - nodes: Immutable.List; - - static create( - properties: DocumentProperties | Document | Immutable.List | Node[] - ): Document; - static fromJSON(properties: DocumentProperties | Document): Document; - static isDocument(maybeDocument: any): maybeDocument is Document; - - toJSON(): DocumentJSON; - } - - interface BlockProperties { - type: string; - key?: string; - nodes?: Immutable.List; - isVoid?: boolean; - data?: Immutable.Map | { [key: string]: any }; - } - - interface BlockJSON { - type: string; - key?: string; - nodes?: NodeJSON[]; - isVoid?: boolean; - data?: { [key: string]: any }; - object: 'block'; - } - - class Block extends BaseNode { - isVoid: boolean; - object: 'block'; - nodes: Immutable.List; - - static create(properties: BlockProperties | Block | string): Block; - static createList( - array: (BlockProperties[] | Block[] | string[]) - ): Immutable.List; - static fromJSON(properties: BlockProperties | Block): Block; - static isBlock(maybeBlock: any): maybeBlock is Block; - - toJSON(): BlockJSON; - } - - interface InlineProperties { - type: string; - key?: string; - nodes?: Immutable.List; - isVoid?: boolean; - data?: Immutable.Map | { [key: string]: any }; - } - - interface InlineJSON { - type: string; - key?: string; - nodes?: NodeJSON[]; - isVoid?: boolean; - data?: { [key: string]: any }; - object: 'inline'; - } - - class Inline extends BaseNode { - isVoid: boolean; - object: 'inline'; - nodes: Immutable.List; - - static create(properties: InlineProperties | Inline | string): Inline; - static createList( - array: (InlineProperties[] | Inline[] | string[]) - ): Immutable.List; - static fromJSON(properties: InlineProperties | Inline): Inline; - static isInline(maybeInline: any): maybeInline is Inline; - - toJSON(): InlineJSON; - } - - interface Leaf { - marks?: Mark[]; - text: string; - } - - interface TextProperties { - key?: string; - characters: Immutable.List; - } - - interface TextJSON { - key?: string; - characters?: Character[]; - leaves: Leaf[]; - object: 'text'; - } - - class Text extends Immutable.Record({}) { - object: 'text'; - characters: Immutable.List; - key: string; - text: string; - - static create(properties: TextProperties | Text | string): Text; - static fromJSON(properties: TextProperties | Text): Text; - static isText(maybeText: any): maybeText is Text; - - toJSON(): TextJSON; - } - - type Node = Document | Block | Inline | Text; - type NodeJSON = DocumentJSON | BlockJSON | InlineJSON | TextJSON; - - class BaseNode extends Immutable.Record( - {} - ) { - data: Immutable.Map; - type: string; - key: string; - object: 'document' | 'block' | 'inline' | 'text'; - nodes: Immutable.List; - readonly text: string; - - filterDescendants(iterator: (node: Node) => boolean): Immutable.List; - findDescendants(iterator: (node: Node) => boolean): Node | null; - getBlocksAtRange(range: Range): Immutable.List; - getBlocks(): Immutable.List; - getCharactersAtRange(range: Range): Immutable.List; - getChild(key: string | Node): Node | null; - getClosestBlock(key: string | Node): Block | null; - getClosestInline(key: string | Node): Inline | null; - getClosest(key: string | Node, match: (node: Node) => boolean): Node | null; - getDepth(key: string | Node): number; - getDescendant(key: string | Node): Node | null; - getFirstText(): Text | null; - getFragmentAtRange(range: Range): Document; - getFurthest(key: string, iterator: (node: Node) => boolean): Node | null; - getFurthestAncestor(key: string): Node | null; - getFurthestBlock(key: string): Block | null; - getFurthestInline(key: string): Inline | null; - getFurthestOnlyChildAncestor(key: string): Node | null; - getInlinesAtRange(range: Range): Immutable.List; - getLastText(): Text | null; - getMarksAtRange(range: Range): Immutable.Set; - getNextBlock(key: string | Node): Block | null; - getNextSibling(key: string | Node): Node | null; - getNextText(key: string | Node): Text | null; - getParent(key: string | Node): Node | null; - getPreviousBlock(key: string | Node): Block | null; - getPreviousSibling(key: string | Node): Node | null; - getPreviousText(key: string | Node): Text | null; - getTexts(): Immutable.List; - getTextsAsArray(): Text[]; - getTextAtOffset(offset: number): Text | null; - getTextsAtRange(range: Range): Immutable.List; - getTextsAtRangeAsArray(range: Range): Text[]; - hasChild(key: string | Node): boolean; - } - - interface CharacterProperties { - marks?: Immutable.Set | Mark[]; - text: string; - } - - class Character extends Immutable.Record({}) { - object: 'character'; - marks: Immutable.Set; - text: string; - - static create( - properties: CharacterProperties | Character | string - ): Character; - static createList( - array: (CharacterProperties[] | Character[] | string[]) - ): Immutable.List; - static fromJSON(properties: CharacterProperties | Character): Character; - static isCharacter(maybeCharacter: any): maybeCharacter is Character; - - toJSON(): CharacterProperties; - } - - interface MarkProperties { - type: string; - data?: Immutable.Map | { [key: string]: any }; - } - - interface MarkJSON { - type: string; - data?: { [key: string]: any }; - } - - class Mark extends Immutable.Record({}) { - object: 'mark'; - type: string; - data: Immutable.Map; - - static create(properties: MarkProperties | Mark | string): Mark; - static createSet( - array: (MarkProperties[] | Mark[] | string[]) - ): Immutable.Set; - static fromJSON(properties: MarkJSON | Mark): Mark; - static isMark(maybeMark: any): maybeMark is Mark; - - toJSON(): MarkProperties; - } - - class Change extends Immutable.Record({}) { - object: 'change'; - value: Value; - operations: Immutable.List; - - call(customChange: (change: Change, ...args: any[]) => Change): Change; - - applyOperations(operations: Operation[]): Change; - applyOperation(operation: Operation): Change; - - // Full Value Change - setValue(properties: Value | ValueProperties): Change; - - // Current Value Changes - deleteBackward(n: number): Change; - deleteForward(n: number): Change; - delete(): Change; - insertBlock(block: Block | BlockProperties | string): Change; - insertFragment(fragment: Document): Change; - insertInline(inline: Inline | InlineProperties): Change; - insertText(text: string): Change; - addMark(mark: Mark | MarkProperties | string): Change; - setBlocks(properties: BlockProperties | string): Change; - setInlines(properties: InlineProperties | string): Change; - splitBlock(depth: number): Change; - splitInline(depth: number): Change; - removeMark(mark: Mark | MarkProperties | string): Change; - toggleMark(mark: Mark | MarkProperties | string): Change; - unwrapBlock(properties: BlockProperties | string): Change; - unwrapInline(properties: InlineProperties | string): Change; - wrapBlock(properties: BlockProperties | string): Change; - wrapInline(properties: InlineProperties | string): Change; - wrapText(prefix: string, suffix?: string): Change; - - // Selection Changes - blur(): Change; - collapseToAnchor(): Change; - collapseToFocus(): Change; - collapseToStart(): Change; - collapseToEnd(): Change; - collapseToStartOf(node: Node): Change; - collapseToEndOf(node: Node): Change; - collapseToStartOfNextBlock(): Change; - collapseToEndOfNextBlock(): Change; - collapseToStartOfPreviousBlock(): Change; - collapseToEndOfPreviousBlock(): Change; - collapseToStartOfNextText(): Change; - collapseToEndOfNextText(): Change; - collapseToStartOfPreviousText(): Change; - collapseToEndOfPreviousText(): Change; - extend(n: number): Change; - extendToStartOf(node: Node): Change; - extendToEndOf(node: Node): Change; - flip(): Change; - focus(): Change; - move(n: number): Change; - moveStart(n: number): Change; - moveEnd(n: number): Change; - moveOffsetsTo(anchorOffset: number, focusOffset: number): Change; - moveToRangeOf(node: Node): Change; - select(properties: Range | RangeProperties): Change; - selectAll(): Change; - deselect(): Change; - - // Document Changes - deleteBackwardAtRange(range: Range, n: number): Change; - deleteForwardAtRange(range: Range, n: number): Change; - deleteAtRange(range: Range): Change; - insertBlockAtRange( - range: Range, - block: Block | BlockProperties | string - ): Change; - insertFragmentAtRange(range: Range, fragment: Document): Change; - insertInlineAtRange( - range: Range, - inline: Inline | InlineProperties - ): Change; - insertTextAtRange(range: Range, text: string): Change; - addMarkAtRange(range: Range, mark: Mark | MarkProperties | string): Change; - setBlocksAtRange(range: Range, properties: BlockProperties | string): Change; - setInlinesAtRange( - range: Range, - properties: InlineProperties | string - ): Change; - splitBlockAtRange(range: Range, depth: number): Change; - splitInlineAtRange(range: Range, depth: number): Change; - removeMarkAtRange( - range: Range, - mark: Mark | MarkProperties | string - ): Change; - toggleMarkAtRange( - range: Range, - mark: Mark | MarkProperties | string - ): Change; - unwrapBlockAtRange( - range: Range, - properties: BlockProperties | string - ): Change; - unwrapInlineAtRange( - range: Range, - properties: InlineProperties | string - ): Change; - wrapBlockAtRange( - range: Range, - properties: BlockProperties | string - ): Change; - wrapInlineAtRange( - range: Range, - properties: InlineProperties | string - ): Change; - wrapTextAtRange(range: Range, prefix: string, suffix?: string): Change; - - // Node Changes - addMarkByKey( - key: string, - offset: number, - length: number, - mark: Mark - ): Change; - insertNodeByKey(key: string, index: number, node: Node): Change; - insertFragmentByKey(key: string, index: number, fragment: Document): Change; - insertTextByKey( - key: string, - offset: number, - text: string, - marks?: Immutable.Set | Mark[] - ): Change; - moveNodeByKey(key: string, newKey: string, newIndex: number): Change; - removeMarkByKey( - key: string, - offset: number, - length: number, - mark: Mark - ): Change; - removeNodeByKey(key: string): Change; - replaceNodeByKey(key: string, node: Node): Change; - removeTextByKey(key: string, offset: number, length: number): Change; - setMarkByKey( - key: string, - offset: number, - length: number, - mark: Mark, - properties: MarkProperties - ): Change; - setNodeByKey( - key: string, - properties: BlockProperties | InlineProperties | string - ): Change; - splitNodeByKey(key: string, offset: number): Change; - unwrapInlineByKey( - key: string, - properties: InlineProperties | string - ): Change; - unwrapBlockByKey(key: string, properties: BlockProperties | string): Change; - unwrapNodeByKey(key: string): Change; - wrapInlineByKey(key: string, properties: InlineProperties | string): Change; - wrapBlockByKey(key: string, properties: BlockProperties | string): Change; - - // History Changes - redo(): Change; - undo(): Change; - } - - interface RangeProperties { - anchorKey?: string | null; - anchorOffset?: number; - focusKey?: string | null; - focusOffset?: number; - isFocused?: boolean; - isBackward?: boolean | null; - marks?: Immutable.Set | null; - } - - interface RangeJSON { - anchorKey?: string | null; - anchorOffset?: number; - focusKey?: string | null; - focusOffset?: number; - isFocused?: boolean; - isBackward?: boolean | null; - marks?: MarkJSON[] | null; - } - - class Range extends Immutable.Record({}) { - object: 'range'; - anchorKey: string | null; - anchorOffset: number; - focusKey: string | null; - focusOffset: number; - isFocused: boolean; - isBackward: boolean | null; - marks: Immutable.Set | null; - - readonly isBlurred: boolean; - readonly isCollapsed: boolean; - readonly isExpanded: boolean; - readonly isForward: boolean; - readonly startKey: string; - readonly startOffset: number; - readonly endKey: string; - readonly endOffset: number; - - static create(properties: RangeProperties | Range): Range; - static fromJSON(properties: RangeJSON): Range; - static isRange(maybeRange: any): maybeRange is Range; - - toJSON(): RangeProperties; - - hasAnchorAtStartOf(node: Node): boolean; - hasFocusAtStartOf(node: Node): boolean; - hasStartAtStartOf(node: Node): boolean; - hasEndAtStartOf(node: Node): boolean; - hasEdgeAtStartOf(node: Node): boolean; - - hasAnchorAtEndOf(node: Node): boolean; - hasFocusAtEndOf(node: Node): boolean; - hasStartAtEndOf(node: Node): boolean; - hasEndAtEndOf(node: Node): boolean; - hasEdgeAtEndOf(node: Node): boolean; - - hasAnchorBetween(node: Node, start: number, end: number): boolean; - hasFocusBetween(node: Node, start: number, end: number): boolean; - hasStartBetween(node: Node, start: number, end: number): boolean; - hasEndBetween(node: Node, start: number, end: number): boolean; - hasEdgeBetween(node: Node, start: number, end: number): boolean; - - hasAnchorIn(node: Node): boolean; - hasFocusIn(node: Node): boolean; - hasStartIn(node: Node): boolean; - hasEndIn(node: Node): boolean; - hasEdgeIn(node: Node): boolean; - - isAtStartOf(node: Node): boolean; - isAtEndOf(node: Node): boolean; - } - - type Operation = - | InsertTextOperation - | RemoveTextOperation - | AddMarkOperation - | RemoveMarkOperation - | SetMarkOperation - | InsertNodeOperation - | MergeNodeOperation - | MoveNodeOperation - | RemoveNodeOperation - | SetNodeOperation - | SplitNodeOperation - | SetSelectionOperation - | SetValueOperation; - - interface InsertTextOperation { - type: 'insert_text'; - path: number[]; - offset: number; - text: string; - marks: Mark[]; - } - - interface RemoveTextOperation { - type: 'remove_text'; - path: number[]; - offset: number; - text: string; - } - - interface AddMarkOperation { - type: 'add_mark'; - path: number[]; - offset: number; - length: number; - mark: Mark; - } - - interface RemoveMarkOperation { - type: 'remove_mark'; - path: number[]; - offset: number; - length: number; - mark: Mark; - } - - interface SetMarkOperation { - type: 'set_mark'; - path: number[]; - offset: number; - length: number; - mark: Mark; - properties: MarkProperties; - } - - interface InsertNodeOperation { - type: 'insert_node'; - path: number[]; - node: Node; - } - - interface MergeNodeOperation { - type: 'merge_node'; - path: number[]; - position: number; - } - - interface MoveNodeOperation { - type: 'move_node'; - path: number[]; - newPath: number[]; - } - - interface RemoveNodeOperation { - type: 'remove_node'; - path: number[]; - node: Node; - } - - interface SetNodeOperation { - type: 'set_node'; - path: number[]; - properties: BlockProperties | InlineProperties | TextProperties; - } - - interface SplitNodeOperation { - type: 'split_node'; - path: number[]; - position: number; - target: number; - } - - interface SetSelectionOperation { - type: 'set_selection'; - properties: RangeProperties; - selection: Range; - } - - interface SetValueOperation { - type: 'set_value'; - properties: ValueProperties; - value: Value; - } - - const Operations: { - apply: (value: Value, operation: Operation) => Value; - invert: (operation: Operation) => Operation; - }; - - class Stack extends Immutable.Record({}) { - plugins: any[]; - } - - function setKeyGenerator(func: () => string): null; - function resetKeyGenerator(): null; + min?: number; + max?: number; + }>; + normalize?: ( + change: Change, + reason: InvalidReason, + context: { [key: string]: any } + ) => void; + parent?: KindsAndTypes; + text?: RegExp; } + +export interface SchemaProperties { + document?: Rules; + blocks?: RulesByNodeType; + inlines?: RulesByNodeType; +} + +export class Schema extends Immutable.Record({}) { + document: Rules; + blocks: RulesByNodeType; + inlines: RulesByNodeType; + + static create(properties: SchemaProperties | Schema): Schema; + static fromJSON(object: SchemaProperties): Schema; + static isSchema(maybeSchema: any): maybeSchema is Schema; + + toJSON(): SchemaProperties; +} + +export interface ValueProperties { + document?: Document; + selection?: Range; + history?: History; + schema?: Schema; + data?: Data; + decorations?: Immutable.List | null; +} + +export interface ValueJSON { + document?: DocumentJSON; + selection?: Range; + history?: History; + schema?: Schema; + data?: Data; + decorations?: Immutable.List | null; + object?: 'value'; +} + +export class Value extends Immutable.Record({}) { + document: Document; + selection: Range; + history: History; + schema: Schema; + data: Data; + object: 'value'; + decorations: Immutable.List | null; + + readonly anchorText: Text; + readonly focusText: Text; + readonly startText: Text; + readonly endText: Text; + + readonly anchorBlock: Block; + readonly focusBlock: Block; + readonly startBlock: Block; + readonly endBlock: Block; + + readonly marks: Immutable.Set; + readonly activeMarks: Immutable.Set; + readonly blocks: Immutable.List; + readonly fragment: Document; + readonly inlines: Immutable.List; + readonly text: Immutable.List; + readonly characters: Immutable.List; + readonly hasUndos: boolean; + readonly hasRedos: boolean; + + readonly anchorKey: string; + readonly focusKey: string; + readonly startKey: string; + readonly endKey: string; + readonly anchorOffset: number; + readonly focusOffset: number; + readonly startOffset: number; + readonly endOffset: number; + readonly isBackward: boolean; + readonly isBlurred: boolean; + readonly isCollapsed: boolean; + readonly isExpanded: boolean; + readonly isFocused: boolean; + readonly isForward: boolean; + + static create(properties?: ValueProperties | Value): Value; + static fromJSON(properties: ValueJSON): Value; + static isValue(maybeValue: any): maybeValue is Value; + + change(): Change; + toJSON(): ValueJSON; +} + +export interface DocumentProperties { + nodes?: Immutable.List | Node[]; + key?: string; + data?: Immutable.Map | { [key: string]: any }; +} + +export interface DocumentJSON { + nodes?: NodeJSON[]; + key?: string; + data?: { [key: string]: any }; + object?: 'document'; +} + +export class Document extends BaseNode< + DataMap +> { + object: 'document'; + nodes: Immutable.List; + + static create( + properties: DocumentProperties | Document | Immutable.List | Node[] + ): Document; + static fromJSON(properties: DocumentProperties | Document): Document; + static isDocument(maybeDocument: any): maybeDocument is Document; + + toJSON(): DocumentJSON; +} + +export interface BlockProperties { + type: string; + key?: string; + nodes?: Immutable.List; + isVoid?: boolean; + data?: Immutable.Map | { [key: string]: any }; +} + +export interface BlockJSON { + type: string; + key?: string; + nodes?: NodeJSON[]; + isVoid?: boolean; + data?: { [key: string]: any }; + object: 'block'; +} + +export class Block extends BaseNode { + isVoid: boolean; + object: 'block'; + nodes: Immutable.List; + + static create(properties: BlockProperties | Block | string): Block; + static createList( + array: (BlockProperties[] | Block[] | string[]) + ): Immutable.List; + static fromJSON(properties: BlockProperties | Block): Block; + static isBlock(maybeBlock: any): maybeBlock is Block; + + toJSON(): BlockJSON; +} + +export interface InlineProperties { + type: string; + key?: string; + nodes?: Immutable.List; + isVoid?: boolean; + data?: Immutable.Map | { [key: string]: any }; +} + +export interface InlineJSON { + type: string; + key?: string; + nodes?: NodeJSON[]; + isVoid?: boolean; + data?: { [key: string]: any }; + object: 'inline'; +} + +export class Inline extends BaseNode { + isVoid: boolean; + object: 'inline'; + nodes: Immutable.List; + + static create(properties: InlineProperties | Inline | string): Inline; + static createList( + array: (InlineProperties[] | Inline[] | string[]) + ): Immutable.List; + static fromJSON(properties: InlineProperties | Inline): Inline; + static isInline(maybeInline: any): maybeInline is Inline; + + toJSON(): InlineJSON; +} + +export interface Leaf { + marks?: Mark[]; + text: string; +} + +export interface TextProperties { + key?: string; + characters: Immutable.List; +} + +export interface TextJSON { + key?: string; + characters?: Character[]; + leaves: Leaf[]; + object: 'text'; +} + +export class Text extends Immutable.Record({}) { + object: 'text'; + characters: Immutable.List; + key: string; + text: string; + + static create(properties: TextProperties | Text | string): Text; + static fromJSON(properties: TextProperties | Text): Text; + static isText(maybeText: any): maybeText is Text; + + toJSON(): TextJSON; +} + +export type Node = Document | Block | Inline | Text; +export type NodeJSON = DocumentJSON | BlockJSON | InlineJSON | TextJSON; + +// tslint:disable-next-line strict-export-declare-modifiers +declare class BaseNode extends Immutable.Record( + {} +) { + data: Immutable.Map; + type: string; + key: string; + object: 'document' | 'block' | 'inline' | 'text'; + nodes: Immutable.List; + readonly text: string; + + filterDescendants(iterator: (node: Node) => boolean): Immutable.List; + findDescendants(iterator: (node: Node) => boolean): Node | null; + getBlocksAtRange(range: Range): Immutable.List; + getBlocks(): Immutable.List; + getCharactersAtRange(range: Range): Immutable.List; + getChild(key: string | Node): Node | null; + getClosestBlock(key: string | Node): Block | null; + getClosestInline(key: string | Node): Inline | null; + getClosest(key: string | Node, match: (node: Node) => boolean): Node | null; + getDepth(key: string | Node): number; + getDescendant(key: string | Node): Node | null; + getFirstText(): Text | null; + getFragmentAtRange(range: Range): Document; + getFurthest(key: string, iterator: (node: Node) => boolean): Node | null; + getFurthestAncestor(key: string): Node | null; + getFurthestBlock(key: string): Block | null; + getFurthestInline(key: string): Inline | null; + getFurthestOnlyChildAncestor(key: string): Node | null; + getInlinesAtRange(range: Range): Immutable.List; + getLastText(): Text | null; + getMarksAtRange(range: Range): Immutable.Set; + getNextBlock(key: string | Node): Block | null; + getNextSibling(key: string | Node): Node | null; + getNextText(key: string | Node): Text | null; + getParent(key: string | Node): Node | null; + getPreviousBlock(key: string | Node): Block | null; + getPreviousSibling(key: string | Node): Node | null; + getPreviousText(key: string | Node): Text | null; + getTexts(): Immutable.List; + getTextsAsArray(): Text[]; + getTextAtOffset(offset: number): Text | null; + getTextsAtRange(range: Range): Immutable.List; + getTextsAtRangeAsArray(range: Range): Text[]; + hasChild(key: string | Node): boolean; +} + +export interface CharacterProperties { + marks?: Immutable.Set | Mark[]; + text: string; +} + +export class Character extends Immutable.Record({}) { + object: 'character'; + marks: Immutable.Set; + text: string; + + static create( + properties: CharacterProperties | Character | string + ): Character; + static createList( + array: (CharacterProperties[] | Character[] | string[]) + ): Immutable.List; + static fromJSON(properties: CharacterProperties | Character): Character; + static isCharacter(maybeCharacter: any): maybeCharacter is Character; + + toJSON(): CharacterProperties; +} + +export interface MarkProperties { + type: string; + data?: Immutable.Map | { [key: string]: any }; +} + +export interface MarkJSON { + type: string; + data?: { [key: string]: any }; +} + +export class Mark extends Immutable.Record({}) { + object: 'mark'; + type: string; + data: Immutable.Map; + + static create(properties: MarkProperties | Mark | string): Mark; + static createSet( + array: (MarkProperties[] | Mark[] | string[]) + ): Immutable.Set; + static fromJSON(properties: MarkJSON | Mark): Mark; + static isMark(maybeMark: any): maybeMark is Mark; + + toJSON(): MarkProperties; +} + +export class Change extends Immutable.Record({}) { + object: 'change'; + value: Value; + operations: Immutable.List; + + call(customChange: (change: Change, ...args: any[]) => Change): Change; + + applyOperations(operations: Operation[]): Change; + applyOperation(operation: Operation): Change; + + // Full Value Change + setValue(properties: Value | ValueProperties): Change; + + // Current Value Changes + deleteBackward(n: number): Change; + deleteForward(n: number): Change; + delete(): Change; + insertBlock(block: Block | BlockProperties | string): Change; + insertFragment(fragment: Document): Change; + insertInline(inline: Inline | InlineProperties): Change; + insertText(text: string): Change; + addMark(mark: Mark | MarkProperties | string): Change; + setBlocks(properties: BlockProperties | string): Change; + setInlines(properties: InlineProperties | string): Change; + splitBlock(depth: number): Change; + splitInline(depth: number): Change; + removeMark(mark: Mark | MarkProperties | string): Change; + toggleMark(mark: Mark | MarkProperties | string): Change; + unwrapBlock(properties: BlockProperties | string): Change; + unwrapInline(properties: InlineProperties | string): Change; + wrapBlock(properties: BlockProperties | string): Change; + wrapInline(properties: InlineProperties | string): Change; + wrapText(prefix: string, suffix?: string): Change; + + // Selection Changes + blur(): Change; + collapseToAnchor(): Change; + collapseToFocus(): Change; + collapseToStart(): Change; + collapseToEnd(): Change; + collapseToStartOf(node: Node): Change; + collapseToEndOf(node: Node): Change; + collapseToStartOfNextBlock(): Change; + collapseToEndOfNextBlock(): Change; + collapseToStartOfPreviousBlock(): Change; + collapseToEndOfPreviousBlock(): Change; + collapseToStartOfNextText(): Change; + collapseToEndOfNextText(): Change; + collapseToStartOfPreviousText(): Change; + collapseToEndOfPreviousText(): Change; + extend(n: number): Change; + extendToStartOf(node: Node): Change; + extendToEndOf(node: Node): Change; + flip(): Change; + focus(): Change; + move(n: number): Change; + moveStart(n: number): Change; + moveEnd(n: number): Change; + moveOffsetsTo(anchorOffset: number, focusOffset: number): Change; + moveToRangeOf(node: Node): Change; + select(properties: Range | RangeProperties): Change; + selectAll(): Change; + deselect(): Change; + + // Document Changes + deleteBackwardAtRange(range: Range, n: number): Change; + deleteForwardAtRange(range: Range, n: number): Change; + deleteAtRange(range: Range): Change; + insertBlockAtRange( + range: Range, + block: Block | BlockProperties | string + ): Change; + insertFragmentAtRange(range: Range, fragment: Document): Change; + insertInlineAtRange( + range: Range, + inline: Inline | InlineProperties + ): Change; + insertTextAtRange(range: Range, text: string): Change; + addMarkAtRange(range: Range, mark: Mark | MarkProperties | string): Change; + setBlocksAtRange(range: Range, properties: BlockProperties | string): Change; + setInlinesAtRange( + range: Range, + properties: InlineProperties | string + ): Change; + splitBlockAtRange(range: Range, depth: number): Change; + splitInlineAtRange(range: Range, depth: number): Change; + removeMarkAtRange( + range: Range, + mark: Mark | MarkProperties | string + ): Change; + toggleMarkAtRange( + range: Range, + mark: Mark | MarkProperties | string + ): Change; + unwrapBlockAtRange( + range: Range, + properties: BlockProperties | string + ): Change; + unwrapInlineAtRange( + range: Range, + properties: InlineProperties | string + ): Change; + wrapBlockAtRange( + range: Range, + properties: BlockProperties | string + ): Change; + wrapInlineAtRange( + range: Range, + properties: InlineProperties | string + ): Change; + wrapTextAtRange(range: Range, prefix: string, suffix?: string): Change; + + // Node Changes + addMarkByKey( + key: string, + offset: number, + length: number, + mark: Mark + ): Change; + insertNodeByKey(key: string, index: number, node: Node): Change; + insertFragmentByKey(key: string, index: number, fragment: Document): Change; + insertTextByKey( + key: string, + offset: number, + text: string, + marks?: Immutable.Set | Mark[] + ): Change; + moveNodeByKey(key: string, newKey: string, newIndex: number): Change; + removeMarkByKey( + key: string, + offset: number, + length: number, + mark: Mark + ): Change; + removeNodeByKey(key: string): Change; + replaceNodeByKey(key: string, node: Node): Change; + removeTextByKey(key: string, offset: number, length: number): Change; + setMarkByKey( + key: string, + offset: number, + length: number, + mark: Mark, + properties: MarkProperties + ): Change; + setNodeByKey( + key: string, + properties: BlockProperties | InlineProperties | string + ): Change; + splitNodeByKey(key: string, offset: number): Change; + unwrapInlineByKey( + key: string, + properties: InlineProperties | string + ): Change; + unwrapBlockByKey(key: string, properties: BlockProperties | string): Change; + unwrapNodeByKey(key: string): Change; + wrapInlineByKey(key: string, properties: InlineProperties | string): Change; + wrapBlockByKey(key: string, properties: BlockProperties | string): Change; + + // History Changes + redo(): Change; + undo(): Change; +} + +export interface RangeProperties { + anchorKey?: string | null; + anchorOffset?: number; + focusKey?: string | null; + focusOffset?: number; + isFocused?: boolean; + isBackward?: boolean | null; + marks?: Immutable.Set | null; +} + +export interface RangeJSON { + anchorKey?: string | null; + anchorOffset?: number; + focusKey?: string | null; + focusOffset?: number; + isFocused?: boolean; + isBackward?: boolean | null; + marks?: MarkJSON[] | null; +} + +export class Range extends Immutable.Record({}) { + object: 'range'; + anchorKey: string | null; + anchorOffset: number; + focusKey: string | null; + focusOffset: number; + isFocused: boolean; + isBackward: boolean | null; + marks: Immutable.Set | null; + + readonly isBlurred: boolean; + readonly isCollapsed: boolean; + readonly isExpanded: boolean; + readonly isForward: boolean; + readonly startKey: string; + readonly startOffset: number; + readonly endKey: string; + readonly endOffset: number; + + static create(properties: RangeProperties | Range): Range; + static fromJSON(properties: RangeJSON): Range; + static isRange(maybeRange: any): maybeRange is Range; + + toJSON(): RangeProperties; + + hasAnchorAtStartOf(node: Node): boolean; + hasFocusAtStartOf(node: Node): boolean; + hasStartAtStartOf(node: Node): boolean; + hasEndAtStartOf(node: Node): boolean; + hasEdgeAtStartOf(node: Node): boolean; + + hasAnchorAtEndOf(node: Node): boolean; + hasFocusAtEndOf(node: Node): boolean; + hasStartAtEndOf(node: Node): boolean; + hasEndAtEndOf(node: Node): boolean; + hasEdgeAtEndOf(node: Node): boolean; + + hasAnchorBetween(node: Node, start: number, end: number): boolean; + hasFocusBetween(node: Node, start: number, end: number): boolean; + hasStartBetween(node: Node, start: number, end: number): boolean; + hasEndBetween(node: Node, start: number, end: number): boolean; + hasEdgeBetween(node: Node, start: number, end: number): boolean; + + hasAnchorIn(node: Node): boolean; + hasFocusIn(node: Node): boolean; + hasStartIn(node: Node): boolean; + hasEndIn(node: Node): boolean; + hasEdgeIn(node: Node): boolean; + + isAtStartOf(node: Node): boolean; + isAtEndOf(node: Node): boolean; +} + +export type Operation = + | InsertTextOperation + | RemoveTextOperation + | AddMarkOperation + | RemoveMarkOperation + | SetMarkOperation + | InsertNodeOperation + | MergeNodeOperation + | MoveNodeOperation + | RemoveNodeOperation + | SetNodeOperation + | SplitNodeOperation + | SetSelectionOperation + | SetValueOperation; + +export interface InsertTextOperation { + type: 'insert_text'; + path: number[]; + offset: number; + text: string; + marks: Mark[]; +} + +export interface RemoveTextOperation { + type: 'remove_text'; + path: number[]; + offset: number; + text: string; +} + +export interface AddMarkOperation { + type: 'add_mark'; + path: number[]; + offset: number; + length: number; + mark: Mark; +} + +export interface RemoveMarkOperation { + type: 'remove_mark'; + path: number[]; + offset: number; + length: number; + mark: Mark; +} + +export interface SetMarkOperation { + type: 'set_mark'; + path: number[]; + offset: number; + length: number; + mark: Mark; + properties: MarkProperties; +} + +export interface InsertNodeOperation { + type: 'insert_node'; + path: number[]; + node: Node; +} + +export interface MergeNodeOperation { + type: 'merge_node'; + path: number[]; + position: number; +} + +export interface MoveNodeOperation { + type: 'move_node'; + path: number[]; + newPath: number[]; +} + +export interface RemoveNodeOperation { + type: 'remove_node'; + path: number[]; + node: Node; +} + +export interface SetNodeOperation { + type: 'set_node'; + path: number[]; + properties: BlockProperties | InlineProperties | TextProperties; +} + +export interface SplitNodeOperation { + type: 'split_node'; + path: number[]; + position: number; + target: number; +} + +export interface SetSelectionOperation { + type: 'set_selection'; + properties: RangeProperties; + selection: Range; +} + +export interface SetValueOperation { + type: 'set_value'; + properties: ValueProperties; + value: Value; +} + +export const Operations: { + apply: (value: Value, operation: Operation) => Value; + invert: (operation: Operation) => Operation; +}; + +export class Stack extends Immutable.Record({}) { + plugins: any[]; +} + +export function setKeyGenerator(func: () => string): null; +export function resetKeyGenerator(): null; + +export {}; diff --git a/types/slate/slate-tests.ts b/types/slate/slate-tests.ts index 45aca77e7e..2c07a4571b 100644 --- a/types/slate/slate-tests.ts +++ b/types/slate/slate-tests.ts @@ -1,6 +1,6 @@ -import { Slate } from "slate"; +import { Value } from "slate"; -const value = Slate.Value.create(); +const value = Value.create(); value.change() .focus() .selectAll() From f1be7646d597816dea3fd790e36c27f0fc194888 Mon Sep 17 00:00:00 2001 From: Marat Abdullin Date: Tue, 17 Jul 2018 13:44:39 +0200 Subject: [PATCH 098/738] Fixing the typo in a property name. --- 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 28bb0a4058..a2eb459933 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1839,7 +1839,7 @@ export interface AccessibilityPropsIOS { * When `accessible` is true, the system will try to invoke this function when the user performs accessibility tap gesture. * @platform ios */ - onAcccessibilityTap?: () => void; + onAccessibilityTap?: () => void; /** * When accessible is true, the system will invoke this function when the user performs the magic tap gesture. From b6e31ebe69633813327c1a809f04621d10204130 Mon Sep 17 00:00:00 2001 From: Marat Abdullin Date: Tue, 17 Jul 2018 13:53:59 +0200 Subject: [PATCH 099/738] Adding the test. --- types/react-native/test/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index aa22d21fd7..a339bb0e84 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -695,6 +695,7 @@ class AccessibilityTest extends React.Component { accessibilityElementsHidden={true} importantForAccessibility={"no-hide-descendants"} accessibilityTraits={'none'} + onAccessibilityTap={() => {}} > Text From a9768493082c8d7610dc3f3f252418a22f86fb81 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 19 Jul 2018 07:18:17 +0200 Subject: [PATCH 100/738] uglify-js: turn on strictNullChecks (#27408) --- types/uglify-js/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/uglify-js/tsconfig.json b/types/uglify-js/tsconfig.json index 07451065ee..13c6a8a7ff 100644 --- a/types/uglify-js/tsconfig.json +++ b/types/uglify-js/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ From 758b028f89457eaef90cf619f5ae43f25cb44cc2 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 19 Jul 2018 07:56:34 -0700 Subject: [PATCH 101/738] heatmap.js: Make compatible with ts3.0 (#27393) --- types/heatmap.js/heatmap.js-tests.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/types/heatmap.js/heatmap.js-tests.ts b/types/heatmap.js/heatmap.js-tests.ts index af0c021b3f..ca1d3ff604 100644 --- a/types/heatmap.js/heatmap.js-tests.ts +++ b/types/heatmap.js/heatmap.js-tests.ts @@ -18,10 +18,7 @@ declare const container: HTMLElement; { // $ExpectError - const config: h337.HeatmapConfiguration = { - container, - valueField: 'foo', - }; + const config: h337.HeatmapConfiguration = { container, valueField: 'foo' }; } { From f6fbbec6a8e7dd6aff8a081af3d2524ba60e99dc Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 19 Jul 2018 07:56:50 -0700 Subject: [PATCH 102/738] topojson-specification: Make compatible with ts3.0 (#27379) --- .../topojson-specification-tests.ts | 39 +++---------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/types/topojson-specification/topojson-specification-tests.ts b/types/topojson-specification/topojson-specification-tests.ts index c86ed57b3f..666b1d95b7 100644 --- a/types/topojson-specification/topojson-specification-tests.ts +++ b/types/topojson-specification/topojson-specification-tests.ts @@ -154,41 +154,14 @@ topology = { // Fails +// must fail on "type" // $ExpectError -topology = { - type: "Topology", - objects: { - foo: { - type: "hello", // must fail - arcs: [[0]], - }, - }, - arcs: [], -}; +topology = { type: "Topology", objects: { foo: { type: "hello", arcs: [[0]] } }, arcs: [] }; +// must fail: Property 'coordinates' is missing in type '{ type: "Point"; }'. // $ExpectError -topology = { - type: "Topology", - objects: { - foo: { - type: "Point", - // must fail: Property 'coordinates' is missing in type '{ type: "Point"; }'. - }, - }, - arcs: [], -}; +topology = { type: "Topology", objects: { foo: { type: "Point" } }, arcs: [] }; +// must fail: Property 'arcs' is missing in type '{ type: "Polygon"; }' // $ExpectError -topology = { - type: "Topology", - objects: { - foo: { - type: "GeometryCollection", - geometries: [ - {type: "Polygon"} - // must fail: Property 'arcs' is missing in type '{ type: "Polygon"; }' - ], - }, - }, - arcs: [], -}; +topology = { type: "Topology", objects: { foo: { type: "GeometryCollection", geometries: [{type: "Polygon"}] } }, arcs: [] }; From a5ab4665a849d139572aeb89a30f739c12b3bdcf Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 19 Jul 2018 15:51:48 -0700 Subject: [PATCH 103/738] reactstrap: Set TS version to 2.9 (#27372) --- types/reactstrap/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 45f885b172..a682ec6588 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -8,7 +8,7 @@ // Tim Chen // Pat Gaffney // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.9 export interface CSSModule { [className: string]: string; From 3f26db811998a882baa2d8ff1365bf5ae21213df Mon Sep 17 00:00:00 2001 From: Alexaner T Date: Fri, 20 Jul 2018 14:11:33 +0300 Subject: [PATCH 104/738] Add imageRef prop to ImageBackground --- types/react-native/index.d.ts | 3 ++- types/react-native/test/index.tsx | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index a2eb459933..2d3337c96d 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3698,8 +3698,9 @@ export class Image extends ImageBase { } export interface ImageBackgroundProps extends ImagePropsBase { - style?: StyleProp; imageStyle?: StyleProp; + style?: StyleProp; + imageRef?(image: Image): void; } declare class ImageBackgroundComponent extends React.Component {} diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index a339bb0e84..818be960c7 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -28,6 +28,7 @@ import { ImageLoadEventData, ImageErrorEventData, ImageResolvedAssetSource, + ImageBackground, InteractionManager, ListView, ListViewDataSource, @@ -661,6 +662,25 @@ export class ImageTest extends React.Component { } } +export class ImageBackgroundProps extends React.Component { + private _imageRef: Image | null = null; + + setImageRef = (image: Image) => { + this._imageRef = image; + } + + render() { + return ( + + + + ); + } +} + class StylePropsTest extends React.PureComponent { render() { const uri = 'https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png' From 63867fb112eabd85e3d71373faab0d8961e41611 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 20 Jul 2018 08:31:21 -0400 Subject: [PATCH 105/738] [jquery] `offset` can accept a partial `Coordinates` object. (#27437) --- types/jquery/index.d.ts | 8 +++++++- types/jquery/jquery-tests.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 4b0ebd1614..4bf8e03ee7 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -4704,7 +4704,7 @@ interface JQuery extends Iterable { * @see \`{@link https://api.jquery.com/offset/ }\` * @since 1.4 */ - offset(coordinates: JQuery.Coordinates | ((this: TElement, index: number, coords: JQuery.Coordinates) => JQuery.Coordinates)): this; + offset(coordinates: JQuery.CoordinatesPartial | ((this: TElement, index: number, coords: JQuery.Coordinates) => JQuery.CoordinatesPartial)): this; /** * Get the current coordinates of the first element in the set of matched elements, relative to the document. * @@ -8334,6 +8334,12 @@ declare namespace JQuery { top: number; } + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type CoordinatesPartial = + Pick | + Pick | + { [key: string]: never; }; + interface ValHook { get?(elem: TElement): any; set?(elem: TElement, value: any): any; diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index c569758fb0..bee2c7c2ab 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -2756,6 +2756,18 @@ function JQuery() { top: 50 }); + // $ExpectType JQuery + $('p').offset({ + left: 20 + }); + + // $ExpectType JQuery + $('p').offset({}); + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + $('p').offset(20); + // $ExpectType JQuery $('p').offset(function(index, coords) { // $ExpectType HTMLElement @@ -2771,6 +2783,20 @@ function JQuery() { }; }); + // $ExpectType JQuery + $('p').offset(function(index, coords) { + // $ExpectType HTMLElement + this; + // $ExpectType number + index; + // $ExpectType Coordinates + coords; + + return { + top: 50 + }; + }); + // $ExpectType Coordinates | undefined $('p').offset(); } From c9a4dbbefa3d4febf8ffba06e388a2ece05dca70 Mon Sep 17 00:00:00 2001 From: Lorex75 Date: Fri, 20 Jul 2018 17:43:03 +0200 Subject: [PATCH 106/738] snapTo method (#27415) * snapTo method As per Official Docs, this method accept as first parameter or a number or an array of numbers, not just an array of numbers (docs -> http://snapsvg.io/docs/#Snap.snapTo, source -> https://github.com/adobe-webplatform/Snap.svg/blob/b242f49e6798ac297a3dad0dfb03c0893e394464/src/svg.js#L519) * Typo --- types/snapsvg/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/snapsvg/index.d.ts b/types/snapsvg/index.d.ts index 900d5416e6..981252ac07 100644 --- a/types/snapsvg/index.d.ts +++ b/types/snapsvg/index.d.ts @@ -31,7 +31,7 @@ declare namespace Snap { export function plugin(f:Function):void; export function select(query:string):Snap.Element; export function selectAll(query:string):any; - export function snapTo(values:Array,value:number,tolerance?:number):number; + export function snapTo(values:Array|number,value:number,tolerance?:number):number; export function animate(from:number|number[],to:number|number[],updater:(n:number)=>void,duration:number,easing?:(num:number)=>number,callback?:()=>void):mina.MinaAnimation; export function animation(attr:Object,duration:number,easing?:(num:number)=>number,callback?:()=>void):Snap.Animation; From 20be7a25e751e748a683887769463491d8a9be2c Mon Sep 17 00:00:00 2001 From: Radu Raicea Date: Fri, 20 Jul 2018 11:44:39 -0400 Subject: [PATCH 107/738] Add createButton types for googlepay (#27303) * Add createButton types for googlepay New API changes added createButton, a method to request the creation of a HTMLElement button. * Bump googlepay version and author list * Change from Promise to HTMLElement in googlepay The return value for createButton is HTMLElement, not Promise. --- types/googlepay/googlepay-tests.ts | 11 +++++++---- types/googlepay/index.d.ts | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/types/googlepay/googlepay-tests.ts b/types/googlepay/googlepay-tests.ts index ea97c2a586..4897dd3c80 100644 --- a/types/googlepay/googlepay-tests.ts +++ b/types/googlepay/googlepay-tests.ts @@ -26,10 +26,13 @@ function onGooglePayLoaded() { } function addGooglePayButton() { - const button = document.createElement('button'); - button.className = 'google-pay'; - button.appendChild(document.createTextNode('Google Pay')); - button.addEventListener('click', onGooglePaymentButtonClick); + const buttonOptions: google.payments.api.ButtonOptions = { + onClick: onGooglePaymentButtonClick, + buttonColor: 'black', + buttonType: 'short', + }; + const client = getGooglePaymentsClient(); + const button = client.createButton(buttonOptions); document.appendChild(document.createElement('div').appendChild(button)); } diff --git a/types/googlepay/index.d.ts b/types/googlepay/index.d.ts index 524c277691..4e700d695d 100644 --- a/types/googlepay/index.d.ts +++ b/types/googlepay/index.d.ts @@ -1,12 +1,15 @@ -// Type definitions for Google Pay API 0.0 +// Type definitions for Google Pay API 0.1 // Project: https://developers.google.com/pay/api/web/setup/ -// Definitions by: Florian Luccioni +// Definitions by: Florian Luccioni , +// Radu Raicea // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace google.payments.api { type AddressFormat = 'FULL' | 'MIN'; type AllowedCardNetwork = 'AMEX' | 'DISCOVER' | 'JCB' | 'MASTERCARD' | 'VISA'; type AllowedPaymentMethod = 'CARD' | 'TOKENIZED_CARD'; + type ButtonColor = 'default' | 'black' | 'white'; + type ButtonType = 'long' | 'short'; type CardClass = 'CREDIT' | 'DEBIT'; type CardInfo = CardInfoMin | CardInfoFull; type CardRequirements = CardRequirementsMin | CardRequirementsFull; @@ -19,6 +22,12 @@ declare namespace google.payments.api { type PaymentDataRequest = PaymentDataRequestMin | PaymentDataRequestFull; type PaymentData = PaymentDataMin | PaymentDataFull; + interface ButtonOptions { + onClick: EventListener; + buttonColor?: ButtonColor; + buttonType?: ButtonType; + } + interface PaymentOptions { environment?: EnvironmentType; } @@ -151,6 +160,7 @@ declare namespace google.payments.api { class PaymentsClient { constructor(paymentOptions: PaymentOptions); + createButton(request: ButtonOptions): HTMLElement; isReadyToPay(request: IsReadyToPayRequest): Promise<{result: boolean}>; loadPaymentData(request: PaymentDataRequestMin): Promise; loadPaymentData(request: PaymentDataRequestFull): Promise; From d937097f805be944e000d0405826d7351eb0f7a5 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 20 Jul 2018 11:49:48 -0700 Subject: [PATCH 108/738] knex: Remove unnecessary 'lodash' dependency (#27450) --- types/knex/knex-tests.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index ebd392aea3..e409b8f5ae 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -1,7 +1,4 @@ -"use strict"; import Knex = require('knex'); -import Promise = require('bluebird'); -import _ = require('lodash'); // Initializing the Library var knex = Knex({ @@ -767,7 +764,7 @@ knex.transaction<{ length: number }>(function(trx) { // transacting handles undefined knex.insert({ name: 'Old Books'}).transacting(undefined); -knex.schema.withSchema("public").hasTable("table") as Promise; +knex.schema.withSchema("public").hasTable("table"); // $ExpectType Bluebird knex.schema.createTable('users', function (table) { table.increments(); @@ -856,8 +853,8 @@ knex.select('name').from('users') .andWhere('id', '<', 200) .limit(10) .offset(x) - .then(function(rows: any) { - return _.map(rows, 'name'); + .then(function(rows) { + return rows.map((r: any) => r.name); }) .then(function(names: any) { return knex.select('id').from('nicknames').whereIn('nickname', names); @@ -936,7 +933,7 @@ knex.select('name').from('users') .offset(x) .exec(function(err: any, rows: any[]) { if (err) return console.error(err); - knex.select('id').from('nicknames').whereIn('nickname', _.map(rows, 'name') as any) + knex.select('id').from('nicknames').whereIn('nickname', rows.map((r: any) => r.name)) .exec(function(err: any, rows: any[]) { if (err) return console.error(err); console.log(rows); From c6a52c68c8bf90210cd903637504fc0c6750069e Mon Sep 17 00:00:00 2001 From: Grant Timmerman Date: Fri, 20 Jul 2018 17:25:47 -0700 Subject: [PATCH 109/738] Override Google Apps Script generated types (remove Object, add JSDoc comments) (#27459) --- ...vice.d.ts => google-apps-script.card.d.ts} | 4 +- .../google-apps-script.drive.d.ts | 100 +++++++++++++++++- .../google-apps-script.forms.d.ts | 3 + .../google-apps-script.gmail.d.ts | 80 ++++++++++++-- .../google-apps-script.url-fetch.d.ts | 61 ++++++++++- types/google-apps-script/index.d.ts | 4 +- 6 files changed, 231 insertions(+), 21 deletions(-) rename types/google-apps-script/{google-apps-script.card-service.d.ts => google-apps-script.card.d.ts} (99%) diff --git a/types/google-apps-script/google-apps-script.card-service.d.ts b/types/google-apps-script/google-apps-script.card.d.ts similarity index 99% rename from types/google-apps-script/google-apps-script.card-service.d.ts rename to types/google-apps-script/google-apps-script.card.d.ts index 8e33747bbc..60a8bb9d37 100644 --- a/types/google-apps-script/google-apps-script.card-service.d.ts +++ b/types/google-apps-script/google-apps-script.card.d.ts @@ -7,7 +7,7 @@ /// declare namespace GoogleAppsScript { - export module Card_Service { + export module Card { /** * An action that enables interactivity within UI elements. The action does not happen directly on * the client but rather invokes an Apps Script callback function with optional parameters. @@ -657,4 +657,4 @@ declare namespace GoogleAppsScript { } } -declare var CardService: GoogleAppsScript.Card_Service.CardService; +declare var CardService: GoogleAppsScript.Card.CardService; diff --git a/types/google-apps-script/google-apps-script.drive.d.ts b/types/google-apps-script/google-apps-script.drive.d.ts index 89ef2032d5..4bc84f1184 100644 --- a/types/google-apps-script/google-apps-script.drive.d.ts +++ b/types/google-apps-script/google-apps-script.drive.d.ts @@ -32,29 +32,104 @@ declare namespace GoogleAppsScript { export interface DriveApp { Access: typeof Access; Permission: typeof Permission; + /** + * Adds the given file to the root of the user's Drive. + * This method does not move the file out of its existing parent folder; + * a file can have more than one parent simultaneously. + */ addFile(child: File): Folder; + /** + * Adds the given folder to the root of the user's Drive. + * This method does not move the folder out of its existing parent folder; + * a folder can have more than one parent simultaneously. + */ addFolder(child: Folder): Folder; + /** + * Resumes a file iteration using a continuation token from a previous iterator. + * This method is useful if processing an iterator in one execution would exceed + * the maximum execution time. Continuation tokens are generally valid for one week. + */ continueFileIterator(continuationToken: string): FileIterator; + /** + * Resumes a folder iteration using a continuation token from a previous iterator. + * This method is useful if processing an iterator in one execution would exceed + * the maximum execution time. Continuation tokens are generally valid for one week. + */ continueFolderIterator(continuationToken: string): FolderIterator; + /** Creates a file in the root of the user's Drive from a given Blob of arbitrary data. */ createFile(blob: Base.BlobSource): File; + /** + * Creates a text file in the root of the user's Drive with the given name + * and contents. Throws an exception if content is larger than 50 MB. + */ createFile(name: string, content: string): File; + /** + * Creates a file in the root of the user's Drive with the given name, contents, and MIME type. + * Throws an exception if content is larger than 10MB. + */ createFile(name: string, content: string, mimeType: string): File; + /** Creates a folder in the root of the user's Drive with the given name. */ createFolder(name: string): Folder; + /** + * Gets the file with the given ID. + * Throws a scripting exception if the file does not exist or + * the user does not have permission to access it. + */ getFileById(id: string): File; + /** Gets a collection of all files in the user's Drive. */ getFiles(): FileIterator; + /** Gets a collection of all files in the user's Drive that have the given name. */ getFilesByName(name: string): FileIterator; + /** Gets a collection of all files in the user's Drive that have the given MIME type. */ getFilesByType(mimeType: string): FileIterator; + /** + * Gets the folder with the given ID. Throws a scripting exception if the folder + * does not exist or the user does not have permission to access it. + */ getFolderById(id: string): Folder; + /** Gets a collection of all folders in the user's Drive. */ getFolders(): FolderIterator; + /** Gets a collection of all folders in the user's Drive that have the given name. */ getFoldersByName(name: string): FolderIterator; + /** Gets the folder at the root of the user's Drive. */ getRootFolder(): Folder; + /** Gets the number of bytes the user is allowed to store in Drive. */ getStorageLimit(): Integer; + /** Gets the number of bytes the user is currently storing in Drive. */ getStorageUsed(): Integer; + /** Gets a collection of all the files in the trash of the user's Drive. */ getTrashedFiles(): FileIterator; + /** Gets a collection of all the folders in the trash of the user's Drive. */ getTrashedFolders(): FolderIterator; + /** + * Removes the given file from the root of the user's Drive. + * This method does not delete the file, but if a file is removed from all + * of its parents, it cannot be seen in Drive except by searching for it + * or using the "All items" view. + */ removeFile(child: File): Folder; + /** + * Removes the given folder from the root of the user's Drive. + * This method does not delete the folder or its contents, but if a folder + * is removed from all of its parents, it cannot be seen in Drive except + * by searching for it or using the "All items" view. + */ removeFolder(child: Folder): Folder; + /** + * Gets a collection of all files in the user's Drive that match the given search criteria. + * The search criteria are detailed the Google Drive SDK documentation. + * Note that the params argument is a query string that may contain string values, + * so take care to escape quotation marks correctly + * (for example "title contains 'Gulliver\\'s Travels'" or 'title contains "Gulliver\'s Travels"'). + */ searchFiles(params: string): FileIterator; + /** + * Gets a collection of all folders in the user's Drive that match the given search criteria. + * The search criteria are detailed the Google Drive SDK documentation. + * Note that the params argument is a query string that may contain string values, + * so take care to escape quotation marks correctly + * (for example "title contains 'Gulliver\\'s Travels'" or 'title contains "Gulliver\'s Travels"'). + */ searchFolders(params: string): FolderIterator; } @@ -138,8 +213,18 @@ declare namespace GoogleAppsScript { * } */ export interface FileIterator { + /** + * Gets a token that can be used to resume this iteration at a later time. + * This method is useful if processing an iterator in one execution would + * exceed the maximum execution time. Continuation tokens are generally valid for one week. + */ getContinuationToken(): string; + /** Determines whether calling next() will return an item. */ hasNext(): boolean; + /** + * Gets the next item in the collection of files or folders. + * Throws an exception if no items remain. + */ next(): File; } @@ -249,13 +334,26 @@ declare namespace GoogleAppsScript { * } */ export interface User { + /** Gets the domain name associated with the user's account. */ getDomain(): string; + /** + * Gets the user's email address. The user's email address is only available + * if the user has chosen to share the address from the Google+ account settings + * page, or if the user belongs to the same domain as the user running the script + * and the domain administrator has allowed all users within the domain to see + * other users' email addresses. + */ getEmail(): string; + /** Gets the user's name. This method returns null if the user's name is not available. */ getName(): string; + /** Gets the URL for the user's photo. This method returns null if the user's photo is not available. */ getPhotoUrl(): string; + /** + * Gets the user's email address. + * @deprecated As of June 24, 2013, replaced by getEmail() + */ getUserLoginId(): string; } - } } diff --git a/types/google-apps-script/google-apps-script.forms.d.ts b/types/google-apps-script/google-apps-script.forms.d.ts index e7698ea67e..df08002505 100644 --- a/types/google-apps-script/google-apps-script.forms.d.ts +++ b/types/google-apps-script/google-apps-script.forms.d.ts @@ -151,6 +151,9 @@ declare namespace GoogleAppsScript { * checkBoxItem.setValidation(checkBoxValidation); */ export interface CheckboxValidation { + requireSelectAtLeast(number: Integer): CheckboxValidation; + requireSelectAtMost(number: Integer): CheckboxValidation; + requireSelectExactly(number: Integer): CheckboxValidation; } /** diff --git a/types/google-apps-script/google-apps-script.gmail.d.ts b/types/google-apps-script/google-apps-script.gmail.d.ts index 94a10d2dfb..9a241db3e0 100644 --- a/types/google-apps-script/google-apps-script.gmail.d.ts +++ b/types/google-apps-script/google-apps-script.gmail.d.ts @@ -119,13 +119,72 @@ declare namespace GoogleAppsScript { * A user-created draft message in a user's Gmail account. */ export interface GmailDraft { + /** + * Deletes this draft message. + */ deleteDraft(): void; + /** + * Gets the ID of this draft message. + */ getId(): string; + /** + * Returns a GmailMessage representing this draft. + */ getMessage(): GmailMessage; + /** + * Returns the ID of the `GmailMessage` representing this draft. + */ getMessageId(): string; + /** + * Sends this draft email message. + */ send(): GmailMessage; + /** + * Replaces the contents of this draft message. + */ update(recipient: string, subject: string, body: string): GmailDraft; - update(recipient: string, subject: string, body: string, options: Object): GmailDraft; + /** + * Replaces the contents of this draft message using optional arguments. + */ + update(recipient: string, subject: string, body: string, options: GmailDraftOptions): GmailDraft; + } + + /** + * Options for a Gmail draft. + */ + export type GmailDraftOptions = { + /** + * An array of files to send with the email. + */ + attachments?: Base.BlobSource[]; + /** + * A comma-separated list of email addresses to BCC. + */ + bcc?: string; + /** + * A comma-separated list of email addresses to CC. + */ + cc?: string; + /** + * The address that the email should be sent from, which must be one of the values returned by `GmailApp.getAliases()`. + */ + from?: string; + /** + * If set, devices capable of rendering HTML will use it instead of the required body argument; you can add an optional `inlineImages` field in HTML body if you have inlined images for your email. + */ + htmlBody?: string; + /** + * A JavaScript object containing a mapping from image key (`String`) to image data (`BlobSource`) ; this assumes that the `htmlBody` parameter is used and contains references to these images in the format ``. + */ + inlineImages?: { [imageKey: string]: Base.BlobSource }; + /** + * The name of the sender of the email (default: the user's name). + */ + name?: string; + /** + * An email address to use as the default reply-to address (default: the user's email address). + */ + replyTo?: string; } /** @@ -148,11 +207,11 @@ declare namespace GoogleAppsScript { */ export interface GmailMessage { createDraftReply(body: string): GmailDraft; - createDraftReply(body: string, options: Object): GmailDraft; + createDraftReply(body: string, options: GmailDraftOptions): GmailDraft; createDraftReplyAll(body: string): GmailDraft; - createDraftReplyAll(body: string, options: Object): GmailDraft; + createDraftReplyAll(body: string, options: GmailDraftOptions): GmailDraft; forward(recipient: string): GmailMessage; - forward(recipient: string, options: Object): GmailMessage; + forward(recipient: string, options: GmailDraftOptions): GmailMessage; getAttachments(): GmailAttachment[]; getBcc(): string; getBody(): string; @@ -178,9 +237,9 @@ declare namespace GoogleAppsScript { moveToTrash(): GmailMessage; refresh(): GmailMessage; reply(body: string): GmailMessage; - reply(body: string, options: Object): GmailMessage; + reply(body: string, options: GmailDraftOptions): GmailMessage; replyAll(body: string): GmailMessage; - replyAll(body: string, options: Object): GmailMessage; + replyAll(body: string, options: GmailDraftOptions): GmailMessage; star(): GmailMessage; unstar(): GmailMessage; } @@ -191,9 +250,9 @@ declare namespace GoogleAppsScript { export interface GmailThread { addLabel(label: GmailLabel): GmailThread; createDraftReply(body: string): GmailDraft; - createDraftReply(body: string, options: Object): GmailDraft; + createDraftReply(body: string, options: GmailDraftOptions): GmailDraft; createDraftReplyAll(body: string): GmailDraft; - createDraftReplyAll(body: string, options: Object): GmailDraft; + createDraftReplyAll(body: string, options: GmailDraftOptions): GmailDraft; getFirstMessageSubject(): string; getId(): string; getLabels(): GmailLabel[]; @@ -220,11 +279,10 @@ declare namespace GoogleAppsScript { refresh(): GmailThread; removeLabel(label: GmailLabel): GmailThread; reply(body: string): GmailThread; - reply(body: string, options: Object): GmailThread; + reply(body: string, options: GmailDraftOptions): GmailThread; replyAll(body: string): GmailThread; - replyAll(body: string, options: Object): GmailThread; + replyAll(body: string, options: GmailDraftOptions): GmailThread; } - } } diff --git a/types/google-apps-script/google-apps-script.url-fetch.d.ts b/types/google-apps-script/google-apps-script.url-fetch.d.ts index 43d6825b72..cd43670167 100644 --- a/types/google-apps-script/google-apps-script.url-fetch.d.ts +++ b/types/google-apps-script/google-apps-script.url-fetch.d.ts @@ -25,6 +25,61 @@ declare namespace GoogleAppsScript { getResponseCode(): Integer; } + export interface URLFetchRequestOptions { + /** + * the content type (defaults to 'application/x-www-form-urlencoded'). Another example of content + * type is 'application/xml; charset=utf-8'. + */ + contentType?: string; + + /** + * a JavaScript key/value map of HTTP headers for the request + */ + headers?: Object; + + /** + * the HTTP method for the request: get, delete, patch, post, or put. The default is get. + */ + method?: 'get' | 'delete' | 'patch' | 'post' | 'put'; + + /** + * the payload (e.g. POST body) for the request. Certain HTTP methods (e.g. GET) do not accept a + * payload. It can be a string, a byte array, or a JavaScript object. A JavaScript object will be + * interpretted as a map of form field names to values, where the values can be either strings or blobs. + */ + payload?: string; + + /** + * Deprecated. This instructs fetch to resolve the specified URL within the intranet linked to your + * domain through (deprecated) SDC + */ + useIntranet?: boolean; + + /** + * if this is set to false, the fetch will ignore any invalid certificates for HTTPS requests. + * The default is true. + */ + validateHttpsCertificates?: boolean; + + /** + * if this is set to false, the fetch not automatically follow HTTP redirects; it will return + * the original HTTP response. The default is true. + */ + followRedirects?: boolean; + + /** + * if this is set to true, the fetch will not throw an exception if the response code indicates + * failure, and will instead return the HTTPResponse (default: false) + */ + muteHttpExceptions?: boolean; + + /** + * if this is set to false, reserved characters in the URL will not be escaped (default: true) + */ + escaping?: boolean; + } + + /** * Fetch resources and communicate with other hosts over the Internet. * @@ -47,11 +102,9 @@ declare namespace GoogleAppsScript { * Setting explicit scopes */ export interface UrlFetchApp { - fetch(url: string): HTTPResponse; - fetch(url: string, params: Object): HTTPResponse; + fetch(url: string, params?: URLFetchRequestOptions): HTTPResponse; fetchAll(requests: Object[]): HTTPResponse[]; - getRequest(url: string): Object; - getRequest(url: string, params: Object): Object; + getRequest(url: string, params?: URLFetchRequestOptions): Object; } } diff --git a/types/google-apps-script/index.d.ts b/types/google-apps-script/index.d.ts index 0a965efe99..2635b9aad7 100644 --- a/types/google-apps-script/index.d.ts +++ b/types/google-apps-script/index.d.ts @@ -3,11 +3,10 @@ // Definitions by: motemen , grant // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - /// /// /// -/// +/// /// /// /// @@ -33,4 +32,3 @@ /// /// /// - From d00d623d9522c398bfc8f09ccaf62de85d63497f Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Sat, 21 Jul 2018 03:26:40 +0300 Subject: [PATCH 110/738] activex-excel: Default properties; remove EnumeratorConstructor overloads; reduce any (#27427) * Default properties; reduce any; remove EnumeratorConstructor overloads * Test fixes --- types/activex-excel/activex-excel-tests.ts | 141 +- types/activex-excel/index.d.ts | 3907 +++++++++++--------- types/activex-excel/tslint.json | 6 +- types/activex-interop/index.d.ts | 1 - types/activex-office/index.d.ts | 2 + types/activex-outlook/index.d.ts | 4 - 6 files changed, 2234 insertions(+), 1827 deletions(-) diff --git a/types/activex-excel/activex-excel-tests.ts b/types/activex-excel/activex-excel-tests.ts index 4f6fab3aa1..505fcacfef 100644 --- a/types/activex-excel/activex-excel-tests.ts +++ b/types/activex-excel/activex-excel-tests.ts @@ -16,6 +16,17 @@ const inCollection = (collection: { Item(index: any): T }, index: strin return item; }; +{ + let app1: Excel.Application | null = new ActiveXObject('Excel.Application'); + app1.Visible = true; + const book1 = app1.Workbooks.Add(); + + app1.Quit(); + app1 = null; + + WScript.Quit(); +} + const app = new ActiveXObject('Excel.Application'); // create a workbook -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/create-a-workbook @@ -27,7 +38,7 @@ newBook.SaveAs('allsales.xls'); // create or replace a worksheet -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/create-or-replace-a-worksheet const newOrExistingWorksheet = () => { const mySheetName = 'Sheet4'; - let mySheet = inCollection(newBook.Worksheets, mySheetName) as Excel.Worksheet | undefined; + let mySheet = inCollection(newBook.Worksheets, mySheetName); if (!mySheet) { WScript.Echo(`The sheet named "${mySheetName} doesn't exist, but will be created.`); mySheet = app.Worksheets.Add() as Excel.Worksheet; @@ -37,7 +48,7 @@ const newOrExistingWorksheet = () => { const replaceWorksheet = () => { const mySheetName = 'Sheet4'; app.DisplayAlerts = false; - let mySheet = inCollection(app.Worksheets, mySheetName); + let mySheet = inCollection(app.Worksheets, mySheetName); if (mySheet) { mySheet.Delete(); } app.DisplayAlerts = true; mySheet = app.Worksheets.Add() as Excel.Worksheet; @@ -46,9 +57,7 @@ const replaceWorksheet = () => { }; // referencing multiple sheets -- https://msdn.microsoft.com/VBA/Excel-VBA/articles/sheets-object-excel -const moveMultipleSheets = () => { - app.Worksheets.Item(toSafeArray(1, 'Sheet2')).Move(4); -}; +const moveMultipleSheets = () => app.Worksheets(toSafeArray(1, 'Sheet2')).Move(4); // sort worksheets alphanumerically by name -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/sort-worksheets-alphanumerically-by-name const sortSheetsTabName = () => { @@ -56,9 +65,9 @@ const sortSheetsTabName = () => { const sheets = app.ActiveWorkbook.Sheets; const sheetCount = sheets.Count; for (let i = 0; i < sheetCount; i += 1) { - const sheetI = sheets.Item(i); + const sheetI = sheets(i); for (let j = i; j < sheetCount; j += 1) { - const sheetJ = sheets.Item(j); + const sheetJ = sheets(j); if (sheetJ.Name < sheetI.Name) { sheetJ.Move(sheetI); } } } @@ -68,7 +77,7 @@ const sortSheetsTabName = () => { // fill a value down into blank cells in a column -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/fill-a-value-down-into-blank-cells-in-a-column const fillCellsFromAbove = () => { app.ScreenUpdating = false; - const columnA = app.Columns.Item(1); + const columnA = app.Columns(1); try { columnA.SpecialCells(Excel.XlCellType.xlCellTypeBlanks).Formula = '=R[-1]C'; columnA.Value = columnA.Value; @@ -78,7 +87,7 @@ const fillCellsFromAbove = () => { // hide and unhide columns -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/hide-and-unhide-columns const setColumnVisibility = (visible: boolean) => { - const book = app.Workbooks.Item(1); + const book = app.Workbooks(1); const sheet = inCollection(book.Worksheets, 'Sheet1'); if (!sheet) { return; } @@ -97,7 +106,7 @@ const setColumnVisibility = (visible: boolean) => { }; // highlighting the active cell, row, or column -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/highlight-the-active-cell-row-or-column -(() => { +{ const wks = app.ActiveSheet as Excel.Worksheet; // highlight active cell @@ -120,10 +129,10 @@ const setColumnVisibility = (visible: boolean) => { prm.Target.EntireColumn.Interior.ColorIndex = 8; app.ScreenUpdating = true; }); -})(); +} // referencing cells -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/reference-cells-and-ranges -(() => { +{ const wks = app.ActiveSheet as Excel.Worksheet; // all the cells on a worksheet @@ -141,20 +150,19 @@ const setColumnVisibility = (visible: boolean) => { wks.Range('A:A,C:C,F:F').Font.Bold = true; // using index numbers - wks.Cells.Item(6, 1).Value2 = 10; - // Value is also a property with parameters - ActiveXObject.set(wks.Cells.Item(6, 1), 'Value', 10); + wks.Cells(6, 1).Value2 = 10; + wks.Cells(6, 1).Value = 10; // iterating through cells using index numbers for (let counter = 1; counter < 20; counter += 1) { - ActiveXObject.set(wks.Cells.Item(counter, 1), 'Value', 10); + wks.Cells(counter, 1).Value = 10; } // relative to other cells - wks.Cells.Item(1, 1).Font.Underline = Excel.XlUnderlineStyle.xlUnderlineStyleDouble; + wks.Cells(1, 1).Font.Underline = Excel.XlUnderlineStyle.xlUnderlineStyleDouble; // using a Range object - const rng = wks.Cells.Item('A1:D5'); + const rng = wks.Cells('A1:D5'); rng.Formula = '=RAND()'; rng.Font.Bold = true; @@ -166,23 +174,22 @@ const setColumnVisibility = (visible: boolean) => { // refer to multiple ranges using Areas WScript.Echo(union.Areas.Count); -})(); +} // looping through a range of cells -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/looping-through-a-range-of-cells -(() => { +{ const wks = app.ActiveSheet as Excel.Worksheet; // using for for (let x = 1; x < 20; x++) { - const currentCell = wks.Cells.Item(x, 1); - if (Math.abs(currentCell.Value()) < 0.01) { - // because Value is typed as a method on the Excel.Range class, we have to treat it as a setter with parameters - ActiveXObject.set(currentCell, 'Value', 0); + const currentCell = wks.Cells(x, 1); + if (Math.abs(currentCell.Value) < 0.01) { + currentCell.Value = 0; } } // using Enumerator - let enumerator = new Enumerator(wks.Cells.Item('A1:D10')); + let enumerator = new Enumerator(wks.Cells('A1:D10')); enumerator.moveFirst(); while (!enumerator.atEnd()) { const currentCell = enumerator.item(); @@ -202,11 +209,11 @@ const setColumnVisibility = (visible: boolean) => { } enumerator.moveNext(); } -})(); +} // using selection -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/selecting-and-activating-cells -(() => { - const wks = app.ActiveWorkbook.Worksheets.Item(1) as Excel.Worksheet; +{ + const wks = app.ActiveWorkbook.Worksheets(1); // make a worksheet the active worksheet; otherwise code which uses the selection will fail wks.Select(); @@ -219,24 +226,24 @@ const setColumnVisibility = (visible: boolean) => { wks.Range("B1").Activate(); // working with 3-D ranges -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/working-with-3-d-ranges - app.Sheets.Item(toSafeArray("Sheet2", "Sheet3", "Sheet4")).Select(); + app.Sheets(toSafeArray("Sheet2", "Sheet3", "Sheet4")).Select(); app.Range("A1:H1").Select(); - (app.Selection as Excel.Range).Borders.Item(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Excel.XlLineStyle.xlDouble; + (app.Selection as Excel.Range).Borders(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Excel.XlLineStyle.xlDouble; // alternatively, use FillAcrossSheets to fill formatting and data across sheets const book = app.ActiveWorkbook; - const wks2 = book.Sheets.Item("Sheet2") as Excel.Worksheet; + const wks2 = book.Worksheets("Sheet2"); const rng = wks2.Range("A1:H1"); - rng.Borders.Item(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Excel.XlLineStyle.xlDouble; + rng.Borders(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Excel.XlLineStyle.xlDouble; book.Sheets.FillAcrossSheets(rng); -})(); +} // prevent duplicate entry -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/prevent-duplicate-entries-in-a-range -(() => { - const book = app.Workbooks.Item(1); +{ + const book = app.Workbooks(1); ActiveXObject.on(book, 'SheetChange', ['Sh', 'Target'], function(this, prm) { - const EvalRange = this.ActiveSheet.Range("A1:B20"); + const EvalRange = (this.ActiveSheet as Excel.Worksheet).Range("A1:B20"); // If the cell where the value was entered is not in the defined range, if the value pasted is larger than a single cell, or if no value was entered in the cell, then exit the macro if ( @@ -253,10 +260,11 @@ const setColumnVisibility = (visible: boolean) => { return; } + // const enumerator = new Enumerator(book.Worksheets); const enumerator = new Enumerator(book.Worksheets); enumerator.moveFirst(); while (!enumerator.atEnd()) { - const wks = enumerator.item() as Excel.Worksheet; + const wks = enumerator.item(); if (wks.Name === prm.Target.Name) { continue; } // If the value entered already exists in the defined range on the current worksheet, undo the entry. @@ -267,14 +275,14 @@ const setColumnVisibility = (visible: boolean) => { app.EnableEvents = true; } }); -})(); +} // add a unique list of values to a combobox -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/add-a-unique-list-of-values-to-a-combo-box -(() => { - (() => { +{ + { // using the AdvancedFilter property const book = app.ThisWorkbook; - const sheet = book.Worksheets.Item("Sheet1") as Excel.Worksheet; + const sheet = book.Worksheets("Sheet1"); const dataRange = sheet.Range('A1', sheet.Range("A100").End(Excel.XlDirection.xlUp)); dataRange.AdvancedFilter(Excel.XlFilterAction.xlFilterCopy, undefined, sheet.Range('L1'), true); const data = sheet.Range("L2", sheet.Range('L100').End(Excel.XlDirection.xlUp)).Value() as SafeArray; @@ -284,15 +292,17 @@ const setColumnVisibility = (visible: boolean) => { combobox.Clear(); ActiveXObject.set(combobox, 'List', [], data); combobox.ListIndex = -1; - })(); + } - (() => { + { // using a Dictionary - const sheet = app.ThisWorkbook.Sheets.Item('Sheet2') as Excel.Worksheet; + const sheet = app.ThisWorkbook.Sheets('Sheet2') as Excel.Worksheet; const data = sheet.Range('A2', sheet.Range('A100').End(Excel.XlDirection.xlUp)).Value2 as SafeArray; const arr = new VBArray(data).toArray(); const dict = new ActiveXObject('Scripting.Dictionary'); - arr.forEach(x => ActiveXObject.set(dict, 'Item', [x], true)); + for (const x of arr) { + ActiveXObject.set(dict, 'Item', [x], true); + } const combobox = sheet.OLEObjects('ComboBox1').Object as MSForms.ComboBox; combobox.Clear(); @@ -307,21 +317,28 @@ const setColumnVisibility = (visible: boolean) => { // alternatively, make a JS array out of the keys, and iterate using forEach // new VBArray(dict.Keys()).toArray().forEach(x => combobox.AddItem(x)); - })(); -})(); - -// animating a sparkline -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/animate-a-sparkline -(() => { - const wks = app.ActiveSheet as Excel.Worksheet; - const oSparkGroup = wks.Cells.SparklineGroups.Item(1); - - // Set the data source to the first year of data - oSparkGroup.ModifySourceData('B2:M4'); - - // Loop through the data points for the subsequent two years - for (let i = 1; i <= 24; i++) { - // Move the reference for the sparkline group over one cell - oSparkGroup.ModifySourceData(wks.Range(oSparkGroup.SourceData).Offset(0, 1).Address()); - WScript.Sleep(1000); } -})(); + + // animating a sparkline -- https://msdn.microsoft.com/en-us/vba/excel-vba/articles/animate-a-sparkline + { + const wks = app.ActiveSheet as Excel.Worksheet; + const oSparkGroup = wks.Cells.SparklineGroups(1); + + // Set the data source to the first year of data + oSparkGroup.ModifySourceData('B2:M4'); + + // Loop through the data points for the subsequent two years + for (let i = 1; i <= 24; i++) { + // Move the reference for the sparkline group over one cell + oSparkGroup.ModifySourceData(wks.Range(oSparkGroup.SourceData).Offset(0, 1).Address()); + WScript.Sleep(1000); + } + } + + { + const formats = new VBArray(app.ClipboardFormats).toArray(); + for (const format of formats) { + WScript.Echo(format); + } + } +} diff --git a/types/activex-excel/index.d.ts b/types/activex-excel/index.d.ts index c55bfe1c42..6243d25e05 100644 --- a/types/activex-excel/index.d.ts +++ b/types/activex-excel/index.d.ts @@ -2,14 +2,52 @@ // Project: https://msdn.microsoft.com/en-us/library/fp179694.aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 /// /// /// +/// +/// declare namespace Excel { - // tslint:disable-next-line:no-const-enum + type AddSheetResult = + T extends XlSheetType.xlDialogSheet ? DialogSheet : + T extends XlSheetType.xlChart ? Chart : + T extends XlSheetType ? Worksheet : + T extends undefined ? Sheet : + never; + + type InternationalResult = + T extends XlApplicationInternationalStrings ? string : + T extends XlApplicationInternationalNumbers ? number : + T extends XlApplicationInternationalBooleans ? boolean : + any; + + type LineStyle = XlLineStyle | Constants.xlGray25 | Constants.xlGray50 | Constants.xlGray75 | Constants.xlAutomatic; + + type HorizontalAlignments = Constants.xlCenter | Constants.xlDistributed | Constants.xlJustify | Constants.xlLeft | Constants.xlRight; + + type VerticalAlignments = Constants.xlBottom | Constants.xlCenter | Constants.xlDistributed | Constants.xlJustify | Constants.xlTop; + + type PivotTableWizardSourceData = + TSourceType extends XlPivotTableSourceType.xlExternal ? SafeArray : + TSourceType extends XlPivotTableSourceType ? Range | SafeArray | string : + TSourceType extends undefined ? undefined : + never; + + type PivotTableWizardAutoPage = + TSourceType extends XlPivotTableSourceType.xlConsolidation ? boolean : + undefined; + + type PrintToFileName = + T extends true ? string : + undefined; + + type Sheet = Worksheet | Chart | DialogSheet; + + type SheetView = WorksheetView | DialogSheetView; + const enum Constants { xl3DBar = -4099, xl3DEffects1 = 13, @@ -180,7 +218,48 @@ declare namespace Excel { xlWorksheetShort = 5, } - // tslint:disable-next-line:no-const-enum + const enum FunctionCategory { + Commands = 10, + Customizing = 11, + Database = 6, + DateAndTime = 2, + DDEAndExternal = 13, + Financial = 1, + Information = 9, + Logical = 8, + LookupAndReference = 5, + MacroControl = 12, + MathAndTrig = 3, + Statistical = 4, + Text = 7, + UserDefined = 14, + } + + const enum InputBoxReturnType { + Formula = 0, + Number = 1, + String = 2, + Boolean = 4, + Range = 8, + ErrorValue = 16, + SafeArray = 64, + } + + const enum PivotFieldSubtotal { + Automatic = 1, + Average = 4, + Count = 3, + CountNums = 8, + Max = 5, + Min = 6, + Product = 7, + StdDev = 9, + StdDevp = 10, + Sum = 2, + Var = 11, + Varp = 12 + } + const enum XlAboveBelow { xlAboveAverage = 0, xlAboveStdDev = 4, @@ -190,7 +269,6 @@ declare namespace Excel { xlEqualBelowAverage = 3, } - // tslint:disable-next-line:no-const-enum const enum XlActionType { xlActionTypeDrillthrough = 256, xlActionTypeReport = 128, @@ -198,80 +276,82 @@ declare namespace Excel { xlActionTypeUrl = 1, } - // tslint:disable-next-line:no-const-enum const enum XlAllocation { xlAutomaticAllocation = 2, xlManualAllocation = 1, } - // tslint:disable-next-line:no-const-enum const enum XlAllocationMethod { xlEqualAllocation = 1, xlWeightedAllocation = 2, } - // tslint:disable-next-line:no-const-enum const enum XlAllocationValue { xlAllocateIncrement = 2, xlAllocateValue = 1, } - // tslint:disable-next-line:no-const-enum - const enum XlApplicationInternational { - xl24HourClock = 33, - xl4DigitYears = 43, + const enum XlApplicationInternationalStrings { xlAlternateArraySeparator = 16, xlColumnSeparator = 14, - xlCountryCode = 1, - xlCountrySetting = 2, - xlCurrencyBefore = 37, xlCurrencyCode = 25, - xlCurrencyDigits = 27, - xlCurrencyLeadingZeros = 40, - xlCurrencyMinusSign = 38, - xlCurrencyNegative = 28, - xlCurrencySpaceBefore = 36, - xlCurrencyTrailingZeros = 39, - xlDateOrder = 32, - xlDateSeparator = 17, - xlDayCode = 21, - xlDayLeadingZero = 42, xlDecimalSeparator = 3, xlGeneralFormatName = 26, - xlHourCode = 22, xlLeftBrace = 12, xlLeftBracket = 10, xlListSeparator = 5, xlLowerCaseColumnLetter = 9, xlLowerCaseRowLetter = 8, - xlMDY = 44, - xlMetric = 35, - xlMinuteCode = 23, - xlMonthCode = 20, - xlMonthLeadingZero = 41, - xlMonthNameChars = 30, - xlNoncurrencyDigits = 29, - xlNonEnglishFunctions = 34, xlRightBrace = 13, xlRightBracket = 11, + xlUpperCaseColumnLetter = 7, + xlUpperCaseRowLetter = 6, + xlDateSeparator = 17, + xlDayCode = 21, + xlHourCode = 22, + xlMinuteCode = 23, + xlMonthCode = 20, xlRowSeparator = 15, xlSecondCode = 24, xlThousandsSeparator = 4, - xlTimeLeadingZero = 45, xlTimeSeparator = 18, - xlUpperCaseColumnLetter = 7, - xlUpperCaseRowLetter = 6, - xlWeekdayNameChars = 31, xlYearCode = 19, } - // tslint:disable-next-line:no-const-enum + const enum XlApplicationInternationalNumbers { + xlCountryCode = 1, + xlCountrySetting = 2, + xlCurrencyDigits = 27, + xlCurrencyNegative = 28, + xlNoncurrencyDigits = 29, + xlDateOrder = 32, + xlMonthNameChars = 30, + xlWeekdayNameChars = 31, + } + + const enum XlApplicationInternationalBooleans { + xl24HourClock = 33, + xl4DigitYears = 43, + xlCurrencyBefore = 37, + xlCurrencyLeadingZeros = 40, + xlCurrencyMinusSign = 38, + xlCurrencySpaceBefore = 36, + xlCurrencyTrailingZeros = 39, + xlDayLeadingZero = 42, + xlMDY = 44, + xlMetric = 35, + xlMonthLeadingZero = 41, + xlNonEnglishFunctions = 34, + xlTimeLeadingZero = 45, + } + + type XlApplicationInternational = XlApplicationInternationalStrings | XlApplicationInternationalNumbers | XlApplicationInternationalBooleans; + const enum XlApplyNamesOrder { xlColumnThenRow = 2, xlRowThenColumn = 1, } - // tslint:disable-next-line:no-const-enum const enum XlArabicModes { xlArabicBothStrict = 3, xlArabicNone = 0, @@ -279,7 +359,6 @@ declare namespace Excel { xlArabicStrictFinalYaa = 2, } - // tslint:disable-next-line:no-const-enum const enum XlArrangeStyle { xlArrangeStyleCascade = 7, xlArrangeStyleHorizontal = -4128, @@ -287,14 +366,12 @@ declare namespace Excel { xlArrangeStyleVertical = -4166, } - // tslint:disable-next-line:no-const-enum const enum XlArrowHeadLength { xlArrowHeadLengthLong = 3, xlArrowHeadLengthMedium = -4138, xlArrowHeadLengthShort = 1, } - // tslint:disable-next-line:no-const-enum const enum XlArrowHeadStyle { xlArrowHeadStyleClosed = 3, xlArrowHeadStyleDoubleClosed = 5, @@ -303,14 +380,12 @@ declare namespace Excel { xlArrowHeadStyleOpen = 2, } - // tslint:disable-next-line:no-const-enum const enum XlArrowHeadWidth { xlArrowHeadWidthMedium = -4138, xlArrowHeadWidthNarrow = 1, xlArrowHeadWidthWide = 3, } - // tslint:disable-next-line:no-const-enum const enum XlAutoFillType { xlFillCopy = 1, xlFillDays = 5, @@ -325,7 +400,6 @@ declare namespace Excel { xlLinearTrend = 9, } - // tslint:disable-next-line:no-const-enum const enum XlAutoFilterOperator { xlAnd = 1, xlBottom10Items = 4, @@ -343,7 +417,6 @@ declare namespace Excel { xlTop10Percent = 5, } - // tslint:disable-next-line:no-const-enum const enum XlAxisCrosses { xlAxisCrossesAutomatic = -4105, xlAxisCrossesCustom = -4114, @@ -351,27 +424,23 @@ declare namespace Excel { xlAxisCrossesMinimum = 4, } - // tslint:disable-next-line:no-const-enum const enum XlAxisGroup { xlPrimary = 1, xlSecondary = 2, } - // tslint:disable-next-line:no-const-enum const enum XlAxisType { xlCategory = 1, xlSeriesAxis = 3, xlValue = 2, } - // tslint:disable-next-line:no-const-enum const enum XlBackground { xlBackgroundAutomatic = -4105, xlBackgroundOpaque = 3, xlBackgroundTransparent = 2, } - // tslint:disable-next-line:no-const-enum const enum XlBarShape { xlBox = 0, xlConeToMax = 5, @@ -381,7 +450,6 @@ declare namespace Excel { xlPyramidToPoint = 1, } - // tslint:disable-next-line:no-const-enum const enum XlBordersIndex { xlDiagonalDown = 5, xlDiagonalUp = 6, @@ -393,7 +461,6 @@ declare namespace Excel { xlInsideVertical = 11, } - // tslint:disable-next-line:no-const-enum const enum XlBorderWeight { xlHairline = 1, xlMedium = -4138, @@ -401,7 +468,6 @@ declare namespace Excel { xlThin = 2, } - // tslint:disable-next-line:no-const-enum const enum XlBuiltInDialog { _xlDialogChartSourceData = 541, _xlDialogPhonetic = 538, @@ -664,62 +730,53 @@ declare namespace Excel { xlDialogZoom = 256, } - // tslint:disable-next-line:no-const-enum const enum XlCalcFor { xlAllValues = 0, xlColGroups = 2, xlRowGroups = 1, } - // tslint:disable-next-line:no-const-enum const enum XlCalculatedMemberType { xlCalculatedMember = 0, xlCalculatedSet = 1, } - // tslint:disable-next-line:no-const-enum const enum XlCalculation { xlCalculationAutomatic = -4105, xlCalculationManual = -4135, xlCalculationSemiautomatic = 2, } - // tslint:disable-next-line:no-const-enum const enum XlCalculationInterruptKey { xlAnyKey = 2, xlEscKey = 1, xlNoKey = 0, } - // tslint:disable-next-line:no-const-enum const enum XlCalculationState { xlCalculating = 1, xlDone = 0, xlPending = 2, } - // tslint:disable-next-line:no-const-enum const enum XlCategoryType { xlAutomaticScale = -4105, xlCategoryScale = 2, xlTimeScale = 3, } - // tslint:disable-next-line:no-const-enum const enum XlCellChangedState { xlCellChangeApplied = 3, xlCellChanged = 2, xlCellNotChanged = 1, } - // tslint:disable-next-line:no-const-enum const enum XlCellInsertionMode { xlInsertDeleteCells = 1, xlInsertEntireRows = 2, xlOverwriteCells = 0, } - // tslint:disable-next-line:no-const-enum const enum XlCellType { xlCellTypeAllFormatConditions = -4172, xlCellTypeAllValidation = -4174, @@ -733,20 +790,17 @@ declare namespace Excel { xlCellTypeVisible = 12, } - // tslint:disable-next-line:no-const-enum const enum XlChartElementPosition { xlChartElementPositionAutomatic = -4105, xlChartElementPositionCustom = -4114, } - // tslint:disable-next-line:no-const-enum const enum XlChartGallery { xlAnyGallery = 23, xlBuiltIn = 21, xlUserDefined = 22, } - // tslint:disable-next-line:no-const-enum const enum XlChartItem { xlAxis = 21, xlAxisTitle = 17, @@ -782,14 +836,12 @@ declare namespace Excel { xlYErrorBars = 11, } - // tslint:disable-next-line:no-const-enum const enum XlChartLocation { xlLocationAsNewSheet = 1, xlLocationAsObject = 2, xlLocationAutomatic = 3, } - // tslint:disable-next-line:no-const-enum const enum XlChartPicturePlacement { xlAllFaces = 7, xlEnd = 2, @@ -800,14 +852,12 @@ declare namespace Excel { xlSides = 1, } - // tslint:disable-next-line:no-const-enum const enum XlChartPictureType { xlStack = 2, xlStackScale = 3, xlStretch = 1, } - // tslint:disable-next-line:no-const-enum const enum XlChartSplitType { xlSplitByCustomSplit = 4, xlSplitByPercentValue = 3, @@ -815,7 +865,6 @@ declare namespace Excel { xlSplitByValue = 2, } - // tslint:disable-next-line:no-const-enum const enum XlChartType { xl3DArea = -4098, xl3DAreaStacked = 78, @@ -892,14 +941,12 @@ declare namespace Excel { xlXYScatterSmoothNoMarkers = 73, } - // tslint:disable-next-line:no-const-enum const enum XlCheckInVersionType { xlCheckInMajorVersion = 1, xlCheckInMinorVersion = 0, xlCheckInOverwriteVersion = 2, } - // tslint:disable-next-line:no-const-enum const enum XlClipboardFormat { xlClipboardFormatBIFF = 8, xlClipboardFormatBIFF12 = 63, @@ -937,7 +984,6 @@ declare namespace Excel { xlClipboardFormatWK1 = 10, } - // tslint:disable-next-line:no-const-enum const enum XlCmdType { xlCmdCube = 1, xlCmdDefault = 4, @@ -946,13 +992,11 @@ declare namespace Excel { xlCmdTable = 3, } - // tslint:disable-next-line:no-const-enum const enum XlColorIndex { xlColorIndexAutomatic = -4105, xlColorIndexNone = -4142, } - // tslint:disable-next-line:no-const-enum const enum XlColumnDataType { xlDMYFormat = 4, xlDYMFormat = 7, @@ -966,21 +1010,18 @@ declare namespace Excel { xlYMDFormat = 5, } - // tslint:disable-next-line:no-const-enum const enum XlCommandUnderlines { xlCommandUnderlinesAutomatic = -4105, xlCommandUnderlinesOff = -4146, xlCommandUnderlinesOn = 1, } - // tslint:disable-next-line:no-const-enum const enum XlCommentDisplayMode { xlCommentAndIndicator = 1, xlCommentIndicatorOnly = -1, xlNoIndicator = 0, } - // tslint:disable-next-line:no-const-enum const enum XlConditionValueTypes { xlConditionValueAutomaticMax = 7, xlConditionValueAutomaticMin = 6, @@ -993,7 +1034,6 @@ declare namespace Excel { xlConditionValuePercentile = 5, } - // tslint:disable-next-line:no-const-enum const enum XlConnectionType { xlConnectionTypeODBC = 2, xlConnectionTypeOLEDB = 1, @@ -1002,7 +1042,6 @@ declare namespace Excel { xlConnectionTypeXMLMAP = 3, } - // tslint:disable-next-line:no-const-enum const enum XlConsolidationFunction { xlAverage = -4106, xlCount = -4112, @@ -1018,7 +1057,6 @@ declare namespace Excel { xlVarP = -4165, } - // tslint:disable-next-line:no-const-enum const enum XlContainsOperator { xlBeginsWith = 2, xlContains = 0, @@ -1026,32 +1064,27 @@ declare namespace Excel { xlEndsWith = 3, } - // tslint:disable-next-line:no-const-enum const enum XlCopyPictureFormat { xlBitmap = 2, xlPicture = -4147, } - // tslint:disable-next-line:no-const-enum const enum XlCorruptLoad { xlExtractData = 2, xlNormalLoad = 0, xlRepairFile = 1, } - // tslint:disable-next-line:no-const-enum const enum XlCreator { xlCreatorCode = 1480803660, } - // tslint:disable-next-line:no-const-enum const enum XlCredentialsMethod { xlCredentialsMethodIntegrated = 0, xlCredentialsMethodNone = 1, xlCredentialsMethodStored = 2, } - // tslint:disable-next-line:no-const-enum const enum XlCubeFieldSubType { xlCubeAttribute = 4, xlCubeCalculatedMeasure = 5, @@ -1065,20 +1098,17 @@ declare namespace Excel { xlCubeSet = 3, } - // tslint:disable-next-line:no-const-enum const enum XlCubeFieldType { xlHierarchy = 1, xlMeasure = 2, xlSet = 3, } - // tslint:disable-next-line:no-const-enum const enum XlCutCopyMode { xlCopy = 1, xlCut = 2, } - // tslint:disable-next-line:no-const-enum const enum XlCVError { xlErrDiv0 = 2007, xlErrNA = 2042, @@ -1089,32 +1119,27 @@ declare namespace Excel { xlErrValue = 2015, } - // tslint:disable-next-line:no-const-enum const enum XlDataBarAxisPosition { xlDataBarAxisAutomatic = 0, xlDataBarAxisMidpoint = 1, xlDataBarAxisNone = 2, } - // tslint:disable-next-line:no-const-enum const enum XlDataBarBorderType { xlDataBarBorderNone = 0, xlDataBarBorderSolid = 1, } - // tslint:disable-next-line:no-const-enum const enum XlDataBarFillType { xlDataBarFillGradient = 1, xlDataBarFillSolid = 0, } - // tslint:disable-next-line:no-const-enum const enum XlDataBarNegativeColorType { xlDataBarColor = 0, xlDataBarSameAsPositive = 1, } - // tslint:disable-next-line:no-const-enum const enum XlDataLabelPosition { xlLabelPositionAbove = 0, xlLabelPositionBelow = 1, @@ -1129,12 +1154,10 @@ declare namespace Excel { xlLabelPositionRight = -4152, } - // tslint:disable-next-line:no-const-enum const enum XlDataLabelSeparator { xlDataLabelSeparatorDefault = 1, } - // tslint:disable-next-line:no-const-enum const enum XlDataLabelsType { xlDataLabelsShowBubbleSizes = 6, xlDataLabelsShowLabel = 4, @@ -1144,7 +1167,6 @@ declare namespace Excel { xlDataLabelsShowValue = 2, } - // tslint:disable-next-line:no-const-enum const enum XlDataSeriesDate { xlDay = 1, xlMonth = 3, @@ -1152,7 +1174,6 @@ declare namespace Excel { xlYear = 4, } - // tslint:disable-next-line:no-const-enum const enum XlDataSeriesType { xlAutoFill = 4, xlChronological = 3, @@ -1160,13 +1181,11 @@ declare namespace Excel { xlGrowth = 2, } - // tslint:disable-next-line:no-const-enum const enum XlDeleteShiftDirection { xlShiftToLeft = -4159, xlShiftUp = -4162, } - // tslint:disable-next-line:no-const-enum const enum XlDirection { xlDown = -4121, xlToLeft = -4159, @@ -1174,21 +1193,18 @@ declare namespace Excel { xlUp = -4162, } - // tslint:disable-next-line:no-const-enum const enum XlDisplayBlanksAs { xlInterpolated = 3, xlNotPlotted = 1, xlZero = 2, } - // tslint:disable-next-line:no-const-enum const enum XlDisplayDrawingObjects { xlDisplayShapes = -4104, xlHide = 3, xlPlaceholders = 2, } - // tslint:disable-next-line:no-const-enum const enum XlDisplayUnit { xlHundredMillions = -8, xlHundreds = -2, @@ -1201,20 +1217,17 @@ declare namespace Excel { xlThousands = -3, } - // tslint:disable-next-line:no-const-enum const enum XlDupeUnique { xlDuplicate = 1, xlUnique = 0, } - // tslint:disable-next-line:no-const-enum const enum XlDVAlertStyle { xlValidAlertInformation = 3, xlValidAlertStop = 1, xlValidAlertWarning = 2, } - // tslint:disable-next-line:no-const-enum const enum XlDVType { xlValidateCustom = 7, xlValidateDate = 4, @@ -1226,7 +1239,6 @@ declare namespace Excel { xlValidateWholeNumber = 1, } - // tslint:disable-next-line:no-const-enum const enum XlDynamicFilterCriteria { xlFilterAboveAverage = 33, xlFilterAllDatesInPeriodApril = 24, @@ -1264,7 +1276,6 @@ declare namespace Excel { xlFilterYesterday = 2, } - // tslint:disable-next-line:no-const-enum const enum XlEditionFormat { xlBIFF = 2, xlPICT = 1, @@ -1272,7 +1283,6 @@ declare namespace Excel { xlVALU = 8, } - // tslint:disable-next-line:no-const-enum const enum XlEditionOptionsOption { xlAutomaticUpdate = 4, xlCancel = 1, @@ -1284,39 +1294,33 @@ declare namespace Excel { xlUpdateSubscriber = 2, } - // tslint:disable-next-line:no-const-enum const enum XlEditionType { xlPublisher = 1, xlSubscriber = 2, } - // tslint:disable-next-line:no-const-enum const enum XlEnableCancelKey { xlDisabled = 0, xlErrorHandler = 2, xlInterrupt = 1, } - // tslint:disable-next-line:no-const-enum const enum XlEnableSelection { xlNoRestrictions = 0, xlNoSelection = -4142, xlUnlockedCells = 1, } - // tslint:disable-next-line:no-const-enum const enum XlEndStyleCap { xlCap = 1, xlNoCap = 2, } - // tslint:disable-next-line:no-const-enum const enum XlErrorBarDirection { xlX = -4168, xlY = 1, } - // tslint:disable-next-line:no-const-enum const enum XlErrorBarInclude { xlErrorBarIncludeBoth = 1, xlErrorBarIncludeMinusValues = 3, @@ -1324,7 +1328,6 @@ declare namespace Excel { xlErrorBarIncludePlusValues = 2, } - // tslint:disable-next-line:no-const-enum const enum XlErrorBarType { xlErrorBarTypeCustom = -4114, xlErrorBarTypeFixedValue = 1, @@ -1333,7 +1336,6 @@ declare namespace Excel { xlErrorBarTypeStError = 4, } - // tslint:disable-next-line:no-const-enum const enum XlErrorChecks { xlEmptyCellReferences = 7, xlEvaluateToError = 1, @@ -1346,13 +1348,11 @@ declare namespace Excel { xlUnlockedFormulaCells = 6, } - // tslint:disable-next-line:no-const-enum const enum XlFileAccess { xlReadOnly = 3, xlReadWrite = 2, } - // tslint:disable-next-line:no-const-enum const enum XlFileFormat { xlAddIn = 18, xlAddIn8 = 18, @@ -1410,27 +1410,23 @@ declare namespace Excel { xlXMLSpreadsheet = 46, } - // tslint:disable-next-line:no-const-enum const enum XlFileValidationPivotMode { xlFileValidationPivotDefault = 0, xlFileValidationPivotRun = 1, xlFileValidationPivotSkip = 2, } - // tslint:disable-next-line:no-const-enum const enum XlFillWith { xlFillWithAll = -4104, xlFillWithContents = 2, xlFillWithFormats = -4122, } - // tslint:disable-next-line:no-const-enum const enum XlFilterAction { xlFilterCopy = 2, xlFilterInPlace = 1, } - // tslint:disable-next-line:no-const-enum const enum XlFilterAllDatesInPeriod { xlFilterAllDatesInPeriodDay = 2, xlFilterAllDatesInPeriodHour = 3, @@ -1440,26 +1436,22 @@ declare namespace Excel { xlFilterAllDatesInPeriodYear = 0, } - // tslint:disable-next-line:no-const-enum const enum XlFindLookIn { xlComments = -4144, xlFormulas = -4123, xlValues = -4163, } - // tslint:disable-next-line:no-const-enum const enum XlFixedFormatQuality { xlQualityMinimum = 1, xlQualityStandard = 0, } - // tslint:disable-next-line:no-const-enum const enum XlFixedFormatType { xlTypePDF = 0, xlTypeXPS = 1, } - // tslint:disable-next-line:no-const-enum const enum XlFormatConditionOperator { xlBetween = 1, xlEqual = 3, @@ -1471,7 +1463,6 @@ declare namespace Excel { xlNotEqual = 4, } - // tslint:disable-next-line:no-const-enum const enum XlFormatConditionType { xlAboveAverageCondition = 12, xlBlanksCondition = 10, @@ -1489,7 +1480,6 @@ declare namespace Excel { xlUniqueValues = 8, } - // tslint:disable-next-line:no-const-enum const enum XlFormatFilterTypes { xlFilterBottom = 0, xlFilterBottomPercent = 2, @@ -1497,7 +1487,6 @@ declare namespace Excel { xlFilterTopPercent = 3, } - // tslint:disable-next-line:no-const-enum const enum XlFormControl { xlButtonControl = 0, xlCheckBox = 1, @@ -1511,7 +1500,6 @@ declare namespace Excel { xlSpinner = 9, } - // tslint:disable-next-line:no-const-enum const enum XlFormulaLabel { xlColumnLabels = 2, xlMixedLabels = 3, @@ -1519,19 +1507,16 @@ declare namespace Excel { xlRowLabels = 1, } - // tslint:disable-next-line:no-const-enum const enum XlGenerateTableRefs { xlGenerateTableRefA1 = 0, xlGenerateTableRefStruct = 1, } - // tslint:disable-next-line:no-const-enum const enum XlGradientFillType { xlGradientFillLinear = 0, xlGradientFillPath = 1, } - // tslint:disable-next-line:no-const-enum const enum XlHAlign { xlHAlignCenter = -4108, xlHAlignCenterAcrossSelection = 7, @@ -1543,7 +1528,6 @@ declare namespace Excel { xlHAlignRight = -4152, } - // tslint:disable-next-line:no-const-enum const enum XlHebrewModes { xlHebrewFullScript = 0, xlHebrewMixedAuthorizedScript = 3, @@ -1551,14 +1535,12 @@ declare namespace Excel { xlHebrewPartialScript = 1, } - // tslint:disable-next-line:no-const-enum const enum XlHighlightChangesTime { xlAllChanges = 2, xlNotYetReviewed = 3, xlSinceMyLastSave = 1, } - // tslint:disable-next-line:no-const-enum const enum XlHtmlType { xlHtmlCalc = 1, xlHtmlChart = 3, @@ -1566,7 +1548,6 @@ declare namespace Excel { xlHtmlStatic = 0, } - // tslint:disable-next-line:no-const-enum const enum XlIcon { xlIcon0Bars = 37, xlIcon0FilledBoxes = 52, @@ -1623,7 +1604,6 @@ declare namespace Excel { xlIconYellowUpInclineArrow = 25, } - // tslint:disable-next-line:no-const-enum const enum XlIconSet { xl3Arrows = 1, xl3ArrowsGray = 2, @@ -1648,7 +1628,6 @@ declare namespace Excel { xlCustomSet = -1, } - // tslint:disable-next-line:no-const-enum const enum XlIMEMode { xlIMEModeAlpha = 8, xlIMEModeAlphaFull = 7, @@ -1663,39 +1642,33 @@ declare namespace Excel { xlIMEModeOn = 1, } - // tslint:disable-next-line:no-const-enum const enum XlImportDataAs { xlPivotTableReport = 1, xlQueryTable = 0, xlTable = 2, } - // tslint:disable-next-line:no-const-enum const enum XlInsertFormatOrigin { xlFormatFromLeftOrAbove = 0, xlFormatFromRightOrBelow = 1, } - // tslint:disable-next-line:no-const-enum const enum XlInsertShiftDirection { xlShiftDown = -4121, xlShiftToRight = -4161, } - // tslint:disable-next-line:no-const-enum const enum XlLayoutFormType { xlOutline = 1, xlTabular = 0, } - // tslint:disable-next-line:no-const-enum const enum XlLayoutRowType { xlCompactRow = 0, xlOutlineRow = 2, xlTabularRow = 1, } - // tslint:disable-next-line:no-const-enum const enum XlLegendPosition { xlLegendPositionBottom = -4107, xlLegendPositionCorner = 2, @@ -1705,7 +1678,6 @@ declare namespace Excel { xlLegendPositionTop = -4160, } - // tslint:disable-next-line:no-const-enum const enum XlLineStyle { xlContinuous = 1, xlDash = -4115, @@ -1717,7 +1689,6 @@ declare namespace Excel { xlSlantDashDot = 13, } - // tslint:disable-next-line:no-const-enum const enum XlLink { xlExcelLinks = 1, xlOLELinks = 2, @@ -1725,21 +1696,18 @@ declare namespace Excel { xlSubscribers = 6, } - // tslint:disable-next-line:no-const-enum const enum XlLinkInfo { xlEditionDate = 2, xlLinkInfoStatus = 3, xlUpdateState = 1, } - // tslint:disable-next-line:no-const-enum const enum XlLinkInfoType { xlLinkInfoOLELinks = 2, xlLinkInfoPublishers = 5, xlLinkInfoSubscribers = 6, } - // tslint:disable-next-line:no-const-enum const enum XlLinkStatus { xlLinkStatusCopiedValues = 10, xlLinkStatusIndeterminate = 5, @@ -1754,13 +1722,11 @@ declare namespace Excel { xlLinkStatusSourceOpen = 9, } - // tslint:disable-next-line:no-const-enum const enum XlLinkType { xlLinkTypeExcelLinks = 1, xlLinkTypeOLELinks = 2, } - // tslint:disable-next-line:no-const-enum const enum XlListConflict { xlListConflictDialog = 0, xlListConflictDiscardAllConflicts = 2, @@ -1768,7 +1734,6 @@ declare namespace Excel { xlListConflictRetryAllConflicts = 1, } - // tslint:disable-next-line:no-const-enum const enum XlListDataType { xlListDataTypeCheckbox = 9, xlListDataTypeChoice = 6, @@ -1785,7 +1750,6 @@ declare namespace Excel { xlListDataTypeText = 1, } - // tslint:disable-next-line:no-const-enum const enum XlListObjectSourceType { xlSrcExternal = 0, xlSrcQuery = 3, @@ -1793,7 +1757,6 @@ declare namespace Excel { xlSrcXml = 2, } - // tslint:disable-next-line:no-const-enum const enum XlLocationInTable { xlColumnHeader = -4110, xlColumnItem = 5, @@ -1806,27 +1769,23 @@ declare namespace Excel { xlTableBody = 8, } - // tslint:disable-next-line:no-const-enum const enum XlLookAt { xlPart = 2, xlWhole = 1, } - // tslint:disable-next-line:no-const-enum const enum XlLookFor { xlLookForBlanks = 0, xlLookForErrors = 1, xlLookForFormulas = 2, } - // tslint:disable-next-line:no-const-enum const enum XlMailSystem { xlMAPI = 1, xlNoMailSystem = 0, xlPowerTalk = 2, } - // tslint:disable-next-line:no-const-enum const enum XlMarkerStyle { xlMarkerStyleAutomatic = -4105, xlMarkerStyleCircle = 8, @@ -1842,21 +1801,18 @@ declare namespace Excel { xlMarkerStyleX = -4168, } - // tslint:disable-next-line:no-const-enum const enum XlMeasurementUnits { xlCentimeters = 1, xlInches = 0, xlMillimeters = 2, } - // tslint:disable-next-line:no-const-enum const enum XlMouseButton { xlNoButton = 0, xlPrimaryButton = 1, xlSecondaryButton = 2, } - // tslint:disable-next-line:no-const-enum const enum XlMousePointer { xlDefault = -4143, xlIBeam = 3, @@ -1864,7 +1820,6 @@ declare namespace Excel { xlWait = 2, } - // tslint:disable-next-line:no-const-enum const enum XlMSApplication { xlMicrosoftAccess = 4, xlMicrosoftFoxPro = 5, @@ -1875,46 +1830,39 @@ declare namespace Excel { xlMicrosoftWord = 1, } - // tslint:disable-next-line:no-const-enum const enum XlOartHorizontalOverflow { xlOartHorizontalOverflowClip = 1, xlOartHorizontalOverflowOverflow = 0, } - // tslint:disable-next-line:no-const-enum const enum XlOartVerticalOverflow { xlOartVerticalOverflowClip = 1, xlOartVerticalOverflowEllipsis = 2, xlOartVerticalOverflowOverflow = 0, } - // tslint:disable-next-line:no-const-enum const enum XlObjectSize { xlFitToPage = 2, xlFullPage = 3, xlScreenSize = 1, } - // tslint:disable-next-line:no-const-enum const enum XlOLEType { xlOLEControl = 2, xlOLEEmbed = 1, xlOLELink = 0, } - // tslint:disable-next-line:no-const-enum const enum XlOLEVerb { xlVerbOpen = 2, xlVerbPrimary = 1, } - // tslint:disable-next-line:no-const-enum const enum XlOrder { xlDownThenOver = 1, xlOverThenDown = 2, } - // tslint:disable-next-line:no-const-enum const enum XlOrientation { xlDownward = -4170, xlHorizontal = -4128, @@ -1922,26 +1870,22 @@ declare namespace Excel { xlVertical = -4166, } - // tslint:disable-next-line:no-const-enum const enum XlPageBreak { xlPageBreakAutomatic = -4105, xlPageBreakManual = -4135, xlPageBreakNone = -4142, } - // tslint:disable-next-line:no-const-enum const enum XlPageBreakExtent { xlPageBreakFull = 1, xlPageBreakPartial = 2, } - // tslint:disable-next-line:no-const-enum const enum XlPageOrientation { xlLandscape = 2, xlPortrait = 1, } - // tslint:disable-next-line:no-const-enum const enum XlPaperSize { xlPaper10x14 = 16, xlPaper11x17 = 17, @@ -1987,7 +1931,6 @@ declare namespace Excel { xlPaperUser = 256, } - // tslint:disable-next-line:no-const-enum const enum XlParameterDataType { xlParamTypeBigInt = -5, xlParamTypeBinary = -2, @@ -2012,14 +1955,12 @@ declare namespace Excel { xlParamTypeWChar = -8, } - // tslint:disable-next-line:no-const-enum const enum XlParameterType { xlConstant = 1, xlPrompt = 0, xlRange = 2, } - // tslint:disable-next-line:no-const-enum const enum XlPasteSpecialOperation { xlPasteSpecialOperationAdd = 2, xlPasteSpecialOperationDivide = 5, @@ -2028,7 +1969,6 @@ declare namespace Excel { xlPasteSpecialOperationSubtract = 3, } - // tslint:disable-next-line:no-const-enum const enum XlPasteType { xlPasteAll = -4104, xlPasteAllExceptBorders = 7, @@ -2044,7 +1984,6 @@ declare namespace Excel { xlPasteValuesAndNumberFormats = 12, } - // tslint:disable-next-line:no-const-enum const enum XlPattern { xlPatternAutomatic = -4105, xlPatternChecker = 9, @@ -2070,7 +2009,6 @@ declare namespace Excel { xlPatternVertical = -4166, } - // tslint:disable-next-line:no-const-enum const enum XlPhoneticAlignment { xlPhoneticAlignCenter = 2, xlPhoneticAlignDistributed = 3, @@ -2078,7 +2016,6 @@ declare namespace Excel { xlPhoneticAlignNoControl = 0, } - // tslint:disable-next-line:no-const-enum const enum XlPhoneticCharacterType { xlHiragana = 2, xlKatakana = 1, @@ -2086,13 +2023,11 @@ declare namespace Excel { xlNoConversion = 3, } - // tslint:disable-next-line:no-const-enum const enum XlPictureAppearance { xlPrinter = 2, xlScreen = 1, } - // tslint:disable-next-line:no-const-enum const enum XlPictureConvertorType { xlBMP = 1, xlCGM = 7, @@ -2109,7 +2044,6 @@ declare namespace Excel { xlWPG = 3, } - // tslint:disable-next-line:no-const-enum const enum XlPieSliceIndex { xlCenterPoint = 5, xlInnerCenterPoint = 8, @@ -2122,13 +2056,11 @@ declare namespace Excel { xlOuterCounterClockwisePoint = 1, } - // tslint:disable-next-line:no-const-enum const enum XlPieSliceLocation { xlHorizontalCoordinate = 1, xlVerticalCoordinate = 2, } - // tslint:disable-next-line:no-const-enum const enum XlPivotCellType { xlPivotCellBlankCell = 9, xlPivotCellCustomSubtotal = 7, @@ -2142,14 +2074,12 @@ declare namespace Excel { xlPivotCellValue = 0, } - // tslint:disable-next-line:no-const-enum const enum XlPivotConditionScope { xlDataFieldScope = 2, xlFieldsScope = 1, xlSelectionScope = 0, } - // tslint:disable-next-line:no-const-enum const enum XlPivotFieldCalculation { xlDifferenceFrom = 2, xlIndex = 9, @@ -2168,14 +2098,12 @@ declare namespace Excel { xlRunningTotal = 5, } - // tslint:disable-next-line:no-const-enum const enum XlPivotFieldDataType { xlDate = 2, xlNumber = -4145, xlText = -4158, } - // tslint:disable-next-line:no-const-enum const enum XlPivotFieldOrientation { xlColumnField = 2, xlDataField = 4, @@ -2184,13 +2112,11 @@ declare namespace Excel { xlRowField = 1, } - // tslint:disable-next-line:no-const-enum const enum XlPivotFieldRepeatLabels { xlDoNotRepeatLabels = 1, xlRepeatLabels = 2, } - // tslint:disable-next-line:no-const-enum const enum XlPivotFilterType { xlAfter = 33, xlAfterOrEqualTo = 34, @@ -2262,7 +2188,6 @@ declare namespace Excel { xlYearToDate = 52, } - // tslint:disable-next-line:no-const-enum const enum XlPivotFormatType { xlPTClassic = 20, xlPTNone = 21, @@ -2288,7 +2213,6 @@ declare namespace Excel { xlTable9 = 18, } - // tslint:disable-next-line:no-const-enum const enum XlPivotLineType { xlPivotLineBlank = 3, xlPivotLineGrandTotal = 2, @@ -2296,7 +2220,6 @@ declare namespace Excel { xlPivotLineSubtotal = 1, } - // tslint:disable-next-line:no-const-enum const enum XlPivotTableMissingItems { xlMissingItemsDefault = -1, xlMissingItemsMax = 32500, @@ -2304,7 +2227,6 @@ declare namespace Excel { xlMissingItemsNone = 0, } - // tslint:disable-next-line:no-const-enum const enum XlPivotTableSourceType { xlConsolidation = 3, xlDatabase = 1, @@ -2313,7 +2235,6 @@ declare namespace Excel { xlScenario = 4, } - // tslint:disable-next-line:no-const-enum const enum XlPivotTableVersionList { xlPivotTableVersion10 = 1, xlPivotTableVersion11 = 2, @@ -2323,28 +2244,24 @@ declare namespace Excel { xlPivotTableVersionCurrent = -1, } - // tslint:disable-next-line:no-const-enum const enum XlPlacement { xlFreeFloating = 3, xlMove = 2, xlMoveAndSize = 1, } - // tslint:disable-next-line:no-const-enum const enum XlPlatform { xlMacintosh = 1, xlMSDOS = 3, xlWindows = 2, } - // tslint:disable-next-line:no-const-enum const enum XlPortugueseReform { xlPortugueseBoth = 3, xlPortuguesePostReform = 2, xlPortuguesePreReform = 1, } - // tslint:disable-next-line:no-const-enum const enum XlPrintErrors { xlPrintErrorsBlank = 1, xlPrintErrorsDash = 2, @@ -2352,42 +2269,36 @@ declare namespace Excel { xlPrintErrorsNA = 3, } - // tslint:disable-next-line:no-const-enum const enum XlPrintLocation { xlPrintInPlace = 16, xlPrintNoComments = -4142, xlPrintSheetEnd = 1, } - // tslint:disable-next-line:no-const-enum const enum XlPriority { xlPriorityHigh = -4127, xlPriorityLow = -4134, xlPriorityNormal = -4143, } - // tslint:disable-next-line:no-const-enum const enum XlPropertyDisplayedIn { xlDisplayPropertyInPivotTable = 1, xlDisplayPropertyInPivotTableAndTooltip = 3, xlDisplayPropertyInTooltip = 2, } - // tslint:disable-next-line:no-const-enum const enum XlProtectedViewCloseReason { xlProtectedViewCloseEdit = 1, xlProtectedViewCloseForced = 2, xlProtectedViewCloseNormal = 0, } - // tslint:disable-next-line:no-const-enum const enum XlProtectedViewWindowState { xlProtectedViewWindowMaximized = 2, xlProtectedViewWindowMinimized = 1, xlProtectedViewWindowNormal = 0, } - // tslint:disable-next-line:no-const-enum const enum XlPTSelectionMode { xlBlanks = 4, xlButton = 15, @@ -2398,7 +2309,6 @@ declare namespace Excel { xlOrigin = 3, } - // tslint:disable-next-line:no-const-enum const enum XlQueryType { xlADORecordset = 7, xlDAORecordset = 2, @@ -2408,7 +2318,6 @@ declare namespace Excel { xlWebQuery = 4, } - // tslint:disable-next-line:no-const-enum const enum XlRangeAutoFormat { xlRangeAutoFormat3DEffects1 = 13, xlRangeAutoFormat3DEffects2 = 14, @@ -2455,20 +2364,17 @@ declare namespace Excel { xlRangeAutoFormatTable9 = 40, } - // tslint:disable-next-line:no-const-enum const enum XlRangeValueDataType { xlRangeValueDefault = 10, xlRangeValueMSPersistXML = 12, xlRangeValueXMLSpreadsheet = 11, } - // tslint:disable-next-line:no-const-enum const enum XlReferenceStyle { xlA1 = 1, xlR1C1 = -4150, } - // tslint:disable-next-line:no-const-enum const enum XlReferenceType { xlAbsolute = 1, xlAbsRowRelColumn = 2, @@ -2476,7 +2382,6 @@ declare namespace Excel { xlRelRowAbsColumn = 3, } - // tslint:disable-next-line:no-const-enum const enum XlRemoveDocInfoType { xlRDIAll = 99, xlRDIComments = 1, @@ -2497,7 +2402,6 @@ declare namespace Excel { xlRDISendForReview = 7, } - // tslint:disable-next-line:no-const-enum const enum XlRgbColor { rgbAliceBlue = 16775408, rgbAntiqueWhite = 14150650, @@ -2645,33 +2549,28 @@ declare namespace Excel { rgbYellowGreen = 3329434, } - // tslint:disable-next-line:no-const-enum const enum XlRobustConnect { xlAlways = 1, xlAsRequired = 0, xlNever = 2, } - // tslint:disable-next-line:no-const-enum const enum XlRoutingSlipDelivery { xlAllAtOnce = 2, xlOneAfterAnother = 1, } - // tslint:disable-next-line:no-const-enum const enum XlRoutingSlipStatus { xlNotYetRouted = 0, xlRoutingComplete = 2, xlRoutingInProgress = 1, } - // tslint:disable-next-line:no-const-enum const enum XlRowCol { xlColumns = 2, xlRows = 1, } - // tslint:disable-next-line:no-const-enum const enum XlRunAutoMacro { xlAutoActivate = 3, xlAutoClose = 2, @@ -2679,51 +2578,43 @@ declare namespace Excel { xlAutoOpen = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSaveAction { xlDoNotSaveChanges = 2, xlSaveChanges = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSaveAsAccessMode { xlExclusive = 3, xlNoChange = 1, xlShared = 2, } - // tslint:disable-next-line:no-const-enum const enum XlSaveConflictResolution { xlLocalSessionChanges = 2, xlOtherSessionChanges = 3, xlUserResolution = 1, } - // tslint:disable-next-line:no-const-enum const enum XlScaleType { xlScaleLinear = -4132, xlScaleLogarithmic = -4133, } - // tslint:disable-next-line:no-const-enum const enum XlSearchDirection { xlNext = 1, xlPrevious = 2, } - // tslint:disable-next-line:no-const-enum const enum XlSearchOrder { xlByColumns = 2, xlByRows = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSearchWithin { xlWithinSheet = 1, xlWithinWorkbook = 2, } - // tslint:disable-next-line:no-const-enum const enum XlSheetType { xlChart = -4109, xlDialogSheet = -4116, @@ -2732,34 +2623,29 @@ declare namespace Excel { xlWorksheet = -4167, } - // tslint:disable-next-line:no-const-enum const enum XlSheetVisibility { xlSheetHidden = 0, xlSheetVeryHidden = 2, xlSheetVisible = -1, } - // tslint:disable-next-line:no-const-enum const enum XlSizeRepresents { xlSizeIsArea = 1, xlSizeIsWidth = 2, } - // tslint:disable-next-line:no-const-enum const enum XlSlicerCrossFilterType { xlSlicerCrossFilterShowItemsWithDataAtTop = 2, xlSlicerCrossFilterShowItemsWithNoData = 3, xlSlicerNoCrossFilter = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSlicerSort { xlSlicerSortAscending = 2, xlSlicerSortDataSourceOrder = 1, xlSlicerSortDescending = 3, } - // tslint:disable-next-line:no-const-enum const enum XlSmartTagControlType { xlSmartTagControlActiveX = 13, xlSmartTagControlButton = 6, @@ -2777,32 +2663,27 @@ declare namespace Excel { xlSmartTagControlTextbox = 10, } - // tslint:disable-next-line:no-const-enum const enum XlSmartTagDisplayMode { xlButtonOnly = 2, xlDisplayNone = 1, xlIndicatorAndButton = 0, } - // tslint:disable-next-line:no-const-enum const enum XlSortDataOption { xlSortNormal = 0, xlSortTextAsNumbers = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSortMethod { xlPinYin = 1, xlStroke = 2, } - // tslint:disable-next-line:no-const-enum const enum XlSortMethodOld { xlCodePage = 2, xlSyllabary = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSortOn { xlSortOnCellColor = 1, xlSortOnFontColor = 2, @@ -2810,25 +2691,21 @@ declare namespace Excel { xlSortOnValues = 0, } - // tslint:disable-next-line:no-const-enum const enum XlSortOrder { xlAscending = 1, xlDescending = 2, } - // tslint:disable-next-line:no-const-enum const enum XlSortOrientation { xlSortColumns = 1, xlSortRows = 2, } - // tslint:disable-next-line:no-const-enum const enum XlSortType { xlSortLabels = 2, xlSortValues = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSourceType { xlSourceAutoFilter = 3, xlSourceChart = 5, @@ -2840,41 +2717,35 @@ declare namespace Excel { xlSourceWorkbook = 0, } - // tslint:disable-next-line:no-const-enum const enum XlSpanishModes { xlSpanishTuteoAndVoseo = 1, xlSpanishTuteoOnly = 0, xlSpanishVoseoOnly = 2, } - // tslint:disable-next-line:no-const-enum const enum XlSparklineRowCol { xlSparklineColumnsSquare = 2, xlSparklineNonSquare = 0, xlSparklineRowsSquare = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSparkScale { xlSparkScaleCustom = 3, xlSparkScaleGroup = 1, xlSparkScaleSingle = 2, } - // tslint:disable-next-line:no-const-enum const enum XlSparkType { xlSparkColumn = 2, xlSparkColumnStacked100 = 3, xlSparkLine = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSpeakDirection { xlSpeakByColumns = 1, xlSpeakByRows = 0, } - // tslint:disable-next-line:no-const-enum const enum XlSpecialCellsValue { xlErrors = 16, xlLogical = 4, @@ -2882,7 +2753,6 @@ declare namespace Excel { xlTextValues = 2, } - // tslint:disable-next-line:no-const-enum const enum XlStdColorScale { xlColorScaleBlackWhite = 3, xlColorScaleGYR = 2, @@ -2890,37 +2760,31 @@ declare namespace Excel { xlColorScaleWhiteBlack = 4, } - // tslint:disable-next-line:no-const-enum const enum XlSubscribeToFormat { xlSubscribeToPicture = -4147, xlSubscribeToText = -4158, } - // tslint:disable-next-line:no-const-enum const enum XlSubtototalLocationType { xlAtBottom = 2, xlAtTop = 1, } - // tslint:disable-next-line:no-const-enum const enum XlSummaryColumn { xlSummaryOnLeft = -4131, xlSummaryOnRight = -4152, } - // tslint:disable-next-line:no-const-enum const enum XlSummaryReportType { xlStandardSummary = 1, xlSummaryPivotTable = -4148, } - // tslint:disable-next-line:no-const-enum const enum XlSummaryRow { xlSummaryAbove = 0, xlSummaryBelow = 1, } - // tslint:disable-next-line:no-const-enum const enum XlTableStyleElementType { xlBlankRow = 19, xlColumnStripe1 = 7, @@ -2962,32 +2826,27 @@ declare namespace Excel { xlWholeTable = 0, } - // tslint:disable-next-line:no-const-enum const enum XlTabPosition { xlTabPositionFirst = 0, xlTabPositionLast = 1, } - // tslint:disable-next-line:no-const-enum const enum XlTextParsingType { xlDelimited = 1, xlFixedWidth = 2, } - // tslint:disable-next-line:no-const-enum const enum XlTextQualifier { xlTextQualifierDoubleQuote = 1, xlTextQualifierNone = -4142, xlTextQualifierSingleQuote = 2, } - // tslint:disable-next-line:no-const-enum const enum XlTextVisualLayoutType { xlTextVisualLTR = 1, xlTextVisualRTL = 2, } - // tslint:disable-next-line:no-const-enum const enum XlThemeColor { xlThemeColorAccent1 = 5, xlThemeColorAccent2 = 6, @@ -3003,20 +2862,17 @@ declare namespace Excel { xlThemeColorLight2 = 4, } - // tslint:disable-next-line:no-const-enum const enum XlThemeFont { xlThemeFontMajor = 1, xlThemeFontMinor = 2, xlThemeFontNone = 0, } - // tslint:disable-next-line:no-const-enum const enum XlThreadMode { xlThreadModeAutomatic = 0, xlThreadModeManual = 1, } - // tslint:disable-next-line:no-const-enum const enum XlTickLabelOrientation { xlTickLabelOrientationAutomatic = -4105, xlTickLabelOrientationDownward = -4170, @@ -3025,7 +2881,6 @@ declare namespace Excel { xlTickLabelOrientationVertical = -4166, } - // tslint:disable-next-line:no-const-enum const enum XlTickLabelPosition { xlTickLabelPositionHigh = -4127, xlTickLabelPositionLow = -4134, @@ -3033,7 +2888,6 @@ declare namespace Excel { xlTickLabelPositionNone = -4142, } - // tslint:disable-next-line:no-const-enum const enum XlTickMark { xlTickMarkCross = 4, xlTickMarkInside = 2, @@ -3041,7 +2895,6 @@ declare namespace Excel { xlTickMarkOutside = 3, } - // tslint:disable-next-line:no-const-enum const enum XlTimePeriods { xlLast7Days = 2, xlLastMonth = 5, @@ -3055,14 +2908,12 @@ declare namespace Excel { xlYesterday = 1, } - // tslint:disable-next-line:no-const-enum const enum XlTimeUnit { xlDays = 0, xlMonths = 1, xlYears = 2, } - // tslint:disable-next-line:no-const-enum const enum XlToolbarProtection { xlNoButtonChanges = 1, xlNoChanges = 4, @@ -3071,13 +2922,11 @@ declare namespace Excel { xlToolbarProtectionNone = -4143, } - // tslint:disable-next-line:no-const-enum const enum XlTopBottom { xlTop10Bottom = 0, xlTop10Top = 1, } - // tslint:disable-next-line:no-const-enum const enum XlTotalsCalculation { xlTotalsCalculationAverage = 2, xlTotalsCalculationCount = 3, @@ -3091,7 +2940,6 @@ declare namespace Excel { xlTotalsCalculationVar = 8, } - // tslint:disable-next-line:no-const-enum const enum XlTrendlineType { xlExponential = 5, xlLinear = -4132, @@ -3101,7 +2949,6 @@ declare namespace Excel { xlPower = 4, } - // tslint:disable-next-line:no-const-enum const enum XlUnderlineStyle { xlUnderlineStyleDouble = -4119, xlUnderlineStyleDoubleAccounting = 5, @@ -3110,14 +2957,12 @@ declare namespace Excel { xlUnderlineStyleSingleAccounting = 4, } - // tslint:disable-next-line:no-const-enum const enum XlUpdateLinks { xlUpdateLinksAlways = 3, xlUpdateLinksNever = 2, xlUpdateLinksUserSetting = 1, } - // tslint:disable-next-line:no-const-enum const enum XlVAlign { xlVAlignBottom = -4107, xlVAlignCenter = -4108, @@ -3126,7 +2971,6 @@ declare namespace Excel { xlVAlignTop = -4160, } - // tslint:disable-next-line:no-const-enum const enum XlWBATemplate { xlWBATChart = -4109, xlWBATExcel4IntlMacroSheet = 4, @@ -3134,28 +2978,24 @@ declare namespace Excel { xlWBATWorksheet = -4167, } - // tslint:disable-next-line:no-const-enum const enum XlWebFormatting { xlWebFormattingAll = 1, xlWebFormattingNone = 3, xlWebFormattingRTF = 2, } - // tslint:disable-next-line:no-const-enum const enum XlWebSelectionType { xlAllTables = 2, xlEntirePage = 1, xlSpecifiedTables = 3, } - // tslint:disable-next-line:no-const-enum const enum XlWindowState { xlMaximized = -4137, xlMinimized = -4140, xlNormal = -4143, } - // tslint:disable-next-line:no-const-enum const enum XlWindowType { xlChartAsWindow = 5, xlChartInPlace = 4, @@ -3164,34 +3004,29 @@ declare namespace Excel { xlWorkbook = 1, } - // tslint:disable-next-line:no-const-enum const enum XlWindowView { xlNormalView = 1, xlPageBreakPreview = 2, xlPageLayoutView = 3, } - // tslint:disable-next-line:no-const-enum const enum XlXLMMacroType { xlCommand = 2, xlFunction = 1, xlNotXLM = 3, } - // tslint:disable-next-line:no-const-enum const enum XlXmlExportResult { xlXmlExportSuccess = 0, xlXmlExportValidationFailed = 1, } - // tslint:disable-next-line:no-const-enum const enum XlXmlImportResult { xlXmlImportElementsTruncated = 1, xlXmlImportSuccess = 0, xlXmlImportValidationFailed = 2, } - // tslint:disable-next-line:no-const-enum const enum XlXmlLoadOption { xlXmlLoadImportToList = 2, xlXmlLoadMapXml = 3, @@ -3199,13 +3034,37 @@ declare namespace Excel { xlXmlLoadPromptUser = 0, } - // tslint:disable-next-line:no-const-enum const enum XlYesNoGuess { xlGuess = 0, xlNo = 2, xlYes = 1, } + class AboveAverage { + private 'Excel.AboveAverage_typekey': AboveAverage; + private constructor(); + AboveBelow: XlAboveBelow; + readonly Application: Application; + readonly AppliesTo: Range; + readonly Borders: Borders; + CalcFor: XlCalcFor; + readonly Creator: XlCreator; + Delete(): void; + readonly Font: Font; + readonly Interior: Interior; + ModifyAppliesToRange(Range: Range): void; + NumberFormat: string; + NumStdDev: number; + readonly Parent: any; + Priority: number; + readonly PTCondition: boolean; + ScopeType: XlPivotConditionScope; + SetFirstPriority(): void; + SetLastPriority(): void; + StopIfTrue: boolean; + readonly Type: number; + } + class Action { private 'Excel.Action_typekey': Action; private constructor(); @@ -3220,15 +3079,14 @@ declare namespace Excel { readonly Type: XlActionType; } - class Actions { - private 'Excel.Actions_typekey': Actions; - private constructor(); - _Default(Index: any): Action; + interface Actions { + _Default(Index: number | string): Action; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): Action; + Item(Index: number | string): Action; readonly Parent: any; + (Index: number | string): Action; } class AddIn { @@ -3251,38 +3109,26 @@ declare namespace Excel { readonly Title: string; } - class AddIns { - private 'Excel.AddIns_typekey': AddIns; - private constructor(); - _Default(Index: any): AddIn; - Add(Filename: string, CopyFile?: any): AddIn; + interface AddIns { + _Default(Index: number | string): AddIn; + Add(Filename: string, CopyFile?: boolean): AddIn; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): AddIn; + Item(Index: number | string): AddIn; readonly Parent: any; + (Index: number | string): AddIn; } - class AddIns2 { - private 'Excel.AddIns2_typekey': AddIns2; - private constructor(); - _Default(Index: any): AddIn; - Add(Filename: string, CopyFile?: any): AddIn; - readonly Application: Application; - readonly Count: number; - readonly Creator: XlCreator; - Item(Index: any): AddIn; - readonly Parent: any; - } + type AddIns2 = AddIns; - class Adjustments { - private 'Excel.Adjustments_typekey': Adjustments; - private constructor(); + interface Adjustments { readonly Application: any; readonly Count: number; readonly Creator: number; Item(Index: number): number; readonly Parent: any; + (Index: number): number; } class AllowEditRange { @@ -3292,17 +3138,16 @@ declare namespace Excel { Delete(): void; Range: Range; Title: string; - Unprotect(Password?: any): void; + Unprotect(Password?: string): void; readonly Users: UserAccessList; } - class AllowEditRanges { - private 'Excel.AllowEditRanges_typekey': AllowEditRanges; - private constructor(); - _Default(Index: any): AllowEditRange; - Add(Title: string, Range: Range, Password?: any): AllowEditRange; + interface AllowEditRanges { + _Default(Index: number | string): AllowEditRange; + Add(Title: string, Range: Range, Password?: string): AllowEditRange; readonly Count: number; - Item(Index: any): AllowEditRange; + Item(Index: number | string): AllowEditRange; + (Index: number | string): AllowEditRange; } class Application { @@ -3311,17 +3156,10 @@ declare namespace Excel { readonly _Default: string; _Evaluate(Name: any): any; _FindFile(): void; - _MacroOptions( - Macro?: any, Description?: any, HasMenu?: any, MenuText?: any, HasShortcutKey?: any, ShortcutKey?: any, Category?: any, StatusBar?: any, HelpContextID?: any, HelpFile?: any): void; - _Run2( - Macro?: any, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + _MacroOptions(Macro?: any, Description?: any, HasMenu?: any, MenuText?: any, HasShortcutKey?: any, ShortcutKey?: any, Category?: any, StatusBar?: any, HelpContextID?: any, HelpFile?: any): void; + _Run2(Macro?: any, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; _Wait(Time: any): void; - _WSFunction( - Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + _WSFunction(Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; ActivateMicrosoftApp(Index: XlMSApplication): void; readonly ActiveCell: Range; readonly ActiveChart: Chart; @@ -3330,11 +3168,11 @@ declare namespace Excel { readonly ActiveMenuBar: MenuBar; ActivePrinter: string; readonly ActiveProtectedViewWindow: ProtectedViewWindow; - readonly ActiveSheet: Worksheet | Chart | DialogSheet; + readonly ActiveSheet: Sheet; readonly ActiveWindow: Window; readonly ActiveWorkbook: Workbook; AddChartAutoFormat(Chart: any, Name: string, Description?: any): void; - AddCustomList(ListArray: any, ByRow?: any): void; + AddCustomList(ListArray: SafeArray | Range, ByRow?: boolean): void; readonly AddIns: AddIns; readonly AddIns2: AddIns2; AlertBeforeOverwriting: boolean; @@ -3361,17 +3199,17 @@ declare namespace Excel { CalculationInterruptKey: XlCalculationInterruptKey; readonly CalculationState: XlCalculationState; readonly CalculationVersion: number; - Caller(Index?: any): any; + Caller(Index?: number): Range | string | Error; readonly CanPlaySounds: boolean; readonly CanRecordSounds: boolean; Caption: string; CellDragAndDrop: boolean; readonly Cells: Range; CentimetersToPoints(Centimeters: number): number; - readonly Charts: Sheets; - CheckAbort(KeepAbort?: any): void; - CheckSpelling(Word: string, CustomDictionary?: any, IgnoreUppercase?: any): boolean; - ClipboardFormats(Index?: any): any; + readonly Charts: Sheets; + CheckAbort(KeepAbort?: boolean): void; + CheckSpelling(Word: string, CustomDictionary?: string, IgnoreUppercase?: boolean): boolean; + ClipboardFormats: SafeArray & ((Index: number) => XlClipboardFormat); ClusterConnector: string; ColorButtons: boolean; readonly Columns: Range; @@ -3380,7 +3218,7 @@ declare namespace Excel { CommandUnderlines: XlCommandUnderlines; ConstrainNumeric: boolean; ControlCharacters: boolean; - ConvertFormula(Formula: any, FromReferenceStyle: XlReferenceStyle, ToReferenceStyle?: any, ToAbsolute?: any, RelativeTo?: any): any; + ConvertFormula(Formula: string, FromReferenceStyle: XlReferenceStyle, ToReferenceStyle?: XlReferenceStyle, ToAbsolute?: XlReferenceType, RelativeTo?: Range): string; CopyObjectsWithCells: boolean; readonly Creator: XlCreator; Cursor: XlMousePointer; @@ -3403,7 +3241,7 @@ declare namespace Excel { DeleteChartAutoFormat(Name: string): void; DeleteCustomList(ListNum: number): void; readonly Dialogs: Dialogs; - readonly DialogSheets: Sheets; + readonly DialogSheets: Sheets; DisplayAlerts: boolean; DisplayClipboardWindow: boolean; DisplayCommentIndicator: XlCommentDisplayMode; @@ -3421,26 +3259,21 @@ declare namespace Excel { DisplayRecentFiles: boolean; DisplayScrollBars: boolean; DisplayStatusBar: boolean; - DisplayXMLSourcePane(XmlMap?: any): void; + DisplayXMLSourcePane(XmlMap?: XmlMap): void; DoubleClick(): void; Dummy1(Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any): any; Dummy10(arg?: any): boolean; readonly Dummy101: any; Dummy11(): void; Dummy12(p1: PivotTable, p2: PivotTable): void; - Dummy13( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + Dummy13(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; Dummy14(): void; Dummy2(Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any): any; Dummy20(grfCompareFunctions: number): any; Dummy22: boolean; Dummy23: boolean; Dummy3(): any; - Dummy4( - Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any): any; + Dummy4(Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any): any; Dummy5(Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any): any; Dummy6(): any; Dummy7(): any; @@ -3456,13 +3289,13 @@ declare namespace Excel { EnableSound: boolean; EnableTipWizard: boolean; readonly ErrorCheckingOptions: ErrorCheckingOptions; - Evaluate(Name: any): any; + Evaluate(Name: string): any; readonly Excel4IntlMacroSheets: Sheets; readonly Excel4MacroSheets: Sheets; ExecuteExcel4Macro(String: string): any; ExtendList: boolean; FeatureInstall: Office.MsoFeatureInstall; - FileConverters(Index1?: any, Index2?: any): any; + FileConverters(Index1?: string, Index2?: string): SafeArray; FileDialog(fileDialogType: Office.MsoFileDialogType): Office.FileDialog; readonly FileExportConverters: FileExportConverters; readonly FileFind: Office.IFind; @@ -3476,27 +3309,31 @@ declare namespace Excel { FormulaBarHeight: number; GenerateGetPivotData: boolean; GenerateTableRefs: XlGenerateTableRefs; - GetCustomListContents(ListNum: number): any; - GetCustomListNum(ListArray: any): number; - GetOpenFilename(FileFilter?: any, FilterIndex?: any, Title?: any, ButtonText?: any, MultiSelect?: any): any; - GetPhonetic(Text?: any): string; - GetSaveAsFilename(InitialFilename?: any, FileFilter?: any, FilterIndex?: any, Title?: any, ButtonText?: any): any; - Goto(Reference?: any, Scroll?: any): void; + GetCustomListContents(ListNum: number): SafeArray; + GetCustomListNum(ListArray: SafeArray): number; + + /** @param ButtonText Macintosh only */ + GetOpenFilename(FileFilter?: string, FilterIndex?: number, Title?: string, ButtonText?: null, MultiSelect?: false): string; + + /** @param ButtonText Macintosh only */ + GetOpenFilename(FileFilter: string | null, FilterIndex: number | null, Title: string | null, ButtonText: null, MultiSelect: true): SafeArray; + GetPhonetic(Text?: string): string; + + /** @param ButtonText Macintosh only */ + GetSaveAsFilename(InitialFilename?: string, FileFilter?: string, FilterIndex?: number, Title?: string, ButtonText?: undefined): string; + Goto(Reference?: Range | string, Scroll?: boolean): void; Height: number; - Help(HelpFile?: any, HelpContextID?: any): void; + Help(HelpFile?: string, HelpContextID?: number): void; HighQualityModeForGraphics: boolean; readonly Hinstance: number; - readonly HinstancePtr: any; + readonly HinstancePtr: number; readonly Hwnd: number; IgnoreRemoteRequests: boolean; InchesToPoints(Inches: number): number; - InputBox(Prompt: string, Title?: any, Default?: any, Left?: any, Top?: any, HelpFile?: any, HelpContextID?: any, Type?: any): any; + InputBox(Prompt: string, Title?: string, Default?: string, Left?: number, Top?: number, HelpFile?: string, HelpContextID?: number, Type?: InputBoxReturnType): string | number | boolean | Range | Error | SafeArray | SafeArray | SafeArray; Interactive: boolean; - International(Index?: any): any; - Intersect( - Arg1: Range, Arg2: Range, Arg3?: Range, Arg4?: Range, Arg5?: Range, Arg6?: Range, Arg7?: Range, Arg8?: Range, Arg9?: Range, Arg10?: Range, Arg11?: Range, Arg12?: Range, - Arg13?: Range, Arg14?: Range, Arg15?: Range, Arg16?: Range, Arg17?: Range, Arg18?: Range, Arg19?: Range, Arg20?: Range, Arg21?: Range, Arg22?: Range, Arg23?: Range, Arg24?: Range, - Arg25?: Range, Arg26?: Range, Arg27?: Range, Arg28?: Range, Arg29?: Range, Arg30?: Range): Range; + International: SafeArray & ((Index: T) => InternationalResult); + Intersect(Arg1: Range, Arg2: Range, Arg3?: Range, Arg4?: Range, Arg5?: Range, Arg6?: Range, Arg7?: Range, Arg8?: Range, Arg9?: Range, Arg10?: Range, Arg11?: Range, Arg12?: Range, Arg13?: Range, Arg14?: Range, Arg15?: Range, Arg16?: Range, Arg17?: Range, Arg18?: Range, Arg19?: Range, Arg20?: Range, Arg21?: Range, Arg22?: Range, Arg23?: Range, Arg24?: Range, Arg25?: Range, Arg26?: Range, Arg27?: Range, Arg28?: Range, Arg29?: Range, Arg30?: Range): Range; readonly IsSandboxed: boolean; Iteration: boolean; readonly LanguageSettings: Office.LanguageSettings; @@ -3504,12 +3341,10 @@ declare namespace Excel { LargeOperationCellThousandCount: number; Left: number; readonly LibraryPath: string; - MacroOptions( - Macro?: any, Description?: any, HasMenu?: any, MenuText?: any, HasShortcutKey?: any, ShortcutKey?: any, Category?: any, StatusBar?: any, HelpContextID?: any, - HelpFile?: any, ArgumentDescriptions?: any): void; + MacroOptions(Macro?: string, Description?: string, HasMenu?: undefined, MenuText?: undefined, HasShortcutKey?: boolean, ShortcutKey?: string, Category?: FunctionCategory | string, StatusBar?: string, HelpContextID?: number, HelpFile?: string, ArgumentDescriptions?: SafeArray): void; MailLogoff(): void; - MailLogon(Name?: any, Password?: any, DownloadNewMail?: any): void; - readonly MailSession: any; + MailLogon(Name?: string, Password?: string, DownloadNewMail?: boolean): void; + readonly MailSession: string | null; readonly MailSystem: XlMailSystem; MapPaperSize: boolean; readonly MathCoprocessorAvailable: boolean; @@ -3537,11 +3372,11 @@ declare namespace Excel { OnData: string; OnDoubleClick: string; OnEntry: string; - OnKey(Key: string, Procedure?: any): void; + OnKey(Key: string, Procedure?: string): void; OnRepeat(Text: string, Procedure: string): void; OnSheetActivate: string; OnSheetDeactivate: string; - OnTime(EarliestTime: any, Procedure: string, LatestTime?: any, Schedule?: any): void; + OnTime(EarliestTime: any, Procedure: string, LatestTime?: any, Schedule?: boolean): void; OnUndo(Text: string, Procedure: string): void; OnWindow: string; readonly OperatingSystem: string; @@ -3550,7 +3385,7 @@ declare namespace Excel { readonly Path: string; readonly PathSeparator: string; PivotTableSelection: boolean; - PreviousSelections(Index?: any): any; + PreviousSelections(Index: 1 | 2 | 3 | 4): Range | null; PrintCommunication: boolean; readonly ProductCode: string; PromptForSummaryInfo: boolean; @@ -3560,10 +3395,13 @@ declare namespace Excel { Range(Cell1: string | Range, Cell2?: string | Range): Range; readonly Ready: boolean; readonly RecentFiles: RecentFiles; - RecordMacro(BasicCode?: any, XlmCode?: any): void; + RecordMacro(BasicCode: string): void; + + /** This overload prevents recording */ + RecordMacro(BasicCode: '', XlmCode: ''): void; readonly RecordRelative: boolean; ReferenceStyle: XlReferenceStyle; - RegisteredFunctions(Index1?: any, Index2?: any): any; + RegisteredFunctions(Index1: string | undefined, Index2?: string): SafeArray | null; RegisterXLL(Filename: string): boolean; Repeat(): void; ReplaceFormat: CellFormat; @@ -3571,16 +3409,15 @@ declare namespace Excel { RollZoom: boolean; readonly Rows: Range; readonly RTD: RTD; - Run( - Macro?: any, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + Run(Macro?: string | Range | number, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; Save(Filename?: any): void; SaveISO8601Dates: boolean; + + /** @deprecated */ SaveWorkspace(Filename?: any): void; ScreenUpdating: boolean; readonly Selection: any; - SendKeys(Keys: any, Wait?: any): void; + SendKeys(Keys: string, Wait?: boolean): void; SetDefaultChart(FormatName?: any, Gallery?: any): void; SharePointVersion(bstrUrl: string): number; readonly Sheets: Sheets; @@ -3603,7 +3440,15 @@ declare namespace Excel { StandardFont: string; StandardFontSize: number; readonly StartupPath: string; - StatusBar: any; + + /** + * Get or set the text of the status bar + * + * Returns `false` if Microsoft Excel has control of the status bar. + * + * To restore the default status bar text, set the property to False ; this works even if the status bar is hidden. + */ + StatusBar: string | false; Support(Object: any, ID: number, arg?: any): any; readonly TemplatesPath: string; readonly ThisCell: Range; @@ -3616,10 +3461,7 @@ declare namespace Excel { TransitionNavigKeys: boolean; UILanguage: number; Undo(): void; - Union( - Arg1: Range, Arg2: Range, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): Range; + Union(Arg1: Range, Arg2: Range, Arg3?: Range, Arg4?: Range, Arg5?: Range, Arg6?: Range, Arg7?: Range, Arg8?: Range, Arg9?: Range, Arg10?: Range, Arg11?: Range, Arg12?: Range, Arg13?: Range, Arg14?: Range, Arg15?: Range, Arg16?: Range, Arg17?: Range, Arg18?: Range, Arg19?: Range, Arg20?: Range, Arg21?: Range, Arg22?: Range, Arg23?: Range, Arg24?: Range, Arg25?: Range, Arg26?: Range, Arg27?: Range, Arg28?: Range, Arg29?: Range, Arg30?: Range): Range; readonly UsableHeight: number; readonly UsableWidth: number; UseClusterConnector: boolean; @@ -3632,7 +3474,11 @@ declare namespace Excel { readonly VBE: VBIDE.VBE; readonly Version: string; Visible: boolean; - Volatile(Volatile?: any): void; + + /** + * @param Volatile [Volatile=true] + */ + Volatile(Volatile?: boolean): void; Wait(Time: any): boolean; WarnOnFunctionNameConflict: boolean; readonly Watches: Watches; @@ -3642,24 +3488,25 @@ declare namespace Excel { WindowState: XlWindowState; readonly Workbooks: Workbooks; readonly WorksheetFunction: WorksheetFunction; - readonly Worksheets: Sheets; + readonly Worksheets: Sheets; } - class Areas { - private 'Excel.Areas_typekey': Areas; - private constructor(); + interface Areas { _Default(Index: number): Range; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: number): Range; readonly Parent: any; + (Index: number): Range; } class AutoCorrect { private 'Excel.AutoCorrect_typekey': AutoCorrect; private constructor(); - AddReplacement(What: string, Replacement: string): any; + + /** @returns The string to be replaced */ + AddReplacement(What: string, Replacement: string): string; readonly Application: Application; AutoExpandListRange: boolean; AutoFillFormulasInLists: boolean; @@ -3667,10 +3514,12 @@ declare namespace Excel { CorrectCapsLock: boolean; CorrectSentenceCap: boolean; readonly Creator: XlCreator; - DeleteReplacement(What: string): any; + + /** @returns The string to be replaced */ + DeleteReplacement(What: string): string; DisplayAutoCorrectOptions: boolean; readonly Parent: any; - ReplacementList(Index?: any): any; + ReplacementList(Index: number): SafeArray; ReplaceText: boolean; TwoInitialCapitals: boolean; } @@ -3700,62 +3549,172 @@ declare namespace Excel { Time: number; } + interface Axes { + /** @param AxisGroup [AxisGroup=1] */ + _Default(Type: XlAxisType, AxisGroup?: XlAxisGroup): Axis; + readonly Application: Application; + readonly Count: number; + readonly Creator: XlCreator; + + /** @param AxisGroup [AxisGroup=1] */ + Item(Type: XlAxisType, AxisGroup?: XlAxisGroup): Axis; + readonly Parent: any; + + /** @param AxisGroup [AxisGroup=1] */ + (Type: XlAxisType, AxisGroup?: XlAxisGroup): Axis; + } + + class Axis { + private 'Excel.Axis_typekey': Axis; + private constructor(); + readonly Application: Application; + AxisBetweenCategories: boolean; + readonly AxisGroup: XlAxisGroup; + readonly AxisTitle: AxisTitle; + BaseUnit: XlTimeUnit; + BaseUnitIsAuto: boolean; + readonly Border: Border; + CategoryNames: SafeArray | Range; + CategoryType: XlCategoryType; + readonly Creator: XlCreator; + Crosses: XlAxisCrosses; + CrossesAt: number; + Delete(): any; + DisplayUnit: XlDisplayUnit; + DisplayUnitCustom: number; + readonly DisplayUnitLabel: DisplayUnitLabel; + readonly Format: ChartFormat; + HasDisplayUnitLabel: boolean; + HasMajorGridlines: boolean; + HasMinorGridlines: boolean; + HasTitle: boolean; + readonly Height: number; + readonly Left: number; + LogBase: number; + readonly MajorGridlines: Gridlines; + MajorTickMark: XlTickMark; + MajorUnit: number; + MajorUnitIsAuto: boolean; + MajorUnitScale: XlTimeUnit; + MaximumScale: number; + MaximumScaleIsAuto: boolean; + MinimumScale: number; + MinimumScaleIsAuto: boolean; + readonly MinorGridlines: Gridlines; + MinorTickMark: XlTickMark; + MinorUnit: number; + MinorUnitIsAuto: boolean; + MinorUnitScale: XlTimeUnit; + readonly Parent: any; + ReversePlotOrder: boolean; + ScaleType: XlScaleType; + Select(): any; + TickLabelPosition: XlTickLabelPosition; + readonly TickLabels: TickLabels; + TickLabelSpacing: number; + TickLabelSpacingIsAuto: boolean; + TickMarkSpacing: number; + readonly Top: number; + Type: XlAxisType; + readonly Width: number; + } + + class AxisTitle { + private 'Excel.AxisTitle_typekey': AxisTitle; + private constructor(); + readonly Application: Application; + AutoScaleFont: any; + readonly Border: Border; + Caption: string; + Characters(Start?: number, Length?: number): Characters; + readonly Creator: XlCreator; + Delete(): any; + readonly Fill: ChartFillFormat; + readonly Font: Font; + readonly Format: ChartFormat; + Formula: string; + FormulaLocal: string; + FormulaR1C1: string; + FormulaR1C1Local: string; + readonly Height: number; + HorizontalAlignment: HorizontalAlignments; + IncludeInLayout: boolean; + readonly Interior: Interior; + Left: number; + readonly Name: string; + Orientation: number | XlOrientation; + readonly Parent: any; + Position: XlChartElementPosition; + ReadingOrder: number; + Select(): any; + Shadow: boolean; + Text: string; + Top: number; + VerticalAlignment: VerticalAlignments; + readonly Width: number; + } + class Border { private 'Excel.Border_typekey': Border; private constructor(); readonly Application: Application; - Color: any; - ColorIndex: any; + Color: XlRgbColor | number; + ColorIndex: number | XlColorIndex; readonly Creator: XlCreator; - LineStyle: XlLineStyle | Constants.xlGray25 | Constants.xlGray50 | Constants.xlGray75 | Constants.xlAutomatic; + LineStyle: LineStyle; readonly Parent: any; - ThemeColor: any; - TintAndShade: any; - Weight: any; + ThemeColor: XlThemeColor; + TintAndShade: number; + Weight: XlBorderWeight; } - class Borders { - private 'Excel.Borders_typekey': Borders; - private constructor(); + interface Borders { _Default(Index: XlBordersIndex): Border; readonly Application: Application; - Color: any; - ColorIndex: any; + Color: XlRgbColor | number; + ColorIndex: number | XlColorIndex | null; readonly Count: number; readonly Creator: XlCreator; Item(Index: XlBordersIndex): Border; - LineStyle: any; + LineStyle: LineStyle; readonly Parent: any; - ThemeColor: any; - TintAndShade: any; - Value: any; - Weight: any; + ThemeColor: XlThemeColor; + TintAndShade: number; + Value: LineStyle; + Weight: XlBorderWeight; + (Index: XlBordersIndex): Border; } - class CalculatedFields { - private 'Excel.CalculatedFields_typekey': CalculatedFields; - private constructor(); + interface CalculatedFields { _Add(Name: string, Formula: string): PivotField; _Default(Field: any): PivotField; - Add(Name: string, Formula: string, UseStandardFormula?: any): PivotField; + + /** + * @param UseStandardFormula [UseStandardFormula=false] + */ + Add(Name: string, Formula: string, UseStandardFormula?: boolean): PivotField; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): PivotField; + Item(Index: number | string): PivotField; readonly Parent: any; + (Field: number | string): PivotField; } - class CalculatedItems { - private 'Excel.CalculatedItems_typekey': CalculatedItems; - private constructor(); + interface CalculatedItems { _Add(Name: string, Formula: string): PivotItem; - _Default(Field: any): PivotItem; - Add(Name: string, Formula: string, UseStandardFormula?: any): PivotItem; + _Default(Field: number | string): PivotItem; + + /** + * @param UseStandardFormula [UseStandardFormula=false] + */ + Add(Name: string, Formula: string, UseStandardFormula?: boolean): PivotItem; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): PivotItem; + Item(Index: number | string): PivotItem; readonly Parent: any; + (Field: number | string): PivotItem; } class CalculatedMember { @@ -3778,17 +3737,19 @@ declare namespace Excel { readonly Type: XlCalculatedMemberType; } - class CalculatedMembers { - private 'Excel.CalculatedMembers_typekey': CalculatedMembers; - private constructor(); + interface CalculatedMembers { _Add(Name: string, Formula: string, SolveOrder?: any, Type?: any): CalculatedMember; _Default(Index: any): CalculatedMember; - Add(Name: string, Formula: any, SolveOrder?: any, Type?: any, Dynamic?: any, DisplayFolder?: any, HierarchizeDistinct?: any): CalculatedMember; + Add(Name: string, Formula: string, SolveOrder?: number, Type?: XlCalculatedMemberType, Dynamic?: boolean, DisplayFolder?: string, HierarchizeDistinct?: boolean): CalculatedMember; + + /** @version 2013 */ + AddCalculatedMember(Name: string, Formula: string, SolveOrder?: number, Type?: XlCalculatedMemberType, DisplayFolder?: string, MeasureGroup?: any, ParentMember?: any, NumberFormat?: any): CalculatedMember; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): CalculatedMember; + Item(Index: number | string): CalculatedMember; readonly Parent: any; + (Index: number | string): CalculatedMember; } class CalloutFormat { @@ -3816,25 +3777,25 @@ declare namespace Excel { class CellFormat { private 'Excel.CellFormat_typekey': CellFormat; private constructor(); - AddIndent: any; + AddIndent: boolean; readonly Application: Application; Borders: Borders; Clear(): void; readonly Creator: XlCreator; Font: Font; - FormulaHidden: any; - HorizontalAlignment: any; - IndentLevel: any; + FormulaHidden: boolean | null; + HorizontalAlignment: HorizontalAlignments; + IndentLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15; Interior: Interior; - Locked: any; - MergeCells: any; - NumberFormat: any; - NumberFormatLocal: any; - Orientation: any; + Locked: boolean | null; + MergeCells: boolean; + NumberFormat: string | null; + NumberFormatLocal: string | null; + Orientation: number | XlOrientation; readonly Parent: any; - ShrinkToFit: any; - VerticalAlignment: any; - WrapText: any; + ShrinkToFit: boolean | null; + VerticalAlignment: VerticalAlignments; + WrapText: boolean | null; } class Characters { @@ -3844,9 +3805,9 @@ declare namespace Excel { Caption: string; readonly Count: number; readonly Creator: XlCreator; - Delete(): any; + Delete(): null; readonly Font: Font; - Insert(String: string): any; + Insert(String: string | null): string; readonly Parent: any; PhoneticCharacters: string; Text: string; @@ -3857,67 +3818,62 @@ declare namespace Excel { private constructor(); __PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any): void; - /** @param Excel.XlDataLabelsType [Type=2] */ + /** @param Type [Type=2] */ _ApplyDataLabels(Type?: XlDataLabelsType, LegendKey?: any, AutoText?: any, HasLeaderLines?: any): void; _CodeName: string; _Evaluate(Name: any): any; _PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): void; _Protect(Password?: any, DrawingObjects?: any, Contents?: any, Scenarios?: any, UserInterfaceOnly?: any): void; - _SaveAs( - Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, - TextVisualLayout?: any): void; + _SaveAs(Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, TextVisualLayout?: any): void; Activate(): void; readonly Application: Application; ApplyChartTemplate(Filename: string): void; ApplyCustomType(ChartType: XlChartType, TypeName?: any): void; - /** @param Excel.XlDataLabelsType [Type=2] */ - ApplyDataLabels( - Type?: XlDataLabelsType, LegendKey?: any, AutoText?: any, HasLeaderLines?: any, ShowSeriesName?: any, ShowCategoryName?: any, ShowValue?: any, - ShowPercentage?: any, ShowBubbleSize?: any, Separator?: any): void; - ApplyLayout(Layout: number, ChartType?: any): void; + /** @param Type [Type=2] */ + ApplyDataLabels(Type?: XlDataLabelsType, LegendKey?: boolean, AutoText?: boolean, HasLeaderLines?: boolean, ShowSeriesName?: boolean, ShowCategoryName?: boolean, ShowValue?: boolean, ShowPercentage?: boolean, ShowBubbleSize?: boolean, Separator?: string): void; + ApplyLayout(Layout: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10, ChartType?: XlChartType): void; Arcs(Index?: any): any; readonly Area3DGroup: ChartGroup; AreaGroups(Index?: any): any; AutoFormat(Gallery: number, Format?: any): void; AutoScaling: boolean; - /** @param Excel.XlAxisGroup [AxisGroup=1] */ - Axes(Type: any, AxisGroup?: XlAxisGroup): any; + /** @param AxisGroup [AxisGroup=1] */ + Axes(Type?: XlAxisType, AxisGroup?: XlAxisGroup): Axes | Axis; readonly BackWall: Walls; readonly Bar3DGroup: ChartGroup; BarGroups(Index?: any): any; BarShape: XlBarShape; Buttons(Index?: any): any; readonly ChartArea: ChartArea; - ChartGroups(Index?: any): any; - ChartObjects(Index?: any): any; - ChartStyle: any; + ChartObjects(Index?: SafeArray): ChartObjects; + ChartObjects(Index: string | number): ChartObject; + ChartStyle: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48; readonly ChartTitle: ChartTitle; ChartType: XlChartType; - ChartWizard( - Source?: any, Gallery?: any, Format?: any, PlotBy?: any, CategoryLabels?: any, SeriesLabels?: any, HasLegend?: any, Title?: any, CategoryTitle?: any, - ValueTitle?: any, ExtraTitle?: any): void; + ChartWizard(Source?: Range, Gallery?: XlChartType, Format?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10, PlotBy?: XlRowCol, CategoryLabels?: number, SeriesLabels?: number, HasLegend?: boolean, Title?: string, CategoryTitle?: string, ValueTitle?: string, ExtraTitle?: string): void; CheckBoxes(Index?: any): any; - CheckSpelling(CustomDictionary?: any, IgnoreUppercase?: any, AlwaysSuggest?: any, SpellLang?: any): void; + CheckSpelling(CustomDictionary?: string, IgnoreUppercase?: boolean, AlwaysSuggest?: boolean, SpellLang?: Office.MsoLanguageID): void; ClearToMatchStyle(): void; readonly CodeName: string; readonly Column3DGroup: ChartGroup; ColumnGroups(Index?: any): any; - Copy(Before?: any, After?: any): void; + Copy(Before?: Sheet): void; + Copy(Before: undefined, After: Sheet): void; CopyChartBuild(): void; /** - * @param Excel.XlPictureAppearance [Appearance=1] - * @param Excel.XlCopyPictureFormat [Format=-4147] - * @param Excel.XlPictureAppearance [Size=2] + * @param Appearance [Appearance=1] + * @param Format [Format=-4147] + * @param Size [Size=2] */ CopyPicture(Appearance?: XlPictureAppearance, Format?: XlCopyPictureFormat, Size?: XlPictureAppearance): void; readonly Corners: Corners; /** - * @param Excel.XlPictureAppearance [Appearance=1] - * @param Excel.XlPictureAppearance [Size=1] + * @param Appearance [Appearance=1] + * @param Size [Size=1] */ CreatePublisher(Edition: any, Appearance?: XlPictureAppearance, Size?: XlPictureAppearance, ContainsPICT?: any, ContainsBIFF?: any, ContainsRTF?: any, ContainsVALU?: any): void; readonly Creator: XlCreator; @@ -3933,17 +3889,15 @@ declare namespace Excel { Dummy24: boolean; Dummy25: boolean; Elevation: number; - Evaluate(Name: any): any; - Export(Filename: string, FilterName?: any, Interactive?: any): boolean; - ExportAsFixedFormat( - Type: XlFixedFormatType, Filename?: any, Quality?: any, IncludeDocProperties?: any, IgnorePrintAreas?: any, From?: any, To?: any, OpenAfterPublish?: any, - FixedFormatExtClassPtr?: any): void; + Evaluate(Name: string): any; + Export(Filename: string, FilterName?: string, Interactive?: boolean): boolean; + ExportAsFixedFormat(Type: XlFixedFormatType, Filename?: string, Quality?: XlFixedFormatQuality, IncludeDocProperties?: boolean, IgnorePrintAreas?: boolean, From?: number, To?: number, OpenAfterPublish?: boolean, FixedFormatExtClassPtr?: any): void; readonly Floor: Floor; GapDepth: number; GetChartElement(x: number, y: number, ElementID: number, Arg1: number, Arg2: number): void; GroupBoxes(Index?: any): any; GroupObjects(Index?: any): any; - HasAxis(Index1?: any, Index2?: any): any; + HasAxis(Index1?: XlAxisType, Index2?: XlAxisGroup): boolean; HasDataTable: boolean; HasLegend: boolean; HasPivotFields: boolean; @@ -3957,12 +3911,14 @@ declare namespace Excel { LineGroups(Index?: any): any; Lines(Index?: any): any; ListBoxes(Index?: any): any; - Location(Where: XlChartLocation, Name?: any): Chart; + Location(Where: XlChartLocation.xlLocationAsObject, Name: string): Chart; + Location(Where: XlChartLocation, Name?: string): Chart; readonly MailEnvelope: Office.MsoEnvelope; - Move(Before?: any, After?: any): void; + Move(Before?: Sheet, After?: Sheet): void; Name: string; - readonly Next: any; - OLEObjects(Index?: any): any; + readonly Next: Sheet; + OLEObjects(Index: number | string): OLEObject; + OLEObjects(): OLEObjects; OnDoubleClick: string; OnSheetActivate: string; OnSheetDeactivate: string; @@ -3970,7 +3926,7 @@ declare namespace Excel { Ovals(Index?: any): any; readonly PageSetup: PageSetup; readonly Parent: any; - Paste(Type?: any): void; + Paste(Type?: XlPasteType.xlPasteAll | XlPasteType.xlPasteFormats | XlPasteType.xlPasteFormulas): void; Perspective: number; Pictures(Index?: any): any; readonly Pie3DGroup: ChartGroup; @@ -3979,11 +3935,13 @@ declare namespace Excel { readonly PlotArea: PlotArea; PlotBy: XlRowCol; PlotVisibleOnly: boolean; - readonly Previous: any; + readonly Previous: Sheet; readonly PrintedCommentPages: number; - PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): void; - PrintPreview(EnableChanges?: any): void; - Protect(Password?: any, DrawingObjects?: any, Contents?: any, Scenarios?: any, UserInterfaceOnly?: any): void; + PrintOut(From?: number, To?: number, Copies?: number, Preview?: boolean, ActivePrinter?: string, PrintToFile?: T, Collate?: boolean, PrToFileName?: PrintToFileName): any; + PrintPreview(EnableChanges?: boolean): void; + + /** @param Scenarios Passing `true` for this argument is only valid on worksheets */ + Protect(Password?: string, DrawingObjects?: boolean, Contents?: boolean, Scenarios?: false, UserInterfaceOnly?: boolean): void; readonly ProtectContents: boolean; ProtectData: boolean; readonly ProtectDrawingObjects: boolean; @@ -3994,20 +3952,20 @@ declare namespace Excel { RadarGroups(Index?: any): any; Rectangles(Index?: any): any; Refresh(): void; - RightAngleAxes: any; - Rotation: any; - SaveAs( - Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, - TextVisualLayout?: any, Local?: any): void; + + /** `true` if the chart axes are at right angles, independent of chart rotation or elevation. Applies only to 3-D line, column, and bar charts. */ + RightAngleAxes: boolean; + Rotation: number; + SaveAs(Filename: string, FileFormat?: XlFileFormat, Password?: string, WriteResPassword?: string, ReadOnlyRecommended?: boolean, CreateBackup?: boolean, AddToMru?: boolean, TextCodepage?: any, TextVisualLayout?: any, Local?: any): void; SaveChartTemplate(Filename: string): void; readonly Scripts: Office.Scripts; ScrollBars(Index?: any): any; - Select(Replace?: any): void; - SeriesCollection(Index?: any): any; + Select(Replace?: boolean): void; + SeriesCollection(Index?: number | string): SeriesCollection | Series; SetBackgroundPicture(Filename: string): void; SetDefaultChart(Name: any): void; SetElement(Element: Office.MsoChartElementType): void; - SetSourceData(Source: Range, PlotBy?: any): void; + SetSourceData(Source: Range, PlotBy?: XlRowCol): void; readonly Shapes: Shapes; ShowAllFieldButtons: boolean; ShowAxisFieldButtons: boolean; @@ -4024,7 +3982,7 @@ declare namespace Excel { readonly Tab: Tab; TextBoxes(Index?: any): any; Type: number; - Unprotect(Password?: any): void; + Unprotect(Password?: string): void; Visible: XlSheetVisibility; readonly Walls: Walls; WallsAndGridlines2D: boolean; @@ -4138,18 +4096,114 @@ declare namespace Excel { readonly Parent: any; readonly RadarAxisLabels: TickLabels; SecondPlotSize: number; - SeriesCollection(Index?: any): any; + SeriesCollection(Index?: number | string): SeriesCollection | Series; readonly SeriesLines: SeriesLines; ShowNegativeBubbles: boolean; SizeRepresents: XlSizeRepresents; SplitType: XlChartSplitType; - SplitValue: any; + SplitValue: number; SubType: number; Type: number; readonly UpBars: UpBars; VaryByCategories: boolean; } + interface ChartGroups { + readonly Application: Application; + readonly Count: number; + readonly Creator: XlCreator; + Item(Index: number): ChartGroup; + readonly Parent: any; + (Index: number): ChartGroup; + } + + class ChartObject { + private 'Excel.ChartObject_typekey': ChartObject; + private constructor(); + _Copy(): any; + Activate(): any; + readonly Application: Application; + readonly Border: Border; + readonly BottomRightCell: Range; + BringToFront(): any; + readonly Chart: Chart; + Copy(): any; + + /** + * @param Appearance [Appearance=2] + * @param Format [Format=-4147] + */ + CopyPicture(Appearance?: XlPictureAppearance, Format?: XlCopyPictureFormat): any; + readonly Creator: XlCreator; + Cut(): any; + Delete(): any; + Duplicate(): any; + Enabled: boolean; + Height: number; + readonly Index: number; + readonly Interior: Interior; + Left: number; + Locked: boolean; + Name: string; + OnAction: string; + readonly Parent: any; + Placement: XlPlacement; + PrintObject: boolean; + ProtectChartObject: boolean; + RoundedCorners: boolean; + Select(Replace?: boolean): any; + SendToBack(): any; + Shadow: boolean; + readonly ShapeRange: ShapeRange; + Top: number; + readonly TopLeftCell: Range; + Visible: boolean; + Width: number; + readonly ZOrder: number; + } + + interface ChartObjects { + _Copy(): any; + _Default(Index: any): any; + Add(Left: number, Top: number, Width: number, Height: number): ChartObject; + readonly Application: Application; + readonly Border: Border; + BringToFront(): any; + Copy(): any; + + /** + * @param Appearance [Appearance=2] + * @param Format [Format=-4147] + */ + CopyPicture(Appearance?: XlPictureAppearance, Format?: XlCopyPictureFormat): any; + readonly Count: number; + readonly Creator: XlCreator; + Cut(): any; + Delete(): any; + Duplicate(): any; + Enabled: boolean; + Group(): GroupObject; + Height: number; + readonly Interior: Interior; + Item(Index: number | string): ChartObject; + Left: number; + Locked: boolean; + OnAction: string; + readonly Parent: any; + Placement: XlPlacement; + PrintObject: boolean; + ProtectChartObject: boolean; + RoundedCorners: boolean; + Select(Replace?: boolean): any; + SendToBack(): any; + Shadow: boolean; + readonly ShapeRange: ShapeRange; + Top: number; + Visible: boolean; + Width: number; + (Index: number | string): any; + } + class ChartTitle { private 'Excel.ChartTitle_typekey': ChartTitle; private constructor(); @@ -4157,7 +4211,7 @@ declare namespace Excel { AutoScaleFont: any; readonly Border: Border; Caption: string; - Characters(Start?: any, Length?: any): Characters; + Characters(Start?: number, Length?: number): Characters; readonly Creator: XlCreator; Delete(): any; readonly Fill: ChartFillFormat; @@ -4168,7 +4222,7 @@ declare namespace Excel { FormulaR1C1: string; FormulaR1C1Local: string; readonly Height: number; - HorizontalAlignment: any; + HorizontalAlignment: HorizontalAlignments; IncludeInLayout: boolean; readonly Interior: Interior; Left: number; @@ -4181,7 +4235,7 @@ declare namespace Excel { Shadow: boolean; Text: string; Top: number; - VerticalAlignment: any; + VerticalAlignment: VerticalAlignments; readonly Width: number; } @@ -4199,6 +4253,42 @@ declare namespace Excel { readonly Type: Office.MsoColorType; } + class ColorScale { + private 'Excel.ColorScale_typekey': ColorScale; + private constructor(); + readonly Application: Application; + readonly AppliesTo: Range; + readonly ColorScaleCriteria: ColorScaleCriteria; + readonly Creator: XlCreator; + Delete(): void; + Formula: string; + ModifyAppliesToRange(Range: Range): void; + readonly Parent: any; + Priority: number; + readonly PTCondition: boolean; + ScopeType: XlPivotConditionScope; + SetFirstPriority(): void; + SetLastPriority(): void; + readonly StopIfTrue: boolean; + readonly Type: number; + } + + interface ColorScaleCriteria { + _Default(Index: any): ColorScaleCriterion; + readonly Count: number; + Item(Index: number): ColorScaleCriterion; + (Index: number): ColorScaleCriterion; + } + + class ColorScaleCriterion { + private 'Excel.ColorScaleCriterion_typekey': ColorScaleCriterion; + private constructor(); + readonly FormatColor: FormatColor; + readonly Index: number; + Type: XlConditionValueTypes; + Value: any; + } + class Comment { private 'Excel.Comment_typekey': Comment; private constructor(); @@ -4210,32 +4300,44 @@ declare namespace Excel { readonly Parent: any; Previous(): Comment; readonly Shape: Shape; - Text(Text?: any, Start?: any, Overwrite?: any): string; + Text(Text?: string, Start?: number, Overwrite?: boolean): string; Visible: boolean; } - class Comments { - private 'Excel.Comments_typekey': Comments; - private constructor(); + interface Comments { _Default(Index: number): Comment; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: number): Comment; readonly Parent: any; + (Index: number): Comment; } - class Connections { - private 'Excel.Connections_typekey': Connections; + class ConditionValue { + private 'Excel.ConditionValue_typekey': ConditionValue; private constructor(); + readonly Application: Application; + readonly Creator: XlCreator; + Modify(newtype: XlConditionValueTypes.xlConditionValueLowestValue | XlConditionValueTypes.xlConditionValueHighestValue): void; + Modify(newtype: XlConditionValueTypes.xlConditionValueNumber | XlConditionValueTypes.xlConditionValuePercent | XlConditionValueTypes.xlConditionValuePercentile, newvalue: number): void; + Modify(newtype: XlConditionValueTypes.xlConditionValueFormula, newvalue: string): void; + Modify(newtype: XlConditionValueTypes, newvalue?: any): void; + readonly Parent: any; + readonly Type: XlConditionValueTypes; + Value: number | string; + } + + interface Connections { _Default(Index: any): WorkbookConnection; - Add(Name: string, Description: string, ConnectionString: any, CommandText: any, lCmdtype?: any): WorkbookConnection; + Add(Name: string, Description: string, ConnectionString: string, CommandText: string, lCmdtype?: any): WorkbookConnection; AddFromFile(Filename: string): WorkbookConnection; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): WorkbookConnection; + Item(Index: number): WorkbookConnection; readonly Parent: any; + (Index: number): WorkbookConnection; } class ConnectorFormat { @@ -4261,14 +4363,15 @@ declare namespace Excel { private 'Excel.ControlFormat_typekey': ControlFormat; private constructor(); _Default: number; - AddItem(Text: string, Index?: any): void; + AddItem(Text: string, Index?: number): void; readonly Application: Application; readonly Creator: XlCreator; DropDownLines: number; Enabled: boolean; LargeChange: number; LinkedCell: string; - List(Index?: any): any; + List(Index: number): string; + List(): SafeArray; ListCount: number; ListFillRange: string; ListIndex: number; @@ -4279,7 +4382,7 @@ declare namespace Excel { readonly Parent: any; PrintObject: boolean; RemoveAllItems(): void; - RemoveItem(Index: number, Count?: any): void; + RemoveItem(Index: number, Count?: number): void; SmallChange: number; Value: number; } @@ -4299,7 +4402,7 @@ declare namespace Excel { private constructor(); _AddMemberPropertyField(Property: string, PropertyOrder?: any): void; readonly _Caption: string; - AddMemberPropertyField(Property: string, PropertyOrder?: any, PropertyDisplayedIn?: any): void; + AddMemberPropertyField(Property: string, PropertyOrder?: number, PropertyDisplayedIn?: XlPropertyDisplayedIn): void; readonly AllItemsVisible: boolean; readonly Application: Application; Caption: string; @@ -4334,28 +4437,26 @@ declare namespace Excel { readonly Value: string; } - class CubeFields { - private 'Excel.CubeFields_typekey': CubeFields; - private constructor(); + interface CubeFields { _Default(Index: any): CubeField; AddSet(Name: string, Caption: string): CubeField; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): CubeField; + Item(Index: number | string): CubeField; readonly Parent: any; + (Index: number | string): CubeField; } - class CustomProperties { - private 'Excel.CustomProperties_typekey': CustomProperties; - private constructor(); + interface CustomProperties { _Default(Index: any): CustomProperty; Add(Name: string, Value: any): CustomProperty; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): CustomProperty; + Item(Index: number | string): CustomProperty; readonly Parent: any; + (Index: number | string): CustomProperty; } class CustomProperty { @@ -4383,16 +4484,139 @@ declare namespace Excel { Show(): void; } - class CustomViews { - private 'Excel.CustomViews_typekey': CustomViews; - private constructor(); + interface CustomViews { _Default(ViewName: any): CustomView; - Add(ViewName: string, PrintSettings?: any, RowColSettings?: any): CustomView; + Add(ViewName: string, PrintSettings?: boolean, RowColSettings?: boolean): CustomView; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(ViewName: any): CustomView; + Item(ViewName: number | string): CustomView; readonly Parent: any; + (ViewName: number | string): CustomView; + } + + class Databar { + private 'Excel.Databar_typekey': Databar; + private constructor(); + readonly Application: Application; + readonly AppliesTo: Range; + readonly AxisColor: FormatColor; + AxisPosition: XlDataBarAxisPosition; + readonly BarBorder: DataBarBorder; + readonly BarColor: FormatColor; + BarFillType: XlDataBarFillType; + readonly Creator: XlCreator; + Delete(): void; + Direction: number; + Formula: string; + readonly MaxPoint: ConditionValue; + readonly MinPoint: ConditionValue; + ModifyAppliesToRange(Range: Range): void; + readonly NegativeBarFormat: NegativeBarFormat; + readonly Parent: any; + PercentMax: number; + PercentMin: number; + Priority: number; + readonly PTCondition: boolean; + ScopeType: XlPivotConditionScope; + SetFirstPriority(): void; + SetLastPriority(): void; + ShowValue: boolean; + readonly StopIfTrue: boolean; + readonly Type: number; + } + + class DataBarBorder { + private 'Excel.DataBarBorder_typekey': DataBarBorder; + private constructor(); + readonly Application: Application; + readonly Color: FormatColor; + readonly Creator: XlCreator; + readonly Parent: any; + Type: XlDataBarBorderType; + } + + class DataLabel { + private 'Excel.DataLabel_typekey': DataLabel; + private constructor(); + readonly Application: Application; + AutoScaleFont: any; + AutoText: boolean; + readonly Border: Border; + Caption: string; + Characters(Start?: number, Length?: number): Characters; + readonly Creator: XlCreator; + Delete(): any; + readonly Fill: ChartFillFormat; + readonly Font: Font; + readonly Format: ChartFormat; + Formula: string; + FormulaLocal: string; + FormulaR1C1: string; + FormulaR1C1Local: string; + readonly Height: number; + HorizontalAlignment: HorizontalAlignments; + readonly Interior: Interior; + Left: number; + readonly Name: string; + NumberFormat: string; + NumberFormatLinked: boolean; + NumberFormatLocal: string; + Orientation: XlOrientation; + readonly Parent: any; + Position: XlDataLabelPosition; + ReadingOrder: number; + Select(): any; + Separator: string | XlDataLabelSeparator; + Shadow: boolean; + ShowBubbleSize: boolean; + ShowCategoryName: boolean; + ShowLegendKey: boolean; + ShowPercentage: boolean; + ShowSeriesName: boolean; + ShowValue: boolean; + Text: string; + Top: number; + Type: any; + VerticalAlignment: VerticalAlignments; + readonly Width: number; + } + + interface DataLabels { + _Default(Index: any): DataLabel; + readonly Application: Application; + AutoScaleFont: any; + AutoText: boolean; + readonly Border: Border; + readonly Count: number; + readonly Creator: XlCreator; + Delete(): any; + readonly Fill: ChartFillFormat; + readonly Font: Font; + readonly Format: ChartFormat; + HorizontalAlignment: HorizontalAlignments; + readonly Interior: Interior; + Item(Index: number): DataLabel; + readonly Name: string; + NumberFormat: string; + NumberFormatLinked: boolean; + NumberFormatLocal: string; + Orientation: XlOrientation; + readonly Parent: any; + Position: XlDataLabelPosition; + ReadingOrder: number; + Select(): any; + Separator: string | XlDataLabelSeparator; + Shadow: boolean; + ShowBubbleSize: boolean; + ShowCategoryName: boolean; + ShowLegendKey: boolean; + ShowPercentage: boolean; + ShowSeriesName: boolean; + ShowValue: boolean; + Type: any; + VerticalAlignment: VerticalAlignments; + (Index: number): DataLabel; } class DataTable { @@ -4460,14 +4684,14 @@ declare namespace Excel { private constructor(); /** - * @param Office.MsoRelativeNodePosition [pos=2] - * @param Office.MsoDiagramNodeType [nodeType=1] + * @param pos [pos=2] + * @param nodeType [nodeType=1] */ AddNode(pos?: Office.MsoRelativeNodePosition, nodeType?: Office.MsoDiagramNodeType): DiagramNode; readonly Application: any; readonly Children: DiagramNodeChildren; - /** @param Office.MsoRelativeNodePosition [pos=2] */ + /** @param pos [pos=2] */ CloneNode(copyChildren: boolean, pTargetNode: DiagramNode, pos?: Office.MsoRelativeNodePosition): DiagramNode; readonly Creator: number; Delete(): void; @@ -4481,19 +4705,16 @@ declare namespace Excel { readonly Root: DiagramNode; readonly Shape: Shape; - /** @param boolean [swapChildren=true] */ + /** @param swapChildren [swapChildren=true] */ SwapNode(pTargetNode: DiagramNode, swapChildren?: boolean): void; readonly TextShape: Shape; TransferChildren(pReceivingNode: DiagramNode): void; } - class DiagramNodeChildren { - private 'Excel.DiagramNodeChildren_typekey': DiagramNodeChildren; - private constructor(); - + interface DiagramNodeChildren { /** - * @param any [Index=-1] - * @param Office.MsoDiagramNodeType [nodeType=1] + * @param Index [Index=-1] + * @param nodeType [nodeType=1] */ AddNode(Index?: any, nodeType?: Office.MsoDiagramNodeType): DiagramNode; readonly Application: any; @@ -4504,17 +4725,17 @@ declare namespace Excel { readonly LastChild: DiagramNode; readonly Parent: any; SelectAll(): void; + (Index: any): DiagramNode; } - class DiagramNodes { - private 'Excel.DiagramNodes_typekey': DiagramNodes; - private constructor(); + interface DiagramNodes { readonly Application: any; readonly Count: number; readonly Creator: number; Item(Index: any): DiagramNode; readonly Parent: any; SelectAll(): void; + (Index: any): DiagramNode; } class Dialog { @@ -4523,10 +4744,7 @@ declare namespace Excel { readonly Application: Application; readonly Creator: XlCreator; readonly Parent: any; - Show( - Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): boolean; + Show(Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): boolean; } class DialogFrame { @@ -4538,8 +4756,8 @@ declare namespace Excel { CheckSpelling(CustomDictionary?: any, IgnoreUppercase?: any, AlwaysSuggest?: any, SpellLang?: any): any; /** - * @param Excel.XlPictureAppearance [Appearance=2] - * @param Excel.XlCopyPictureFormat [Format=-4147] + * @param Appearance [Appearance=2] + * @param Format [Format=-4147] */ CopyPicture(Appearance?: XlPictureAppearance, Format?: XlCopyPictureFormat): any; readonly Creator: XlCreator; @@ -4557,15 +4775,14 @@ declare namespace Excel { Width: number; } - class Dialogs { - private 'Excel.Dialogs_typekey': Dialogs; - private constructor(); + interface Dialogs { _Default(Index: XlBuiltInDialog): Dialog; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: XlBuiltInDialog): Dialog; readonly Parent: any; + (Index: XlBuiltInDialog): Dialog; } class DialogSheet { @@ -4579,9 +4796,7 @@ declare namespace Excel { _PasteSpecial(Format?: any, Link?: any, DisplayAsIcon?: any, IconFileName?: any, IconIndex?: any, IconLabel?: any): void; _PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): void; _Protect(Password?: any, DrawingObjects?: any, Contents?: any, Scenarios?: any, UserInterfaceOnly?: any): void; - _SaveAs( - Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, - TextVisualLayout?: any): void; + _SaveAs(Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, TextVisualLayout?: any): void; Activate(): void; readonly Application: Application; Arcs(Index?: any): any; @@ -4594,7 +4809,8 @@ declare namespace Excel { ClearCircles(): void; readonly CodeName: string; readonly Comments: Comments; - Copy(Before?: any, After?: any): void; + Copy(Before?: Sheet): void; + Copy(Before: undefined, After: Sheet): void; readonly Creator: XlCreator; readonly CustomProperties: CustomProperties; DefaultButton: any; @@ -4614,9 +4830,7 @@ declare namespace Excel { EnablePivotTable: boolean; EnableSelection: XlEnableSelection; Evaluate(Name: any): any; - ExportAsFixedFormat( - Type: XlFixedFormatType, Filename?: any, Quality?: any, IncludeDocProperties?: any, IgnorePrintAreas?: any, From?: any, To?: any, OpenAfterPublish?: any, - FixedFormatExtClassPtr?: any): void; + ExportAsFixedFormat(Type: XlFixedFormatType, Filename?: any, Quality?: any, IncludeDocProperties?: any, IgnorePrintAreas?: any, From?: any, To?: any, OpenAfterPublish?: any, FixedFormatExtClassPtr?: any): void; Focus: any; GroupBoxes(Index?: any): any; GroupObjects(Index?: any): any; @@ -4628,7 +4842,7 @@ declare namespace Excel { Lines(Index?: any): any; ListBoxes(Index?: any): any; readonly MailEnvelope: Office.MsoEnvelope; - Move(Before?: any, After?: any): void; + Move(Before?: Sheet, After?: Sheet): void; Name: string; readonly Names: Names; readonly Next: any; @@ -4645,12 +4859,9 @@ declare namespace Excel { Pictures(Index?: any): any; readonly Previous: any; readonly PrintedCommentPages: number; - PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): void; + PrintOut(From?: number, To?: number, Copies?: number, Preview?: boolean, ActivePrinter?: string, PrintToFile?: T, Collate?: boolean, PrToFileName?: PrintToFileName): any; PrintPreview(EnableChanges?: any): void; - Protect( - Password?: any, DrawingObjects?: any, Contents?: any, Scenarios?: any, UserInterfaceOnly?: any, AllowFormattingCells?: any, AllowFormattingColumns?: any, - AllowFormattingRows?: any, AllowInsertingColumns?: any, AllowInsertingRows?: any, AllowInsertingHyperlinks?: any, AllowDeletingColumns?: any, - AllowDeletingRows?: any, AllowSorting?: any, AllowFiltering?: any, AllowUsingPivotTables?: any): void; + Protect(Password?: any, DrawingObjects?: any, Contents?: any, Scenarios?: any, UserInterfaceOnly?: any, AllowFormattingCells?: any, AllowFormattingColumns?: any, AllowFormattingRows?: any, AllowInsertingColumns?: any, AllowInsertingRows?: any, AllowInsertingHyperlinks?: any, AllowDeletingColumns?: any, AllowDeletingRows?: any, AllowSorting?: any, AllowFiltering?: any, AllowUsingPivotTables?: any): void; readonly ProtectContents: boolean; readonly ProtectDrawingObjects: boolean; readonly Protection: Protection; @@ -4659,9 +4870,7 @@ declare namespace Excel { readonly QueryTables: QueryTables; Rectangles(Index?: any): any; ResetAllPageBreaks(): void; - SaveAs( - Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, - TextVisualLayout?: any, Local?: any): void; + SaveAs(Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, TextVisualLayout?: any, Local?: any): void; readonly Scripts: Office.Scripts; ScrollArea: string; ScrollBars(Index?: any): any; @@ -4678,30 +4887,73 @@ declare namespace Excel { readonly VPageBreaks: VPageBreaks; } + class DialogSheetView { + private 'Excel.DialogSheetView_typekey': DialogSheetView; + private constructor(); + readonly Application: Application; + readonly Creator: XlCreator; + readonly Parent: any; + readonly Sheet: DialogSheet; + } + class DisplayFormat { private 'Excel.DisplayFormat_typekey': DisplayFormat; private constructor(); - readonly AddIndent: any; + readonly AddIndent: boolean | null; readonly Application: Application; readonly Borders: Borders; - Characters(Start?: any, Length?: any): Characters; + Characters(Start?: number, Length?: number): Characters; readonly Creator: XlCreator; readonly Font: Font; - readonly FormulaHidden: any; + readonly FormulaHidden: boolean | null; readonly HorizontalAlignment: any; readonly IndentLevel: any; readonly Interior: Interior; - readonly Locked: any; - readonly MergeCells: any; - readonly NumberFormat: any; - readonly NumberFormatLocal: any; + readonly Locked: boolean | null; + readonly MergeCells: boolean; + readonly NumberFormat: string | null; + readonly NumberFormatLocal: string | null; readonly Orientation: any; readonly Parent: any; readonly ReadingOrder: number; - readonly ShrinkToFit: any; - readonly Style: any; + readonly ShrinkToFit: boolean; + readonly Style: Style; readonly VerticalAlignment: any; - readonly WrapText: any; + readonly WrapText: boolean; + } + + class DisplayUnitLabel { + private 'Excel.DisplayUnitLabel_typekey': DisplayUnitLabel; + private constructor(); + readonly Application: Application; + AutoScaleFont: any; + readonly Border: Border; + Caption: string; + Characters(Start?: number, Length?: number): Characters; + readonly Creator: XlCreator; + Delete(): any; + readonly Fill: ChartFillFormat; + readonly Font: Font; + readonly Format: ChartFormat; + Formula: string; + FormulaLocal: string; + FormulaR1C1: string; + FormulaR1C1Local: string; + readonly Height: number; + HorizontalAlignment: HorizontalAlignments; + readonly Interior: Interior; + Left: number; + readonly Name: string; + Orientation: XlOrientation; + readonly Parent: any; + Position: XlChartElementPosition; + ReadingOrder: number; + Select(): any; + Shadow: boolean; + Text: string; + Top: number; + VerticalAlignment: VerticalAlignments; + readonly Width: number; } class DownBars { @@ -4742,6 +4994,21 @@ declare namespace Excel { readonly Value: boolean; } + class ErrorBars { + private 'Excel.ErrorBars_typekey': ErrorBars; + private constructor(); + readonly Application: Application; + readonly Border: Border; + ClearFormats(): any; + readonly Creator: XlCreator; + Delete(): any; + EndStyle: XlEndStyleCap; + readonly Format: ChartFormat; + readonly Name: string; + readonly Parent: any; + Select(): any; + } + class ErrorCheckingOptions { private 'Excel.ErrorCheckingOptions_typekey': ErrorCheckingOptions; private constructor(); @@ -4761,14 +5028,13 @@ declare namespace Excel { UnlockedFormulaCells: boolean; } - class Errors { - private 'Excel.Errors_typekey': Errors; - private constructor(); + interface Errors { _Default(Index: any): Error; readonly Application: Application; readonly Creator: XlCreator; - Item(Index: any): Error; + Item(Index: number | XlErrorChecks): Error; readonly Parent: any; + (Index: number | XlErrorChecks): Error; } class FileExportConverter { @@ -4782,15 +5048,14 @@ declare namespace Excel { readonly Parent: any; } - class FileExportConverters { - private 'Excel.FileExportConverters_typekey': FileExportConverters; - private constructor(); + interface FileExportConverters { _Default(Index: any): FileExportConverter; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): FileExportConverter; + Item(Index: number): FileExportConverter; readonly Parent: any; + (Index: number): FileExportConverter; } class FillFormat { @@ -4848,15 +5113,14 @@ declare namespace Excel { readonly Parent: any; } - class Filters { - private 'Excel.Filters_typekey': Filters; - private constructor(); + interface Filters { _Default(Index: number): Filter; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: number): Filter; readonly Parent: any; + (Index: number): Filter; } class Floor { @@ -4872,7 +5136,7 @@ declare namespace Excel { readonly Name: string; readonly Parent: any; Paste(): void; - PictureType: any; + PictureType: XlChartPictureType; Select(): any; Thickness: number; } @@ -4881,133 +5145,103 @@ declare namespace Excel { private 'Excel.Font_typekey': Font; private constructor(); readonly Application: Application; - Background: any; - Bold: any; - Color: any; - ColorIndex: any; + Background: XlBackground; + Bold: boolean; + Color: XlRgbColor | number; + ColorIndex: number | XlColorIndex; readonly Creator: XlCreator; - FontStyle: any; - Italic: any; - Name: any; + FontStyle: 'Regular' | 'Italic' | 'Bold' | 'Bold Italic'; + Italic: boolean; + Name: string; OutlineFont: any; readonly Parent: any; Shadow: any; - Size: any; - Strikethrough: any; - Subscript: any; - Superscript: any; - ThemeColor: any; + Size: number; + Strikethrough: boolean; + Subscript: boolean; + Superscript: boolean; + ThemeColor: XlThemeColor; ThemeFont: XlThemeFont; - TintAndShade: any; - Underline: any; + TintAndShade: number; + Underline: XlUnderlineStyle; } class FormatColor { private 'Excel.FormatColor_typekey': FormatColor; private constructor(); readonly Application: Application; - Color: any; + Color: XlRgbColor | number; ColorIndex: XlColorIndex; readonly Creator: XlCreator; readonly Parent: any; - ThemeColor: any; - TintAndShade: any; + ThemeColor: XlThemeColor; + TintAndShade: number; } - class FormatConditions { - private 'Excel.FormatConditions_typekey': FormatConditions; + class FormatCondition { + private 'Excel.FormatCondition_typekey': FormatCondition; private constructor(); + _Modify(Type: XlFormatConditionType, Operator?: any, Formula1?: any, Formula2?: any): void; + readonly Application: Application; + readonly AppliesTo: Range; + readonly Borders: Borders; + readonly Creator: XlCreator; + DateOperator: XlTimePeriods; + Delete(): void; + readonly Font: Font; + readonly Formula1: string; + readonly Formula2: string; + readonly Interior: Interior; + Modify(Type: XlFormatConditionType.xlExpression, Operator: undefined, Formula1: string): void; + Modify(Type: XlFormatConditionType, Operator: XlFormatConditionOperator.xlBetween | XlFormatConditionOperator.xlNotBetween, Formula1: string, Formula2: string): void; + Modify(Type: XlFormatConditionType, Operator?: XlFormatConditionOperator, Formula1?: string, Formula2?: string, String?: any, Operator2?: any): void; + ModifyAppliesToRange(Range: Range): void; + NumberFormat: string; + readonly Operator: number; + readonly Parent: any; + Priority: number; + readonly PTCondition: boolean; + ScopeType: XlPivotConditionScope; + SetFirstPriority(): void; + SetLastPriority(): void; + StopIfTrue: boolean; + Text: string; + TextOperator: XlContainsOperator; + readonly Type: number; + } + + interface FormatConditions { _Default(Index: any): any; - Add(Type: XlFormatConditionType, Operator?: any, Formula1?: any, Formula2?: any, String?: any, TextOperator?: any, DateOperator?: any, ScopeType?: any): any; - AddAboveAverage(): any; - AddColorScale(ColorScaleType: number): any; - AddDatabar(): any; - AddIconSetCondition(): any; - AddTop10(): any; - AddUniqueValues(): any; + Add(Type: XlFormatConditionType.xlExpression, Operator: undefined, Formula1: string): FormatCondition; + Add(Type: XlFormatConditionType, Operator: XlFormatConditionOperator.xlBetween | XlFormatConditionOperator.xlNotBetween, Formula1: string, Formula2: string): FormatCondition; + Add(Type: XlFormatConditionType, Operator?: XlFormatConditionOperator, Formula1?: string, Formula2?: string, String?: any, TextOperator?: any, DateOperator?: any, ScopeType?: any): FormatCondition; + AddAboveAverage(): AboveAverage; + AddColorScale(ColorScaleType: number): ColorScale; + AddDatabar(): Databar; + AddIconSetCondition(): IconSetCondition; + AddTop10(): Top10; + AddUniqueValues(): UniqueValues; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Delete(): void; - Item(Index: any): any; + Item(Index: number | string): FormatCondition; readonly Parent: any; + (Index: number | string): FormatCondition; } class FreeformBuilder { private 'Excel.FreeformBuilder_typekey': FreeformBuilder; private constructor(); - AddNodes(SegmentType: Office.MsoSegmentType, EditingType: Office.MsoEditingType, X1: number, Y1: number, X2?: any, Y2?: any, X3?: any, Y3?: any): void; + AddNodes(SegmentType: Office.MsoSegmentType.msoSegmentCurve, EditingType: Office.MsoEditingType.msoEditingCorner, X1: number, Y1: number, X2: number, Y2: number, X3: number, Y3: number): void; + AddNodes(SegmentType: Office.MsoSegmentType, EditingType: Office.MsoEditingType.msoEditingAuto, X1: number, Y1: number): void; readonly Application: Application; ConvertToShape(): Shape; readonly Creator: XlCreator; readonly Parent: any; } - class Global { - private 'Excel.Global_typekey': Global; - private constructor(); - _Evaluate(Name: any): any; - _Run2( - Macro?: any, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; - readonly ActiveCell: Range; - readonly ActiveChart: Chart; - readonly ActiveDialog: DialogSheet; - readonly ActiveMenuBar: MenuBar; - ActivePrinter: string; - readonly ActiveSheet: any; - readonly ActiveWindow: Window; - readonly ActiveWorkbook: Workbook; - readonly AddIns: AddIns; - readonly Application: Application; - readonly Assistant: Office.Assistant; - Calculate(): void; - readonly Cells: Range; - readonly Charts: Sheets; - readonly Columns: Range; - readonly CommandBars: Office.CommandBars; - readonly Creator: XlCreator; - readonly DDEAppReturnCode: number; - DDEExecute(Channel: number, String: string): void; - DDEInitiate(App: string, Topic: string): number; - DDEPoke(Channel: number, Item: any, Data: any): void; - DDERequest(Channel: number, Item: string): any; - DDETerminate(Channel: number): void; - readonly DialogSheets: Sheets; - Evaluate(Name: any): any; - readonly Excel4IntlMacroSheets: Sheets; - readonly Excel4MacroSheets: Sheets; - ExecuteExcel4Macro(String: string): any; - Intersect( - Arg1: Range, Arg2: Range, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): Range; - readonly MenuBars: MenuBars; - readonly Modules: Modules; - readonly Names: Names; - readonly Parent: Application; - Range(Cell1: any, Cell2?: any): Range; - readonly Rows: Range; - Run( - Macro?: any, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; - readonly Selection: any; - SendKeys(Keys: any, Wait?: any): void; - readonly Sheets: Sheets; - ShortcutMenus(Index: number): Menu; - readonly ThisWorkbook: Workbook; - readonly Toolbars: Toolbars; - Union( - Arg1: Range, Arg2: Range, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): Range; - readonly Windows: Windows; - readonly Workbooks: Workbooks; - readonly WorksheetFunction: WorksheetFunction; - readonly Worksheets: Sheets; - } + // there is no way to use the Globals class from within Javascript class Graphic { private 'Excel.Graphic_typekey': Graphic; @@ -5028,16 +5262,82 @@ declare namespace Excel { Width: number; } - class GroupShapes { - private 'Excel.GroupShapes_typekey': GroupShapes; + class Gridlines { + private 'Excel.Gridlines_typekey': Gridlines; private constructor(); + readonly Application: Application; + readonly Border: Border; + readonly Creator: XlCreator; + Delete(): any; + readonly Format: ChartFormat; + readonly Name: string; + readonly Parent: any; + Select(): any; + } + + class GroupObject { + private 'Excel.GroupObject_typekey': GroupObject; + private constructor(); + _Default: number; + AddIndent: boolean; + readonly Application: Application; + ArrowHeadLength: any; + ArrowHeadStyle: any; + ArrowHeadWidth: any; + AutoSize: boolean; + readonly Border: Border; + readonly BottomRightCell: Range; + BringToFront(): any; + CheckSpelling(CustomDictionary?: any, IgnoreUppercase?: any, AlwaysSuggest?: any, SpellLang?: any): any; + Copy(): any; + + /** + * @param Appearance [Appearance=2] + * @param Format [Format=-4147] + */ + CopyPicture(Appearance?: XlPictureAppearance, Format?: XlCopyPictureFormat): any; + readonly Creator: XlCreator; + Cut(): any; + Delete(): any; + Duplicate(): any; + Enabled: boolean; + readonly Font: Font; + Height: number; + HorizontalAlignment: any; + readonly Index: number; + readonly Interior: Interior; + Left: number; + Locked: boolean; + Name: string; + OnAction: string; + Orientation: any; + readonly Parent: any; + Placement: any; + PrintObject: boolean; + ReadingOrder: number; + RoundedCorners: boolean; + Select(Replace?: any): any; + SendToBack(): any; + Shadow: boolean; + readonly ShapeRange: ShapeRange; + Top: number; + readonly TopLeftCell: Range; + Ungroup(): any; + VerticalAlignment: any; + Visible: boolean; + Width: number; + readonly ZOrder: number; + } + + interface GroupShapes { _Default(Index: any): Shape; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): Shape; + Item(Index: number | string): Shape; readonly Parent: any; - Range(Index: any): ShapeRange; + Range(Index: number | string | SafeArray): ShapeRange; + (Index: number | string): Shape; } class HeaderFooter { @@ -5073,16 +5373,15 @@ declare namespace Excel { Type: XlPageBreak; } - class HPageBreaks { - private 'Excel.HPageBreaks_typekey': HPageBreaks; - private constructor(); + interface HPageBreaks { _Default(Index: number): HPageBreak; - Add(Before: any): HPageBreak; + Add(Before: Range): HPageBreak; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: number): HPageBreak; readonly Parent: any; + (Index: number): HPageBreak; } class Hyperlink { @@ -5095,7 +5394,7 @@ declare namespace Excel { readonly Creator: XlCreator; Delete(): void; EmailSubject: string; - Follow(NewWindow?: any, AddHistory?: any, ExtraInfo?: any, Method?: any, HeaderInfo?: any): void; + Follow(NewWindow?: boolean, AddHistory?: undefined, ExtraInfo?: string | Office.ByteArray, Method?: Office.MsoExtraInfoMethod, HeaderInfo?: string): void; readonly Name: string; readonly Parent: any; readonly Range: Range; @@ -5106,17 +5405,16 @@ declare namespace Excel { readonly Type: number; } - class Hyperlinks { - private 'Excel.Hyperlinks_typekey': Hyperlinks; - private constructor(); + interface Hyperlinks { _Default(Index: any): Hyperlink; - Add(Anchor: any, Address: string, SubAddress?: any, ScreenTip?: any, TextToDisplay?: any): any; + Add(Anchor: Range | Shape, Address: string, SubAddress?: string, ScreenTip?: string, TextToDisplay?: string): Hyperlink; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Delete(): void; - Item(Index: any): Hyperlink; + Item(Index: number | string): Hyperlink; readonly Parent: any; + (Index: number | string): Hyperlink; } class Icon { @@ -5128,46 +5426,100 @@ declare namespace Excel { readonly Parent: IconSet; } - class IconSet { - private 'Excel.IconSet_typekey': IconSet; - private constructor(); + // tslint:disable-next-line:interface-name + interface IconSet { _Default(Index: any): Icon; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; readonly ID: XlIconSet; - Item(Index: any): Icon; + Item(Index: number): Icon; readonly Parent: any; + (Index: number): Icon; } - class IconSets { - private 'Excel.IconSets_typekey': IconSets; + class IconSetCondition { + private 'Excel.IconSetCondition_typekey': IconSetCondition; private constructor(); + readonly Application: Application; + readonly AppliesTo: Range; + readonly Creator: XlCreator; + Delete(): void; + Formula: string; + readonly IconCriteria: IconCriteria; + IconSet: IconSets; + ModifyAppliesToRange(Range: Range): void; + readonly Parent: any; + PercentileValues: boolean; + Priority: number; + readonly PTCondition: boolean; + ReverseOrder: boolean; + ScopeType: XlPivotConditionScope; + SetFirstPriority(): void; + SetLastPriority(): void; + ShowIconOnly: boolean; + readonly StopIfTrue: boolean; + readonly Type: number; + } + + // tslint:disable-next-line:interface-name + interface IconCriteria { + _Default(Index: any): IconCriterion; + readonly Count: number; + Item(Index: number): IconCriterion; + (Index: number): IconCriterion; + } + + class IconCriterion { + private 'Excel.IconCriterion_typekey': IconCriterion; + private constructor(); + Icon: XlIcon; + readonly Index: number; + Operator: number; + Type: XlConditionValueTypes; + Value: number | string; + } + + // tslint:disable-next-line:interface-name + interface IconSets { _Default(Index: any): any; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): any; + Item(Index: number): IconSet; readonly Parent: any; + (Index: number): IconSet; } class Interior { private 'Excel.Interior_typekey': Interior; private constructor(); readonly Application: Application; - Color: any; + Color: XlRgbColor | number; ColorIndex: number | XlColorIndex; readonly Creator: XlCreator; readonly Gradient: any; - InvertIfNegative: any; + InvertIfNegative: boolean; readonly Parent: any; - Pattern: any; - PatternColor: any; - PatternColorIndex: any; - PatternThemeColor: any; - PatternTintAndShade: any; - ThemeColor: any; - TintAndShade: any; + Pattern: XlPattern; + PatternColor: XlRgbColor | number; + PatternColorIndex: number | XlColorIndex; + PatternThemeColor: XlThemeColor; + PatternTintAndShade: number; + ThemeColor: XlThemeColor; + TintAndShade: number; + } + + class LeaderLines { + private 'Excel.LeaderLines_typekey': LeaderLines; + private constructor(); + readonly Application: Application; + readonly Border: Border; + readonly Creator: XlCreator; + Delete(): void; + readonly Format: ChartFormat; + readonly Parent: any; + Select(): void; } class Legend { @@ -5186,7 +5538,7 @@ declare namespace Excel { IncludeInLayout: boolean; readonly Interior: Interior; Left: number; - LegendEntries(Index?: any): any; + LegendEntries: LegendEntries & ((Index: number) => LegendEntry); readonly Name: string; readonly Parent: any; Position: XlLegendPosition; @@ -5196,6 +5548,66 @@ declare namespace Excel { Width: number; } + interface LegendEntries { + _Default(Index: any): LegendEntry; + readonly Application: Application; + readonly Count: number; + readonly Creator: XlCreator; + Item(Index: number): LegendEntry; + readonly Parent: any; + (Index: number): LegendEntry; + } + + class LegendEntry { + private 'Excel.LegendEntry_typekey': LegendEntry; + private constructor(); + readonly Application: Application; + AutoScaleFont: any; + readonly Creator: XlCreator; + Delete(): any; + readonly Font: Font; + readonly Format: ChartFormat; + readonly Height: number; + readonly Index: number; + readonly Left: number; + readonly LegendKey: LegendKey; + readonly Parent: any; + Select(): any; + readonly Top: number; + readonly Width: number; + } + + class LegendKey { + private 'Excel.LegendKey_typekey': LegendKey; + private constructor(); + readonly Application: Application; + readonly Border: Border; + ClearFormats(): any; + readonly Creator: XlCreator; + Delete(): any; + readonly Fill: ChartFillFormat; + readonly Format: ChartFormat; + readonly Height: number; + readonly Interior: Interior; + InvertIfNegative: boolean; + readonly Left: number; + MarkerBackgroundColor: number; + MarkerBackgroundColorIndex: XlColorIndex; + MarkerForegroundColor: number; + MarkerForegroundColorIndex: XlColorIndex; + MarkerSize: number; + MarkerStyle: XlMarkerStyle; + readonly Parent: any; + PictureType: number; + PictureUnit: number; + PictureUnit2: number; + Select(): any; + Shadow: boolean; + Smooth: boolean; + readonly Top: number; + readonly Width: number; + } + class LineFormat { private 'Excel.LineFormat_typekey': LineFormat; private constructor(); @@ -5249,16 +5661,15 @@ declare namespace Excel { readonly XPath: XPath; } - class ListColumns { - private 'Excel.ListColumns_typekey': ListColumns; - private constructor(); + interface ListColumns { _Default(Index: any): ListColumn; - Add(Position?: any): ListColumn; + Add(Position?: number): ListColumn; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): ListColumn; + Item(Index: number | string): ListColumn; readonly Parent: any; + (Index: number | string): ListColumn; } class ListDataFormat { @@ -5267,15 +5678,15 @@ declare namespace Excel { readonly _Default: XlListDataType; readonly AllowFillIn: boolean; readonly Application: Application; - readonly Choices: any; + readonly Choices: SafeArray; readonly Creator: XlCreator; readonly DecimalPlaces: number; readonly DefaultValue: any; readonly IsPercent: boolean; readonly lcid: number; readonly MaxCharacters: number; - readonly MaxNumber: any; - readonly MinNumber: any; + readonly MaxNumber: number | null; + readonly MinNumber: number | null; readonly Parent: any; readonly ReadOnly: boolean; readonly Required: boolean; @@ -5303,7 +5714,7 @@ declare namespace Excel { readonly ListRows: ListRows; Name: string; readonly Parent: any; - Publish(Target: any, LinkSource: boolean): string; + Publish(Target: SafeArray, LinkSource: boolean): string; readonly QueryTable: QueryTable; readonly Range: Range; Refresh(): void; @@ -5324,32 +5735,33 @@ declare namespace Excel { Unlink(): void; Unlist(): void; - /** @param Excel.XlListConflict [iConflictType=0] */ + /** @param iConflictType [iConflictType=0] */ UpdateChanges(iConflictType?: XlListConflict): void; readonly XmlMap: XmlMap; } - class ListObjects { - private 'Excel.ListObjects_typekey': ListObjects; - private constructor(); - + interface ListObjects { /** - * @param Excel.XlListObjectSourceType [SourceType=1] - * @param Excel.XlYesNoGuess [XlListObjectHasHeaders=0] + * @param SourceType [SourceType=1] + * @param XlListObjectHasHeaders [XlListObjectHasHeaders=0] */ _Add(SourceType?: XlListObjectSourceType, Source?: any, LinkSource?: any, XlListObjectHasHeaders?: XlYesNoGuess, Destination?: any): ListObject; _Default(Index: any): ListObject; + Add(SourceType: XlListObjectSourceType.xlSrcRange, Source?: Range, LinkSource?: undefined, XlListObjectHasHeaders?: XlYesNoGuess, Destination?: undefined, TableStyleName?: string): ListObject; + Add(SourceType: XlListObjectSourceType.xlSrcExternal, Source: SafeArray, LinkSource: boolean, XlListObjectHasHeaders: XlYesNoGuess, Destination: Range, TableStyleName?: string): ListObject; + /** - * @param Excel.XlListObjectSourceType [SourceType=1] - * @param Excel.XlYesNoGuess [XlListObjectHasHeaders=0] + * @param SourceType [SourceType=1] + * @param XlListObjectHasHeaders [XlListObjectHasHeaders=0] */ - Add(SourceType?: XlListObjectSourceType, Source?: any, LinkSource?: any, XlListObjectHasHeaders?: XlYesNoGuess, Destination?: any, TableStyleName?: any): ListObject; + Add(SourceType?: XlListObjectSourceType, Source?: any, LinkSource?: boolean, XlListObjectHasHeaders?: XlYesNoGuess, Destination?: Range, TableStyleName?: string): ListObject; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): ListObject; + Item(Index: number | string): ListObject; readonly Parent: any; + (Index: number | string): ListObject; } class ListRow { @@ -5364,19 +5776,19 @@ declare namespace Excel { readonly Range: Range; } - class ListRows { - private 'Excel.ListRows_typekey': ListRows; - private constructor(); + interface ListRows { _Add(Position?: any): ListRow; _Default(Index: any): ListRow; - Add(Position?: any, AlwaysInsert?: any): ListRow; + Add(Position?: number, AlwaysInsert?: boolean): ListRow; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): ListRow; + Item(Index: number | string): ListRow; readonly Parent: any; + (Index: number | string): ListRow; } + /** Macintosh only */ class Mailer { private 'Excel.Mailer_typekey': Mailer; private constructor(); @@ -5422,9 +5834,7 @@ declare namespace Excel { Reset(): void; } - class MenuBars { - private 'Excel.MenuBars_typekey': MenuBars; - private constructor(); + interface MenuBars { _Default(Index: any): MenuBar; Add(Name?: any): MenuBar; readonly Application: Application; @@ -5432,6 +5842,7 @@ declare namespace Excel { readonly Creator: XlCreator; Item(Index: any): MenuBar; readonly Parent: any; + (Index: any): MenuBar; } class MenuItem { @@ -5451,9 +5862,7 @@ declare namespace Excel { StatusBar: string; } - class MenuItems { - private 'Excel.MenuItems_typekey': MenuItems; - private constructor(); + interface MenuItems { _Default(Index: any): any; Add(Caption: string, OnAction?: any, ShortcutKey?: any, Before?: any, Restore?: any, StatusBar?: any, HelpFile?: any, HelpContextID?: any): MenuItem; AddMenu(Caption: string, Before?: any, Restore?: any): Menu; @@ -5462,11 +5871,10 @@ declare namespace Excel { readonly Creator: XlCreator; Item(Index: any): any; readonly Parent: any; + (Index: any): any; } - class Menus { - private 'Excel.Menus_typekey': Menus; - private constructor(); + interface Menus { _Default(Index: any): Menu; Add(Caption: string, Before?: any, Restore?: any): Menu; readonly Application: Application; @@ -5474,6 +5882,7 @@ declare namespace Excel { readonly Creator: XlCreator; Item(Index: any): Menu; readonly Parent: any; + (Index: any): Menu; } class Module { @@ -5483,9 +5892,7 @@ declare namespace Excel { _CodeName: string; _PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any): void; _Protect(Password?: any, DrawingObjects?: any, Contents?: any, Scenarios?: any, UserInterfaceOnly?: any): void; - _SaveAs( - Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, - TextVisualLayout?: any): void; + _SaveAs(Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, TextVisualLayout?: any): void; Activate(): void; readonly Application: Application; readonly CodeName: string; @@ -5507,18 +5914,14 @@ declare namespace Excel { Protect(Password?: any, DrawingObjects?: any, Contents?: any, Scenarios?: any, UserInterfaceOnly?: any): void; readonly ProtectContents: boolean; readonly ProtectionMode: boolean; - SaveAs( - Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, - TextVisualLayout?: any): void; + SaveAs(Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, TextVisualLayout?: any): void; Select(Replace?: any): void; readonly Shapes: Shapes; Unprotect(Password?: any): void; Visible: XlSheetVisibility; } - class Modules { - private 'Excel.Modules_typekey': Modules; - private constructor(); + interface Modules { __PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any): void; _Default(Index: any): any; _PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): void; @@ -5536,6 +5939,7 @@ declare namespace Excel { Select(Replace?: any): void; Visible: any; readonly VPageBreaks: VPageBreaks; + (Index: any): any; } class MultiThreadedCalculation { @@ -5564,10 +5968,10 @@ declare namespace Excel { Name: string; NameLocal: string; readonly Parent: any; - RefersTo: any; - RefersToLocal: any; - RefersToR1C1: any; - RefersToR1C1Local: any; + RefersTo: string; + RefersToLocal: string; + RefersToR1C1: string; + RefersToR1C1Local: string; readonly RefersToRange: Range; ShortcutKey: string; readonly ValidWorkbookParameter: boolean; @@ -5576,17 +5980,30 @@ declare namespace Excel { WorkbookParameter: boolean; } - class Names { - private 'Excel.Names_typekey': Names; - private constructor(); + interface Names { _Default(Index?: any, IndexLocal?: any, RefersTo?: any): Name; - Add( - Name?: any, RefersTo?: any, Visible?: any, MacroType?: any, ShortcutKey?: any, Category?: any, NameLocal?: any, RefersToLocal?: any, CategoryLocal?: any, - RefersToR1C1?: any, RefersToR1C1Local?: any): Name; + Add(Name?: string, RefersTo?: string, Visible?: boolean, MacroType?: 1 | 2 | 3, ShortcutKey?: string, Category?: FunctionCategory | string, NameLocal?: string, RefersToLocal?: string, CategoryLocal?: string, RefersToR1C1?: string, RefersToR1C1Local?: string): Name; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index?: any, IndexLocal?: any, RefersTo?: any): Name; + Item(Index: number | string): Name; + Item(Index: undefined, IndexLocal: string): Name; + Item(Index: undefined, IndexLocal: undefined, RefersTo: string): Name; + readonly Parent: any; + (Index: number | string): Name; + (Index: undefined, IndexLocal: string): Name; + (Index: undefined, IndexLocal: undefined, RefersTo: string): Name; + } + + class NegativeBarFormat { + private 'Excel.NegativeBarFormat_typekey': NegativeBarFormat; + private constructor(); + readonly Application: Application; + readonly BorderColor: FormatColor; + BorderColorType: XlDataBarNegativeColorType; + readonly Color: FormatColor; + ColorType: XlDataBarNegativeColorType; + readonly Creator: XlCreator; readonly Parent: any; } @@ -5597,9 +6014,9 @@ declare namespace Excel { readonly Application: Application; BackgroundQuery: boolean; CancelRefresh(): void; - CommandText: any; + CommandText: string; CommandType: XlCmdType; - Connection: any; + Connection: string; readonly Creator: XlCreator; EnableRefresh: boolean; readonly Parent: any; @@ -5609,12 +6026,12 @@ declare namespace Excel { RefreshOnFileOpen: boolean; RefreshPeriod: number; RobustConnect: XlRobustConnect; - SaveAsODC(ODCFileName: string, Description?: any, Keywords?: any): void; + SaveAsODC(ODCFileName: string, Description?: string, Keywords?: string): void; SavePassword: boolean; ServerCredentialsMethod: XlCredentialsMethod; ServerSSOApplicationID: string; SourceConnectionFile: string; - SourceData: any; + SourceData: string | SafeArray | PivotTable; SourceDataFile: string; } @@ -5628,33 +6045,32 @@ declare namespace Excel { readonly SqlState: string; } - class ODBCErrors { - private 'Excel.ODBCErrors_typekey': ODBCErrors; - private constructor(); + interface ODBCErrors { _Default(Index: number): ODBCError; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: number): ODBCError; readonly Parent: any; + (Index: number): ODBCError; } class OLEDBConnection { private 'Excel.OLEDBConnection_typekey': OLEDBConnection; private constructor(); - readonly ADOConnection: any; + readonly ADOConnection: ADODB.Connection; AlwaysUseConnectionFile: boolean; readonly Application: Application; BackgroundQuery: boolean; readonly CalculatedMembers: CalculatedMembers; CancelRefresh(): void; - CommandText: any; + CommandText: string; CommandType: XlCmdType; - Connection: any; + Connection: string; readonly Creator: XlCreator; EnableRefresh: boolean; readonly IsConnected: boolean; - LocalConnection: any; + LocalConnection: string; LocaleID: number; MaintainConnection: boolean; MakeConnection(): void; @@ -5669,7 +6085,7 @@ declare namespace Excel { RefreshPeriod: number; RetrieveInOfficeUILang: boolean; RobustConnect: XlRobustConnect; - SaveAsODC(ODCFileName: string, Description?: any, Keywords?: any): void; + SaveAsODC(ODCFileName: string, Description?: string, Keywords?: string): void; SavePassword: boolean; ServerCredentialsMethod: XlCredentialsMethod; ServerFillColor: boolean; @@ -5695,15 +6111,14 @@ declare namespace Excel { readonly Stage: number; } - class OLEDBErrors { - private 'Excel.OLEDBErrors_typekey': OLEDBErrors; - private constructor(); + interface OLEDBErrors { _Default(Index: number): OLEDBError; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: number): OLEDBError; readonly Parent: any; + (Index: number): OLEDBError; } class OLEFormat { @@ -5715,7 +6130,7 @@ declare namespace Excel { readonly Object: any; readonly Parent: any; readonly progID: string; - Verb(Verb?: any): void; + Verb(Verb?: XlOLEVerb): void; } class OLEObject { @@ -5732,8 +6147,8 @@ declare namespace Excel { Copy(): any; /** - * @param Excel.XlPictureAppearance [Appearance=2] - * @param Excel.XlCopyPictureFormat [Format=-4147] + * @param Appearance [Appearance=2] + * @param Format [Format=-4147] */ CopyPicture(Appearance?: XlPictureAppearance, Format?: XlCopyPictureFormat): any; readonly Creator: XlCreator; @@ -5750,13 +6165,13 @@ declare namespace Excel { Locked: boolean; Name: string; readonly Object: any; - readonly OLEType: any; + readonly OLEType: XlOLEType.xlOLELink | XlOLEType.xlOLEEmbed; OnAction: string; readonly Parent: any; - Placement: any; + Placement: XlPlacement; PrintObject: boolean; readonly progID: string; - Select(Replace?: any): any; + Select(Replace?: boolean): any; SendToBack(): any; Shadow: boolean; readonly ShapeRange: ShapeRange; @@ -5765,13 +6180,58 @@ declare namespace Excel { readonly TopLeftCell: Range; Update(): any; - /** @param Excel.XlOLEVerb [Verb=1] */ + /** @param Verb [Verb=1] */ Verb(Verb?: XlOLEVerb): any; Visible: boolean; Width: number; readonly ZOrder: number; } + class OLEObjects { + private 'Excel.OLEObjects_typekey': OLEObjects; + private constructor(); + Add(ClassType: string, Filename: undefined, Link: undefined, DisplayAsIcon: true, IconFileName?: string, IconIndex?: number, IconLabel?: string, Left?: number, Top?: number, Width?: number, Height?: number): OLEObject; + Add(ClassType: string, Filename?: undefined, Link?: undefined, DisplayAsIcon?: false, IconFileName?: undefined, IconIndex?: undefined, IconLabel?: undefined, Left?: number, Top?: number, Width?: number, Height?: number): OLEObject; + Add(ClassType: undefined, Filename: string, Link: boolean, DisplayAsIcon: true, IconFileName?: string, IconIndex?: number, IconLabel?: string, Left?: number, Top?: number, Width?: number, Height?: number): OLEObject; + Add(ClassType: undefined, Filename: string, Link?: boolean, DisplayAsIcon?: false, IconFileName?: undefined, IconIndex?: undefined, IconLabel?: undefined, Left?: number, Top?: number, Width?: number, Height?: number): OLEObject; + readonly Application: Application; + AutoLoad: boolean; + readonly Border: Border; + BringToFront(): any; + Copy(): any; + + /** + * @param Appearance [Appearance=2] + * @param Format [Format=-4147] + */ + CopyPicture(Appearance?: XlPictureAppearance, Format?: XlCopyPictureFormat): any; + readonly Count: number; + readonly Creator: XlCreator; + Cut(): any; + Delete(): any; + Duplicate(): any; + Enabled: boolean; + Group(): GroupObject; + Height: number; + readonly Interior: Interior; + Item(Index: number | string): any; + Left: number; + Locked: boolean; + OnAction: string; + readonly Parent: any; + Placement: any; + PrintObject: boolean; + Select(Replace?: boolean): any; + SendToBack(): any; + Shadow: boolean; + readonly ShapeRange: ShapeRange; + SourceName: string; + Top: number; + Visible: boolean; + Width: number; + readonly ZOrder: number; + } + class Outline { private 'Excel.Outline_typekey': Outline; private constructor(); @@ -5779,7 +6239,7 @@ declare namespace Excel { AutomaticStyles: boolean; readonly Creator: XlCreator; readonly Parent: any; - ShowLevels(RowLevels?: any, ColumnLevels?: any): any; + ShowLevels(RowLevels?: number, ColumnLevels?: number): any; SummaryColumn: XlSummaryColumn; SummaryRow: XlSummaryRow; } @@ -5795,12 +6255,11 @@ declare namespace Excel { readonly RightHeader: HeaderFooter; } - class Pages { - private 'Excel.Pages_typekey': Pages; - private constructor(); + interface Pages { _Default(Index: any): Page; readonly Count: number; - Item(Index: any): Page; + Item(Index: number): Page; + (Index: number): Page; } class PageSetup { @@ -5823,8 +6282,8 @@ declare namespace Excel { readonly EvenPage: Page; readonly FirstPage: Page; FirstPageNumber: number; - FitToPagesTall: any; - FitToPagesWide: any; + FitToPagesTall: number | false; + FitToPagesWide: number | false; FooterMargin: number; HeaderMargin: number; LeftFooter: string; @@ -5844,7 +6303,7 @@ declare namespace Excel { PrintGridlines: boolean; PrintHeadings: boolean; PrintNotes: boolean; - PrintQuality(Index?: any): any; + PrintQuality: SafeArray & ((Index: 1 | 2) => number); PrintTitleColumns: string; PrintTitleRows: string; RightFooter: string; @@ -5854,7 +6313,9 @@ declare namespace Excel { RightMargin: number; ScaleWithDocHeaderFooter: boolean; TopMargin: number; - Zoom: any; + + /** Represents a percentage between 10 and 400 */ + Zoom: number; } class Pane { @@ -5864,26 +6325,25 @@ declare namespace Excel { readonly Application: Application; readonly Creator: XlCreator; readonly Index: number; - LargeScroll(Down?: any, Up?: any, ToRight?: any, ToLeft?: any): any; + LargeScroll(Down?: number, Up?: number, ToRight?: number, ToLeft?: number): any; readonly Parent: any; PointsToScreenPixelsX(Points: number): number; PointsToScreenPixelsY(Points: number): number; ScrollColumn: number; - ScrollIntoView(Left: number, Top: number, Width: number, Height: number, Start?: any): void; + ScrollIntoView(Left: number, Top: number, Width: number, Height: number, Start?: boolean): void; ScrollRow: number; - SmallScroll(Down?: any, Up?: any, ToRight?: any, ToLeft?: any): any; + SmallScroll(Down?: number, Up?: number, ToRight?: number, ToLeft?: number): any; readonly VisibleRange: Range; } - class Panes { - private 'Excel.Panes_typekey': Panes; - private constructor(); + interface Panes { _Default(Index: number): Pane; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: number): Pane; readonly Parent: any; + (Index: number): Pane; } class Parameter { @@ -5902,17 +6362,16 @@ declare namespace Excel { readonly Value: any; } - class Parameters { - private 'Excel.Parameters_typekey': Parameters; - private constructor(); + interface Parameters { _Default(Index: any): Parameter; - Add(Name: string, iDataType?: any): Parameter; + Add(Name: string, iDataType?: XlParameterDataType): Parameter; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Delete(): void; - Item(Index: any): Parameter; + Item(Index: number | string): Parameter; readonly Parent: any; + (Index: number | string): Parameter; } class Phonetic { @@ -5928,9 +6387,7 @@ declare namespace Excel { Visible: boolean; } - class Phonetics { - private 'Excel.Phonetics_typekey': Phonetics; - private constructor(); + interface Phonetics { _Default(Index: number): any; Add(Start: number, Length: number, Text: string): void; Alignment: number; @@ -5940,12 +6397,13 @@ declare namespace Excel { readonly Creator: XlCreator; Delete(): void; readonly Font: Font; - Item(Index: number): any; + Item(Index: number): Phonetic; readonly Length: number; readonly Parent: any; readonly Start: number; Text: string; Visible: boolean; + (Index: number): Phonetic; } class PictureFormat { @@ -5980,18 +6438,18 @@ declare namespace Excel { class PivotCache { private 'Excel.PivotCache_typekey': PivotCache; private constructor(); - readonly ADOConnection: any; + readonly ADOConnection: ADODB.Connection; readonly Application: Application; BackgroundQuery: boolean; - CommandText: any; + CommandText: string; CommandType: XlCmdType; - Connection: any; - CreatePivotTable(TableDestination: any, TableName?: any, ReadData?: any, DefaultVersion?: any): PivotTable; + Connection: string; + CreatePivotTable(TableDestination: Range, TableName?: string, ReadData?: boolean, DefaultVersion?: any): PivotTable; readonly Creator: XlCreator; EnableRefresh: boolean; readonly Index: number; readonly IsConnected: boolean; - LocalConnection: any; + LocalConnection: string; MaintainConnection: boolean; MakeConnection(): void; readonly MemoryUsed: number; @@ -6001,7 +6459,7 @@ declare namespace Excel { readonly Parent: any; readonly QueryType: XlQueryType; readonly RecordCount: number; - Recordset: any; + Recordset: ADODB.Recordset; Refresh(): void; readonly RefreshDate: VarDate; readonly RefreshName: string; @@ -6009,10 +6467,10 @@ declare namespace Excel { RefreshPeriod: number; ResetTimer(): void; RobustConnect: XlRobustConnect; - SaveAsODC(ODCFileName: string, Description?: any, Keywords?: any): void; + SaveAsODC(ODCFileName: string, Description?: string, Keywords?: string): void; SavePassword: boolean; SourceConnectionFile: string; - SourceData: any; + SourceData: string | SafeArray | PivotTable; readonly SourceDataFile: string; readonly SourceType: XlPivotTableSourceType; Sql: any; @@ -6022,17 +6480,17 @@ declare namespace Excel { readonly WorkbookConnection: WorkbookConnection; } - class PivotCaches { - private 'Excel.PivotCaches_typekey': PivotCaches; - private constructor(); + interface PivotCaches { _Default(Index: any): PivotCache; Add(SourceType: XlPivotTableSourceType, SourceData?: any): PivotCache; readonly Application: Application; readonly Count: number; - Create(SourceType: XlPivotTableSourceType, SourceData?: any, Version?: any): PivotCache; + Create(SourceType: XlPivotTableSourceType.xlDatabase | XlPivotTableSourceType.xlConsolidation, SourceData: string, Version?: XlPivotTableVersionList): PivotCache; + Create(SourceType: XlPivotTableSourceType.xlExternal, SourceData: WorkbookConnection, Version?: XlPivotTableVersionList): PivotCache; readonly Creator: XlCreator; - Item(Index: any): PivotCache; + Item(Index: number): PivotCache; readonly Parent: any; + (Index: number): PivotCache; } class PivotCell { @@ -6065,7 +6523,7 @@ declare namespace Excel { private constructor(); _AutoSort(Order: number, Field: string): void; _Default: string; - AddPageItem(Item: string, ClearList?: any): void; + AddPageItem(Item: string, ClearList?: boolean): void; readonly AllItemsVisible: boolean; readonly Application: Application; AutoShow(Type: number, Range: number, Count: number, Field: string): void; @@ -6084,15 +6542,15 @@ declare namespace Excel { Calculation: XlPivotFieldCalculation; Caption: string; readonly ChildField: PivotField; - ChildItems(Index?: any): any; + readonly ChildItems: PivotItemsResult; ClearAllFilters(): void; ClearLabelFilters(): void; ClearManualFilter(): void; ClearValueFilters(): void; readonly Creator: XlCreator; readonly CubeField: CubeField; - CurrentPage: any; - CurrentPageList: any; + CurrentPage: PivotItem; + CurrentPageList: SafeArray; CurrentPageName: string; DatabaseSort: boolean; readonly DataRange: Range; @@ -6112,10 +6570,10 @@ declare namespace Excel { EnableMultiplePageItems: boolean; Formula: string; Function: XlConsolidationFunction; - readonly GroupLevel: any; + readonly GroupLevel: number; Hidden: boolean; - HiddenItems(Index?: any): any; - HiddenItemsList: any; + readonly HiddenItems: PivotItemsResult; + HiddenItemsList: SafeArray; IncludeNewItemsInFilter: boolean; readonly IsCalculated: boolean; readonly IsMemberProperty: boolean; @@ -6132,9 +6590,9 @@ declare namespace Excel { Orientation: XlPivotFieldOrientation; readonly Parent: any; readonly ParentField: PivotField; - ParentItems(Index?: any): any; + readonly ParentItems: PivotItemsResult; readonly PivotFilters: PivotFilters; - PivotItems(Index?: any): any; + readonly PivotItems: PivotItemsResult; Position: any; PropertyOrder: number; readonly PropertyParentField: PivotField; @@ -6147,12 +6605,12 @@ declare namespace Excel { readonly SourceName: string; StandardFormula: string; SubtotalName: string; - Subtotals(Index?: any): any; - readonly TotalLevels: any; + readonly Subtotals: SafeArray & ((Index: PivotFieldSubtotal) => boolean); + readonly TotalLevels: number; UseMemberPropertyAsCaption: boolean; Value: string; - VisibleItems(Index?: any): any; - VisibleItemsList: any; + readonly VisibleItems: PivotItemsResult; + VisibleItemsList: SafeArray; } class PivotFields { @@ -6161,10 +6619,12 @@ declare namespace Excel { readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): any; + Item(Index: number | string): PivotField; readonly Parent: PivotTable; } + type PivotFieldsResult = PivotFields & ((Index: number | string) => PivotField) & ((Indexes: SafeArray) => PivotFields); + class PivotFilter { private 'Excel.PivotFilter_typekey': PivotFilter; private constructor(); @@ -6186,16 +6646,15 @@ declare namespace Excel { readonly Value2: any; } - class PivotFilters { - private 'Excel.PivotFilters_typekey': PivotFilters; - private constructor(); + interface PivotFilters { _Default(Index: any): PivotFilter; Add(Type: XlPivotFilterType, DataField?: any, Value1?: any, Value2?: any, Order?: any, Name?: any, Description?: any, MemberPropertyField?: any): PivotFilter; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): PivotFilter; + Item(Index: number): PivotFilter; readonly Parent: any; + (Index: number): PivotFilter; } class PivotFormula { @@ -6212,17 +6671,16 @@ declare namespace Excel { Value: string; } - class PivotFormulas { - private 'Excel.PivotFormulas_typekey': PivotFormulas; - private constructor(); + interface PivotFormulas { _Add(Formula: string): PivotFormula; _Default(Index: any): PivotFormula; Add(Formula: string, UseStandardFormula?: any): PivotFormula; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): PivotFormula; + Item(Index: number | string): PivotFormula; readonly Parent: any; + (Index: number | string): PivotFormula; } class PivotItem { @@ -6231,7 +6689,7 @@ declare namespace Excel { _Default: string; readonly Application: Application; Caption: string; - ChildItems(Index?: any): any; + ChildItems: PivotItemsResult; readonly Creator: XlCreator; readonly DataRange: Range; Delete(): void; @@ -6254,17 +6712,29 @@ declare namespace Excel { Visible: boolean; } - class PivotItemList { - private 'Excel.PivotItemList_typekey': PivotItemList; - private constructor(); + interface PivotItemList { _Default(Field: any): PivotItem; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): PivotItem; + Item(Index: number | string): PivotItem; readonly Parent: any; + (Field: number | string): PivotItem; } + class PivotItems { + private 'Excel.PivotItems_typekey': PivotItems; + private constructor(); + Add(Name: string): void; + readonly Application: Application; + readonly Count: number; + readonly Creator: XlCreator; + Item(Index: number | string): any; + readonly Parent: PivotField; + } + + type PivotItemsResult = PivotItems & ((Index: number | string) => PivotItem) & ((Indexes: SafeArray) => PivotItems); + class PivotLayout { private 'Excel.PivotLayout_typekey': PivotLayout; private constructor(); @@ -6296,26 +6766,24 @@ declare namespace Excel { readonly Position: number; } - class PivotLineCells { - private 'Excel.PivotLineCells_typekey': PivotLineCells; - private constructor(); + interface PivotLineCells { _Default(Index: any): PivotCell; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): PivotCell; + Item(Index: number): PivotCell; readonly Parent: any; + (Index: number): PivotCell; } - class PivotLines { - private 'Excel.PivotLines_typekey': PivotLines; - private constructor(); + interface PivotLines { _Default(Index: any): PivotLine; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): PivotLine; + Item(Index: number): PivotLine; readonly Parent: any; + (Index: number): PivotLine; } class PivotTable { @@ -6323,11 +6791,11 @@ declare namespace Excel { private constructor(); _Default: string; - /** @param Excel.XlPTSelectionMode [Mode=0] */ + /** @param Mode [Mode=0] */ _PivotSelect(Name: string, Mode?: XlPTSelectionMode): void; readonly ActiveFilters: PivotFilters; AddDataField(Field: any, Caption?: any, Function?: any): PivotField; - AddFields(RowFields?: any, ColumnFields?: any, PageFields?: any, AddToTable?: any): any; + AddFields(RowFields?: string | SafeArray, ColumnFields?: string | SafeArray, PageFields?: string | SafeArray, AddToTable?: boolean): any; AllocateChanges(): void; Allocation: XlAllocation; AllocationMethod: XlAllocationMethod; @@ -6342,10 +6810,10 @@ declare namespace Excel { CalculatedMembersInFilters: boolean; ChangeConnection(conn: WorkbookConnection): void; readonly ChangeList: PivotTableChangeList; - ChangePivotCache(PivotCache: any): void; + ChangePivotCache(PivotCache: string): void; ClearAllFilters(): void; ClearTable(): void; - ColumnFields(Index?: any): any; + ColumnFields: PivotFieldsResult; ColumnGrand: boolean; readonly ColumnRange: Range; CommitChanges(): void; @@ -6353,11 +6821,11 @@ declare namespace Excel { CompactLayoutRowHeader: string; CompactRowIndent: number; ConvertToFormulas(ConvertFilters: boolean): void; - CreateCubeFile(File: string, Measures?: any, Levels?: any, Members?: any, Properties?: any): string; + CreateCubeFile(File: string, Measures?: SafeArray, Levels?: SafeArray, Members?: SafeArray>, Properties?: boolean): string; readonly Creator: XlCreator; readonly CubeFields: CubeFields; readonly DataBodyRange: Range; - DataFields(Index?: any): any; + DataFields: PivotFieldsResult; readonly DataLabelRange: Range; readonly DataPivotField: PivotField; DiscardChanges(): void; @@ -6369,10 +6837,7 @@ declare namespace Excel { DisplayImmediateItems: boolean; DisplayMemberPropertyTooltips: boolean; DisplayNullString: boolean; - Dummy15( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + Dummy15(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; EnableDataValueEditing: boolean; EnableDrilldown: boolean; EnableFieldDialog: boolean; @@ -6383,13 +6848,10 @@ declare namespace Excel { FieldListSortAscending: boolean; Format(Format: XlPivotFormatType): void; GetData(Name: string): number; - GetPivotData( - DataField?: any, Field1?: any, Item1?: any, Field2?: any, Item2?: any, Field3?: any, Item3?: any, Field4?: any, Item4?: any, Field5?: any, Item5?: any, - Field6?: any, Item6?: any, Field7?: any, Item7?: any, Field8?: any, Item8?: any, Field9?: any, Item9?: any, Field10?: any, Item10?: any, Field11?: any, - Item11?: any, Field12?: any, Item12?: any, Field13?: any, Item13?: any, Field14?: any, Item14?: any): Range; + GetPivotData(DataField?: string, Field1?: string, Item1?: string, Field2?: string, Item2?: string, Field3?: string, Item3?: string, Field4?: string, Item4?: string, Field5?: string, Item5?: string, Field6?: string, Item6?: string, Field7?: string, Item7?: string, Field8?: string, Item8?: string, Field9?: string, Item9?: string, Field10?: string, Item10?: string, Field11?: string, Item11?: string, Field12?: string, Item12?: string, Field13?: string, Item13?: string, Field14?: string, Item14?: string): Range; GrandTotalName: string; HasAutoFormat: boolean; - HiddenFields(Index?: any): any; + HiddenFields: PivotFieldsResult; InGridDropZones: boolean; InnerDetail: string; LayoutRowDefault: XlLayoutRowType; @@ -6401,7 +6863,7 @@ declare namespace Excel { Name: string; NullString: string; PageFieldOrder: number; - PageFields(Index?: any): any; + PageFields: PivotFieldsResult; PageFieldStyle: string; PageFieldWrapCount: number; readonly PageRange: Range; @@ -6409,17 +6871,16 @@ declare namespace Excel { readonly Parent: any; PivotCache(): PivotCache; readonly PivotColumnAxis: PivotAxis; - PivotFields(Index?: any): any; + PivotFields: PivotFieldsResult; readonly PivotFormulas: PivotFormulas; readonly PivotRowAxis: PivotAxis; - /** @param Excel.XlPTSelectionMode [Mode=0] */ - PivotSelect(Name: string, Mode?: XlPTSelectionMode, UseStandardName?: any): void; + /** @param Mode [Mode=0] */ + PivotSelect(Name: string, Mode?: XlPTSelectionMode, UseStandardName?: boolean): void; PivotSelection: string; PivotSelectionStandard: string; - PivotTableWizard( - SourceType?: any, SourceData?: any, TableDestination?: any, TableName?: any, RowGrand?: any, ColumnGrand?: any, SaveData?: any, HasAutoFormat?: any, - AutoPage?: any, Reserved?: any, BackgroundQuery?: any, OptimizeCache?: any, PageFieldOrder?: any, PageFieldWrapCount?: any, ReadData?: any, Connection?: any): void; + PivotTableWizard(): void; + PivotTableWizard(SourceType: TSourceType, SourceData: PivotTableWizardSourceData, TableDestination?: Range, TableName?: string, RowGrand?: boolean, ColumnGrand?: boolean, SaveData?: boolean, HasAutoFormat?: boolean, AutoPage?: PivotTableWizardAutoPage, Reserved?: undefined, BackgroundQuery?: boolean, OptimizeCache?: boolean, PageFieldOrder?: XlOrder, PageFieldWrapCount?: number, ReadData?: boolean, Connection?: string): void; PreserveFormatting: boolean; PrintDrillIndicators: boolean; PrintTitles: boolean; @@ -6430,7 +6891,7 @@ declare namespace Excel { RepeatAllLabels(Repeat: XlPivotFieldRepeatLabels): void; RepeatItemsOnEachPrintedPage: boolean; RowAxisLayout(RowLayout: XlLayoutRowType): void; - RowFields(Index?: any): any; + RowFields: PivotFieldsResult; RowGrand: boolean; readonly RowRange: Range; SaveData: boolean; @@ -6438,7 +6899,7 @@ declare namespace Excel { ShowCellBackgroundFromOLAP: boolean; ShowDrillIndicators: boolean; ShowPageMultipleItemLabel: boolean; - ShowPages(PageField?: any): any; + ShowPages(PageField?: string): any; ShowTableStyleColumnHeaders: boolean; ShowTableStyleColumnStripes: boolean; ShowTableStyleLastColumn: boolean; @@ -6463,21 +6924,20 @@ declare namespace Excel { Value: string; readonly Version: XlPivotTableVersionList; ViewCalculatedMembers: boolean; - VisibleFields(Index?: any): any; + VisibleFields: PivotFieldsResult; VisualTotals: boolean; VisualTotalsForSets: boolean; } - class PivotTableChangeList { - private 'Excel.PivotTableChangeList_typekey': PivotTableChangeList; - private constructor(); + interface PivotTableChangeList { _Default(Index: any): ValueChange; Add(Tuple: string, Value: number, AllocationValue?: any, AllocationMethod?: any, AllocationWeightExpression?: any): ValueChange; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): ValueChange; + Item(Index: number | string): ValueChange; readonly Parent: any; + (Index: number | string): ValueChange; } class PlotArea { @@ -6508,6 +6968,66 @@ declare namespace Excel { Width: number; } + class Point { + private 'Excel.Point_typekey': Point; + private constructor(); + + /** @param Type [Type=2] */ + _ApplyDataLabels(Type?: XlDataLabelsType, LegendKey?: any, AutoText?: any, HasLeaderLines?: any): any; + readonly Application: Application; + + /** @param Type [Type=2] */ + ApplyDataLabels(Type?: XlDataLabelsType, LegendKey?: boolean, AutoText?: boolean, HasLeaderLines?: boolean, ShowSeriesName?: boolean, ShowCategoryName?: boolean, ShowValue?: boolean, ShowPercentage?: boolean, ShowBubbleSize?: boolean, Separator?: string): any; + ApplyPictToEnd: boolean; + ApplyPictToFront: boolean; + ApplyPictToSides: boolean; + readonly Border: Border; + ClearFormats(): any; + Copy(): any; + readonly Creator: XlCreator; + readonly DataLabel: DataLabel; + Delete(): any; + Explosion: number; + readonly Fill: ChartFillFormat; + readonly Format: ChartFormat; + Has3DEffect: boolean; + HasDataLabel: boolean; + readonly Height: number; + readonly Interior: Interior; + InvertIfNegative: boolean; + readonly Left: number; + MarkerBackgroundColor: number; + MarkerBackgroundColorIndex: XlColorIndex; + MarkerForegroundColor: number; + MarkerForegroundColorIndex: XlColorIndex; + MarkerSize: number; + MarkerStyle: XlMarkerStyle; + readonly Name: string; + readonly Parent: any; + Paste(): any; + PictureType: XlChartPictureType; + PictureUnit: number; + PictureUnit2: number; + + /** @param Index [Index=2] */ + PieSliceLocation(loc: XlPieSliceLocation, Index?: XlPieSliceIndex): number; + SecondaryPlot: boolean; + Select(): any; + Shadow: boolean; + readonly Top: number; + readonly Width: number; + } + + interface Points { + _Default(Index: number): Point; + readonly Application: Application; + readonly Count: number; + readonly Creator: XlCreator; + Item(Index: number): Point; + readonly Parent: any; + (Index: number): Point; + } + class ProtectedViewWindow { private 'Excel.ProtectedViewWindow_typekey': ProtectedViewWindow; private constructor(); @@ -6515,7 +7035,7 @@ declare namespace Excel { Activate(): void; Caption: string; Close(): boolean; - Edit(WriteResPassword?: any, UpdateLinks?: any): Workbook; + Edit(WriteResPassword?: string, UpdateLinks?: 0 | 1): Workbook; EnableResize: boolean; Height: number; Left: number; @@ -6528,16 +7048,15 @@ declare namespace Excel { readonly Workbook: Workbook; } - class ProtectedViewWindows { - private 'Excel.ProtectedViewWindows_typekey': ProtectedViewWindows; - private constructor(); + interface ProtectedViewWindows { _Default(Index: any): ProtectedViewWindow; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): ProtectedViewWindow; - Open(Filename: string, Password?: any, AddToMru?: any, RepairMode?: any): ProtectedViewWindow; + Item(Index: number | string): ProtectedViewWindow; + Open(Filename: string, Password?: string, AddToMru?: boolean, RepairMode?: boolean): ProtectedViewWindow; readonly Parent: any; + (Index: number | string): ProtectedViewWindow; } class Protection { @@ -6568,25 +7087,24 @@ declare namespace Excel { Filename: string; HtmlType: XlHtmlType; readonly Parent: any; - Publish(Create?: any): void; + Publish(Create?: boolean): void; readonly Sheet: string; readonly Source: string; readonly SourceType: XlSourceType; Title: string; } - class PublishObjects { - private 'Excel.PublishObjects_typekey': PublishObjects; - private constructor(); + interface PublishObjects { _Default(Index: any): PublishObject; - Add(SourceType: XlSourceType, Filename: string, Sheet?: any, Source?: any, HtmlType?: any, DivID?: any, Title?: any): PublishObject; + Add(SourceType: XlSourceType, Filename: string, Sheet?: string, Source?: XlSourceType.xlSourceAutoFilter | XlSourceType.xlSourceChart | XlSourceType.xlSourcePivotTable | XlSourceType.xlSourcePrintArea | XlSourceType.xlSourceQuery | XlSourceType.xlSourceRange, HtmlType?: XlHtmlType, DivID?: string, Title?: string): PublishObject; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Delete(): void; - Item(Index: any): PublishObject; + Item(Index: number | string): PublishObject; readonly Parent: any; Publish(): void; + (Index: number | string): PublishObject; } class QueryTable { @@ -6596,13 +7114,13 @@ declare namespace Excel { readonly Application: Application; BackgroundQuery: boolean; CancelRefresh(): void; - CommandText: any; + CommandText: string; CommandType: XlCmdType; - Connection: any; + Connection: string; readonly Creator: XlCreator; Delete(): void; readonly Destination: Range; - EditWebPage: any; + EditWebPage: string; EnableEditing: boolean; EnableRefresh: boolean; readonly FetchedRowOverflow: boolean; @@ -6618,8 +7136,8 @@ declare namespace Excel { PreserveColumnInfo: boolean; PreserveFormatting: boolean; readonly QueryType: XlQueryType; - Recordset: any; - Refresh(BackgroundQuery?: any): boolean; + Recordset: DAO.Recordset | ADODB.Recordset; + Refresh(BackgroundQuery?: boolean): boolean; readonly Refreshing: boolean; RefreshOnFileOpen: boolean; RefreshPeriod: number; @@ -6628,7 +7146,7 @@ declare namespace Excel { readonly ResultRange: Range; RobustConnect: XlRobustConnect; RowNumbers: boolean; - SaveAsODC(ODCFileName: string, Description?: any, Keywords?: any): void; + SaveAsODC(ODCFileName: string, Description?: string, Keywords?: string): void; SaveData: boolean; SavePassword: boolean; readonly Sort: Sort; @@ -6636,11 +7154,11 @@ declare namespace Excel { SourceDataFile: string; Sql: any; TablesOnlyFromHTML: boolean; - TextFileColumnDataTypes: any; + TextFileColumnDataTypes: SafeArray; TextFileCommaDelimiter: boolean; TextFileConsecutiveDelimiter: boolean; TextFileDecimalSeparator: string; - TextFileFixedColumnWidths: any; + TextFileFixedColumnWidths: SafeArray; TextFileOtherDelimiter: string; TextFileParseType: XlTextParsingType; TextFilePlatform: number; @@ -6664,79 +7182,77 @@ declare namespace Excel { readonly WorkbookConnection: WorkbookConnection; } - class QueryTables { - private 'Excel.QueryTables_typekey': QueryTables; - private constructor(); + interface QueryTables { _Default(Index: any): QueryTable; - Add(Connection: any, Destination: Range, Sql?: any): QueryTable; + Add(Connection: QueryTable | DAO.Recordset | ADODB.Recordset, Destination: Range): QueryTable; + Add(Connection: string, Destination: Range, Sql?: string): QueryTable; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): QueryTable; + Item(Index: number | string): QueryTable; readonly Parent: any; + (Index: number | string): QueryTable; } - class Range { - private 'Excel.Range_typekey': Range; - private constructor(); + interface Range { __PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any): any; /** - * @param Excel.XlBorderWeight [Weight=2] - * @param Excel.XlColorIndex [ColorIndex=-4105] + * @param Weight [Weight=2] + * @param ColorIndex [ColorIndex=-4105] */ _BorderAround(LineStyle: any, Weight?: XlBorderWeight, ColorIndex?: XlColorIndex, Color?: any): any; _Default(RowIndex?: any, ColumnIndex?: any): any; /** - * @param Excel.XlPasteType [Paste=-4104] - * @param Excel.XlPasteSpecialOperation [Operation=-4142] + * @param Paste [Paste=-4104] + * @param Operation [Operation=-4142] */ _PasteSpecial(Paste?: XlPasteType, Operation?: XlPasteSpecialOperation, SkipBlanks?: any, Transpose?: any): any; _PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): any; Activate(): any; - AddComment(Text?: any): Comment; - AddIndent: any; + AddComment(Text?: string): Comment; + AddIndent: boolean; - /** @param Excel.XlReferenceStyle [ReferenceStyle=1] */ + /** @param ReferenceStyle [ReferenceStyle=1] */ Address(RowAbsolute?: boolean, ColumnAbsolute?: boolean, ReferenceStyle?: XlReferenceStyle, External?: boolean, RelativeTo?: Range): string; - /** @param Excel.XlReferenceStyle [ReferenceStyle=1] */ - AddressLocal(RowAbsolute: any, ColumnAbsolute: any, ReferenceStyle?: XlReferenceStyle, External?: any, RelativeTo?: any): string; + /** @param ReferenceStyle [ReferenceStyle=1] */ + AddressLocal(RowAbsolute?: boolean, ColumnAbsolute?: boolean, ReferenceStyle?: XlReferenceStyle, External?: boolean, RelativeTo?: Range): string; AdvancedFilter(Action: XlFilterAction.xlFilterCopy, CriteriaRange?: Range, CopyToRange?: Range, Unique?: boolean): any; AdvancedFilter(Action: XlFilterAction, CriteriaRange?: Range, CopyToRange?: undefined, Unique?: boolean): any; AllocateChanges(): void; readonly AllowEdit: boolean; readonly Application: Application; - /** @param Excel.XlApplyNamesOrder [Order=1] */ - ApplyNames(Names: any, IgnoreRelativeAbsolute: any, UseRowColumnNames: any, OmitColumn: any, OmitRow: any, Order?: XlApplyNamesOrder, AppendLast?: any): any; + /** @param Order [Order=1] */ + ApplyNames(Names?: SafeArray, IgnoreRelativeAbsolute?: boolean, UseRowColumnNames?: boolean, OmitColumn?: boolean, OmitRow?: boolean, Order?: XlApplyNamesOrder, AppendLast?: boolean): any; ApplyOutlineStyles(): any; readonly Areas: Areas; AutoComplete(String: string): string; - /** @param Excel.XlAutoFillType [Type=0] */ + /** @param Type [Type=0] */ AutoFill(Destination: Range, Type?: XlAutoFillType): any; - /** @param Excel.XlAutoFilterOperator [Operator=1] */ - AutoFilter(Field: any, Criteria1: any, Operator?: XlAutoFilterOperator, Criteria2?: any, VisibleDropDown?: any): any; + /** @param Operator [Operator=1] */ + AutoFilter(Field: number, Criteria1: string, Operator?: XlAutoFilterOperator, Criteria2?: string, VisibleDropDown?: boolean): any; AutoFit(): any; - /** @param Excel.XlRangeAutoFormat [Format=1] */ + /** @param Format [Format=1] */ AutoFormat(Format?: XlRangeAutoFormat, Number?: any, Font?: any, Alignment?: any, Border?: any, Pattern?: any, Width?: any): any; AutoOutline(): any; /** - * @param Excel.XlBorderWeight [Weight=2] - * @param Excel.XlColorIndex [ColorIndex=-4105] + * @param Weight [Weight=2] + * @param ColorIndex [ColorIndex=-4105] */ - BorderAround(LineStyle: any, Weight?: XlBorderWeight, ColorIndex?: XlColorIndex, Color?: any, ThemeColor?: any): any; + BorderAround(LineStyle?: XlLineStyle, Weight?: XlBorderWeight, ColorIndex?: XlColorIndex, Color?: number, ThemeColor?: number | XlThemeColor): any; readonly Borders: Borders; Calculate(): any; CalculateRowMajorOrder(): any; readonly Cells: Range; - Characters(Start?: any, Length?: any): Characters; - CheckSpelling(CustomDictionary?: any, IgnoreUppercase?: any, AlwaysSuggest?: any, SpellLang?: any): any; + Characters(Start?: number, Length?: number): Characters; + CheckSpelling(CustomDictionary?: string, IgnoreUppercase?: boolean, AlwaysSuggest?: boolean, SpellLang?: Office.MsoLanguageID): any; Clear(): any; ClearComments(): void; ClearContents(): any; @@ -6745,38 +7261,39 @@ declare namespace Excel { ClearNotes(): any; ClearOutline(): any; readonly Column: number; - ColumnDifferences(Comparison: any): Range; + ColumnDifferences(Comparison: Range): Range; readonly Columns: Range; - ColumnWidth: any; + ColumnWidth: number | null; readonly Comment: Comment; - Consolidate(Sources?: any, Function?: any, TopRow?: any, LeftColumn?: any, CreateLinks?: any): any; - Copy(Destination?: any): any; - CopyFromRecordset(Data: any, MaxRows?: any, MaxColumns?: any): number; + Consolidate(Sources?: SafeArray, Function?: XlConsolidationFunction, TopRow?: boolean, LeftColumn?: boolean, CreateLinks?: boolean): any; + Copy(Destination?: Range): any; + CopyFromRecordset(Data: DAO.Recordset | ADODB.Recordset, MaxRows?: number, MaxColumns?: number): number; /** - * @param Excel.XlPictureAppearance [Appearance=1] - * @param Excel.XlCopyPictureFormat [Format=-4147] + * @param Appearance [Appearance=1] + * @param Format [Format=-4147] */ CopyPicture(Appearance?: XlPictureAppearance, Format?: XlCopyPictureFormat): any; readonly Count: number; - readonly CountLarge: any; - CreateNames(Top?: any, Left?: any, Bottom?: any, Right?: any): any; + readonly CountLarge: number; + CreateNames(Top?: boolean, Left?: boolean, Bottom?: boolean, Right?: boolean): any; - /** @param Excel.XlPictureAppearance [Appearance=1] */ + /** @param Appearance [Appearance=1] */ CreatePublisher(Edition: any, Appearance?: XlPictureAppearance, ContainsPICT?: any, ContainsBIFF?: any, ContainsRTF?: any, ContainsVALU?: any): any; readonly Creator: XlCreator; readonly CurrentArray: Range; readonly CurrentRegion: Range; - Cut(Destination?: any): any; + Cut(Destination?: Range): any; /** - * @param Excel.XlDataSeriesType [Type=-4132] - * @param Excel.XlDataSeriesDate [Date=1] + * @param Type [Type=-4132] + * @param Date [Date=1] + * @param Step [Step=1] */ - DataSeries(Rowcol: any, Type?: XlDataSeriesType, Date?: XlDataSeriesDate, Step?: any, Stop?: any, Trend?: any): any; - Delete(Shift?: any): any; + DataSeries(Rowcol: XlRowCol, Type?: XlDataSeriesType, Date?: XlDataSeriesDate, Step?: number, Stop?: number, Trend?: boolean): any; + Delete(Shift?: XlDeleteShiftDirection): any; readonly Dependents: Range; - DialogBox(): any; + DialogBox(): number | false; readonly DirectDependents: Range; readonly DirectPrecedents: Range; Dirty(): void; @@ -6784,81 +7301,78 @@ declare namespace Excel { readonly DisplayFormat: DisplayFormat; /** - * @param Excel.XlPictureAppearance [Appearance=1] - * @param Excel.XlPictureAppearance [ChartSize=1] + * @param Appearance [Appearance=1] + * @param ChartSize [ChartSize=1] */ EditionOptions(Type: XlEditionType, Option: XlEditionOptionsOption, Name: any, Reference: any, Appearance?: XlPictureAppearance, ChartSize?: XlPictureAppearance, Format?: any): any; End(Direction: XlDirection): Range; readonly EntireColumn: Range; readonly EntireRow: Range; readonly Errors: Errors; - ExportAsFixedFormat( - Type: XlFixedFormatType, Filename?: any, Quality?: any, IncludeDocProperties?: any, IgnorePrintAreas?: any, From?: any, To?: any, OpenAfterPublish?: any, - FixedFormatExtClassPtr?: any): void; + ExportAsFixedFormat(Type: XlFixedFormatType, Filename?: string, Quality?: XlFixedFormatQuality, IncludeDocProperties?: boolean, IgnorePrintAreas?: boolean, From?: number, To?: number, OpenAfterPublish?: boolean, FixedFormatExtClassPtr?: any): void; FillDown(): any; FillLeft(): any; FillRight(): any; FillUp(): any; - /** @param Excel.XlSearchDirection [SearchDirection=1] */ - Find(What: any, After?: any, LookIn?: XlFindLookIn, LookAt?: XlLookAt, SearchOrder?: XlSearchOrder, SearchDirection?: XlSearchDirection, MatchCase?: boolean, - MatchByte?: boolean, SearchFormat?: any): Range; + /** @param SearchDirection [SearchDirection=1] */ + Find(What: any, After?: any, LookIn?: XlFindLookIn, LookAt?: XlLookAt, SearchOrder?: XlSearchOrder, SearchDirection?: XlSearchDirection, MatchCase?: boolean, MatchByte?: boolean, SearchFormat?: any): Range; FindNext(After?: any): Range; FindPrevious(After?: any): Range; readonly Font: Font; readonly FormatConditions: FormatConditions; - Formula: any; - FormulaArray: any; - FormulaHidden: any; + Formula: string | SafeArray; + FormulaArray: string | SafeArray | null; + FormulaHidden: boolean | null; FormulaLabel: XlFormulaLabel; - FormulaLocal: any; - FormulaR1C1: any; - FormulaR1C1Local: any; + FormulaLocal: string | SafeArray; + FormulaR1C1: string | SafeArray; + FormulaR1C1Local: string | SafeArray; FunctionWizard(): any; GoalSeek(Goal: any, ChangingCell: Range): boolean; - Group(Start?: any, End?: any, By?: any, Periods?: any): any; - readonly HasArray: any; - readonly HasFormula: any; - readonly Height: any; - Hidden: any; - HorizontalAlignment: any; + Group(Start?: any, End?: any, By?: number, Periods?: SafeArray): any; + readonly HasArray: boolean; + readonly HasFormula: boolean | null; + Height: number; + Hidden: boolean; + HorizontalAlignment: HorizontalAlignments; readonly Hyperlinks: Hyperlinks; ID: string; - IndentLevel: any; - Insert(Shift?: any, CopyOrigin?: any): any; + IndentLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15; + Insert(Shift?: XlInsertShiftDirection, CopyOrigin?: any): any; InsertIndent(InsertAmount: number): void; readonly Interior: Interior; Item(RowIndex: number, ColumnIndex?: number): Range; Item(Address: string): Range; Justify(): any; - readonly Left: any; + readonly Left: number; readonly ListHeaderRows: number; ListNames(): any; readonly ListObject: ListObject; readonly LocationInTable: XlLocationInTable; - Locked: any; + Locked: boolean | null; readonly MDX: string; - Merge(Across?: any): void; + Merge(Across?: boolean): void; readonly MergeArea: Range; - MergeCells: any; - Name: any; - NavigateArrow(TowardPrecedent?: any, ArrowNumber?: any, LinkNumber?: any): any; + MergeCells: boolean; + Name: string | Name; + NavigateArrow(TowardPrecedent?: boolean, ArrowNumber?: number, LinkNumber?: number): any; readonly Next: Range; - NoteText(Text?: any, Start?: any, Length?: any): string; - NumberFormat: any; - NumberFormatLocal: any; + NoteText(Text?: string, Start?: number, Length?: number): string; + NumberFormat: string | null; + NumberFormatLocal: string | null; Offset(RowOffset?: number, ColumnOffset?: number): Range; - Orientation: any; - OutlineLevel: any; + Orientation: number | XlOrientation; + OutlineLevel: number; PageBreak: number; readonly Parent: any; - Parse(ParseLine?: any, Destination?: any): any; + Parse(ParseLine?: string, Destination?: Range): any; /** - * @param Excel.XlPasteType [Paste=-4104] - * @param Excel.XlPasteSpecialOperation [Operation=-4142] + * @param Paste [Paste=-4104] + * @param Operation [Operation=-4142] */ - PasteSpecial(Paste?: XlPasteType, Operation?: XlPasteSpecialOperation, SkipBlanks?: any, Transpose?: any): any; + PasteSpecial(Paste?: XlPasteType, Operation?: XlPasteSpecialOperation, SkipBlanks?: boolean, Transpose?: boolean): any; readonly Phonetic: Phonetic; readonly Phonetics: Phonetics; readonly PivotCell: PivotCell; @@ -6866,114 +7380,108 @@ declare namespace Excel { readonly PivotItem: PivotItem; readonly PivotTable: PivotTable; readonly Precedents: Range; - readonly PrefixCharacter: any; + readonly PrefixCharacter: "'" | '"' | '^' | '\\' | ''; readonly Previous: Range; - PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): any; - PrintPreview(EnableChanges?: any): any; + PrintOut(From?: number, To?: number, Copies?: number, Preview?: boolean, ActivePrinter?: string, PrintToFile?: T, Collate?: boolean, PrToFileName?: PrintToFileName): any; + PrintPreview(EnableChanges?: boolean): any; readonly QueryTable: QueryTable; - Range(Cell1: any, Cell2?: any): Range; + Range(Cell1: string | Range, Cell2?: string | Range): Range; ReadingOrder: number; - /** @param Excel.XlYesNoGuess [Header=2] */ - RemoveDuplicates(Columns: any, Header?: XlYesNoGuess): void; + /** @param Header [Header=2] */ + RemoveDuplicates(Columns: SafeArray, Header?: XlYesNoGuess): void; RemoveSubtotal(): any; - Replace(What: any, Replacement: any, LookAt?: any, SearchOrder?: any, MatchCase?: any, MatchByte?: any, SearchFormat?: any, ReplaceFormat?: any): boolean; - Resize(RowSize?: any, ColumnSize?: any): Range; + Replace(What: string, Replacement: string, LookAt?: XlLookAt, SearchOrder?: XlSearchOrder, MatchCase?: boolean, MatchByte?: boolean, SearchFormat?: boolean, ReplaceFormat?: boolean): boolean; + Resize(RowSize?: number, ColumnSize?: number): Range; readonly Row: number; - RowDifferences(Comparison: any): Range; - RowHeight: any; + RowDifferences(Comparison: Range): Range; + RowHeight: number | null; readonly Rows: Range; - Run( - Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + Run(Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; Select(): any; readonly ServerActions: Actions; SetPhonetic(): void; Show(): any; - ShowDependents(Remove?: any): any; + ShowDependents(Remove?: boolean): any; ShowDetail: any; ShowErrors(): any; - ShowPrecedents(Remove?: any): any; - ShrinkToFit: any; + ShowPrecedents(Remove?: boolean): any; + ShrinkToFit: boolean | null; readonly SmartTags: SmartTags; /** - * @param Excel.XlSortOrder [Order1=1] - * @param Excel.XlSortOrder [Order2=1] - * @param Excel.XlSortOrder [Order3=1] - * @param Excel.XlYesNoGuess [Header=2] - * @param Excel.XlSortOrientation [Orientation=2] - * @param Excel.XlSortMethod [SortMethod=1] - * @param Excel.XlSortDataOption [DataOption1=0] - * @param Excel.XlSortDataOption [DataOption2=0] - * @param Excel.XlSortDataOption [DataOption3=0] + * @param Order1 [Order1=1] + * @param Order2 [Order2=1] + * @param Order3 [Order3=1] + * @param Header [Header=2] + * @param Orientation [Orientation=2] + * @param SortMethod [SortMethod=1] + * @param DataOption1 [DataOption1=0] + * @param DataOption2 [DataOption2=0] + * @param DataOption3 [DataOption3=0] */ - Sort( - Key1: any, Order1?: XlSortOrder, Key2?: any, Type?: any, Order2?: XlSortOrder, Key3?: any, Order3?: XlSortOrder, Header?: XlYesNoGuess, OrderCustom?: any, - MatchCase?: any, Orientation?: XlSortOrientation, SortMethod?: XlSortMethod, DataOption1?: XlSortDataOption, DataOption2?: XlSortDataOption, DataOption3?: XlSortDataOption): any; + Sort(Key1: string | Range, Order1?: XlSortOrder, Key2?: any, Type?: any, Order2?: XlSortOrder, Key3?: any, Order3?: XlSortOrder, Header?: XlYesNoGuess, OrderCustom?: number, MatchCase?: boolean, Orientation?: XlSortOrientation, SortMethod?: XlSortMethod, DataOption1?: XlSortDataOption, DataOption2?: XlSortDataOption, DataOption3?: XlSortDataOption): any; /** - * @param Excel.XlSortMethod [SortMethod=1] - * @param Excel.XlSortOrder [Order1=1] - * @param Excel.XlSortOrder [Order2=1] - * @param Excel.XlSortOrder [Order3=1] - * @param Excel.XlYesNoGuess [Header=2] - * @param Excel.XlSortOrientation [Orientation=2] - * @param Excel.XlSortDataOption [DataOption1=0] - * @param Excel.XlSortDataOption [DataOption2=0] - * @param Excel.XlSortDataOption [DataOption3=0] + * @param SortMethod [SortMethod=1] + * @param Order1 [Order1=1] + * @param Order2 [Order2=1] + * @param Order3 [Order3=1] + * @param Header [Header=2] + * @param Orientation [Orientation=2] + * @param DataOption1 [DataOption1=0] + * @param DataOption2 [DataOption2=0] + * @param DataOption3 [DataOption3=0] */ - SortSpecial( - SortMethod?: XlSortMethod, Key1?: any, Order1?: XlSortOrder, Type?: any, Key2?: any, Order2?: XlSortOrder, Key3?: any, Order3?: XlSortOrder, - Header?: XlYesNoGuess, OrderCustom?: any, MatchCase?: any, Orientation?: XlSortOrientation, DataOption1?: XlSortDataOption, DataOption2?: XlSortDataOption, - DataOption3?: XlSortDataOption): any; + SortSpecial(SortMethod?: XlSortMethod, Key1?: string | Range, Order1?: XlSortOrder, Type?: any, Key2?: string | Range, Order2?: XlSortOrder, Key3?: string | Range, Order3?: XlSortOrder, Header?: XlYesNoGuess, OrderCustom?: number, MatchCase?: boolean, Orientation?: XlSortOrientation, DataOption1?: XlSortDataOption, DataOption2?: XlSortDataOption, DataOption3?: XlSortDataOption): any; readonly SoundNote: SoundNote; readonly SparklineGroups: SparklineGroups; - Speak(SpeakDirection?: any, SpeakFormulas?: any): void; - SpecialCells(Type: XlCellType, Value?: any): Range; - Style: any; + Speak(SpeakDirection?: XlSpeakDirection, SpeakFormulas?: boolean): void; + SpecialCells(Type: XlCellType.xlCellTypeConstants | XlCellType.xlCellTypeFormulas, Value?: XlSpecialCellsValue): Range; + SpecialCells(Type: XlCellType): Range; + Style: Style; - /** @param Excel.XlSubscribeToFormat [Format=-4158] */ + /** @param Format [Format=-4158] */ SubscribeTo(Edition: string, Format?: XlSubscribeToFormat): any; - /** @param Excel.XlSummaryRow [SummaryBelowData=1] */ - Subtotal(GroupBy: number, Function: XlConsolidationFunction, TotalList: any, Replace: any, PageBreaks: any, SummaryBelowData?: XlSummaryRow): any; - readonly Summary: any; - Table(RowInput?: any, ColumnInput?: any): any; - readonly Text: any; + /** @param SummaryBelowData [SummaryBelowData=1] */ + Subtotal(GroupBy: number, Function: XlConsolidationFunction, TotalList: SafeArray, Replace: boolean, PageBreaks: boolean, SummaryBelowData?: XlSummaryRow): any; + readonly Summary: boolean; + Table(RowInput?: Range, ColumnInput?: Range): any; + readonly Text: string; /** - * @param Excel.XlTextParsingType [DataType=1] - * @param Excel.XlTextQualifier [TextQualifier=1] + * @param DataType [DataType=1] + * @param TextQualifier [TextQualifier=1] */ - TextToColumns( - Destination: any, DataType?: XlTextParsingType, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: any, Tab?: any, Semicolon?: any, Comma?: any, - Space?: any, Other?: any, OtherChar?: any, FieldInfo?: any, DecimalSeparator?: any, ThousandsSeparator?: any, TrailingMinusNumbers?: any): any; - readonly Top: any; + TextToColumns(Destination: Range, DataType?: XlTextParsingType, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: boolean, Tab?: boolean, Semicolon?: boolean, Comma?: boolean, Space?: boolean, Other?: boolean, OtherChar?: string, FieldInfo?: SafeArray, DecimalSeparator?: string, ThousandsSeparator?: string, TrailingMinusNumbers?: any): any; + readonly Top: number; Ungroup(): any; UnMerge(): void; - UseStandardHeight: any; - UseStandardWidth: any; + UseStandardHeight: boolean | null; + UseStandardWidth: boolean | null; readonly Validation: Validation; - Value(RangeValueDataType?: XlRangeValueDataType): any; + + // tslint:disable-next-line: ban-types + Value: Exclude & ((RangeValueDataType?: XlRangeValueDataType) => any); Value2: any; - VerticalAlignment: any; - readonly Width: any; + VerticalAlignment: VerticalAlignments; + readonly Width: number; readonly Worksheet: Worksheet; - WrapText: any; + WrapText: boolean | null; readonly XPath: XPath; + (RowIndex: number, ColumnIndex?: number): Range; + (Address: string): Range; } - class Ranges { - private 'Excel.Ranges_typekey': Ranges; - private constructor(); + interface Ranges { _Default(Index: any): Range; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: any): Range; readonly Parent: any; + (Index: any): Range; } class RecentFile { @@ -6989,9 +7497,7 @@ declare namespace Excel { readonly Path: string; } - class RecentFiles { - private 'Excel.RecentFiles_typekey': RecentFiles; - private constructor(); + interface RecentFiles { _Default(Index: number): RecentFile; Add(Name: string): RecentFile; readonly Application: Application; @@ -7000,6 +7506,7 @@ declare namespace Excel { Item(Index: number): RecentFile; Maximum: number; readonly Parent: any; + (Index: number): RecentFile; } class Research { @@ -7009,7 +7516,7 @@ declare namespace Excel { readonly Creator: XlCreator; IsResearchService(ServiceID: string): boolean; readonly Parent: any; - Query(ServiceID: string, QueryString?: any, QueryLanguage?: any, UseSelection?: any, LaunchQuery?: any): any; + Query(ServiceID: string, QueryString?: string, QueryLanguage?: any, UseSelection?: boolean, LaunchQuery?: boolean): any; SetLanguagePair(LanguageFrom: number, LanguageTo: number): any; } @@ -7037,6 +7544,123 @@ declare namespace Excel { ThrottleInterval: number; } + class Scenario { + private 'Excel.Scenario_typekey': Scenario; + private constructor(); + readonly Application: Application; + ChangeScenario(ChangingCells: Range, Values?: SafeArray): any; + readonly ChangingCells: Range; + Comment: string; + readonly Creator: XlCreator; + Delete(): any; + Hidden: boolean; + readonly Index: number; + Locked: boolean; + Name: string; + readonly Parent: any; + Show(): any; + Values(): SafeArray; + Values(Index: number): any; + } + + interface Scenarios { + Add(Name: string, ChangingCells: Range, Values?: SafeArray, Comment?: string, Locked?: boolean, Hidden?: boolean): Scenario; + readonly Application: Application; + readonly Count: number; + + /** @param ReportType [ReportType=1] */ + CreateSummary(ReportType?: XlSummaryReportType, ResultCells?: Range): any; + readonly Creator: XlCreator; + Item(Index: number | string): Scenario; + Merge(Source: string | Worksheet): any; + readonly Parent: any; + (Index: number | string): Scenario; + } + + class Series { + private 'Excel.Series_typekey': Series; + private constructor(); + + /** @param Type [Type=2] */ + _ApplyDataLabels(Type?: XlDataLabelsType, LegendKey?: any, AutoText?: any, HasLeaderLines?: any): any; + readonly Application: Application; + ApplyCustomType(ChartType: XlChartType): void; + + /** @param Type [Type=2] */ + ApplyDataLabels(Type?: XlDataLabelsType, LegendKey?: boolean, AutoText?: boolean, HasLeaderLines?: boolean, ShowSeriesName?: boolean, ShowCategoryName?: boolean, ShowValue?: boolean, ShowPercentage?: boolean, ShowBubbleSize?: boolean, Separator?: string): any; + ApplyPictToEnd: boolean; + ApplyPictToFront: boolean; + ApplyPictToSides: boolean; + AxisGroup: XlAxisGroup; + BarShape: XlBarShape; + readonly Border: Border; + BubbleSizes: string; + ChartType: XlChartType; + ClearFormats(): any; + Copy(): any; + readonly Creator: XlCreator; + DataLabels: DataLabels & ((Index: number) => DataLabel); + Delete(): any; + ErrorBar(Direction: XlErrorBarDirection, Include: XlErrorBarInclude, Type: XlErrorBarType, Amount?: any, MinusValues?: any): any; + readonly ErrorBars: ErrorBars; + Explosion: number; + readonly Fill: ChartFillFormat; + readonly Format: ChartFormat; + Formula: string; + FormulaLocal: string; + FormulaR1C1: string; + FormulaR1C1Local: string; + Has3DEffect: boolean; + HasDataLabels: boolean; + HasErrorBars: boolean; + HasLeaderLines: boolean; + readonly Interior: Interior; + InvertColor: number; + InvertColorIndex: number; + InvertIfNegative: boolean; + readonly LeaderLines: LeaderLines; + MarkerBackgroundColor: number; + MarkerBackgroundColorIndex: XlColorIndex; + MarkerForegroundColor: number; + MarkerForegroundColorIndex: XlColorIndex; + MarkerSize: number; + MarkerStyle: XlMarkerStyle; + Name: string; + readonly Parent: any; + Paste(): any; + PictureType: XlChartPictureType; + PictureUnit: number; + PictureUnit2: number; + readonly PlotColorIndex: number; + PlotOrder: number; + Points: Points & ((Index: number) => Point); + Select(): any; + Shadow: boolean; + Smooth: boolean; + Trendlines: Trendlines & ((Index: number | string) => Trendline); + Type: number; + Values: Range | SafeArray; + XValues: Range | SafeArray; + } + + interface SeriesCollection { + _Default(Index: any): Series; + + /** @param Rowcol [Rowcol=-4105] */ + Add(Source: Range, Rowcol?: XlRowCol, SeriesLabels?: boolean, CategoryLabels?: boolean, Replace?: boolean): Series; + readonly Application: Application; + readonly Count: number; + readonly Creator: XlCreator; + Extend(Source: Range, Rowcol?: XlRowCol, CategoryLabels?: boolean): any; + Item(Index: number | string): Series; + NewSeries(): Series; + readonly Parent: any; + + /** @param Rowcol [Rowcol=-4105] */ + Paste(Rowcol?: XlRowCol, SeriesLabels?: boolean, CategoryLabels?: boolean, Replace?: boolean, NewSeries?: boolean): any; + (Index: number | string): Series; + } + class SeriesLines { private 'Excel.SeriesLines_typekey': SeriesLines; private constructor(); @@ -7050,18 +7674,17 @@ declare namespace Excel { Select(): any; } - class ServerViewableItems { - private 'Excel.ServerViewableItems_typekey': ServerViewableItems; - private constructor(); + interface ServerViewableItems { _Default(Index: any): any; Add(Obj: any): any; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Delete(Index: any): void; + Delete(Index: number): void; DeleteAll(): void; - Item(Index: any): any; + Item(Index: number): any; readonly Parent: any; + (Index: number): any; } class ShadowFormat { @@ -7109,7 +7732,7 @@ declare namespace Excel { readonly ConnectorFormat: ConnectorFormat; readonly ControlFormat: ControlFormat; Copy(): void; - CopyPicture(Appearance?: any, Format?: any): void; + CopyPicture(Appearance?: XlPictureAppearance, Format?: XlCopyPictureFormat): void; readonly Creator: XlCreator; Cut(): void; Delete(): void; @@ -7150,10 +7773,10 @@ declare namespace Excel { readonly Reflection: Office.ReflectionFormat; RerouteConnections(): void; Rotation: number; - ScaleHeight(Factor: number, RelativeToOriginalSize: Office.MsoTriState, Scale?: any): void; - ScaleWidth(Factor: number, RelativeToOriginalSize: Office.MsoTriState, Scale?: any): void; + ScaleHeight(Factor: number, RelativeToOriginalSize: Office.MsoTriState, Scale?: Office.MsoScaleFrom): void; + ScaleWidth(Factor: number, RelativeToOriginalSize: Office.MsoTriState, Scale?: Office.MsoScaleFrom): void; readonly Script: Office.Script; - Select(Replace?: any): void; + Select(Replace?: boolean): void; SetShapesDefaultProperties(): void; readonly Shadow: ShadowFormat; ShapeStyle: Office.MsoShapeStyleIndex; @@ -7169,7 +7792,7 @@ declare namespace Excel { readonly Type: Office.MsoShapeType; Ungroup(): ShapeRange; readonly VerticalFlip: Office.MsoTriState; - readonly Vertices: any; + readonly Vertices: SafeArray; Visible: Office.MsoTriState; Width: number; ZOrder(ZOrderCmd: Office.MsoZOrderCmd): void; @@ -7183,35 +7806,32 @@ declare namespace Excel { readonly Creator: number; readonly EditingType: Office.MsoEditingType; readonly Parent: any; - readonly Points: any; + readonly Points: SafeArray; readonly SegmentType: Office.MsoSegmentType; } - class ShapeNodes { - private 'Excel.ShapeNodes_typekey': ShapeNodes; - private constructor(); + interface ShapeNodes { readonly Application: any; readonly Count: number; readonly Creator: number; Delete(Index: number): void; /** - * @param number [X2=0] - * @param number [Y2=0] - * @param number [X3=0] - * @param number [Y3=0] + * @param X2 [X2=0] + * @param Y2 [Y2=0] + * @param X3 [X3=0] + * @param Y3 [Y3=0] */ Insert(Index: number, SegmentType: Office.MsoSegmentType, EditingType: Office.MsoEditingType, X1: number, Y1: number, X2?: number, Y2?: number, X3?: number, Y3?: number): void; - Item(Index: any): ShapeNode; + Item(Index: number | string): ShapeNode; readonly Parent: any; SetEditingType(Index: number, EditingType: Office.MsoEditingType): void; SetPosition(Index: number, X1: number, Y1: number): void; SetSegmentType(Index: number, SegmentType: Office.MsoSegmentType): void; + (Index: number | string): ShapeNode; } - class ShapeRange { - private 'Excel.ShapeRange_typekey': ShapeRange; - private constructor(); + interface ShapeRange { _Default(Index: any): Shape; readonly Adjustments: Adjustments; Align(AlignCmd: Office.MsoAlignCmd, RelativeTo: Office.MsoTriState): void; @@ -7253,7 +7873,7 @@ declare namespace Excel { IncrementLeft(Increment: number): void; IncrementRotation(Increment: number): void; IncrementTop(Increment: number): void; - Item(Index: any): Shape; + Item(Index: number | string): Shape; Left: number; readonly Line: LineFormat; LockAspectRatio: Office.MsoTriState; @@ -7267,9 +7887,9 @@ declare namespace Excel { Regroup(): Shape; RerouteConnections(): void; Rotation: number; - ScaleHeight(Factor: number, RelativeToOriginalSize: Office.MsoTriState, Scale?: any): void; - ScaleWidth(Factor: number, RelativeToOriginalSize: Office.MsoTriState, Scale?: any): void; - Select(Replace?: any): void; + ScaleHeight(Factor: number, RelativeToOriginalSize: Office.MsoTriState, Scale?: Office.MsoScaleFrom): void; + ScaleWidth(Factor: number, RelativeToOriginalSize: Office.MsoTriState, Scale?: Office.MsoScaleFrom): void; + Select(Replace?: boolean): void; SetShapesDefaultProperties(): void; readonly Shadow: ShadowFormat; ShapeStyle: Office.MsoShapeStyleIndex; @@ -7283,82 +7903,81 @@ declare namespace Excel { readonly Type: Office.MsoShapeType; Ungroup(): ShapeRange; readonly VerticalFlip: Office.MsoTriState; - readonly Vertices: any; + readonly Vertices: SafeArray; Visible: Office.MsoTriState; Width: number; ZOrder(ZOrderCmd: Office.MsoZOrderCmd): void; readonly ZOrderPosition: number; + (Index: number | string): Shape; } - class Shapes { - private 'Excel.Shapes_typekey': Shapes; - private constructor(); + interface Shapes { _Default(Index: any): Shape; AddCallout(Type: Office.MsoCalloutType, Left: number, Top: number, Width: number, Height: number): Shape; AddCanvas(Left: number, Top: number, Width: number, Height: number): Shape; - AddChart(XlChartType?: any, Left?: any, Top?: any, Width?: any, Height?: any): Shape; + AddChart(XlChartType?: XlChartType, Left?: number, Top?: number, Width?: number, Height?: number, NewLayout?: boolean): Shape; AddConnector(Type: Office.MsoConnectorType, BeginX: number, BeginY: number, EndX: number, EndY: number): Shape; - AddCurve(SafeArrayOfPoints: any): Shape; + AddCurve(SafeArrayOfPoints: SafeArray): Shape; AddDiagram(Type: Office.MsoDiagramType, Left: number, Top: number, Width: number, Height: number): Shape; AddFormControl(Type: XlFormControl, Left: number, Top: number, Width: number, Height: number): Shape; AddLabel(Orientation: Office.MsoTextOrientation, Left: number, Top: number, Width: number, Height: number): Shape; AddLine(BeginX: number, BeginY: number, EndX: number, EndY: number): Shape; - AddOLEObject(ClassType?: any, Filename?: any, Link?: any, DisplayAsIcon?: any, IconFileName?: any, IconIndex?: any, IconLabel?: any, Left?: any, Top?: any, Width?: any, - Height?: any): Shape; + AddOLEObject(ClassType: string, Filename?: undefined, Link?: false, DisplayAsIcon?: boolean, IconFileName?: string, IconIndex?: number, IconLabel?: string, Left?: number, Top?: number, Width?: number, Height?: number): Shape; + AddOLEObject(ClassType: undefined, Filename: string, Link?: boolean, DisplayAsIcon?: boolean, IconFileName?: string, IconIndex?: number, IconLabel?: string, Left?: number, Top?: number, Width?: number, Height?: number): Shape; AddPicture(Filename: string, LinkToFile: Office.MsoTriState, SaveWithDocument: Office.MsoTriState, Left: number, Top: number, Width: number, Height: number): Shape; - AddPolyline(SafeArrayOfPoints: any): Shape; + AddPolyline(SafeArrayOfPoints: SafeArray): Shape; AddShape(Type: Office.MsoAutoShapeType, Left: number, Top: number, Width: number, Height: number): Shape; - AddSmartArt(Layout: Office.SmartArtLayout, Left?: any, Top?: any, Width?: any, Height?: any): Shape; + AddSmartArt(Layout: Office.SmartArtLayout, Left?: number, Top?: number, Width?: number, Height?: number): Shape; AddTextbox(Orientation: Office.MsoTextOrientation, Left: number, Top: number, Width: number, Height: number): Shape; - AddTextEffect( - PresetTextEffect: Office.MsoPresetTextEffect, Text: string, FontName: string, FontSize: number, FontBold: Office.MsoTriState, FontItalic: Office.MsoTriState, - Left: number, Top: number): Shape; + AddTextEffect(PresetTextEffect: Office.MsoPresetTextEffect, Text: string, FontName: string, FontSize: number, FontBold: Office.MsoTriState, FontItalic: Office.MsoTriState, Left: number, Top: number): Shape; readonly Application: Application; BuildFreeform(EditingType: Office.MsoEditingType, X1: number, Y1: number): FreeformBuilder; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): Shape; + Item(Index: number | string): Shape; readonly Parent: any; - Range(Index: any): ShapeRange; + Range(Index: number | string | SafeArray): ShapeRange; SelectAll(): void; + (Index: number | string): Shape; } - class Sheets { - private 'Excel.Sheets_typekey': Sheets; - private constructor(); + interface Sheets { __PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any): void; _Default(Index: any): any; _PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): void; - Add(Before?: any, After?: any, Count?: any, Type?: any): any; + Add(Before?: Sheet, After?: Sheet, Count?: number, Type?: T): AddSheetResult; readonly Application: Application; - Copy(Before?: any, After?: any): void; + Copy(Before?: Sheet): void; + Copy(Before: undefined, After: Sheet): void; readonly Count: number; readonly Creator: XlCreator; Delete(): void; - /** @param Excel.XlFillWith [Type=-4104] */ + /** @param Type [Type=-4104] */ FillAcrossSheets(Range: Range, Type?: XlFillWith): void; readonly HPageBreaks: HPageBreaks; - Item(Index: string | number): Worksheet | Chart | DialogSheet; - Item(Indexes: SafeArray): Sheets; - Move(Before?: any, After?: any): void; + Item(Index: string | number): TSheet; + Item(Indexes: SafeArray): Sheets; + Move(Before?: Sheet | number): void; + Move(Before: undefined, After: Sheet | number): void; readonly Parent: any; - PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any, IgnorePrintAreas?: any): void; - PrintPreview(EnableChanges?: any): void; + PrintOut(From?: number, To?: number, Copies?: number, Preview?: boolean, ActivePrinter?: string, PrintToFile?: T, Collate?: boolean, PrToFileName?: PrintToFileName, IgnorePrintAreas?: boolean): void; + PrintPreview(EnableChanges?: boolean): void; Select(Replace?: boolean): void; Visible: any; readonly VPageBreaks: VPageBreaks; + (Index: string | number): TSheet; + (Indexes: SafeArray): Sheets; } - class SheetViews { - private 'Excel.SheetViews_typekey': SheetViews; - private constructor(); + interface SheetViews { _Default(Index: any): any; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): any; + Item(Index: any): SheetView; readonly Parent: any; + (Index: any): SheetView; } class Slicer { @@ -7430,27 +8049,25 @@ declare namespace Excel { readonly VisibleSlicerItemsList: any; } - class SlicerCacheLevels { - private 'Excel.SlicerCacheLevels_typekey': SlicerCacheLevels; - private constructor(); + interface SlicerCacheLevels { _Default(Level?: any): SlicerCacheLevel; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Level?: any): SlicerCacheLevel; + Item(Level?: number | string): SlicerCacheLevel; readonly Parent: any; + (Level?: number | string): SlicerCacheLevel; } - class SlicerCaches { - private 'Excel.SlicerCaches_typekey': SlicerCaches; - private constructor(); + interface SlicerCaches { _Default(Index: any): SlicerCache; - Add(Source: any, SourceField: any, Name?: any): SlicerCache; + Add(Source: WorkbookConnection | PivotTable | string, SourceField: any, Name?: any): SlicerCache; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): SlicerCache; + Item(Index: number | string): SlicerCache; readonly Parent: any; + (Index: number | string): SlicerCache; } class SlicerItem { @@ -7468,40 +8085,37 @@ declare namespace Excel { readonly Value: string; } - class SlicerItems { - private 'Excel.SlicerItems_typekey': SlicerItems; - private constructor(); + interface SlicerItems { _Default(Index: any): SlicerItem; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): SlicerItem; + Item(Index: number | string): SlicerItem; readonly Parent: any; + (Index: number | string): SlicerItem; } - class SlicerPivotTables { - private 'Excel.SlicerPivotTables_typekey': SlicerPivotTables; - private constructor(); + interface SlicerPivotTables { _Default(Index: any): PivotTable; AddPivotTable(PivotTable: PivotTable): void; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): PivotTable; + Item(Index: number | string): PivotTable; readonly Parent: any; - RemovePivotTable(PivotTable: any): void; + RemovePivotTable(PivotTable: PivotTable | number | string): void; + (Index: number | string): PivotTable; } - class Slicers { - private 'Excel.Slicers_typekey': Slicers; - private constructor(); + interface Slicers { _Default(Index: any): Slicer; - Add(SlicerDestination: any, Level?: any, Name?: any, Caption?: any, Top?: any, Left?: any, Width?: any, Height?: any): Slicer; + Add(SlicerDestination: string | Worksheet, Level?: any, Name?: string, Caption?: string, Top?: number, Left?: number, Width?: number, Height?: number): Slicer; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): Slicer; + Item(Index: number | string): Slicer; readonly Parent: any; + (Index: number | string): Slicer; } class SmartTag { @@ -7539,15 +8153,14 @@ declare namespace Excel { readonly Type: XlSmartTagControlType; } - class SmartTagActions { - private 'Excel.SmartTagActions_typekey': SmartTagActions; - private constructor(); + interface SmartTagActions { _Default(Index: any): SmartTagAction; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: any): SmartTagAction; readonly Parent: any; + (Index: any): SmartTagAction; } class SmartTagOptions { @@ -7572,9 +8185,7 @@ declare namespace Excel { readonly progID: string; } - class SmartTagRecognizers { - private 'Excel.SmartTagRecognizers_typekey': SmartTagRecognizers; - private constructor(); + interface SmartTagRecognizers { _Default(Index: any): SmartTagRecognizer; readonly Application: Application; readonly Count: number; @@ -7582,17 +8193,17 @@ declare namespace Excel { Item(Index: any): SmartTagRecognizer; readonly Parent: any; Recognize: boolean; + (Index: any): SmartTagRecognizer; } - class SmartTags { - private 'Excel.SmartTags_typekey': SmartTags; - private constructor(); + interface SmartTags { _Default(Index: any): SmartTag; Add(SmartTagType: string): SmartTag; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; readonly Parent: any; + (Index: any): SmartTag; } class Sort { @@ -7629,9 +8240,7 @@ declare namespace Excel { readonly SortOnValue: any; } - class SortFields { - private 'Excel.SortFields_typekey': SortFields; - private constructor(); + interface SortFields { _Default(Index: any): SortField; Add(Key: Range, SortOn?: any, Order?: any, CustomOrder?: any, DataOption?: any): SortField; readonly Application: Application; @@ -7640,6 +8249,7 @@ declare namespace Excel { readonly Creator: XlCreator; Item(Index: any): SortField; readonly Parent: any; + (Index: any): SortField; } class SoundNote { @@ -7723,9 +8333,7 @@ declare namespace Excel { Type: XlSparkType; } - class SparklineGroups { - private 'Excel.SparklineGroups_typekey': SparklineGroups; - private constructor(); + interface SparklineGroups { _Default(Index: any): SparklineGroup; Add(Type: XlSparkType, SourceData: string): SparklineGroup; readonly Application: Application; @@ -7734,9 +8342,10 @@ declare namespace Excel { readonly Count: number; readonly Creator: XlCreator; Group(Location: Range): void; - Item(Index: any): SparklineGroup; + Item(Index: number): SparklineGroup; readonly Parent: any; Ungroup(): void; + (Index: number): SparklineGroup; } class SparkPoints { @@ -7769,7 +8378,7 @@ declare namespace Excel { private 'Excel.Speech_typekey': Speech; private constructor(); Direction: XlSpeakDirection; - Speak(Text: string, SpeakAsync?: any, SpeakXML?: any, Purge?: any): void; + Speak(Text: string, SpeakAsync?: boolean, SpeakXML?: boolean, Purge?: boolean): void; SpeakCellOnEnter: boolean; } @@ -7819,7 +8428,7 @@ declare namespace Excel { IndentLevel: number; readonly Interior: Interior; Locked: boolean; - MergeCells: any; + MergeCells: boolean; readonly Name: string; readonly NameLocal: string; NumberFormat: string; @@ -7833,29 +8442,28 @@ declare namespace Excel { WrapText: boolean; } - class Styles { - private 'Excel.Styles_typekey': Styles; - private constructor(); + interface Styles { _Default(Index: any): Style; Add(Name: string, BasedOn?: any): Style; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): Style; - Merge(Workbook: any): any; + Item(Index: number | string): Style; + Merge(Workbook: Workbook): any; readonly Parent: any; + (Index: any): Style; } class Tab { private 'Excel.Tab_typekey': Tab; private constructor(); readonly Application: Application; - Color: any; + Color: XlRgbColor | number; ColorIndex: XlColorIndex; readonly Creator: XlCreator; readonly Parent: any; ThemeColor: XlThemeColor; - TintAndShade: any; + TintAndShade: number; } class TableStyle { @@ -7866,7 +8474,7 @@ declare namespace Excel { readonly BuiltIn: boolean; readonly Creator: XlCreator; Delete(): void; - Duplicate(NewTableStyleName?: any): TableStyle; + Duplicate(NewTableStyleName?: string): TableStyle; readonly Name: string; readonly NameLocal: string; readonly Parent: any; @@ -7890,27 +8498,25 @@ declare namespace Excel { StripeSize: number; } - class TableStyleElements { - private 'Excel.TableStyleElements_typekey': TableStyleElements; - private constructor(); + interface TableStyleElements { _Default(Index: XlTableStyleElementType): TableStyleElement; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: XlTableStyleElementType): TableStyleElement; readonly Parent: any; + (Index: XlTableStyleElementType): TableStyleElement; } - class TableStyles { - private 'Excel.TableStyles_typekey': TableStyles; - private constructor(); + interface TableStyles { _Default(Index: any): TableStyle; Add(TableStyleName: string): TableStyle; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): TableStyle; + Item(Index: number | string): TableStyle; readonly Parent: any; + (Index: number | string): TableStyle; } class TextEffectFormat { @@ -7940,7 +8546,7 @@ declare namespace Excel { readonly Application: Application; AutoMargins: boolean; AutoSize: boolean; - Characters(Start?: any, Length?: any): Characters; + Characters(Start?: number, Length?: number): Characters; readonly Creator: XlCreator; HorizontalAlignment: XlHAlign; HorizontalOverflow: XlOartHorizontalOverflow; @@ -8041,7 +8647,7 @@ declare namespace Excel { readonly Name: string; NumberFormat: string; NumberFormatLinked: boolean; - NumberFormatLocal: any; + NumberFormatLocal: string; Offset: number; Orientation: XlTickLabelOrientation; readonly Parent: any; @@ -8096,9 +8702,7 @@ declare namespace Excel { Width: number; } - class ToolbarButtons { - private 'Excel.ToolbarButtons_typekey': ToolbarButtons; - private constructor(); + interface ToolbarButtons { _Default(Index: number): ToolbarButton; Add(Button?: any, Before?: any, OnAction?: any, Pushed?: any, Enabled?: any, StatusBar?: any, HelpFile?: any, HelpContextID?: any): ToolbarButton; readonly Application: Application; @@ -8106,11 +8710,10 @@ declare namespace Excel { readonly Creator: XlCreator; Item(Index: number): ToolbarButton; readonly Parent: any; + (Index: number): ToolbarButton; } - class Toolbars { - private 'Excel.Toolbars_typekey': Toolbars; - private constructor(); + interface Toolbars { _Default(Index: any): Toolbar; Add(Name?: any): Toolbar; readonly Application: Application; @@ -8118,6 +8721,33 @@ declare namespace Excel { readonly Creator: XlCreator; Item(Index: any): Toolbar; readonly Parent: any; + (Index: any): Toolbar; + } + + class Top10 { + private 'Excel.Top10_typekey': Top10; + private constructor(); + readonly Application: Application; + readonly AppliesTo: Range; + readonly Borders: Borders; + CalcFor: XlCalcFor; + readonly Creator: XlCreator; + Delete(): void; + readonly Font: Font; + readonly Interior: Interior; + ModifyAppliesToRange(Range: Range): void; + NumberFormat: string; + readonly Parent: any; + Percent: boolean; + Priority: number; + readonly PTCondition: boolean; + Rank: number; + ScopeType: XlPivotConditionScope; + SetFirstPriority(): void; + SetLastPriority(): void; + StopIfTrue: boolean; + TopBottom: XlTopBottom; + readonly Type: number; } class TreeviewControl { @@ -8126,10 +8756,74 @@ declare namespace Excel { readonly Application: Application; readonly Creator: XlCreator; Drilled: any; - Hidden: any; + Hidden: SafeArray>; readonly Parent: any; } + class Trendline { + private 'Excel.Trendline_typekey': Trendline; + private constructor(); + readonly Application: Application; + Backward: number; + Backward2: number; + readonly Border: Border; + ClearFormats(): any; + readonly Creator: XlCreator; + readonly DataLabel: DataLabel; + Delete(): any; + DisplayEquation: boolean; + DisplayRSquared: boolean; + readonly Format: ChartFormat; + Forward: number; + Forward2: number; + readonly Index: number; + Intercept: number; + InterceptIsAuto: boolean; + Name: string; + NameIsAuto: boolean; + Order: number; + readonly Parent: any; + Period: number; + Select(): any; + Type: XlTrendlineType; + } + + interface Trendlines { + _Default(Index?: any): Trendline; + + /** @param Type [Type=-4132] */ + Add(Type?: XlTrendlineType, Order?: number, Period?: number, Forward?: number, Backward?: number, Intercept?: any, DisplayEquation?: boolean, DisplayRSquared?: boolean, Name?: string): Trendline; + readonly Application: Application; + readonly Count: number; + readonly Creator: XlCreator; + Item(Index: number): Trendline; + readonly Parent: any; + (Index: number): Trendline; + } + + class UniqueValues { + private 'Excel.UniqueValues_typekey': UniqueValues; + private constructor(); + readonly Application: Application; + readonly AppliesTo: Range; + readonly Borders: Borders; + readonly Creator: XlCreator; + Delete(): void; + DupeUnique: XlDupeUnique; + readonly Font: Font; + readonly Interior: Interior; + ModifyAppliesToRange(Range: Range): void; + NumberFormat: string; + readonly Parent: any; + Priority: number; + readonly PTCondition: boolean; + ScopeType: XlPivotConditionScope; + SetFirstPriority(): void; + SetLastPriority(): void; + StopIfTrue: boolean; + readonly Type: XlFormatConditionType.xlUniqueValues; + } + class UpBars { private 'Excel.UpBars_typekey': UpBars; private constructor(); @@ -8145,15 +8839,14 @@ declare namespace Excel { Select(): any; } - class UsedObjects { - private 'Excel.UsedObjects_typekey': UsedObjects; - private constructor(); + interface UsedObjects { _Default(Index: any): any; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): any; + Item(Index: number | string): any; readonly Parent: any; + (Index: number | string): any; } class UserAccess { @@ -8164,20 +8857,21 @@ declare namespace Excel { readonly Name: string; } - class UserAccessList { - private 'Excel.UserAccessList_typekey': UserAccessList; - private constructor(); + interface UserAccessList { _Default(Index: any): UserAccess; Add(Name: string, AllowEdit: boolean): UserAccess; readonly Count: number; DeleteAll(): void; - Item(Index: any): UserAccess; + Item(Index: number | string): UserAccess; + (Index: number | string): UserAccess; } class Validation { private 'Excel.Validation_typekey': Validation; private constructor(); - Add(Type: XlDVType, AlertStyle?: any, Operator?: any, Formula1?: any, Formula2?: any): void; + Add(Type: XlDVType.xlValidateInputOnly): void; + Add(Type: XlDVType.xlValidateWholeNumber | XlDVType.xlValidateDate | XlDVType.xlValidateDecimal | XlDVType.xlValidateTextLength | XlDVType.xlValidateTime, AlertStyle?: XlDVAlertStyle, Operator?: XlFormatConditionOperator.xlBetween | XlFormatConditionOperator.xlNotBetween, Formula1?: string, Formula2?: string): void; + Add(Type?: XlDVType, AlertStyle?: XlDVAlertStyle, Operator?: XlFormatConditionOperator, Formula1?: string): void; readonly AlertStyle: number; readonly Application: Application; readonly Creator: XlCreator; @@ -8191,7 +8885,9 @@ declare namespace Excel { InCellDropdown: boolean; InputMessage: string; InputTitle: string; - Modify(Type?: any, AlertStyle?: any, Operator?: any, Formula1?: any, Formula2?: any): void; + Modify(Type: XlDVType.xlValidateInputOnly): void; + Modify(Type: XlDVType.xlValidateWholeNumber | XlDVType.xlValidateDate | XlDVType.xlValidateDecimal | XlDVType.xlValidateTextLength | XlDVType.xlValidateTime, AlertStyle?: XlDVAlertStyle, Operator?: XlFormatConditionOperator.xlBetween | XlFormatConditionOperator.xlNotBetween, Formula1?: string, Formula2?: string): void; + Modify(Type?: XlDVType, AlertStyle?: XlDVAlertStyle, Operator?: XlFormatConditionOperator, Formula1?: string): void; readonly Operator: number; readonly Parent: any; ShowError: boolean; @@ -8230,16 +8926,15 @@ declare namespace Excel { Type: XlPageBreak; } - class VPageBreaks { - private 'Excel.VPageBreaks_typekey': VPageBreaks; - private constructor(); + interface VPageBreaks { _Default(Index: number): VPageBreak; - Add(Before: any): VPageBreak; + Add(Before: Range): VPageBreak; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Item(Index: number): VPageBreak; readonly Parent: any; + (Index: number): VPageBreak; } class Walls { @@ -8255,8 +8950,8 @@ declare namespace Excel { readonly Name: string; readonly Parent: any; Paste(): void; - PictureType: any; - PictureUnit: any; + PictureType: XlChartPictureType; + PictureUnit: number; Select(): any; Thickness: number; } @@ -8271,17 +8966,16 @@ declare namespace Excel { readonly Source: any; } - class Watches { - private 'Excel.Watches_typekey': Watches; - private constructor(); + interface Watches { _Default(Index: any): Watch; Add(Source: any): Watch; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; Delete(): void; - Item(Index: any): Watch; + Item(Index: number | string): Watch; readonly Parent: any; + (Index: number | string): Watch; } class WebOptions { @@ -8316,12 +9010,12 @@ declare namespace Excel { readonly ActiveCell: Range; readonly ActiveChart: Chart; readonly ActivePane: Pane; - readonly ActiveSheet: any; - readonly ActiveSheetView: any; + readonly ActiveSheet: Sheet | null; + readonly ActiveSheetView: SheetView | null; readonly Application: Application; AutoFilterDateGrouping: boolean; - Caption: any; - Close(SaveChanges?: any, Filename?: any, RouteWorkbook?: any): boolean; + Caption: string; + Close(SaveChanges?: boolean, Filename?: string, RouteWorkbook?: boolean): boolean; readonly Creator: XlCreator; DisplayFormulas: boolean; DisplayGridlines: boolean; @@ -8340,7 +9034,7 @@ declare namespace Excel { GridlineColorIndex: XlColorIndex; Height: number; readonly Index: number; - LargeScroll(Down?: any, Up?: any, ToRight?: any, ToLeft?: any): any; + LargeScroll(Down?: number, Up?: number, ToRight?: number, ToLeft?: number): any; Left: number; NewWindow(): Window; OnWindow: string; @@ -8348,18 +9042,19 @@ declare namespace Excel { readonly Parent: any; PointsToScreenPixelsX(Points: number): number; PointsToScreenPixelsY(Points: number): number; - PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): any; - PrintPreview(EnableChanges?: any): any; - RangeFromPoint(x: number, y: number): any; + PrintOut(From?: number, To?: number, Copies?: number, Preview?: boolean, ActivePrinter?: string, PrintToFile?: T, Collate?: boolean, PrToFileName?: PrintToFileName): any; + PrintPreview(EnableChanges?: boolean): any; + RangeFromPoint(x: number, y: number): Shape | Range | null; readonly RangeSelection: Range; ScrollColumn: number; - ScrollIntoView(Left: number, Top: number, Width: number, Height: number, Start?: any): void; + ScrollIntoView(Left: number, Top: number, Width: number, Height: number, Start?: boolean): void; ScrollRow: number; - ScrollWorkbookTabs(Sheets?: any, Position?: any): any; + ScrollWorkbookTabs(Sheets: 0, Position: Constants.xlFirst | Constants.xlLast): any; + ScrollWorkbookTabs(Sheets: number): any; readonly SelectedSheets: Sheets; readonly Selection: any; readonly SheetViews: SheetViews; - SmallScroll(Down?: any, Up?: any, ToRight?: any, ToLeft?: any): any; + SmallScroll(Down?: number, Up?: number, ToRight?: number, ToLeft?: number): any; Split: boolean; SplitColumn: number; SplitHorizontal: number; @@ -8376,25 +9071,25 @@ declare namespace Excel { Width: number; readonly WindowNumber: number; WindowState: XlWindowState; - Zoom: any; + Zoom: number | true; } - class Windows { - private 'Excel.Windows_typekey': Windows; - private constructor(); + interface Windows { _Default(Index: any): Window; readonly Application: Application; + Arrange(ArrangeStyle: XlArrangeStyle, ActiveWorkbook: true, SyncHorizontal?: boolean, SyncVertical?: boolean): any; - /** @param Excel.XlArrangeStyle [ArrangeStyle=1] */ - Arrange(ArrangeStyle?: XlArrangeStyle, ActiveWorkbook?: any, SyncHorizontal?: any, SyncVertical?: any): any; + /** @param ArrangeStyle [ArrangeStyle=1] */ + Arrange(ArrangeStyle?: XlArrangeStyle, ActiveWorkbook?: boolean, SyncHorizontal?: boolean, SyncVertical?: boolean): any; BreakSideBySide(): boolean; - CompareSideBySideWith(WindowName: any): boolean; + CompareSideBySideWith(WindowName: string): boolean; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): Window; + Item(Index: number | string): Window; readonly Parent: any; ResetPositionsSideBySide(): void; SyncScrollingSideBySide: boolean; + (Index: number | string): Window; } class Workbook { @@ -8407,16 +9102,14 @@ declare namespace Excel { _ProtectSharing(Filename?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, SharingPassword?: any): void; readonly _ReadOnlyRecommended: boolean; - /** @param Excel.XlSaveAsAccessMode [AccessMode=1] */ - _SaveAs( - Filename: string, FileFormat?: XlFileFormat, Password?: string, WriteResPassword?: string, ReadOnlyRecommended?: boolean, CreateBackup?: boolean, AccessMode?: XlSaveAsAccessMode, - ConflictResolution?: XlSaveConflictResolution, AddToMru?: boolean, TextCodepage?: any, TextVisualLayout?: any): void; + /** @param AccessMode [AccessMode=1] */ + _SaveAs(Filename: string, FileFormat?: XlFileFormat, Password?: string, WriteResPassword?: string, ReadOnlyRecommended?: boolean, CreateBackup?: boolean, AccessMode?: XlSaveAsAccessMode, ConflictResolution?: XlSaveConflictResolution, AddToMru?: boolean, TextCodepage?: any, TextVisualLayout?: any): void; AcceptAllChanges(When?: any, Who?: any, Where?: any): void; AcceptLabelsInFormulas: boolean; AccuracyVersion: number; Activate(): void; readonly ActiveChart: Chart; - readonly ActiveSheet: any; + readonly ActiveSheet: Sheet; readonly ActiveSlicer: Slicer; AddToFavorites(): void; readonly Application: Application; @@ -8428,18 +9121,21 @@ declare namespace Excel { readonly BuiltinDocumentProperties: Office.DocumentProperties; readonly CalculationVersion: number; CanCheckIn(): boolean; - ChangeFileAccess(Mode: XlFileAccess, WritePassword?: any, Notify?: any): void; + ChangeFileAccess(Mode: XlFileAccess.xlReadWrite, WritePassword?: string, Notify?: boolean): void; + ChangeFileAccess(Mode: XlFileAccess): void; ChangeHistoryDuration: number; - /** @param Excel.XlLinkType [Type=1] */ + /** @param Type [Type=1] */ ChangeLink(Name: string, NewName: string, Type?: XlLinkType): void; - readonly Charts: Sheets; + readonly Charts: Sheets; CheckCompatibility: boolean; - CheckIn(SaveChanges?: any, Comments?: any, MakePublic?: any): void; - CheckInWithVersion(SaveChanges?: any, Comments?: any, MakePublic?: any, VersionType?: any): void; - Close(SaveChanges?: any, Filename?: any, RouteWorkbook?: any): void; + CheckIn(SaveChanges: true, Comments?: string, MakePublic?: boolean): void; + CheckIn(SaveChanges?: any): void; + CheckInWithVersion(SaveChanges?: boolean, Comments?: any, MakePublic?: any, VersionType?: any): void; + Close(SaveChanges: true, Filename?: string, RouteWorkbook?: boolean): void; + Close(SaveChanges?: boolean, Filename?: undefined, RouteWorkbook?: boolean): void; readonly CodeName: string; - Colors(Index?: any): any; + Colors: SafeArray & ((Index: number) => number); readonly CommandBars: Office.CommandBars; Comments: string; ConflictResolution: XlSaveConflictResolution; @@ -8457,7 +9153,7 @@ declare namespace Excel { DefaultSlicerStyle: any; DefaultTableStyle: any; DeleteNumberFormat(NumberFormat: string): void; - readonly DialogSheets: Sheets; + readonly DialogSheets: Sheets; DisplayDrawingObjects: XlDisplayDrawingObjects; DisplayInkComments: boolean; readonly DocumentInspectors: Office.DocumentInspectors; @@ -8476,12 +9172,10 @@ declare namespace Excel { readonly Excel4MacroSheets: Sheets; readonly Excel8CompatibilityMode: boolean; ExclusiveAccess(): boolean; - ExportAsFixedFormat( - Type: XlFixedFormatType, Filename?: any, Quality?: any, IncludeDocProperties?: any, IgnorePrintAreas?: any, From?: any, To?: any, OpenAfterPublish?: any, - FixedFormatExtClassPtr?: any): void; + ExportAsFixedFormat(Type: XlFixedFormatType, Filename?: string, Quality?: XlFixedFormatQuality, IncludeDocProperties?: boolean, IgnorePrintAreas?: boolean, From?: number, To?: number, OpenAfterPublish?: boolean, FixedFormatExtClassPtr?: any): void; readonly FileFormat: XlFileFormat; Final: boolean; - FollowHyperlink(Address: string, SubAddress?: any, NewWindow?: any, AddHistory?: any, ExtraInfo?: any, Method?: any, HeaderInfo?: any): void; + FollowHyperlink(Address: string, SubAddress?: string, NewWindow?: boolean, AddHistory?: undefined, ExtraInfo?: string | Office.ByteArray, Method?: Office.MsoExtraInfoMethod, HeaderInfo?: string): void; ForceFullCalculation: boolean; ForwardMailer(): void; readonly FullName: string; @@ -8493,7 +9187,7 @@ declare namespace Excel { HasRoutingSlip: boolean; readonly HasVBProject: boolean; HighlightChangesOnScreen: boolean; - HighlightChangesOptions(When?: any, Who?: any, Where?: any): void; + HighlightChangesOptions(When?: XlHighlightChangesTime, Who?: 'Everyone' | 'Everyone but me' | string, Where?: string): void; readonly HTMLProject: Office.HTMLProject; readonly IconSets: IconSets; InactiveListBorderVisible: boolean; @@ -8501,12 +9195,12 @@ declare namespace Excel { readonly IsInplace: boolean; KeepChangeHistory: boolean; Keywords: string; - LinkInfo(Name: string, LinkInfo: XlLinkInfo, Type?: any, EditionRef?: any): any; - LinkSources(Type?: any): any; + LinkInfo(Name: string, LinkInfo: XlLinkInfo, Type?: XlLinkInfoType, EditionRef?: string): any; + LinkSources(Type?: XlLink): SafeArray; ListChangesOnNewSheet: boolean; LockServerFile(): void; readonly Mailer: Mailer; - MergeWorkbook(Filename: any): void; + MergeWorkbook(Filename: string): void; readonly Modules: Sheets; readonly MultiUserEditing: boolean; readonly Name: string; @@ -8515,7 +9209,7 @@ declare namespace Excel { OnSave: string; OnSheetActivate: string; OnSheetDeactivate: string; - OpenLinks(Name: string, ReadOnly?: any, Type?: any): void; + OpenLinks(Name: string, ReadOnly?: boolean, Type?: XlLink): void; readonly Parent: any; Password: string; readonly PasswordEncryptionAlgorithm: string; @@ -8527,19 +9221,18 @@ declare namespace Excel { PersonalViewListSettings: boolean; PersonalViewPrintSettings: boolean; PivotCaches(): PivotCaches; - PivotTableWizard( - SourceType?: any, SourceData?: any, TableDestination?: any, TableName?: any, RowGrand?: any, ColumnGrand?: any, SaveData?: any, HasAutoFormat?: any, - AutoPage?: any, Reserved?: any, BackgroundQuery?: any, OptimizeCache?: any, PageFieldOrder?: any, PageFieldWrapCount?: any, ReadData?: any, Connection?: any): void; - Post(DestName?: any): void; + PivotTableWizard(): void; + PivotTableWizard(SourceType: TSourceType, SourceData: PivotTableWizardSourceData, TableDestination?: Range, TableName?: string, RowGrand?: boolean, ColumnGrand?: boolean, SaveData?: boolean, HasAutoFormat?: boolean, AutoPage?: PivotTableWizardAutoPage, Reserved?: undefined, BackgroundQuery?: boolean, OptimizeCache?: boolean, PageFieldOrder?: XlOrder, PageFieldWrapCount?: number, ReadData?: boolean, Connection?: string): void; + Post(): void; PrecisionAsDisplayed: boolean; - PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any, IgnorePrintAreas?: any): void; - PrintPreview(EnableChanges?: any): void; - Protect(Password?: any, Structure?: any, Windows?: any): void; - ProtectSharing(Filename?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, SharingPassword?: any, FileFormat?: any): void; + PrintOut(From?: number, To?: number, Copies?: number, Preview?: boolean, ActivePrinter?: string, PrintToFile?: T, Collate?: boolean, PrToFileName?: PrintToFileName, IgnorePrintAreas?: boolean): void; + PrintPreview(EnableChanges?: boolean): void; + Protect(Password?: string, Structure?: boolean, Windows?: boolean): void; + ProtectSharing(Filename?: string, Password?: string, WriteResPassword?: string, ReadOnlyRecommended?: boolean, CreateBackup?: boolean, SharingPassword?: string, FileFormat?: any): void; readonly ProtectStructure: boolean; readonly ProtectWindows: boolean; readonly PublishObjects: PublishObjects; - PurgeChangeHistoryNow(Days: number, SharingPassword?: any): void; + PurgeChangeHistoryNow(Days: number, SharingPassword?: string): void; readonly ReadOnly: boolean; ReadOnlyRecommended: boolean; RecheckSmartTags(): void; @@ -8551,7 +9244,7 @@ declare namespace Excel { RemoveUser(Index: number): void; Reply(): void; ReplyAll(): void; - ReplyWithChanges(ShowMessage?: any): void; + ReplyWithChanges(ShowMessage?: boolean): void; readonly Research: Research; ResetColors(): void; readonly RevisionNumber: number; @@ -8561,25 +9254,27 @@ declare namespace Excel { RunAutoMacros(Which: XlRunAutoMacro): void; Save(): void; - /** @param Excel.XlSaveAsAccessMode [AccessMode=1] */ - SaveAs( - Filename: string, FileFormat?: XlFileFormat, Password?: string, WriteResPassword?: string, ReadOnlyRecommended?: boolean, CreateBackup?: boolean, AccessMode?: XlSaveAsAccessMode, - ConflictResolution?: XlSaveConflictResolution, AddToMru?: boolean, TextCodepage?: any, TextVisualLayout?: any): void; + /** @param AccessMode [AccessMode=1] */ + SaveAs(Filename: string, FileFormat?: XlFileFormat, Password?: string, WriteResPassword?: string, ReadOnlyRecommended?: boolean, CreateBackup?: boolean, AccessMode?: XlSaveAsAccessMode, ConflictResolution?: XlSaveConflictResolution, AddToMru?: boolean, TextCodepage?: any, TextVisualLayout?: any): void; SaveAsXMLData(Filename: string, Map: XmlMap): void; - SaveCopyAs(Filename?: any): void; + SaveCopyAs(Filename: string): void; Saved: boolean; SaveLinkValues: boolean; sblt(s: string): void; - SendFaxOverInternet(Recipients?: any, Subject?: any, ShowMessage?: any): void; - SendForReview(Recipients?: any, Subject?: any, ShowMessage?: any, IncludeAttachment?: any): void; - SendMail(Recipients: any, Subject?: any, ReturnReceipt?: any): void; + SendFaxOverInternet(Recipients?: string, Subject?: string, ShowMessage?: boolean): void; + SendForReview(Recipients?: string, Subject?: string, ShowMessage?: boolean, IncludeAttachment?: boolean): void; + SendMail(Recipients: string | SafeArray, Subject?: string, ReturnReceipt?: boolean): void; - /** @param Excel.XlPriority [Priority=-4143] */ + /** + * Macintosh only + * + * @param Priority [Priority=-4143] + */ SendMailer(FileFormat: any, Priority?: XlPriority): void; readonly ServerPolicy: Office.ServerPolicy; readonly ServerViewableItems: ServerViewableItems; - SetLinkOnData(Name: string, Procedure?: any): void; - SetPasswordEncryptionOptions(PasswordEncryptionProvider?: any, PasswordEncryptionAlgorithm?: any, PasswordEncryptionKeyLength?: any, PasswordEncryptionFileProperties?: any): void; + SetLinkOnData(Name: string, Procedure?: string): void; + SetPasswordEncryptionOptions(PasswordEncryptionProvider?: string, PasswordEncryptionAlgorithm?: string, PasswordEncryptionKeyLength?: number, PasswordEncryptionFileProperties?: boolean): void; readonly SharedWorkspace: Office.SharedWorkspace; readonly Sheets: Sheets; ShowConflictHistory: boolean; @@ -8597,25 +9292,25 @@ declare namespace Excel { readonly Theme: Office.OfficeTheme; Title: string; ToggleFormsDesign(): void; - Unprotect(Password?: any): void; - UnprotectSharing(SharingPassword?: any): void; + Unprotect(Password?: string): void; + UnprotectSharing(SharingPassword?: string): void; UpdateFromFile(): void; - UpdateLink(Name?: any, Type?: any): void; + UpdateLink(Name?: string, Type?: XlLinkType): void; UpdateLinks: XlUpdateLinks; UpdateRemoteReferences: boolean; UserControl: boolean; - readonly UserStatus: any; + readonly UserStatus: SafeArray; readonly VBASigned: boolean; readonly VBProject: VBIDE.VBProject; readonly WebOptions: WebOptions; WebPagePreview(): void; readonly Windows: Windows; - readonly Worksheets: Sheets; + readonly Worksheets: Sheets; WritePassword: string; readonly WriteReserved: boolean; readonly WriteReservedBy: string; - XmlImport(Url: string, ImportMap: XmlMap, Overwrite?: any, Destination?: any): XlXmlImportResult; - XmlImportXml(Data: string, ImportMap: XmlMap, Overwrite?: any, Destination?: any): XlXmlImportResult; + XmlImport(Url: string, ImportMap: XmlMap, Overwrite?: boolean, Destination?: any): XlXmlImportResult; + XmlImportXml(Data: string, ImportMap: XmlMap, Overwrite?: boolean, Destination?: any): XlXmlImportResult; readonly XmlMaps: XmlMaps; readonly XmlNamespaces: XmlNamespaces; } @@ -8637,25 +9332,16 @@ declare namespace Excel { readonly Type: XlConnectionType; } - class Workbooks { - private 'Excel.Workbooks_typekey': Workbooks; - private constructor(); - - /** @param Excel.XlTextQualifier [TextQualifier=1] */ - __OpenText( - Filename: string, Origin: any, StartRow: any, DataType: any, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: any, Tab?: any, Semicolon?: any, - Comma?: any, Space?: any, Other?: any, OtherChar?: any, FieldInfo?: any, TextVisualLayout?: any): void; + interface Workbooks { + /** @param TextQualifier [TextQualifier=1] */ + __OpenText(Filename: string, Origin: any, StartRow: any, DataType: any, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: any, Tab?: any, Semicolon?: any, Comma?: any, Space?: any, Other?: any, OtherChar?: any, FieldInfo?: any, TextVisualLayout?: any): void; _Default(Index: any): Workbook; - _Open( - Filename: string, UpdateLinks?: any, ReadOnly?: any, Format?: any, Password?: any, WriteResPassword?: any, IgnoreReadOnlyRecommended?: any, Origin?: any, - Delimiter?: any, Editable?: any, Notify?: any, Converter?: any, AddToMru?: any): Workbook; + _Open(Filename: string, UpdateLinks?: any, ReadOnly?: any, Format?: any, Password?: any, WriteResPassword?: any, IgnoreReadOnlyRecommended?: any, Origin?: any, Delimiter?: any, Editable?: any, Notify?: any, Converter?: any, AddToMru?: any): Workbook; - /** @param Excel.XlTextQualifier [TextQualifier=1] */ - _OpenText( - Filename: string, Origin: any, StartRow: any, DataType: any, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: any, Tab?: any, Semicolon?: any, - Comma?: any, Space?: any, Other?: any, OtherChar?: any, FieldInfo?: any, TextVisualLayout?: any, DecimalSeparator?: any, ThousandsSeparator?: any): void; + /** @param TextQualifier [TextQualifier=1] */ + _OpenText(Filename: string, Origin: any, StartRow: any, DataType: any, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: any, Tab?: any, Semicolon?: any, Comma?: any, Space?: any, Other?: any, OtherChar?: any, FieldInfo?: any, TextVisualLayout?: any, DecimalSeparator?: any, ThousandsSeparator?: any): void; _OpenXML(Filename: string, Stylesheets?: any): Workbook; - Add(Template?: any): Workbook; + Add(Template?: string | XlWBATemplate): Workbook; readonly Application: Application; CanCheckOut(Filename: string): boolean; CheckOut(Filename: string): void; @@ -8663,18 +9349,21 @@ declare namespace Excel { readonly Count: number; readonly Creator: XlCreator; Item(Index: number | string): Workbook; - Open( - Filename: string, UpdateLinks?: any, ReadOnly?: any, Format?: any, Password?: any, WriteResPassword?: any, IgnoreReadOnlyRecommended?: any, Origin?: any, - Delimiter?: any, Editable?: any, Notify?: any, Converter?: any, AddToMru?: any, Local?: any, CorruptLoad?: any): Workbook; - OpenDatabase(Filename: string, CommandText?: any, CommandType?: any, BackgroundQuery?: any, ImportDataAs?: any): Workbook; + Open(Filename: string, UpdateLinks?: 0 | 3, ReadOnly?: boolean, Format?: 1 | 2 | 3 | 4 | 5, Password?: string, WriteResPassword?: string, IgnoreReadOnlyRecommended?: boolean, Origin?: XlPlatform, Delimiter?: undefined, Editable?: boolean, Notify?: boolean, Converter?: number, AddToMru?: boolean, Local?: boolean, CorruptLoad?: XlCorruptLoad): Workbook; + Open(Filename: string, UpdateLinks?: 0 | 3, ReadOnly?: boolean, Format?: 6, Password?: string, WriteResPassword?: string, IgnoreReadOnlyRecommended?: boolean, Origin?: XlPlatform, Delimiter?: string, Editable?: boolean, Notify?: boolean, Converter?: number, AddToMru?: boolean, Local?: boolean, CorruptLoad?: XlCorruptLoad): Workbook; + OpenDatabase(Filename: string, CommandText?: string, CommandType?: XlCmdType, BackgroundQuery?: boolean, ImportDataAs?: XlImportDataAs): Workbook; - /** @param Excel.XlTextQualifier [TextQualifier=1] */ - OpenText( - Filename: string, Origin: any, StartRow: any, DataType: any, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: any, Tab?: any, Semicolon?: any, - Comma?: any, Space?: any, Other?: any, OtherChar?: any, FieldInfo?: any, TextVisualLayout?: any, DecimalSeparator?: any, ThousandsSeparator?: any, - TrailingMinusNumbers?: any, Local?: any): void; - OpenXML(Filename: string, Stylesheets?: any, LoadOption?: any): Workbook; + /** @param TextQualifier [TextQualifier=1] */ + OpenText(Filename: string, Origin: XlPlatform, StartRow: number, DataType: XlTextParsingType.xlDelimited, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: boolean, Tab?: boolean, Semicolon?: boolean, Comma?: boolean, Space?: boolean, Other?: true, OtherChar?: string, FieldInfo?: SafeArray, TextVisualLayout?: any, DecimalSeparator?: string, ThousandsSeparator?: string, TrailingMinusNumbers?: boolean, Local?: boolean): void; + + /** @param TextQualifier [TextQualifier=1] */ + OpenText(Filename: string, Origin: XlPlatform, StartRow: number, DataType: XlTextParsingType.xlDelimited, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: boolean, Tab?: boolean, Semicolon?: boolean, Comma?: boolean, Space?: boolean, Other?: boolean, OtherChar?: undefined, FieldInfo?: SafeArray, TextVisualLayout?: any, DecimalSeparator?: string, ThousandsSeparator?: string, TrailingMinusNumbers?: boolean, Local?: boolean): void; + + /** @param TextQualifier [TextQualifier=1] */ + OpenText(Filename: string, Origin: XlPlatform, StartRow: number, DataType: XlTextParsingType, TextQualifier?: XlTextQualifier, ConsecutiveDelimiter?: undefined, Tab?: undefined, Semicolon?: undefined, Comma?: undefined, Space?: undefined, Other?: undefined, OtherChar?: undefined, FieldInfo?: SafeArray, TextVisualLayout?: any, DecimalSeparator?: string, ThousandsSeparator?: string, TrailingMinusNumbers?: boolean, Local?: boolean): void; + OpenXML(Filename: string, Stylesheets?: string | SafeArray, LoadOption?: XlXmlLoadOption): Workbook; readonly Parent: any; + (Index: number | string): Workbook; } class Worksheet { @@ -8688,9 +9377,7 @@ declare namespace Excel { _PasteSpecial(Format?: any, Link?: any, DisplayAsIcon?: any, IconFileName?: any, IconIndex?: any, IconLabel?: any): void; _PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any): void; _Protect(Password?: any, DrawingObjects?: any, Contents?: any, Scenarios?: any, UserInterfaceOnly?: any): void; - _SaveAs( - Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, - TextVisualLayout?: any): void; + _SaveAs(Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, TextVisualLayout?: any): void; Activate(): void; readonly Application: Application; Arcs(Index?: any): any; @@ -8699,9 +9386,10 @@ declare namespace Excel { Buttons(Index?: any): any; Calculate(): void; readonly Cells: Range; - ChartObjects(Index?: any): any; + ChartObjects(Index?: SafeArray): ChartObjects; + ChartObjects(Index: string | number): ChartObject; CheckBoxes(Index?: any): any; - CheckSpelling(CustomDictionary?: any, IgnoreUppercase?: any, AlwaysSuggest?: any, SpellLang?: any): void; + CheckSpelling(CustomDictionary?: string, IgnoreUppercase?: boolean, AlwaysSuggest?: boolean, SpellLang?: Office.MsoLanguageID): void; CircleInvalid(): void; readonly CircularReference: Range; ClearArrows(): void; @@ -8710,9 +9398,10 @@ declare namespace Excel { readonly Columns: Range; readonly Comments: Comments; readonly ConsolidationFunction: XlConsolidationFunction; - readonly ConsolidationOptions: any; - readonly ConsolidationSources: any; - Copy(Before?: any, After?: any): void; + readonly ConsolidationOptions: SafeArray; + readonly ConsolidationSources: SafeArray | undefined; + Copy(Before?: Sheet): void; + Copy(Before: undefined, After: Sheet): void; readonly Creator: XlCreator; readonly CustomProperties: CustomProperties; Delete(): void; @@ -8728,10 +9417,8 @@ declare namespace Excel { EnableOutlining: boolean; EnablePivotTable: boolean; EnableSelection: XlEnableSelection; - Evaluate(Name: any): any; - ExportAsFixedFormat( - Type: XlFixedFormatType, Filename?: any, Quality?: any, IncludeDocProperties?: any, IgnorePrintAreas?: any, From?: any, To?: any, OpenAfterPublish?: any, - FixedFormatExtClassPtr?: any): void; + Evaluate(Name: string): any; + ExportAsFixedFormat(Type: XlFixedFormatType, Filename?: string, Quality?: XlFixedFormatQuality, IncludeDocProperties?: boolean, IgnorePrintAreas?: boolean, From?: number, To?: number, OpenAfterPublish?: boolean, FixedFormatExtClassPtr?: any): void; readonly FilterMode: boolean; GroupBoxes(Index?: any): any; GroupObjects(Index?: any): any; @@ -8743,11 +9430,12 @@ declare namespace Excel { ListBoxes(Index?: any): any; readonly ListObjects: ListObjects; readonly MailEnvelope: Office.MsoEnvelope; - Move(Before?: any, After?: any): void; + Move(Before?: Sheet, After?: Sheet): void; Name: string; readonly Names: Names; - readonly Next: any; - OLEObjects(Index?: any): any; + readonly Next: Worksheet; + OLEObjects(Index: number | string): OLEObject; + OLEObjects(): OLEObjects; OnCalculate: string; OnData: string; OnDoubleClick: string; @@ -8759,21 +9447,18 @@ declare namespace Excel { Ovals(Index?: any): any; readonly PageSetup: PageSetup; readonly Parent: any; - Paste(Destination?: any, Link?: any): void; - PasteSpecial(Format?: any, Link?: any, DisplayAsIcon?: any, IconFileName?: any, IconIndex?: any, IconLabel?: any, NoHTMLFormatting?: any): void; + Paste(Destination?: Range, Link?: boolean): void; + PasteSpecial(Format: string | undefined, Link: boolean | undefined, DisplayAsIcon: true, IconFileName?: string, IconIndex?: number, IconLabel?: string, NoHTMLFormatting?: boolean): void; + PasteSpecial(Format?: string, Link?: boolean, DisplayAsIcon?: boolean, IconFileName?: undefined, IconIndex?: undefined, IconLabel?: undefined, NoHTMLFormatting?: boolean): void; Pictures(Index?: any): any; PivotTables(Index?: any): any; - PivotTableWizard( - SourceType?: any, SourceData?: any, TableDestination?: any, TableName?: any, RowGrand?: any, ColumnGrand?: any, SaveData?: any, HasAutoFormat?: any, - AutoPage?: any, Reserved?: any, BackgroundQuery?: any, OptimizeCache?: any, PageFieldOrder?: any, PageFieldWrapCount?: any, ReadData?: any, Connection?: any): PivotTable; - readonly Previous: any; + PivotTableWizard(): void; + PivotTableWizard(SourceType: TSourceType, SourceData: PivotTableWizardSourceData, TableDestination?: Range, TableName?: string, RowGrand?: boolean, ColumnGrand?: boolean, SaveData?: boolean, HasAutoFormat?: boolean, AutoPage?: PivotTableWizardAutoPage, Reserved?: undefined, BackgroundQuery?: boolean, OptimizeCache?: boolean, PageFieldOrder?: XlOrder, PageFieldWrapCount?: number, ReadData?: boolean, Connection?: string): void; + readonly Previous: Worksheet; readonly PrintedCommentPages: number; - PrintOut(From?: any, To?: any, Copies?: any, Preview?: any, ActivePrinter?: any, PrintToFile?: any, Collate?: any, PrToFileName?: any, IgnorePrintAreas?: any): void; - PrintPreview(EnableChanges?: any): void; - Protect( - Password?: any, DrawingObjects?: any, Contents?: any, Scenarios?: any, UserInterfaceOnly?: any, AllowFormattingCells?: any, AllowFormattingColumns?: any, - AllowFormattingRows?: any, AllowInsertingColumns?: any, AllowInsertingRows?: any, AllowInsertingHyperlinks?: any, AllowDeletingColumns?: any, - AllowDeletingRows?: any, AllowSorting?: any, AllowFiltering?: any, AllowUsingPivotTables?: any): void; + PrintOut(From?: number, To?: number, Copies?: number, Preview?: boolean, ActivePrinter?: string, PrintToFile?: T, Collate?: boolean, PrToFileName?: PrintToFileName, IgnorePrintAreas?: boolean): void; + PrintPreview(EnableChanges?: boolean): void; + Protect(Password?: string, DrawingObjects?: boolean, Contents?: boolean, Scenarios?: boolean, UserInterfaceOnly?: boolean, AllowFormattingCells?: boolean, AllowFormattingColumns?: boolean, AllowFormattingRows?: boolean, AllowInsertingColumns?: boolean, AllowInsertingRows?: boolean, AllowInsertingHyperlinks?: boolean, AllowDeletingColumns?: boolean, AllowDeletingRows?: boolean, AllowSorting?: boolean, AllowFiltering?: boolean, AllowUsingPivotTables?: boolean): void; readonly ProtectContents: boolean; readonly ProtectDrawingObjects: boolean; readonly Protection: Protection; @@ -8784,14 +9469,13 @@ declare namespace Excel { Rectangles(Index?: any): any; ResetAllPageBreaks(): void; readonly Rows: Range; - SaveAs( - Filename: string, FileFormat?: any, Password?: any, WriteResPassword?: any, ReadOnlyRecommended?: any, CreateBackup?: any, AddToMru?: any, TextCodepage?: any, - TextVisualLayout?: any, Local?: any): void; - Scenarios(Index?: any): any; + SaveAs(Filename: string, FileFormat?: XlFileFormat, Password?: string, WriteResPassword?: string, ReadOnlyRecommended?: boolean, CreateBackup?: boolean, AddToMru?: boolean, TextCodepage?: any, TextVisualLayout?: any, Local?: boolean): void; + Scenarios(Index: number | string): Scenario; + Scenarios(Index?: SafeArray): Scenarios; readonly Scripts: Office.Scripts; ScrollArea: string; ScrollBars(Index?: any): any; - Select(Replace?: any): void; + Select(Replace?: boolean): void; SetBackgroundPicture(Filename: string): void; readonly Shapes: Shapes; ShowAllData(): void; @@ -8806,54 +9490,36 @@ declare namespace Excel { TransitionExpEval: boolean; TransitionFormEntry: boolean; readonly Type: XlSheetType; - Unprotect(Password?: any): void; + Unprotect(Password?: string): void; readonly UsedRange: Range; Visible: XlSheetVisibility; readonly VPageBreaks: VPageBreaks; - XmlDataQuery(XPath: string, SelectionNamespaces?: any, Map?: any): Range; - XmlMapQuery(XPath: string, SelectionNamespaces?: any, Map?: any): Range; + XmlDataQuery(XPath: string, SelectionNamespaces?: string, Map?: XmlMap): Range | null; + XmlMapQuery(XPath: string, SelectionNamespaces?: string, Map?: XmlMap): Range; } class WorksheetFunction { private 'Excel.WorksheetFunction_typekey': WorksheetFunction; private constructor(); - _WSFunction( - Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + _WSFunction(Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; AccrInt(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5: any, Arg6: any, Arg7?: any): number; AccrIntM(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5?: any): number; Acos(Arg1: number): number; Acosh(Arg1: number): number; - Aggregate( - Arg1: number, Arg2: number, Arg3: Range, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Aggregate(Arg1: number, Arg2: number, Arg3: Range, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; AmorDegrc(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5: any, Arg6: any, Arg7?: any): number; AmorLinc(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5: any, Arg6: any, Arg7?: any): number; - And( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): boolean; + And(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): boolean; readonly Application: Application; Asc(Arg1: string): string; Asin(Arg1: number): number; Asinh(Arg1: number): number; Atan2(Arg1: number, Arg2: number): number; Atanh(Arg1: number): number; - AveDev( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - Average( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + AveDev(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Average(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; AverageIf(Arg1: Range, Arg2: any, Arg3?: any): number; - AverageIfs( - Arg1: Range, Arg2: Range, Arg3: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any): number; + AverageIfs(Arg1: Range, Arg2: Range, Arg3: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any): number; BahtText(Arg1: number): string; BesselI(Arg1: any, Arg2: any): number; BesselJ(Arg1: any, Arg2: any): number; @@ -8879,10 +9545,7 @@ declare namespace Excel { ChiSq_Inv_RT(Arg1: number, Arg2: number): number; ChiSq_Test(Arg1: any, Arg2: any): number; ChiTest(Arg1: any, Arg2: any): number; - Choose( - Arg1: any, Arg2: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + Choose(Arg1: any, Arg2: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; Clean(Arg1: string): string; Combin(Arg1: number, Arg2: number): number; Complex(Arg1: any, Arg2: any, Arg3?: any): string; @@ -8892,20 +9555,11 @@ declare namespace Excel { Convert(Arg1: any, Arg2: any, Arg3: any): number; Correl(Arg1: any, Arg2: any): number; Cosh(Arg1: number): number; - Count( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - CountA( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Count(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + CountA(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; CountBlank(Arg1: Range): number; CountIf(Arg1: Range, Arg2: string | number): number; - CountIfs( - Arg1: Range, Arg2: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + CountIfs(Arg1: Range, Arg2: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; CoupDayBs(Arg1: any, Arg2: any, Arg3: any, Arg4?: any): number; CoupDays(Arg1: any, Arg2: any, Arg3: any, Arg4?: any): number; CoupDaysNc(Arg1: any, Arg2: any, Arg3: any, Arg4?: any): number; @@ -8931,10 +9585,7 @@ declare namespace Excel { Dec2Oct(Arg1: any, Arg2?: any): string; Degrees(Arg1: number): number; Delta(Arg1: any, Arg2?: any): number; - DevSq( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + DevSq(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; DGet(Arg1: Range, Arg2: any, Arg3: any): any; Disc(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5?: any): number; DMax(Arg1: Range, Arg2: any, Arg3: any): number; @@ -8946,10 +9597,7 @@ declare namespace Excel { DStDev(Arg1: Range, Arg2: any, Arg3: any): number; DStDevP(Arg1: Range, Arg2: any, Arg3: any): number; DSum(Arg1: Range, Arg2: any, Arg3: any): number; - Dummy19( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + Dummy19(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; Dummy21(Arg1: number, Arg2: number): number; Duration(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5: any, Arg6?: any): number; DVar(Arg1: Range, Arg2: any, Arg3: any): number; @@ -8991,20 +9639,11 @@ declare namespace Excel { GammaInv(Arg1: number, Arg2: number, Arg3: number): number; GammaLn(Arg1: number): number; GammaLn_Precise(Arg1: number): number; - Gcd( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - GeoMean( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Gcd(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + GeoMean(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; GeStep(Arg1: any, Arg2?: any): number; Growth(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any): any; - HarMean( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + HarMean(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; Hex2Bin(Arg1: any, Arg2?: any): string; Hex2Dec(Arg1: any): string; Hex2Oct(Arg1: any, Arg2?: any): string; @@ -9023,18 +9662,12 @@ declare namespace Excel { ImLog10(Arg1: any): string; ImLog2(Arg1: any): string; ImPower(Arg1: any, Arg2: any): string; - ImProduct( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): string; + ImProduct(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): string; ImReal(Arg1: any): number; ImSin(Arg1: any): string; ImSqrt(Arg1: any): string; ImSub(Arg1: any, Arg2: any): string; - ImSum( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): string; + ImSum(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): string; Index(Arg1: any, Arg2: number, Arg3?: any, Arg4?: any): any; Intercept(Arg1: any, Arg2: any): number; IntRate(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5?: any): number; @@ -9052,15 +9685,9 @@ declare namespace Excel { Ispmt(Arg1: number, Arg2: number, Arg3: number, Arg4: number): number; IsText(Arg1: any): boolean; IsThaiDigit(Arg1: string): boolean; - Kurt( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Kurt(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; Large(Arg1: any, Arg2: number): number; - Lcm( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Lcm(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; LinEst(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any): any; Ln(Arg1: number): number; Log(Arg1: number, Arg2?: any): number; @@ -9072,40 +9699,19 @@ declare namespace Excel { LogNormDist(Arg1: number, Arg2: number, Arg3: number): number; Lookup(Arg1: any, Arg2: any, Arg3?: any): any; Match(Arg1: any, Arg2: any, Arg3?: any): number; - Max( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Max(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; MDeterm(Arg1: any): number; MDuration(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5: any, Arg6?: any): number; - Median( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - Min( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Median(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Min(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; MInverse(Arg1: any): any; MIrr(Arg1: any, Arg2: number, Arg3: number): number; MMult(Arg1: any, Arg2: any): any; - Mode( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - Mode_Mult( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; - Mode_Sngl( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Mode(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Mode_Mult(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + Mode_Sngl(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; MRound(Arg1: any, Arg2: any): number; - MultiNomial( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + MultiNomial(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; NegBinom_Dist(Arg1: number, Arg2: number, Arg3: number, Arg4: boolean): number; NegBinomDist(Arg1: number, Arg2: number, Arg3: number): number; NetworkDays(Arg1: any, Arg2: any, Arg3?: any): number; @@ -9120,10 +9726,7 @@ declare namespace Excel { NormSDist(Arg1: number): number; NormSInv(Arg1: number): number; NPer(Arg1: number, Arg2: number, Arg3: number, Arg4?: any, Arg5?: any): number; - Npv( - Arg1: number, Arg2: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Npv(Arg1: number, Arg2: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; Oct2Bin(Arg1: any, Arg2?: any): string; Oct2Dec(Arg1: any): string; Oct2Hex(Arg1: any, Arg2?: any): string; @@ -9132,10 +9735,7 @@ declare namespace Excel { OddFYield(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5: any, Arg6: any, Arg7: any, Arg8: any, Arg9?: any): number; OddLPrice(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5: any, Arg6: any, Arg7: any, Arg8?: any): number; OddLYield(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5: any, Arg6: any, Arg7: any, Arg8?: any): number; - Or( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): boolean; + Or(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): boolean; readonly Parent: any; Pearson(Arg1: any, Arg2: any): number; Percentile(Arg1: any, Arg2: number): number; @@ -9156,10 +9756,7 @@ declare namespace Excel { PriceDisc(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5?: any): number; PriceMat(Arg1: any, Arg2: any, Arg3: any, Arg4: any, Arg5: any, Arg6?: any): number; Prob(Arg1: any, Arg2: any, Arg3: number, Arg4?: any): number; - Product( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Product(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; Proper(Arg1: string): string; Pv(Arg1: number, Arg2: number, Arg3: number, Arg4?: any, Arg5?: any): number; Quartile(Arg1: any, Arg2: number): number; @@ -9183,62 +9780,29 @@ declare namespace Excel { RoundDown(Arg1: number, Arg2: number): number; RoundUp(Arg1: number, Arg2: number): number; RSq(Arg1: any, Arg2: any): number; - RTD( - progID: any, server: any, topic1: any, topic2?: any, topic3?: any, topic4?: any, topic5?: any, topic6?: any, topic7?: any, topic8?: any, topic9?: any, - topic10?: any, topic11?: any, topic12?: any, topic13?: any, topic14?: any, topic15?: any, topic16?: any, topic17?: any, topic18?: any, topic19?: any, - topic20?: any, topic21?: any, topic22?: any, topic23?: any, topic24?: any, topic25?: any, topic26?: any, topic27?: any, topic28?: any): any; + RTD(progID: any, server: any, topic1: any, topic2?: any, topic3?: any, topic4?: any, topic5?: any, topic6?: any, topic7?: any, topic8?: any, topic9?: any, topic10?: any, topic11?: any, topic12?: any, topic13?: any, topic14?: any, topic15?: any, topic16?: any, topic17?: any, topic18?: any, topic19?: any, topic20?: any, topic21?: any, topic22?: any, topic23?: any, topic24?: any, topic25?: any, topic26?: any, topic27?: any, topic28?: any): any; Search(Arg1: string, Arg2: string, Arg3?: any): number; SearchB(Arg1: string, Arg2: string, Arg3?: any): number; SeriesSum(Arg1: any, Arg2: any, Arg3: any, Arg4: any): number; Sinh(Arg1: number): number; - Skew( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Skew(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; Sln(Arg1: number, Arg2: number, Arg3: number): number; Slope(Arg1: any, Arg2: any): number; Small(Arg1: any, Arg2: number): number; SqrtPi(Arg1: any): number; Standardize(Arg1: number, Arg2: number, Arg3: number): number; - StDev( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - StDev_P( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - StDev_S( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - StDevP( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + StDev(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + StDev_P(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + StDev_S(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + StDevP(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; StEyx(Arg1: any, Arg2: any): number; Substitute(Arg1: string, Arg2: string, Arg3: string, Arg4?: any): string; - Subtotal( - Arg1: number, Arg2: Range, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - Sum( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Subtotal(Arg1: number, Arg2: Range, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Sum(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; SumIf(Arg1: Range, Arg2: any, Arg3?: any): number; - SumIfs( - Arg1: Range, Arg2: Range, Arg3: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, - Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, - Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any): number; - SumProduct( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - SumSq( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + SumIfs(Arg1: Range, Arg2: Range, Arg3: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any): number; + SumProduct(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + SumSq(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; SumX2MY2(Arg1: any, Arg2: any): number; SumX2PY2(Arg1: any, Arg2: any): number; SumXMY2(Arg1: any, Arg2: any): number; @@ -9269,22 +9833,10 @@ declare namespace Excel { TrimMean(Arg1: any, Arg2: number): number; TTest(Arg1: any, Arg2: any, Arg3: number, Arg4: number): number; USDollar(Arg1: number, Arg2: number): string; - Var( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - Var_P( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - Var_S( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; - VarP( - Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, - Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, - Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Var(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Var_P(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + Var_S(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; + VarP(Arg1: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): number; Vdb(Arg1: number, Arg2: number, Arg3: number, Arg4: number, Arg5: number, Arg6?: any, Arg7?: any): number; VLookup(Arg1: any, Arg2: any, Arg3: any, Arg4?: any): any; Weekday(Arg1: any, Arg2?: any): number; @@ -9302,6 +9854,20 @@ declare namespace Excel { ZTest(Arg1: any, Arg2: number, Arg3?: any): number; } + class WorksheetView { + private 'Excel.WorksheetView_typekey': WorksheetView; + private constructor(); + readonly Application: Application; + readonly Creator: XlCreator; + DisplayFormulas: boolean; + DisplayGridlines: boolean; + DisplayHeadings: boolean; + DisplayOutline: boolean; + DisplayZeros: boolean; + readonly Parent: any; + readonly Sheet: Worksheet; + } + class XmlDataBinding { private 'Excel.XmlDataBinding_typekey': XmlDataBinding; private constructor(); @@ -9325,10 +9891,10 @@ declare namespace Excel { readonly Creator: XlCreator; readonly DataBinding: XmlDataBinding; Delete(): void; - Export(Url: string, Overwrite?: any): XlXmlExportResult; + Export(Url: string, Overwrite?: boolean): XlXmlExportResult; ExportXml(Data: string): XlXmlExportResult; - Import(Url: string, Overwrite?: any): XlXmlImportResult; - ImportXml(XmlData: string, Overwrite?: any): XlXmlImportResult; + Import(Url: string, Overwrite?: boolean): XlXmlImportResult; + ImportXml(XmlData: string, Overwrite?: boolean): XlXmlImportResult; readonly IsExportable: boolean; Name: string; readonly Parent: any; @@ -9342,16 +9908,15 @@ declare namespace Excel { readonly WorkbookConnection: WorkbookConnection; } - class XmlMaps { - private 'Excel.XmlMaps_typekey': XmlMaps; - private constructor(); + interface XmlMaps { _Default(Index: any): XmlMap; - Add(Schema: string, RootElementName?: any): XmlMap; + Add(Schema: string, RootElementName?: string): XmlMap; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): XmlMap; + Item(Index: number | string): XmlMap; readonly Parent: any; + (Index: number | string): XmlMap; } class XmlNamespace { @@ -9365,17 +9930,16 @@ declare namespace Excel { readonly Uri: string; } - class XmlNamespaces { - private 'Excel.XmlNamespaces_typekey': XmlNamespaces; - private constructor(); + interface XmlNamespaces { _Default(Index: any): XmlNamespace; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - InstallManifest(Path: string, InstallForAllUsers?: any): void; - Item(Index: any): XmlNamespace; + InstallManifest(Path: string, InstallForAllUsers?: boolean): void; + Item(Index: number | string): XmlNamespace; readonly Parent: any; readonly Value: string; + (Index: number | string): XmlNamespace; } class XmlSchema { @@ -9389,15 +9953,14 @@ declare namespace Excel { readonly XML: string; } - class XmlSchemas { - private 'Excel.XmlSchemas_typekey': XmlSchemas; - private constructor(); + interface XmlSchemas { _Default(Index: any): XmlSchema; readonly Application: Application; readonly Count: number; readonly Creator: XlCreator; - Item(Index: any): XmlSchema; + Item(Index: number | string): XmlSchema; readonly Parent: any; + (Index: number | string): XmlSchema; } class XPath { @@ -9410,7 +9973,7 @@ declare namespace Excel { readonly Map: XmlMap; readonly Parent: any; readonly Repeating: boolean; - SetValue(Map: XmlMap, XPath: string, SelectionNamespace?: any, Repeating?: any): void; + SetValue(Map: XmlMap, XPath: string, SelectionNamespace?: any, Repeating?: boolean): void; readonly Value: string; } @@ -9495,223 +10058,100 @@ declare namespace Excel { } } +interface EnumeratorConstructor { + // we need this because there are two overloads for Item on the Sheets object + new (sheets: Excel.Sheets): Enumerator; +} + interface ActiveXObject { - on( - obj: Excel.Application, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Application, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; - on( - obj: Excel.Application, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Application, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Application, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: (this: Excel.Application, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; + on(obj: Excel.Application, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: (this: Excel.Application, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; on(obj: Excel.Application, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Application, parameter: { pctinfo: number }) => void): void; - on( - obj: Excel.Application, event: 'Invoke', argNames: Excel.EventHelperTypes.Application_Invoke_ArgNames, handler: ( - this: Excel.Application, parameter: Excel.EventHelperTypes.Application_Invoke_Parameter) => void): void; - on( - obj: Excel.Application, event: 'NewWorkbook' | 'WorkbookActivate' | 'WorkbookAddinInstall' | 'WorkbookAddinUninstall' | 'WorkbookDeactivate' | 'WorkbookOpen', - argNames: ['Wb'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook }) => void): void; - on( - obj: Excel.Application, event: 'ProtectedViewWindowActivate' | 'ProtectedViewWindowDeactivate' | 'ProtectedViewWindowOpen' | 'ProtectedViewWindowResize', - argNames: ['Pvw'], handler: (this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow }) => void): void; - on( - obj: Excel.Application, event: 'ProtectedViewWindowBeforeClose', argNames: ['Pvw', 'Reason', 'Cancel'], handler: ( - this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow, readonly Reason: Excel.XlProtectedViewCloseReason, Cancel: boolean }) => void): void; - on( - obj: Excel.Application, event: 'ProtectedViewWindowBeforeEdit', argNames: ['Pvw', 'Cancel'], handler: ( - this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'Invoke', argNames: Excel.EventHelperTypes.Application_Invoke_ArgNames, handler: (this: Excel.Application, parameter: Excel.EventHelperTypes.Application_Invoke_Parameter) => void): void; + on(obj: Excel.Application, event: 'NewWorkbook' | 'WorkbookActivate' | 'WorkbookAddinInstall' | 'WorkbookAddinUninstall' | 'WorkbookDeactivate' | 'WorkbookOpen', argNames: ['Wb'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook }) => void): void; + on(obj: Excel.Application, event: 'ProtectedViewWindowActivate' | 'ProtectedViewWindowDeactivate' | 'ProtectedViewWindowOpen' | 'ProtectedViewWindowResize', argNames: ['Pvw'], handler: (this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow }) => void): void; + on(obj: Excel.Application, event: 'ProtectedViewWindowBeforeClose', argNames: ['Pvw', 'Reason', 'Cancel'], handler: (this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow, readonly Reason: Excel.XlProtectedViewCloseReason, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'ProtectedViewWindowBeforeEdit', argNames: ['Pvw', 'Cancel'], handler: (this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow, Cancel: boolean }) => void): void; on(obj: Excel.Application, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Application, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; - on(obj: Excel.Application, event: 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: (this: Excel.Application, parameter: { readonly Sh: any }) => void): void; - on( - obj: Excel.Application, event: 'SheetBeforeDoubleClick' | 'SheetBeforeRightClick', argNames: ['Sh', 'Target', 'Cancel'], handler: ( - this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean }) => void): void; - on( - obj: Excel.Application, event: 'SheetChange' | 'SheetSelectionChange', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.Range }) => void): void; - on( - obj: Excel.Application, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.Hyperlink }) => void): void; - on( - obj: Excel.Application, event: 'SheetPivotTableAfterValueChange', argNames: ['Sh', 'TargetPivotTable', 'TargetRange'], handler: ( - this: Excel.Application, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; - on( - obj: Excel.Application, event: 'SheetPivotTableBeforeAllocateChanges' | 'SheetPivotTableBeforeCommitChanges', - argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: ( - this: Excel.Application, - parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; - on( - obj: Excel.Application, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], - handler: ( - this: Excel.Application, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; - on( - obj: Excel.Application, event: 'SheetPivotTableUpdate', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.PivotTable }) => void): void; - on( - obj: Excel.Application, event: 'WindowActivate' | 'WindowDeactivate' | 'WindowResize', argNames: ['Wb', 'Wn'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Wn: Excel.Window }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookAfterSave', argNames: ['Wb', 'Success'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Success: boolean }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookAfterXmlExport', argNames: ['Wb', 'Map', 'Url', 'Result'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookAfterXmlImport', argNames: ['Wb', 'Map', 'IsRefresh', 'Result'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookBeforeClose' | 'WorkbookBeforePrint', argNames: ['Wb', 'Cancel'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, Cancel: boolean }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookBeforeSave', argNames: ['Wb', 'SaveAsUI', 'Cancel'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly SaveAsUI: boolean, Cancel: boolean }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookBeforeXmlExport', argNames: ['Wb', 'Map', 'Url', 'Cancel'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookBeforeXmlImport', argNames: ['Wb', 'Map', 'Url', 'IsRefresh', 'Cancel'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean }) => void): void; - on(obj: Excel.Application, event: 'WorkbookNewChart', argNames: ['Wb', 'Ch'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Ch: Excel.Chart }) => void): void; - on(obj: Excel.Application, event: 'WorkbookNewSheet', argNames: ['Wb', 'Sh'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Sh: any }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookPivotTableCloseConnection' | 'WorkbookPivotTableOpenConnection', argNames: ['Wb', 'Target'], - handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Target: Excel.PivotTable }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookRowsetComplete', argNames: ['Wb', 'Description', 'Sheet', 'Success'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Description: string, readonly Sheet: string, readonly Success: boolean }) => void): void; - on( - obj: Excel.Application, event: 'WorkbookSync', argNames: ['Wb', 'SyncEventType'], handler: ( - this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly SyncEventType: Office.MsoSyncEventType }) => void): void; - on( - obj: Excel.Chart, event: 'BeforeDoubleClick', argNames: ['ElementID', 'Arg1', 'Arg2', 'Cancel'], handler: ( - this: Excel.Chart, parameter: { readonly ElementID: number, readonly Arg1: number, readonly Arg2: number, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: (this: Excel.Application, parameter: { readonly Sh: Excel.Chart | Excel.Worksheet }) => void): void; + on(obj: Excel.Application, event: 'SheetBeforeDoubleClick' | 'SheetBeforeRightClick', argNames: ['Sh', 'Target', 'Cancel'], handler: (this: Excel.Application, parameter: { readonly Sh: Excel.Worksheet, readonly Target: Excel.Range, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'SheetChange' | 'SheetSelectionChange', argNames: ['Sh', 'Target'], handler: (this: Excel.Application, parameter: { readonly Sh: Excel.Worksheet, readonly Target: Excel.Range }) => void): void; + on(obj: Excel.Application, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: (this: Excel.Application, parameter: { readonly Sh: Excel.Worksheet, readonly Target: Excel.Hyperlink }) => void): void; + on(obj: Excel.Application, event: 'SheetPivotTableAfterValueChange', argNames: ['Sh', 'TargetPivotTable', 'TargetRange'], handler: (this: Excel.Application, parameter: { readonly Sh: Excel.Worksheet, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; + on(obj: Excel.Application, event: 'SheetPivotTableBeforeAllocateChanges' | 'SheetPivotTableBeforeCommitChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: (this: Excel.Application, parameter: { readonly Sh: Excel.Worksheet, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], handler: (this: Excel.Application, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; + on(obj: Excel.Application, event: 'SheetPivotTableUpdate', argNames: ['Sh', 'Target'], handler: (this: Excel.Application, parameter: { readonly Sh: Excel.Worksheet, readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Application, event: 'WindowActivate' | 'WindowDeactivate' | 'WindowResize', argNames: ['Wb', 'Wn'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Wn: Excel.Window }) => void): void; + on(obj: Excel.Application, event: 'WorkbookAfterSave', argNames: ['Wb', 'Success'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Success: boolean }) => void): void; + on(obj: Excel.Application, event: 'WorkbookAfterXmlExport', argNames: ['Wb', 'Map', 'Url', 'Result'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult }) => void): void; + on(obj: Excel.Application, event: 'WorkbookAfterXmlImport', argNames: ['Wb', 'Map', 'IsRefresh', 'Result'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult }) => void): void; + on(obj: Excel.Application, event: 'WorkbookBeforeClose' | 'WorkbookBeforePrint', argNames: ['Wb', 'Cancel'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'WorkbookBeforeSave', argNames: ['Wb', 'SaveAsUI', 'Cancel'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly SaveAsUI: boolean, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'WorkbookBeforeXmlExport', argNames: ['Wb', 'Map', 'Url', 'Cancel'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'WorkbookBeforeXmlImport', argNames: ['Wb', 'Map', 'Url', 'IsRefresh', 'Cancel'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'WorkbookNewChart', argNames: ['Wb', 'Ch'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Ch: Excel.Chart }) => void): void; + on(obj: Excel.Application, event: 'WorkbookNewSheet', argNames: ['Wb', 'Sh'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Sh: Excel.Worksheet }) => void): void; + on(obj: Excel.Application, event: 'WorkbookPivotTableCloseConnection' | 'WorkbookPivotTableOpenConnection', argNames: ['Wb', 'Target'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Application, event: 'WorkbookRowsetComplete', argNames: ['Wb', 'Description', 'Sheet', 'Success'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Description: string, readonly Sheet: string, readonly Success: boolean }) => void): void; + on(obj: Excel.Application, event: 'WorkbookSync', argNames: ['Wb', 'SyncEventType'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly SyncEventType: Office.MsoSyncEventType }) => void): void; + on(obj: Excel.Chart, event: 'BeforeDoubleClick', argNames: ['ElementID', 'Arg1', 'Arg2', 'Cancel'], handler: (this: Excel.Chart, parameter: { readonly ElementID: number, readonly Arg1: number, readonly Arg2: number, Cancel: boolean }) => void): void; on(obj: Excel.Chart, event: 'BeforeRightClick', argNames: ['Cancel'], handler: (this: Excel.Chart, parameter: { Cancel: boolean }) => void): void; - on( - obj: Excel.Chart, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Chart, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; - on( - obj: Excel.Chart, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Chart, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Chart, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: (this: Excel.Chart, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; + on(obj: Excel.Chart, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: (this: Excel.Chart, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; on(obj: Excel.Chart, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Chart, parameter: { pctinfo: number }) => void): void; on(obj: Excel.Chart, event: 'Invoke', argNames: Excel.EventHelperTypes.Chart_Invoke_ArgNames, handler: (this: Excel.Chart, parameter: Excel.EventHelperTypes.Chart_Invoke_Parameter) => void): void; - on( - obj: Excel.Chart, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'x', 'y'], handler: ( - this: Excel.Chart, parameter: { readonly Button: number, readonly Shift: number, readonly x: number, readonly y: number }) => void): void; + on(obj: Excel.Chart, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'x', 'y'], handler: (this: Excel.Chart, parameter: { readonly Button: number, readonly Shift: number, readonly x: number, readonly y: number }) => void): void; on(obj: Excel.Chart, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Chart, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; - on( - obj: Excel.Chart, event: 'Select', argNames: ['ElementID', 'Arg1', 'Arg2'], handler: ( - this: Excel.Chart, parameter: { readonly ElementID: number, readonly Arg1: number, readonly Arg2: number }) => void): void; - on( - obj: Excel.Chart, event: 'SeriesChange', argNames: ['SeriesIndex', 'PointIndex'], handler: ( - this: Excel.Chart, parameter: { readonly SeriesIndex: number, readonly PointIndex: number }) => void): void; - on( - obj: Excel.OLEObject, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.OLEObject, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; - on( - obj: Excel.OLEObject, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.OLEObject, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Chart, event: 'Select', argNames: ['ElementID', 'Arg1', 'Arg2'], handler: (this: Excel.Chart, parameter: { readonly ElementID: number, readonly Arg1: number, readonly Arg2: number }) => void): void; + on(obj: Excel.Chart, event: 'SeriesChange', argNames: ['SeriesIndex', 'PointIndex'], handler: (this: Excel.Chart, parameter: { readonly SeriesIndex: number, readonly PointIndex: number }) => void): void; + on(obj: Excel.OLEObject, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: (this: Excel.OLEObject, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; + on(obj: Excel.OLEObject, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: (this: Excel.OLEObject, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; on(obj: Excel.OLEObject, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.OLEObject, parameter: { pctinfo: number }) => void): void; - on( - obj: Excel.OLEObject, event: 'Invoke', argNames: Excel.EventHelperTypes.OLEObject_Invoke_ArgNames, handler: ( - this: Excel.OLEObject, parameter: Excel.EventHelperTypes.OLEObject_Invoke_Parameter) => void): void; + on(obj: Excel.OLEObject, event: 'Invoke', argNames: Excel.EventHelperTypes.OLEObject_Invoke_ArgNames, handler: (this: Excel.OLEObject, parameter: Excel.EventHelperTypes.OLEObject_Invoke_Parameter) => void): void; on(obj: Excel.OLEObject, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.OLEObject, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; on(obj: Excel.QueryTable, event: 'AfterRefresh', argNames: ['Success'], handler: (this: Excel.QueryTable, parameter: { readonly Success: boolean }) => void): void; on(obj: Excel.QueryTable, event: 'BeforeRefresh', argNames: ['Cancel'], handler: (this: Excel.QueryTable, parameter: { Cancel: boolean }) => void): void; - on( - obj: Excel.QueryTable, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.QueryTable, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; - on( - obj: Excel.QueryTable, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.QueryTable, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.QueryTable, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: (this: Excel.QueryTable, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; + on(obj: Excel.QueryTable, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: (this: Excel.QueryTable, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; on(obj: Excel.QueryTable, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.QueryTable, parameter: { pctinfo: number }) => void): void; - on( - obj: Excel.QueryTable, event: 'Invoke', argNames: Excel.EventHelperTypes.QueryTable_Invoke_ArgNames, handler: ( - this: Excel.QueryTable, parameter: Excel.EventHelperTypes.QueryTable_Invoke_Parameter) => void): void; + on(obj: Excel.QueryTable, event: 'Invoke', argNames: Excel.EventHelperTypes.QueryTable_Invoke_ArgNames, handler: (this: Excel.QueryTable, parameter: Excel.EventHelperTypes.QueryTable_Invoke_Parameter) => void): void; on(obj: Excel.QueryTable, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.QueryTable, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; on(obj: Excel.Workbook, event: 'AfterSave', argNames: ['Success'], handler: (this: Excel.Workbook, parameter: { readonly Success: boolean }) => void): void; - on( - obj: Excel.Workbook, event: 'AfterXmlExport', argNames: ['Map', 'Url', 'Result'], handler: ( - this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult }) => void): void; - on( - obj: Excel.Workbook, event: 'AfterXmlImport', argNames: ['Map', 'IsRefresh', 'Result'], handler: ( - this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult }) => void): void; + on(obj: Excel.Workbook, event: 'AfterXmlExport', argNames: ['Map', 'Url', 'Result'], handler: (this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult }) => void): void; + on(obj: Excel.Workbook, event: 'AfterXmlImport', argNames: ['Map', 'IsRefresh', 'Result'], handler: (this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult }) => void): void; on(obj: Excel.Workbook, event: 'BeforeClose' | 'BeforePrint', argNames: ['Cancel'], handler: (this: Excel.Workbook, parameter: { Cancel: boolean }) => void): void; on(obj: Excel.Workbook, event: 'BeforeSave', argNames: ['SaveAsUI', 'Cancel'], handler: (this: Excel.Workbook, parameter: { readonly SaveAsUI: boolean, Cancel: boolean }) => void): void; - on( - obj: Excel.Workbook, event: 'BeforeXmlExport', argNames: ['Map', 'Url', 'Cancel'], handler: ( - this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean }) => void): void; - on( - obj: Excel.Workbook, event: 'BeforeXmlImport', argNames: ['Map', 'Url', 'IsRefresh', 'Cancel'], handler: ( - this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean }) => void): void; - on( - obj: Excel.Workbook, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Workbook, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; - on( - obj: Excel.Workbook, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Workbook, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Workbook, event: 'BeforeXmlExport', argNames: ['Map', 'Url', 'Cancel'], handler: (this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean }) => void): void; + on(obj: Excel.Workbook, event: 'BeforeXmlImport', argNames: ['Map', 'Url', 'IsRefresh', 'Cancel'], handler: (this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean }) => void): void; + on(obj: Excel.Workbook, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: (this: Excel.Workbook, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; + on(obj: Excel.Workbook, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: (this: Excel.Workbook, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; on(obj: Excel.Workbook, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Workbook, parameter: { pctinfo: number }) => void): void; - on( - obj: Excel.Workbook, event: 'Invoke', argNames: Excel.EventHelperTypes.Workbook_Invoke_ArgNames, handler: ( - this: Excel.Workbook, parameter: Excel.EventHelperTypes.Workbook_Invoke_Parameter) => void): void; + on(obj: Excel.Workbook, event: 'Invoke', argNames: Excel.EventHelperTypes.Workbook_Invoke_ArgNames, handler: (this: Excel.Workbook, parameter: Excel.EventHelperTypes.Workbook_Invoke_Parameter) => void): void; on(obj: Excel.Workbook, event: 'NewChart', argNames: ['Ch'], handler: (this: Excel.Workbook, parameter: { readonly Ch: Excel.Chart }) => void): void; - on(obj: Excel.Workbook, event: 'NewSheet' | 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: ( - this: Excel.Workbook, parameter: { readonly Sh: any }) => void): void; - on( - obj: Excel.Workbook, event: 'PivotTableCloseConnection' | 'PivotTableOpenConnection', argNames: ['Target'], handler: ( - this: Excel.Workbook, parameter: { readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Workbook, event: 'NewSheet' | 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: (this: Excel.Workbook, parameter: { readonly Sh: Excel.Chart | Excel.Worksheet }) => void): void; + on(obj: Excel.Workbook, event: 'PivotTableCloseConnection' | 'PivotTableOpenConnection', argNames: ['Target'], handler: (this: Excel.Workbook, parameter: { readonly Target: Excel.PivotTable }) => void): void; on(obj: Excel.Workbook, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Workbook, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; - on( - obj: Excel.Workbook, event: 'RowsetComplete', argNames: ['Description', 'Sheet', 'Success'], handler: ( - this: Excel.Workbook, parameter: { readonly Description: string, readonly Sheet: string, readonly Success: boolean }) => void): void; - on( - obj: Excel.Workbook, event: 'SheetBeforeDoubleClick' | 'SheetBeforeRightClick', argNames: ['Sh', 'Target', 'Cancel'], handler: ( - this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean }) => void): void; - on( - obj: Excel.Workbook, event: 'SheetChange' | 'SheetSelectionChange', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.Range }) => void): void; - on(obj: Excel.Workbook, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.Hyperlink }) => void): void; - on( - obj: Excel.Workbook, event: 'SheetPivotTableAfterValueChange', argNames: ['Sh', 'TargetPivotTable', 'TargetRange'], handler: ( - this: Excel.Workbook, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; - on( - obj: Excel.Workbook, event: 'SheetPivotTableBeforeAllocateChanges' | 'SheetPivotTableBeforeCommitChanges', - argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: ( - this: Excel.Workbook, - parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; - on( - obj: Excel.Workbook, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], handler: ( - this: Excel.Workbook, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; - on( - obj: Excel.Workbook, event: 'SheetPivotTableChangeSync' | 'SheetPivotTableUpdate', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Workbook, event: 'RowsetComplete', argNames: ['Description', 'Sheet', 'Success'], handler: (this: Excel.Workbook, parameter: { readonly Description: string, readonly Sheet: string, readonly Success: boolean }) => void): void; + on(obj: Excel.Workbook, event: 'SheetBeforeDoubleClick' | 'SheetBeforeRightClick', argNames: ['Sh', 'Target', 'Cancel'], handler: (this: Excel.Workbook, parameter: { readonly Sh: Excel.Worksheet, readonly Target: Excel.Range, Cancel: boolean }) => void): void; + on(obj: Excel.Workbook, event: 'SheetChange' | 'SheetSelectionChange', argNames: ['Sh', 'Target'], handler: (this: Excel.Workbook, parameter: { readonly Sh: Excel.Worksheet, readonly Target: Excel.Range }) => void): void; + on(obj: Excel.Workbook, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: (this: Excel.Workbook, parameter: { readonly Sh: Excel.Worksheet, readonly Target: Excel.Hyperlink }) => void): void; + on(obj: Excel.Workbook, event: 'SheetPivotTableAfterValueChange', argNames: ['Sh', 'TargetPivotTable', 'TargetRange'], handler: (this: Excel.Workbook, parameter: { readonly Sh: Excel.Worksheet, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; + on(obj: Excel.Workbook, event: 'SheetPivotTableBeforeAllocateChanges' | 'SheetPivotTableBeforeCommitChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: (this: Excel.Workbook, parameter: { readonly Sh: Excel.Worksheet, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; + on(obj: Excel.Workbook, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], handler: (this: Excel.Workbook, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; + on(obj: Excel.Workbook, event: 'SheetPivotTableChangeSync' | 'SheetPivotTableUpdate', argNames: ['Sh', 'Target'], handler: (this: Excel.Workbook, parameter: { readonly Sh: Excel.Worksheet, readonly Target: Excel.PivotTable }) => void): void; on(obj: Excel.Workbook, event: 'Sync', argNames: ['SyncEventType'], handler: (this: Excel.Workbook, parameter: { readonly SyncEventType: Office.MsoSyncEventType }) => void): void; on(obj: Excel.Workbook, event: 'WindowActivate' | 'WindowDeactivate' | 'WindowResize', argNames: ['Wn'], handler: (this: Excel.Workbook, parameter: { readonly Wn: Excel.Window }) => void): void; - on( - obj: Excel.Worksheet, event: 'BeforeDoubleClick' | 'BeforeRightClick', argNames: ['Target', 'Cancel'], handler: ( - this: Excel.Worksheet, parameter: { readonly Target: Excel.Range, Cancel: boolean }) => void): void; + on(obj: Excel.Worksheet, event: 'BeforeDoubleClick' | 'BeforeRightClick', argNames: ['Target', 'Cancel'], handler: (this: Excel.Worksheet, parameter: { readonly Target: Excel.Range, Cancel: boolean }) => void): void; on(obj: Excel.Worksheet, event: 'Change' | 'SelectionChange', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: { readonly Target: Excel.Range }) => void): void; on(obj: Excel.Worksheet, event: 'FollowHyperlink', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: { readonly Target: Excel.Hyperlink }) => void): void; - on( - obj: Excel.Worksheet, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Worksheet, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; - on( - obj: Excel.Worksheet, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Worksheet, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Worksheet, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: (this: Excel.Worksheet, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; + on(obj: Excel.Worksheet, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: (this: Excel.Worksheet, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; on(obj: Excel.Worksheet, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Worksheet, parameter: { pctinfo: number }) => void): void; - on( - obj: Excel.Worksheet, event: 'Invoke', argNames: Excel.EventHelperTypes.Worksheet_Invoke_ArgNames, handler: ( - this: Excel.Worksheet, parameter: Excel.EventHelperTypes.Worksheet_Invoke_Parameter) => void): void; - on( - obj: Excel.Worksheet, event: 'PivotTableAfterValueChange', argNames: ['TargetPivotTable', 'TargetRange'], handler: ( - this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; - on( - obj: Excel.Worksheet, event: 'PivotTableBeforeAllocateChanges' | 'PivotTableBeforeCommitChanges', - argNames: ['TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: ( - this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; - on( - obj: Excel.Worksheet, event: 'PivotTableBeforeDiscardChanges', argNames: ['TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], - handler: (this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; - on(obj: Excel.Worksheet, event: 'PivotTableChangeSync' | 'PivotTableUpdate', argNames: ['Target'], handler: ( - this: Excel.Worksheet, parameter: { readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Worksheet, event: 'Invoke', argNames: Excel.EventHelperTypes.Worksheet_Invoke_ArgNames, handler: (this: Excel.Worksheet, parameter: Excel.EventHelperTypes.Worksheet_Invoke_Parameter) => void): void; + on(obj: Excel.Worksheet, event: 'PivotTableAfterValueChange', argNames: ['TargetPivotTable', 'TargetRange'], handler: (this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; + on(obj: Excel.Worksheet, event: 'PivotTableBeforeAllocateChanges' | 'PivotTableBeforeCommitChanges', argNames: ['TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: (this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; + on(obj: Excel.Worksheet, event: 'PivotTableBeforeDiscardChanges', argNames: ['TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], handler: (this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; + on(obj: Excel.Worksheet, event: 'PivotTableChangeSync' | 'PivotTableUpdate', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: { readonly Target: Excel.PivotTable }) => void): void; on(obj: Excel.Worksheet, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Worksheet, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; on(obj: Excel.Application, event: 'AddRef' | 'AfterCalculate' | 'Release', handler: (this: Excel.Application, parameter: {}) => void): void; on(obj: Excel.Chart, event: 'Activate' | 'AddRef' | 'Calculate' | 'Deactivate' | 'DragOver' | 'DragPlot' | 'Release' | 'Resize', handler: (this: Excel.Chart, parameter: {}) => void): void; @@ -9719,10 +10159,13 @@ interface ActiveXObject { on(obj: Excel.QueryTable, event: 'AddRef' | 'Release', handler: (this: Excel.QueryTable, parameter: {}) => void): void; on(obj: Excel.Workbook, event: 'Activate' | 'AddinInstall' | 'AddinUninstall' | 'AddRef' | 'Deactivate' | 'Open' | 'Release', handler: (this: Excel.Workbook, parameter: {}) => void): void; on(obj: Excel.Worksheet, event: 'Activate' | 'AddRef' | 'Calculate' | 'Deactivate' | 'Release', handler: (this: Excel.Worksheet, parameter: {}) => void): void; - set(obj: Excel.Chart, propertyName: 'HasAxis', parameterTypes: [any, any], newValue: any): void; - set(obj: Excel.Workbook, propertyName: 'Colors', parameterTypes: [any], newValue: any): void; + set(obj: Excel.Chart, propertyName: 'HasAxis', parameterTypes: [Excel.XlAxisType | undefined, Excel.XlAxisGroup | undefined], newValue: boolean): void; + set(obj: Excel.ControlFormat, propertyName: 'List', parameterTypes: [number], newValue: string): void; + set(obj: Excel.ControlFormat, propertyName: 'List', parameterTypes: never[], newValue: SafeArray): void; + set(obj: Excel.PageSetup, propertyName: 'PrintQuality', parameterTypes: [number], newValue: number): void; + set(obj: Excel.Workbook, propertyName: 'Colors', parameterTypes: [number], newValue: number): void; set(obj: Excel.Range, propertyName: 'Value', parameterTypes: [Excel.XlRangeValueDataType], newValue: any): void; - set(obj: Excel.Range, propertyName: 'Value', newValue: any): void; // because Value is defined on the type as a method, not a property + set(obj: Excel.PivotField, propertyName: 'Subtotals', parameterTypes: [Excel.PivotFieldSubtotal], newValue: boolean): void; } interface ActiveXObjectNameMap { @@ -9730,57 +10173,3 @@ interface ActiveXObjectNameMap { 'Excel.Chart': Excel.Chart; 'Excel.Sheet': Excel.Worksheet; } - -interface EnumeratorConstructor { - new(col: Excel.Range): Enumerator; - - new(col: Excel.GroupShapes | Excel.ShapeRange | Excel.Shapes): Enumerator; - new(col: Excel.HPageBreaks): Enumerator; - new(col: Excel.Hyperlinks): Enumerator; - new(col: Excel.IconSet): Enumerator; - new(col: Excel.ListColumns): Enumerator; - new(col: Excel.ListObjects): Enumerator; - new(col: Excel.ListRows): Enumerator; - new(col: Excel.MenuBars): Enumerator; - new(col: Excel.Menus): Enumerator; - new(col: Excel.Names): Enumerator; - new(col: Excel.ODBCErrors): Enumerator; - new(col: Excel.OLEDBErrors): Enumerator; - new(col: Excel.Pages): Enumerator; - new(col: Excel.Parameters): Enumerator; - new(col: Excel.PivotCaches): Enumerator; - new(col: Excel.PivotFilters): Enumerator; - new(col: Excel.PivotFormulas): Enumerator; - new(col: Excel.PivotLineCells): Enumerator; - new(col: Excel.PivotLines): Enumerator; - new(col: Excel.PivotTableChangeList): Enumerator; - new(col: Excel.ProtectedViewWindows): Enumerator; - new(col: Excel.PublishObjects): Enumerator; - new(col: Excel.QueryTables): Enumerator; - new(col: Excel.RecentFiles): Enumerator; - new(col: Excel.Sheets): Enumerator; - new(col: Excel.ShapeNodes): Enumerator; - new(col: Excel.SlicerCacheLevels): Enumerator; - new(col: Excel.SlicerCaches): Enumerator; - new(col: Excel.SlicerItems): Enumerator; - new(col: Excel.SlicerPivotTables): Enumerator; - new(col: Excel.Slicers): Enumerator; - new(col: Excel.SmartTagActions): Enumerator; - new(col: Excel.SmartTagRecognizers): Enumerator; - new(col: Excel.SortFields): Enumerator; - new(col: Excel.SparklineGroup): Enumerator; - new(col: Excel.SparklineGroups): Enumerator; - new(col: Excel.Styles): Enumerator; - new(col: Excel.TableStyleElements): Enumerator; - new(col: Excel.TableStyles): Enumerator; - new(col: Excel.ToolbarButtons): Enumerator; - new(col: Excel.Toolbars): Enumerator; - new(col: Excel.UserAccessList): Enumerator; - new(col: Excel.VPageBreaks): Enumerator; - new(col: Excel.Watches): Enumerator; - new(col: Excel.Windows): Enumerator; - new(col: Excel.Workbooks): Enumerator; - new(col: Excel.XmlMaps): Enumerator; - new(col: Excel.XmlNamespaces): Enumerator; - new(col: Excel.XmlSchemas): Enumerator; -} diff --git a/types/activex-excel/tslint.json b/types/activex-excel/tslint.json index f93cf8562a..7b89accc6d 100644 --- a/types/activex-excel/tslint.json +++ b/types/activex-excel/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + "no-const-enum": false, + "max-line-length": false + } } diff --git a/types/activex-interop/index.d.ts b/types/activex-interop/index.d.ts index 3bb13a5351..d59b315fcb 100644 --- a/types/activex-interop/index.d.ts +++ b/types/activex-interop/index.d.ts @@ -51,7 +51,6 @@ interface Enumerator { interface EnumeratorConstructor { new (collection: { Item(index: any): T }): Enumerator; - // new (collection: any): Enumerator; } declare var Enumerator: EnumeratorConstructor; diff --git a/types/activex-office/index.d.ts b/types/activex-office/index.d.ts index 18a7dd285d..6df01eb16e 100644 --- a/types/activex-office/index.d.ts +++ b/types/activex-office/index.d.ts @@ -10,6 +10,8 @@ declare namespace Office { type MsoRGBType = number; + type ByteArray = SafeArray; + const enum BackstageGroupStyle { BackstageGroupStyleError = 2, BackstageGroupStyleNormal = 0, diff --git a/types/activex-outlook/index.d.ts b/types/activex-outlook/index.d.ts index 2b316d80bd..4789c10e19 100644 --- a/types/activex-outlook/index.d.ts +++ b/types/activex-outlook/index.d.ts @@ -5886,7 +5886,3 @@ interface EnumeratorConstructor { new(col: Outlook.Reminders): Enumerator; new(col: Outlook.Views): Enumerator; } - -interface SafeArray { - _brand: SafeArray; -} From 1d3d5b231a60b31048e52a75f36ebe2f04a43a12 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Sat, 21 Jul 2018 02:27:47 +0200 Subject: [PATCH 111/738] [whatwg-streams] Fixes for readable byte streams (#27375) * ReadableByteStreamController.enqueue accepts any ArrayBufferView See step 5 in https://streams.spec.whatwg.org/#rbs-controller-enqueue * ReadableStreamBYOBRequest.view is always a Uint8Array See step 2b in https://streams.spec.whatwg.org/#rbs-controller-byob-request * ReadableByteStreamController.byobRequest may be undefined See step 2 in https://streams.spec.whatwg.org/#rbs-controller-byob-request * Remove unused type parameter on ReadableByteStreamSource and related classes * Fix tests * Replace IteratorResult with own interface to avoid dependency on ES2015 types --- types/whatwg-streams/index.d.ts | 27 ++++++++++++-------- types/whatwg-streams/whatwg-streams-tests.ts | 4 +-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/types/whatwg-streams/index.d.ts b/types/whatwg-streams/index.d.ts index 8b61b9d657..008029b2d9 100644 --- a/types/whatwg-streams/index.d.ts +++ b/types/whatwg-streams/index.d.ts @@ -12,9 +12,9 @@ export interface ReadableStreamSource { cancel?(reason: any): void | Promise; } -export interface ReadableByteStreamSource { - start?(controller: ReadableByteStreamController): void | Promise; - pull?(controller: ReadableByteStreamController): void | Promise; +export interface ReadableByteStreamSource { + start?(controller: ReadableByteStreamController): void | Promise; + pull?(controller: ReadableByteStreamController): void | Promise; cancel?(reason: any): void | Promise; type: "bytes"; @@ -37,9 +37,14 @@ export interface WritableReadablePair, U extends R readable: U; } +export interface ReadResult { + done: boolean; + value: T; +} + declare class ReadableStream { constructor(underlyingSource?: ReadableStreamSource, strategy?: QueuingStrategy); - constructor(underlyingSource?: ReadableByteStreamSource, strategy?: QueuingStrategy); + constructor(underlyingSource?: ReadableByteStreamSource, strategy?: QueuingStrategy); readonly locked: boolean; @@ -57,7 +62,7 @@ declare class ReadableStreamDefaultReader { readonly closed: Promise; cancel(reason: any): Promise; - read(): Promise>; + read(): Promise>; releaseLock(): void; } @@ -67,7 +72,7 @@ declare class ReadableStreamBYOBReader { readonly closed: Promise; cancel(reason: any): Promise; - read(view: T): Promise>; + read(view: T): Promise>; releaseLock(): void; } @@ -79,17 +84,17 @@ declare class ReadableStreamDefaultController { error(e: any): void; } -declare class ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest; +declare class ReadableByteStreamController { + readonly byobRequest: ReadableStreamBYOBRequest | undefined; readonly desiredSize: number | null; close(): void; - enqueue(chunk: R): void; + enqueue(chunk: ArrayBufferView): void; error(e: any): void; } -declare class ReadableStreamBYOBRequest { - readonly view: R; +declare class ReadableStreamBYOBRequest { + readonly view: Uint8Array; respond(bytesWritten: number): void; respondWithNewView(view: ArrayBufferView): void; diff --git a/types/whatwg-streams/whatwg-streams-tests.ts b/types/whatwg-streams/whatwg-streams-tests.ts index c6e83a89d3..be749686cc 100644 --- a/types/whatwg-streams/whatwg-streams-tests.ts +++ b/types/whatwg-streams/whatwg-streams-tests.ts @@ -187,14 +187,14 @@ function makeReadableByteFileStream(filename: string) { pull(controller: ReadableByteStreamController) { // Even when the consumer is using the default reader, the auto-allocation // feature allocates a buffer and passes it to us via byobRequest. - const v = controller.byobRequest.view; + const v = controller.byobRequest!.view; return fs.read(fd, v.buffer, v.byteOffset, v.byteLength, position).then(bytesRead => { if (bytesRead === 0) { return fs.close(fd).then(() => controller.close()); } else { position += bytesRead; - controller.byobRequest.respond(bytesRead); + controller.byobRequest!.respond(bytesRead); } }); }, From cf883dad9d4086d3773f93f03499a3d87a02ff10 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 21 Jul 2018 02:27:56 +0200 Subject: [PATCH 112/738] Add missing methods from ethereumjs-abi type (#27363) --- types/ethereumjs-abi/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/ethereumjs-abi/index.d.ts b/types/ethereumjs-abi/index.d.ts index 4314e46cbd..9208712d59 100644 --- a/types/ethereumjs-abi/index.d.ts +++ b/types/ethereumjs-abi/index.d.ts @@ -8,3 +8,5 @@ export function soliditySHA3(argTypes: string[], args: any[]): Buffer; export function soliditySHA256(argTypes: string[], args: any[]): Buffer; export function methodID(name: string, types: string[]): Buffer; +export function simpleEncode(signature: string, ...args: any[]): Buffer; +export function rawDecode(signature: string[], data: Buffer): any[]; From 43c1545b6e5d11d37ccfbb768be7be28c0a414f3 Mon Sep 17 00:00:00 2001 From: s Date: Fri, 20 Jul 2018 20:30:42 -0400 Subject: [PATCH 113/738] [@types/twit] removing myself from list of maintainers (#27343) --- types/twit/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 35ff1decb0..2b2103d650 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for twit 2.2 // Project: https://github.com/ttezel/twit // Definitions by: Volox -// lostfictions // sapphiredev // abraham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From e3727a66d21755c98f1acf7a5cecc17fc2c8f862 Mon Sep 17 00:00:00 2001 From: Ishaan Malhi Date: Sat, 21 Jul 2018 06:01:00 +0530 Subject: [PATCH 114/738] [@types/aws-lambda] Add SQS Event Source (#27334) * feat: Add initial typings * feat: Add tests for SQS Event Source * fix: linting fixes --- types/aws-lambda/aws-lambda-tests.ts | 57 ++++++++++++++++++++++++++++ types/aws-lambda/index.d.ts | 35 +++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 51f0635da1..1c90bb1c72 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -838,3 +838,60 @@ let customHandler: AWSLambda.Handler = (event, contex }; let kinesisStreamHandler: AWSLambda.KinesisStreamHandler = (event: AWSLambda.KinesisStreamEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; + +let SQSMessageHandler: AWSLambda.SQSHandler = (event: AWSLambda.SQSEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; + +// See https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-sqs +const SQSEvent: AWSLambda.SQSEvent = { + Records: [ + { + messageId: "c80e8021-a70a-42c7-a470-796e1186f753", + receiptHandle: "AQEBJQ+/u6NsnT5t8Q/VbVxgdUl4TMKZ5FqhksRdIQvLBhwNvADoBxYSOVeCBXdnS9P+", + body: "{\"foo\":\"bar\"}", + attributes: { + ApproximateReceiveCount: "3", + SentTimestamp: "1529104986221", + SenderId: "594035263019", + ApproximateFirstReceiveTimestamp: "1529104986230" + }, + messageAttributes: {}, + md5OfBody: "9bb58f26192e4ba00f01e2e7b136bbd8", + eventSource: "aws:sqs", + eventSourceARN: "arn:aws:sqs:us-west-2:594035263019:NOTFIFOQUEUE", + awsRegion: "us-west-2" + } + ] +}; + +let SQSMessageLegacyAsyncHandler: AWSLambda.SQSHandler = async ( + event: AWSLambda.SQSEvent, + context: AWSLambda.Context, + cb: AWSLambda.Callback, +) => { + // $ExpectType SQSEvent + event; + str = event.Records[0].messageId; + anyObj = event.Records[0].body; + // $ExpectType Context + context; + str = context.functionName; + // $ExpectType Callback + cb; + cb(); + cb(null); + cb(new Error()); +}; + +let SQSMessageNode8AsyncHandler: AWSLambda.SQSHandler = async ( + event: AWSLambda.SQSEvent, + context: AWSLambda.Context +) => { + // $ExpectType SQSEvent + event; + str = event.Records[0].messageId; + anyObj = event.Records[0].body; + // $ExpectType Context + context; + str = context.functionName; + return; +}; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 4c10da216f..aafdf4a0a0 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -642,6 +642,39 @@ export interface KinesisStreamEvent { Records: KinesisStreamRecord[]; } +// SQS +// https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html#supported-event-source-sqs +export interface SQSRecord { + messageId: string; + receiptHandle: string; + body: string; + attributes: SQSRecordAttributes; + messageAttributes: SQSMessageAttributes; + md5OfBody: string; + eventSource: string; + eventSourceARN: string; + awsRegion: string; + } + +export interface SQSEvent { + Records: SQSRecord[]; +} + +export interface SQSRecordAttributes { + ApproximateReceiveCount: string; + SentTimestamp: string; + SenderId: string; + ApproximateFirstReceiveTimestamp: string; +} +export interface SQSMessageAttribute { + Name: string; + Type: string; + Value: string; +} +export interface SQSMessageAttributes { + [name: string]: SQSMessageAttribute; +} + /** * AWS Lambda handler function. * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html @@ -686,6 +719,8 @@ export type SNSHandler = Handler; export type CognitoUserPoolTriggerHandler = Handler; // TODO: Different event/handler types for each event trigger so we can type the result? +export type SQSHandler = Handler; + // TODO: CognitoSync export type CloudFormationCustomResourceHandler = Handler; From 59c9faf71a1493d43ed142de149dccdd3e42a97f Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Sat, 21 Jul 2018 02:31:13 +0200 Subject: [PATCH 115/738] fix returntype of publish() and sendToQueue() (#27322) --- .../amqp-connection-manager/amqp-connection-manager-tests.ts | 5 +++++ types/amqp-connection-manager/index.d.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/amqp-connection-manager/amqp-connection-manager-tests.ts b/types/amqp-connection-manager/amqp-connection-manager-tests.ts index 0ee1aeaf95..6eae738a3c 100644 --- a/types/amqp-connection-manager/amqp-connection-manager-tests.ts +++ b/types/amqp-connection-manager/amqp-connection-manager-tests.ts @@ -18,3 +18,8 @@ connection.on("disconnect", (_arg: { err: Error }): void => undefined); channelWrapper.on("close", () => undefined); channelWrapper.on("connect", () => undefined); channelWrapper.on("error", (_error: Error) => undefined); + +channelWrapper.sendToQueue("foo", Buffer.from("bar")) + .catch((error: Error): void => { + // nothing + }); diff --git a/types/amqp-connection-manager/index.d.ts b/types/amqp-connection-manager/index.d.ts index e8683a4ed6..ab69aadeb1 100644 --- a/types/amqp-connection-manager/index.d.ts +++ b/types/amqp-connection-manager/index.d.ts @@ -146,7 +146,7 @@ export interface ChannelWrapper extends EventEmitter { * @param options * @param callback */ - publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): Promise; /** * @see amqplib @@ -155,7 +155,7 @@ export interface ChannelWrapper extends EventEmitter { * @param options * @param callback */ - sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): Promise; /** * @see amqplib From 87167476ba15573e291e435fe151335fef03578b Mon Sep 17 00:00:00 2001 From: Cerberuser Date: Sat, 21 Jul 2018 07:31:26 +0700 Subject: [PATCH 116/738] Cytoscape: layout events fix (#27314) * Cytoscape: layout events fix * fix: adjacent overloads --- types/cytoscape/cytoscape-tests.ts | 7 +++++++ types/cytoscape/index.d.ts | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/types/cytoscape/cytoscape-tests.ts b/types/cytoscape/cytoscape-tests.ts index 394851623d..d6e78ff3cf 100644 --- a/types/cytoscape/cytoscape-tests.ts +++ b/types/cytoscape/cytoscape-tests.ts @@ -469,6 +469,13 @@ const edgePoints: cytoscape.Position[] = [ aliases(eles.layout, eles.createLayout, eles.makeLayout); const layout = eles.layout({name: 'random'}).run(); +layout.on('layoutstop', () => { + cy.fit(); +}); +layout.on('layoutstop', {}, (obj) => { + console.log(obj); +}); + eles.select(); assert(ele.selected()); // as we selected all, and this too aliases(eles.unselect, eles.deselect); diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 9b56a2fd43..ddc0f12a16 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -4677,9 +4677,13 @@ declare namespace cytoscape { * @param handler The handler function that is called * when one of the specified events occurs. */ + on(events: EventNames, handler: EventHandler): this; on(events: EventNames, data: any, handler: EventHandler): this; + bind(events: EventNames, handler: EventHandler): this; bind(events: EventNames, data: any, handler: EventHandler): this; + listen(events: EventNames, handler: EventHandler): this; listen(events: EventNames, data: any, handler: EventHandler): this; + addListener(events: EventNames, handler: EventHandler): this; addListener(events: EventNames, data: any, handler: EventHandler): this; /** From cf6f86c363f0a2b402c6b0010e147d8519f441c5 Mon Sep 17 00:00:00 2001 From: Ika Date: Sat, 21 Jul 2018 08:31:40 +0800 Subject: [PATCH 117/738] fix(escape-string-regexp): correct version number (#27261) --- types/escape-string-regexp/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/escape-string-regexp/index.d.ts b/types/escape-string-regexp/index.d.ts index 7a52a312b1..a0b218afe9 100644 --- a/types/escape-string-regexp/index.d.ts +++ b/types/escape-string-regexp/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for escape-string-regexp +// Type definitions for escape-string-regexp 1.0 // Project: https://github.com/sindresorhus/escape-string-regexp // Definitions by: kruncher // faergeek From efce430c491c432ffcb4aae2de3ac004d902e40a Mon Sep 17 00:00:00 2001 From: nakagawa424 <35394755+nakagawa424@users.noreply.github.com> Date: Sat, 21 Jul 2018 09:32:24 +0900 Subject: [PATCH 118/738] cytoscape: fix map() (#27245) * cytoscape: fix map() * add tests --- types/cytoscape/cytoscape-tests.ts | 4 ++++ types/cytoscape/index.d.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/cytoscape/cytoscape-tests.ts b/types/cytoscape/cytoscape-tests.ts index d6e78ff3cf..7c9f5353c9 100644 --- a/types/cytoscape/cytoscape-tests.ts +++ b/types/cytoscape/cytoscape-tests.ts @@ -545,6 +545,10 @@ eles.difference(collNodes).abscomp().intersection(collSel).symdiff(collNodes); const diff = collSel.diff(collNodes); cy.collection().merge(diff.left).merge(diff.right).merge(diff.both).unmerge(collSel).filter((ele, i, eles) => true); +nodes.map(n => n.degree(false)); +edges.map(e => e.source()); +eles.map(e => e.id()); + eles.sort((a, b) => 1).map((ele, i, eles) => [i, ele]); eles.reduce((prev, ele, i, eles) => [...prev, [ele, i]], []).concat(['finish']); const min = eles.min((ele, i, eles) => ele.id.length + i); min.ele.scratch('min', min.value).scratch('min').value; diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index ddc0f12a16..77a7d20dc3 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -2517,7 +2517,7 @@ declare namespace cytoscape { * * http://js.cytoscape.org/#eles.map */ - map(fn: (ele: CollectionArgument, i: number, eles: CollectionArgument) => any, thisArg?: any): any[]; + map(fn: (ele: TOut, i: number, eles: CollectionArgument) => T, thisArg?: any): T[]; /** * Reduce a single value by applying a From 960c7ef8a00f7b1895b20813d9ef735756633fa1 Mon Sep 17 00:00:00 2001 From: Andrey Tselishchev Date: Sat, 21 Jul 2018 03:33:17 +0300 Subject: [PATCH 119/738] [@types/bson] Updated BSON types (#27259) * `Binary`: Added `sub_type` property. * `Code`: Added `code` and `scope` properties * Added missing `Int32` type * `Decimal128`: Added `bytes` property * `BSONRegExp`: Added `pattern` and `options` properties * `Symbol`: Added `valueOf()` method --- types/bson/index.d.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/types/bson/index.d.ts b/types/bson/index.d.ts index 6bad691dcf..e6afab65a5 100644 --- a/types/bson/index.d.ts +++ b/types/bson/index.d.ts @@ -131,6 +131,8 @@ export class Binary { /** The underlying Buffer which stores the binary data. */ readonly buffer: Buffer; + /** Binary data subtype */ + readonly sub_type?: number; /** The length of the binary. */ length(): number; @@ -146,11 +148,16 @@ export class Binary { /** A class representation of the BSON Code type. */ export class Code { + /** * @param code A string or function. * @param scope An optional scope for the function. */ constructor(code: string | Function, scope?: any); + + readonly code: string | Function; + readonly scope?: any; + } /** @@ -180,6 +187,16 @@ export class Double { valueOf(): number; } +/** A class representation of the BSON Int32 type. */ +export class Int32 { + /** + * @param value The number we want to represent as an int32. + */ + constructor(value: number); + + valueOf(): number; +} + /** * Base class for Long and Timestamp. * In original js-node@1.0.x code 'Timestamp' is a 100% copy-paste of 'Long' @@ -315,6 +332,9 @@ export class Decimal128 { */ constructor(bytes: Buffer); + /** A buffer containing the raw Decimal128 bytes. */ + readonly bytes: Buffer; + toJSON(): string; toString(): string; } @@ -386,7 +406,12 @@ export { ObjectID as ObjectId }; /** A class representation of the BSON RegExp type. */ export class BSONRegExp { + constructor(pattern: string, options: string); + + readonly pattern: string; + readonly options: string; + } /** @@ -394,7 +419,12 @@ export class BSONRegExp { * @deprecated */ export class Symbol { + constructor(value: string); + + /** Access the wrapped string value. */ + valueOf(): string; + } /** A class representation of the BSON Timestamp type. */ From 1aa8a708ac3a310a8ab12c37b9298e645f548708 Mon Sep 17 00:00:00 2001 From: Richie Foreman Date: Fri, 20 Jul 2018 20:34:05 -0400 Subject: [PATCH 120/738] Add types for $injector.{loadNewModules, modules} to types/angular (#27240) * Add {loadNewModules, modules} to angular.auto.IInjectorService * Add {loadNewModules, modules} to angular.auto.IInjectorService * Allow for annotated functions in .loadNewModules() * Fix Injectable Type * Add useful docstrings (which are pretty much carbon copied from the Angular docs) * I dont see any whitespace, but travis does.. remove junk * more * Add {loadNewModules, modules} to angular.auto.IInjectorService --- types/angular/angular-tests.ts | 14 ++++++++++++++ types/angular/index.d.ts | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 5d7dd7cbb8..963b5deae6 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -520,6 +520,20 @@ namespace TestInjector { anyResult = $injector.invoke(inlineAnnotatedFunction, 'anyContext'); anyResult = $injector.invoke(inlineAnnotatedFunction, undefined, 'anyLocals'); } + + // $injector.loadNewModules + { + const inlineAnnotatedFunction: any[] = [false, (v: boolean) => {}]; + const modA = angular.module('$injector.moduleA', []); + $injector.loadNewModules([modA]); + $injector.loadNewModules([modA.name]); + $injector.loadNewModules([inlineAnnotatedFunction]); + } + + // $injector.modules + { + const module: angular.IModule = $injector.modules['$injector.module']; + } } // Promise signature tests diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index c05ee388a8..450d381b6d 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -2183,6 +2183,14 @@ declare namespace angular { has(name: string): boolean; instantiate(typeConstructor: {new(...args: any[]): T}, locals?: any): T; invoke(func: Injectable T)>, context?: any, locals?: any): T; + /** + * Add the specified modules to the current injector. + * This method will add each of the injectables to the injector and execute all of the config and run blocks for each module passed to the method. + * @param modules A module, module name or annotated injection function. + */ + loadNewModules(modules: Array void>>): void; + /** An object map of all the modules that have been loaded into the injector. */ + modules: {[moduleName: string]: IModule}; strictDi: boolean; } From d912769f8d27c0b5460d688df766d4265703f785 Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Sat, 21 Jul 2018 08:34:34 +0800 Subject: [PATCH 121/738] update weixin-app's triggerEvent (#27319) --- types/weixin-app/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/weixin-app/index.d.ts b/types/weixin-app/index.d.ts index 88d8c4bfc5..9c5f1f2126 100644 --- a/types/weixin-app/index.d.ts +++ b/types/weixin-app/index.d.ts @@ -3217,7 +3217,11 @@ interface Component { /** * 触发事件,参见 [组件事件](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/custom-component/events.html) */ - triggerEvent(name: string): void; + triggerEvent(name: string, details?: any, options?: { + bubbles: boolean; + composed: boolean; + capturePhase: boolean; + }): void; /** * 创建一个 SelectorQuery 对象 * 选择器选取范围为这个[组件实例](https://mp.weixin.qq.com/debug/wxadoc/dev/api/wxml-nodes-info.html)内 From 0f848d5c204512ca93967d83d1f5e82f1af8a003 Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Sat, 21 Jul 2018 08:34:45 +0800 Subject: [PATCH 122/738] update weixin-app to use union value for wx.request method? (#27316) --- types/weixin-app/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/weixin-app/index.d.ts b/types/weixin-app/index.d.ts index 9c5f1f2126..612f0c62b0 100644 --- a/types/weixin-app/index.d.ts +++ b/types/weixin-app/index.d.ts @@ -41,7 +41,7 @@ declare namespace wx { /** 设置请求的 header , header 中不能设置 Referer */ header?: RequestHeader; /** 默认为 GET,有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT */ - method?: string; + method?: "GET" | "OPTIONS" | "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "TRACE" | "CONNECT"; /** 如果设为json,会尝试对返回的数据做一次 JSON.parse */ dataType?: string; /** From 4b5508062fb646fc99e9a3e315ad87da3561c7e6 Mon Sep 17 00:00:00 2001 From: Krzysztof Bogdan Date: Sat, 21 Jul 2018 02:36:43 +0200 Subject: [PATCH 123/738] Add missing generateMipmaps field (#27325) Add missing generateMipmaps field from WebGLRenderTargetOptions --- types/three/three-core.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 1f8b742e72..b0c8a9fdb3 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -5738,6 +5738,7 @@ export interface WebGLRenderTargetOptions { anisotropy?: number; // 1; depthBuffer?: boolean; // true; stencilBuffer?: boolean; // true; + generateMipmaps?: boolean; // true; } export class WebGLRenderTarget extends EventDispatcher { From 097c9e20ad43f9f73d4c851b510b5a7caf28ed9e Mon Sep 17 00:00:00 2001 From: Krzysztof Bogdan Date: Sat, 21 Jul 2018 02:37:25 +0200 Subject: [PATCH 124/738] three.js add missing math.lerp and webglrenderer methods (#27317) * Update three-core.d.ts Add missing WebGLRenderer methods (getDrawingBufferSize, setDrawingBufferSize, getCurrentViewport) * Update three-core.d.ts remove unnecessary whitespace * Add missing lerp method from Math namespace * Fixed indentation & order --- types/three/three-core.d.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index b0c8a9fdb3..98cdcbe4e0 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -3650,6 +3650,17 @@ export namespace Math { export function isPowerOfTwo(value: number): boolean; + /** + * Returns a value linearly interpolated from two known points based + * on the given interval - t = 0 will return x and t = 1 will return y. + * + * @param x Start point. + * @param y End point. + * @param t interpolation factor in the closed interval [0, 1] + * @return {number} + */ + export function lerp (x: number, y: number, t: number): number; + /** * @deprecated Use {@link Math#floorPowerOfTwo .floorPowerOfTwo()} */ @@ -5532,14 +5543,18 @@ export class WebGLRenderer implements Renderer { getPixelRatio(): number; setPixelRatio(value: number): void; + + getDrawingBufferSize(): { width: number; height: number; }; + setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; getSize(): { width: number; height: number; }; - + /** * Resizes the output canvas to (width, height), and also sets the viewport to fit that size, starting in (0, 0). */ setSize(width: number, height: number, updateStyle?: boolean): void; + getCurrentViewport(): Vector4; /** * Sets the viewport to render from (x, y) to (x + width, y + height). */ From 42bdf3969d18ab219e2f77789a9ea04e4d5abb9d Mon Sep 17 00:00:00 2001 From: Siwalik M Date: Sat, 21 Jul 2018 06:07:40 +0530 Subject: [PATCH 125/738] Updating interface for cursor acc. to new API (#27332) * Updating interface for cursor acc. to new API * update contributor * review changes --- types/twit/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 2b2103d650..7e4e60c249 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Volox // sapphiredev // abraham +// siwalik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -263,7 +264,7 @@ declare module 'twit' { long?: number, follow?: boolean, include_email?: boolean, - cursor?: number, + cursor?: number | string, tweet_mode?: string, trim_user?: boolean, exclude_replies?: boolean, From 77637140d43d2836acea450324fe678c0633d4bb Mon Sep 17 00:00:00 2001 From: Ronald Rey Date: Fri, 20 Jul 2018 20:38:11 -0400 Subject: [PATCH 126/738] fuzzaldrin-plus@0.6.0: Update definitions (#27249) * fuzzaldrin-plus@0.6.0: Update definitions * Rename `IFuzzaldrinPlusOptions` to `IOptions` Co-Authored-By: shiftkey --- .../fuzzaldrin-plus/fuzzaldrin-plus-tests.ts | 209 +++++++++++++++++- types/fuzzaldrin-plus/index.d.ts | 48 ++-- 2 files changed, 229 insertions(+), 28 deletions(-) diff --git a/types/fuzzaldrin-plus/fuzzaldrin-plus-tests.ts b/types/fuzzaldrin-plus/fuzzaldrin-plus-tests.ts index 97730fe2e5..b5d83d4e9c 100644 --- a/types/fuzzaldrin-plus/fuzzaldrin-plus-tests.ts +++ b/types/fuzzaldrin-plus/fuzzaldrin-plus-tests.ts @@ -1,4 +1,8 @@ -import * as fz from "fuzzaldrin-plus"; +import * as fz from 'fuzzaldrin-plus' + +// +// Simple use cases +// ---------------------------------------------------------------------- const candidates = [ 'Find And Replace: Select All', @@ -7,14 +11,201 @@ const candidates = [ 'Application: Install Update', 'Install' ] -const objectCandidates = candidates.map(s => ({ foo: s })); +const objectCandidates = candidates.map(s => ({ foo: s })) +const options: fz.IOptions = { allowErrors: true } +const filterOptions: fz.IFilterOptions = { + allowErrors: true, + key: 'foo' +} -fz.filter(candidates, 'install'); -fz.filter(objectCandidates, 'install', { key: 'foo' }); +fz.filter(candidates, 'install') +fz.filter(candidates, 'install', options) +fz.filter(candidates, 'install', filterOptions) +fz.filter(objectCandidates, 'install', { key: 'foo' }) -const prepQuery = fz.prepQuery('install'); -fz.score('Application: Install Update', 'install'); -fz.score('Application: Install Update', 'install', prepQuery); +const preparedQuery: fz.Query = fz.prepareQuery('install') -fz.match('Application: Install Update', 'install'); -fz.match('Application: Install Update', 'install', prepQuery); +fz.score('Maybe', 'me') +fz.score('Maybe', 'me', undefined) +fz.score('Maybe', 'me', null) +fz.score('Maybe', 'me', {}) +fz.score('Maybe', 'me', { allowErrors: true }) +fz.score('Application: Install Update', 'install') +fz.score('Application: Install Update', 'install', { preparedQuery }) + +fz.match('Maybe', 'me') +fz.match('Application: Install Update', 'install') +fz.match('Application: Install Update', 'install', { preparedQuery }) + +fz.wrap('Maybe', 'me') + +// +// Complex filter cases, using all the options +// ---------------------------------------------------------------------- + +fz.filter(['Maybe', 'Me'], 'me') +fz.filter(['Maybe', 'Me'], 'me', undefined) +fz.filter(['Maybe', 'Me'], 'me', null) +fz.filter(['Maybe', 'Me'], 'me', {}) +fz.filter(['Maybe', 'Me'], 'me', { allowErrors: true }) +fz.filter(['Maybe', 'Me'], 'me', { key: 'key' }) +fz.filter(['Maybe', 'Me'], 'me', { + preparedQuery: fz.prepareQuery('me') +}) +fz.filter(['Maybe', 'Me'], 'me', { + allowErrors: true, + usePathScoring: true +}) +fz.filter(['Maybe', 'Me'], 'me', { + allowErrors: true, + usePathScoring: true, + useExtensionBonus: true +}) +fz.filter(['Maybe', 'Me'], 'me', { + allowErrors: true, + usePathScoring: true, + useExtensionBonus: true, + pathSeparator: '/' +}) +fz.filter(['Maybe', 'Me'], 'me', { + allowErrors: true, + usePathScoring: true, + useExtensionBonus: true, + pathSeparator: '\\', + optCharRegEx: new RegExp('') +}) +fz.filter(['Maybe', 'Me'], 'me', { + allowErrors: true, + usePathScoring: true, + useExtensionBonus: true, + pathSeparator: '\\', + optCharRegEx: new RegExp(''), + wrap: { + tagOpen: '', + tagClass: '', + tagClose: '' + } +}) +fz.filter(['Maybe', 'Me'], 'me', { + allowErrors: true, + usePathScoring: true, + useExtensionBonus: true, + pathSeparator: '\\', + optCharRegEx: new RegExp(''), + wrap: { + tagOpen: '', + tagClass: '', + tagClose: '' + }, + maxResults: 10 +}) +fz.filter(['Maybe', 'Me'], 'me', { + allowErrors: true, + usePathScoring: true, + useExtensionBonus: true, + pathSeparator: '\\', + optCharRegEx: new RegExp(''), + wrap: { + tagOpen: '', + tagClass: '', + tagClose: '' + }, + maxResults: 10, + maxInners: 10 +}) +fz.filter([{ title: 'Maybe' }, { title: 'Me' }], 'me', { + allowErrors: true, + usePathScoring: true, + useExtensionBonus: true, + pathSeparator: '\\', + optCharRegEx: new RegExp(''), + wrap: { + tagOpen: '', + tagClass: '', + tagClose: '' + }, + maxResults: 10, + maxInners: 10, + key: 'title' +}) +fz.filter([{ title: 'Maybe' }, { title: 'Me' }], 'me', { + allowErrors: true, + key: 'title' +}) +fz.filter([{ title: 'Maybe' }, { title: 'Me' }], 'me', { + key: 'title' +}) + +/** + * ====================================================================== + * Incorrect Usage: + * ====================================================================== + */ + +// $ExpectError +fz.score() +// $ExpectError +fz.match() +// $ExpectError +fz.wrap() +// $ExpectError +fz.prepareQuery() +// $ExpectError +fz.score('Maybe', 'me', true) +// $ExpectError +fz.score('Maybe', 'me', 'string') +// $ExpectError +fz.score('Maybe', 'me', 1) + +const items = ['Maybe', 'Me'] +// $ExpectError +fz.score(items, 'me') +// $ExpectError +fz.score('Maybe', 'me', { unknownProperty: true }) +// $ExpectError +fz.match(items, 'me') +// $ExpectError +fz.wrap(items, 'me') +// $ExpectError +fz.prepareQuery() + +// $ExpectError +const incorrectOptions: fz.IFilterOptions = { allowErrors: 'not a boolean' } + +// $ExpectError +fz.filter(candidates, 'install', { allowErrors: 'not a boolean' }) +fz.filter([{ title: 'Maybe' }, { title: 'Me' }], 'me', { + // $ExpectError + incorrectProperty: true, + key: 'title' +}) + +// $ExpectError +fz.score('Maybe', 'me', undefined, options) +// $ExpectError +fz.match('Maybe', 'me', undefined, options) + +// $ExpectError +fz.filter() +// $ExpectError +fz.filter('not an array', 'query') +// $ExpectError +fz.filter(['Maybe', 'Me'], 'me', { allowErrors: 'not a boolean' }) +// $ExpectError +fz.filter(['Maybe', 'Me'], 'me', { key: true }) +// $ExpectError +fz.filter(['Maybe', 'Me'], 'me', { preparedQuery: {} }) +// $ExpectError +fz.filter([{ title: 'Maybe' }, { title: 'Me' }], 'me', { + key: 1 +}) +// $ExpectError +fz.filter([{ title: 'Maybe' }, { title: 'Me' }], 'me', { + allowErrors: 'not a boolean', + key: 1 +}) +// $ExpectError +fz.filter([{ title: 'Maybe' }, { title: 'Me' }], 'me', { + allowErrors: 'not a boolean', + key: 'title' +}) diff --git a/types/fuzzaldrin-plus/index.d.ts b/types/fuzzaldrin-plus/index.d.ts index 34d6949ace..cd52c501d4 100644 --- a/types/fuzzaldrin-plus/index.d.ts +++ b/types/fuzzaldrin-plus/index.d.ts @@ -1,29 +1,39 @@ -// Type definitions for fuzzaldrin-plus +// Type definitions for fuzzaldrin-plus 0.6.0 // Project: https://github.com/jeancroy/fuzzaldrin-plus/ -// Definitions by: Jean Christophe Roy , Jason Killian +// Definitions by: Jean Christophe Roy , +// Jason Killian +// Ronald Rey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 -export as namespace fuzzaldrin; +export as namespace fuzzaldrin -export interface IQueryOptions { - pathSeparator?: string; - optCharRegEx?: RegExp; +export class Query { + $$__internal: Symbol } -export interface IScoringOptions extends IQueryOptions { - allowErrors?: boolean; - isPath?: boolean; - useExtensionBonus?: boolean; +export interface IOptions { + allowErrors?: boolean + usePathScoring?: boolean + useExtensionBonus?: boolean + pathSeparator?: '/' | '\\' | string + optCharRegEx?: RegExp + wrap?: { tagOpen?: string; tagClass?: string; tagClose?: string } + preparedQuery?: Query } -export interface IFilterOptions extends IScoringOptions { - key?: string; - maxResults?: number; +export type IFilterOptions = IOptions & { + key?: string + maxResults?: number + maxInners?: number } -export type PreparedQuery = { __internalAPIBrand: string; }; - -export function filter(data: T[], query: string, options?: IFilterOptions): T[]; -export function score(str: string, query: string, preparedQuery?: PreparedQuery, options?: IScoringOptions): number; -export function match(str: string, query: string, preparedQuery?: PreparedQuery, options?: IScoringOptions): number[]; -export function prepQuery(query: string, options?: IQueryOptions): PreparedQuery; +export function filter( + data: T[], + query: string, + options?: IFilterOptions +): T[] +export function score(str: string, query: string, options?: IOptions): number +export function match(str: string, query: string, options?: IOptions): number[] +export function wrap(str: string, query: string, options?: IOptions): string +export function prepareQuery(query: string, options?: IOptions): Query From 834879d2a983c21c56fddbb145f5f1a6315b63e6 Mon Sep 17 00:00:00 2001 From: Brandon <9inchsamurai@gmail.com> Date: Fri, 20 Jul 2018 18:39:17 -0600 Subject: [PATCH 127/738] remove the module declaration from the base slate package to simplify importing (#27347) --- types/slate-base64-serializer/index.d.ts | 10 +- .../slate-base64-serializer-tests.ts | 4 +- types/slate-html-serializer/index.d.ts | 22 +- types/slate-plain-serializer/index.d.ts | 10 +- .../slate-plain-serializer-tests.ts | 4 +- types/slate-react/index.d.ts | 72 +- types/slate-react/slate-react-tests.tsx | 8 +- types/slate/index.d.ts | 1413 +++++++++-------- types/slate/slate-tests.ts | 4 +- 9 files changed, 774 insertions(+), 773 deletions(-) diff --git a/types/slate-base64-serializer/index.d.ts b/types/slate-base64-serializer/index.d.ts index 86f626fc86..6d356aa1c3 100644 --- a/types/slate-base64-serializer/index.d.ts +++ b/types/slate-base64-serializer/index.d.ts @@ -3,9 +3,9 @@ // Definitions by: Brandon Shelton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import { Slate } from "slate"; +import { Value, Node } from "slate"; -export function deserialize(string: string, options?: object): Slate.Value; -export function deserializeNode(string: string, options?: object): Slate.Node; -export function serialize(value: Slate.Value, options?: object): string; -export function serializeNode(node: Slate.Node, options?: object): string; +export function deserialize(string: string, options?: object): Value; +export function deserializeNode(string: string, options?: object): Node; +export function serialize(value: Value, options?: object): string; +export function serializeNode(node: Node, options?: object): string; diff --git a/types/slate-base64-serializer/slate-base64-serializer-tests.ts b/types/slate-base64-serializer/slate-base64-serializer-tests.ts index 3d1b2888b6..680bcf62bd 100644 --- a/types/slate-base64-serializer/slate-base64-serializer-tests.ts +++ b/types/slate-base64-serializer/slate-base64-serializer-tests.ts @@ -1,6 +1,6 @@ import * as Base64 from "slate-base64-serializer"; -import { Slate } from "slate"; +import { Value } from "slate"; -const val = Slate.Value.create(); +const val = Value.create(); const serialized = Base64.serialize(val); const deserialized = Base64.deserialize(serialized); diff --git a/types/slate-html-serializer/index.d.ts b/types/slate-html-serializer/index.d.ts index eb9290955a..cee3041d69 100644 --- a/types/slate-html-serializer/index.d.ts +++ b/types/slate-html-serializer/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 import * as React from 'react'; -import { Slate } from 'slate'; +import { BlockProperties, ValueJSON, Value, Node, Mark, Leaf } from 'slate'; export interface Rule { deserialize?: (el: Element, next: (elements: Element[] | NodeList | Array) => any) => any; @@ -13,28 +13,28 @@ export interface Rule { export interface HtmlOptions { rules?: Rule[]; - defaultBlock?: Slate.BlockProperties; + defaultBlock?: BlockProperties; parseHtml?: (html: string) => HTMLElement; } export default class Html { constructor(options?: HtmlOptions); - deserialize(html: string, options: { toJSON: true }): Slate.ValueJSON; - deserialize(html: string, options?: { toJSON?: false }): Slate.Value; + deserialize(html: string, options: { toJSON: true }): ValueJSON; + deserialize(html: string, options?: { toJSON?: false }): Value; - serialize(value: Slate.Value, options?: { render?: true }): string; - serialize(value: Slate.Value, options: { render: false }): Element[]; + serialize(value: Value, options?: { render?: true }): string; + serialize(value: Value, options: { render: false }): Element[]; protected rules: Rule[]; - protected defaultBlock: Slate.BlockProperties; + protected defaultBlock: BlockProperties; protected parseHtml: (html: string) => HTMLElement; - protected deserializeElements: (elements: HTMLElement[]) => Slate.Node[]; + protected deserializeElements: (elements: HTMLElement[]) => Node[]; protected deserializeElement: (element: HTMLElement) => any; - protected deserializeMark: (mark: Slate.Mark) => Slate.Node[]; + protected deserializeMark: (mark: Mark) => Node[]; - protected serializeNode: (node: Slate.Node) => string; - protected serializeLeaf: (leaf: Slate.Leaf) => string; + protected serializeNode: (node: Node) => string; + protected serializeLeaf: (leaf: Leaf) => string; protected serializeString: (string: string) => string; } diff --git a/types/slate-plain-serializer/index.d.ts b/types/slate-plain-serializer/index.d.ts index 778f523168..b781b4f9e7 100644 --- a/types/slate-plain-serializer/index.d.ts +++ b/types/slate-plain-serializer/index.d.ts @@ -3,13 +3,13 @@ // Definitions by: Brandon Shelton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import { Slate } from 'slate'; +import { BlockProperties, MarkProperties, Value } from 'slate'; export interface DeserializeOptions { toJson?: boolean; - defaultBlock?: Slate.BlockProperties; - defaultMarks?: Slate.MarkProperties[] | Set; + defaultBlock?: BlockProperties; + defaultMarks?: MarkProperties[] | Set; } -export function deserialize(string: string, options?: DeserializeOptions): Slate.Value; -export function serialize(value: Slate.Value): string; +export function deserialize(string: string, options?: DeserializeOptions): Value; +export function serialize(value: Value): string; diff --git a/types/slate-plain-serializer/slate-plain-serializer-tests.ts b/types/slate-plain-serializer/slate-plain-serializer-tests.ts index 7d7db6ff84..c7b7f97e07 100644 --- a/types/slate-plain-serializer/slate-plain-serializer-tests.ts +++ b/types/slate-plain-serializer/slate-plain-serializer-tests.ts @@ -1,6 +1,6 @@ import * as Plain from "slate-plain-serializer"; -import { Slate } from "slate"; +import { Value } from "slate"; -const val = Slate.Value.create(); +const val = Value.create(); const serialized = Plain.serialize(val); const deserialized = Plain.deserialize(serialized); diff --git a/types/slate-react/index.d.ts b/types/slate-react/index.d.ts index 492156363a..3ef179a14b 100644 --- a/types/slate-react/index.d.ts +++ b/types/slate-react/index.d.ts @@ -7,7 +7,7 @@ // Brandon Shelton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import { Slate } from 'slate'; +import { Mark, Node, Block, Change, Schema, Value, Stack } from 'slate'; import * as Immutable from 'immutable'; import * as React from 'react'; @@ -20,9 +20,9 @@ export interface RenderMarkProps { attributes: RenderAttributes; children: React.ReactNode; editor: Editor; - mark: Slate.Mark; - marks: Immutable.Set; - node: Slate.Node; + mark: Mark; + marks: Immutable.Set; + node: Node; offset: number; text: string; } @@ -33,26 +33,26 @@ export interface RenderNodeProps { editor: Editor; isSelected: boolean; key: string; - node: Slate.Block; - parent: Slate.Node; + node: Block; + parent: Node; } export interface Plugin { - onBeforeInput?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onBlur?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onFocus?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onClick?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onCopy?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onCut?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onDrop?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onKeyDown?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onKeyUp?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onPaste?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onSelect?: (event: Event, change: Slate.Change, editor: Editor) => Slate.Change | void; - onChange?: (change: Slate.Change) => any; + onBeforeInput?: (event: Event, change: Change, editor: Editor) => Change | void; + onBlur?: (event: Event, change: Change, editor: Editor) => Change | void; + onFocus?: (event: Event, change: Change, editor: Editor) => Change | void; + onClick?: (event: Event, change: Change, editor: Editor) => Change | void; + onCopy?: (event: Event, change: Change, editor: Editor) => Change | void; + onCut?: (event: Event, change: Change, editor: Editor) => Change | void; + onDrop?: (event: Event, change: Change, editor: Editor) => Change | void; + onKeyDown?: (event: Event, change: Change, editor: Editor) => Change | void; + onKeyUp?: (event: Event, change: Change, editor: Editor) => Change | void; + onPaste?: (event: Event, change: Change, editor: Editor) => Change | void; + onSelect?: (event: Event, change: Change, editor: Editor) => Change | void; + onChange?: (change: Change) => any; renderEditor?: (props: RenderAttributes, editor: Editor) => object | void; - schema?: Slate.Schema; - decorateNode?: (node: Slate.Node) => Slate.Range[] | void; + schema?: Schema; + decorateNode?: (node: Node) => Range[] | void; renderMark?: (props: RenderMarkProps) => any; renderNode?: (props: RenderNodeProps) => any; renderPlaceholder?: (props: RenderAttributes) => any; @@ -61,16 +61,16 @@ export interface Plugin { } export interface BasicEditorProps { - value: Slate.Value; + value: Value; autoCorrect?: boolean; autoFocus?: boolean; className?: string; - onChange?: (change: Slate.Change) => any; + onChange?: (change: Change) => any; placeholder?: any; plugins?: Plugin[]; readOnly?: boolean; role?: string; - schema?: Slate.Schema; + schema?: Schema; spellCheck?: boolean; style?: { [key: string]: string }; tabIndex?: number; @@ -80,29 +80,29 @@ export interface BasicEditorProps { export type EditorProps = BasicEditorProps & Plugin; export interface EditorState { - schema: Slate.Schema; - value: Slate.Value; - stack: Slate.Stack; // [TODO] define stack + schema: Schema; + value: Value; + stack: Stack; // [TODO] define stack } export class Editor extends React.Component { - schema: Slate.Schema; - value: Slate.Value; - stack: Slate.Stack; + schema: Schema; + value: Value; + stack: Stack; // Instance Methods blur(): void; - change(fn: (change: Slate.Change) => any): void; + change(fn: (change: Change) => any): void; change(...args: any[]): void; focus(): void; } export type SlateType = 'fragment' | 'html' | 'node' | 'rich' | 'text' | 'files'; -export function findDOMNode(node: Slate.Node): Element; -export function findDOMRange(range: Slate.Range): Range; -export function findNode(element: Element, value: Slate.Value): Slate.Node; -export function findRange(selection: Selection, value: Slate.Value): Slate.Range; -export function getEventRange(event: Event, value: Slate.Value): Slate.Range; -export function getEventTransfer(event: Event): { type: SlateType; node: Slate.Node }; +export function findDOMNode(node: Node): Element; +export function findDOMRange(range: Range): Range; +export function findNode(element: Element, value: Value): Node; +export function findRange(selection: Selection, value: Value): Range; +export function getEventRange(event: Event, value: Value): Range; +export function getEventTransfer(event: Event): { type: SlateType; node: Node }; export function setEventTransfer(event: Event, type: SlateType, data: any): void; diff --git a/types/slate-react/slate-react-tests.tsx b/types/slate-react/slate-react-tests.tsx index f576ea580c..074f6caa9b 100644 --- a/types/slate-react/slate-react-tests.tsx +++ b/types/slate-react/slate-react-tests.tsx @@ -1,9 +1,9 @@ import { Editor, Plugin, EditorProps } from "slate-react"; -import { Slate } from "slate"; +import { Change, Value } from "slate"; import * as React from "react"; class MyPlugin implements Plugin { - onChange(change: Slate.Change): void { + onChange(change: Change): void { change.blur(); } } @@ -11,14 +11,14 @@ class MyPlugin implements Plugin { const myPlugin = new MyPlugin(); interface MyEditorState { - value: Slate.Value; + value: Value; } class MyEditor extends React.Component { constructor(props: EditorProps) { super(props); this.state = { - value: Slate.Value.create() + value: Value.create() }; } diff --git a/types/slate/index.d.ts b/types/slate/index.d.ts index b73746414d..91fc084056 100644 --- a/types/slate/index.d.ts +++ b/types/slate/index.d.ts @@ -8,714 +8,715 @@ // TypeScript Version: 2.3 import * as Immutable from 'immutable'; -export namespace Slate { - interface Data { - [key: string]: any; - } +export interface Data { + [key: string]: any; +} - interface RulesByNodeType { - [key: string]: Rules; - } +export interface RulesByNodeType { + [key: string]: Rules; +} - interface KindsAndTypes { +export interface KindsAndTypes { + kinds?: string[]; + types?: string[]; +} + +export type InvalidReason = + | 'child_kind_invalid' + | 'child_required' + | 'child_type_invalid' + | 'child_unknown' + | 'first_child_kind_invalid' + | 'first_child_type_invalid' + | 'last_child_kind_invalid' + | 'last_child_type_invalid' + | 'node_data_invalid' + | 'node_is_void_invalid' + | 'node_mark_invalid' + | 'node_text_invalid' + | 'parent_kind_invalid' + | 'parent_type_invalid'; + +export interface Rules { + data?: { + [key: string]: (v: any) => boolean; + }; + first?: KindsAndTypes; + isVoid?: boolean; + last?: KindsAndTypes; + nodes?: Array<{ kinds?: string[]; types?: string[]; - } - - type InvalidReason = - | 'child_kind_invalid' - | 'child_required' - | 'child_type_invalid' - | 'child_unknown' - | 'first_child_kind_invalid' - | 'first_child_type_invalid' - | 'last_child_kind_invalid' - | 'last_child_type_invalid' - | 'node_data_invalid' - | 'node_is_void_invalid' - | 'node_mark_invalid' - | 'node_text_invalid' - | 'parent_kind_invalid' - | 'parent_type_invalid'; - - interface Rules { - data?: { - [key: string]: (v: any) => boolean; - }; - first?: KindsAndTypes; - isVoid?: boolean; - last?: KindsAndTypes; - nodes?: Array<{ - kinds?: string[]; - types?: string[]; - min?: number; - max?: number; - }>; - normalize?: ( - change: Change, - reason: InvalidReason, - context: { [key: string]: any } - ) => void; - parent?: KindsAndTypes; - text?: RegExp; - } - - interface SchemaProperties { - document?: Rules; - blocks?: RulesByNodeType; - inlines?: RulesByNodeType; - } - - class Schema extends Immutable.Record({}) { - document: Rules; - blocks: RulesByNodeType; - inlines: RulesByNodeType; - - static create(properties: SchemaProperties | Schema): Schema; - static fromJSON(object: SchemaProperties): Schema; - static isSchema(maybeSchema: any): maybeSchema is Schema; - - toJSON(): SchemaProperties; - } - - interface ValueProperties { - document?: Document; - selection?: Range; - history?: History; - schema?: Schema; - data?: Data; - decorations?: Immutable.List | null; - } - - interface ValueJSON { - document?: DocumentJSON; - selection?: Range; - history?: History; - schema?: Schema; - data?: Data; - decorations?: Immutable.List | null; - object?: 'value'; - } - - class Value extends Immutable.Record({}) { - document: Document; - selection: Range; - history: History; - schema: Schema; - data: Data; - object: 'value'; - decorations: Immutable.List | null; - - readonly anchorText: Text; - readonly focusText: Text; - readonly startText: Text; - readonly endText: Text; - - readonly anchorBlock: Block; - readonly focusBlock: Block; - readonly startBlock: Block; - readonly endBlock: Block; - - readonly marks: Immutable.Set; - readonly activeMarks: Immutable.Set; - readonly blocks: Immutable.List; - readonly fragment: Document; - readonly inlines: Immutable.List; - readonly text: Immutable.List; - readonly characters: Immutable.List; - readonly hasUndos: boolean; - readonly hasRedos: boolean; - - readonly anchorKey: string; - readonly focusKey: string; - readonly startKey: string; - readonly endKey: string; - readonly anchorOffset: number; - readonly focusOffset: number; - readonly startOffset: number; - readonly endOffset: number; - readonly isBackward: boolean; - readonly isBlurred: boolean; - readonly isCollapsed: boolean; - readonly isExpanded: boolean; - readonly isFocused: boolean; - readonly isForward: boolean; - - static create(properties?: ValueProperties | Value): Value; - static fromJSON(properties: ValueJSON): Value; - static isValue(maybeValue: any): maybeValue is Value; - - change(): Change; - toJSON(): ValueJSON; - } - - interface DocumentProperties { - nodes?: Immutable.List | Node[]; - key?: string; - data?: Immutable.Map | { [key: string]: any }; - } - - interface DocumentJSON { - nodes?: NodeJSON[]; - key?: string; - data?: { [key: string]: any }; - object?: 'document'; - } - - class Document extends BaseNode< - DataMap - > { - object: 'document'; - nodes: Immutable.List; - - static create( - properties: DocumentProperties | Document | Immutable.List | Node[] - ): Document; - static fromJSON(properties: DocumentProperties | Document): Document; - static isDocument(maybeDocument: any): maybeDocument is Document; - - toJSON(): DocumentJSON; - } - - interface BlockProperties { - type: string; - key?: string; - nodes?: Immutable.List; - isVoid?: boolean; - data?: Immutable.Map | { [key: string]: any }; - } - - interface BlockJSON { - type: string; - key?: string; - nodes?: NodeJSON[]; - isVoid?: boolean; - data?: { [key: string]: any }; - object: 'block'; - } - - class Block extends BaseNode { - isVoid: boolean; - object: 'block'; - nodes: Immutable.List; - - static create(properties: BlockProperties | Block | string): Block; - static createList( - array: (BlockProperties[] | Block[] | string[]) - ): Immutable.List; - static fromJSON(properties: BlockProperties | Block): Block; - static isBlock(maybeBlock: any): maybeBlock is Block; - - toJSON(): BlockJSON; - } - - interface InlineProperties { - type: string; - key?: string; - nodes?: Immutable.List; - isVoid?: boolean; - data?: Immutable.Map | { [key: string]: any }; - } - - interface InlineJSON { - type: string; - key?: string; - nodes?: NodeJSON[]; - isVoid?: boolean; - data?: { [key: string]: any }; - object: 'inline'; - } - - class Inline extends BaseNode { - isVoid: boolean; - object: 'inline'; - nodes: Immutable.List; - - static create(properties: InlineProperties | Inline | string): Inline; - static createList( - array: (InlineProperties[] | Inline[] | string[]) - ): Immutable.List; - static fromJSON(properties: InlineProperties | Inline): Inline; - static isInline(maybeInline: any): maybeInline is Inline; - - toJSON(): InlineJSON; - } - - interface Leaf { - marks?: Mark[]; - text: string; - } - - interface TextProperties { - key?: string; - characters: Immutable.List; - } - - interface TextJSON { - key?: string; - characters?: Character[]; - leaves: Leaf[]; - object: 'text'; - } - - class Text extends Immutable.Record({}) { - object: 'text'; - characters: Immutable.List; - key: string; - text: string; - - static create(properties: TextProperties | Text | string): Text; - static fromJSON(properties: TextProperties | Text): Text; - static isText(maybeText: any): maybeText is Text; - - toJSON(): TextJSON; - } - - type Node = Document | Block | Inline | Text; - type NodeJSON = DocumentJSON | BlockJSON | InlineJSON | TextJSON; - - class BaseNode extends Immutable.Record( - {} - ) { - data: Immutable.Map; - type: string; - key: string; - object: 'document' | 'block' | 'inline' | 'text'; - nodes: Immutable.List; - readonly text: string; - - filterDescendants(iterator: (node: Node) => boolean): Immutable.List; - findDescendants(iterator: (node: Node) => boolean): Node | null; - getBlocksAtRange(range: Range): Immutable.List; - getBlocks(): Immutable.List; - getCharactersAtRange(range: Range): Immutable.List; - getChild(key: string | Node): Node | null; - getClosestBlock(key: string | Node): Block | null; - getClosestInline(key: string | Node): Inline | null; - getClosest(key: string | Node, match: (node: Node) => boolean): Node | null; - getDepth(key: string | Node): number; - getDescendant(key: string | Node): Node | null; - getFirstText(): Text | null; - getFragmentAtRange(range: Range): Document; - getFurthest(key: string, iterator: (node: Node) => boolean): Node | null; - getFurthestAncestor(key: string): Node | null; - getFurthestBlock(key: string): Block | null; - getFurthestInline(key: string): Inline | null; - getFurthestOnlyChildAncestor(key: string): Node | null; - getInlinesAtRange(range: Range): Immutable.List; - getLastText(): Text | null; - getMarksAtRange(range: Range): Immutable.Set; - getNextBlock(key: string | Node): Block | null; - getNextSibling(key: string | Node): Node | null; - getNextText(key: string | Node): Text | null; - getParent(key: string | Node): Node | null; - getPreviousBlock(key: string | Node): Block | null; - getPreviousSibling(key: string | Node): Node | null; - getPreviousText(key: string | Node): Text | null; - getTexts(): Immutable.List; - getTextsAsArray(): Text[]; - getTextAtOffset(offset: number): Text | null; - getTextsAtRange(range: Range): Immutable.List; - getTextsAtRangeAsArray(range: Range): Text[]; - hasChild(key: string | Node): boolean; - } - - interface CharacterProperties { - marks?: Immutable.Set | Mark[]; - text: string; - } - - class Character extends Immutable.Record({}) { - object: 'character'; - marks: Immutable.Set; - text: string; - - static create( - properties: CharacterProperties | Character | string - ): Character; - static createList( - array: (CharacterProperties[] | Character[] | string[]) - ): Immutable.List; - static fromJSON(properties: CharacterProperties | Character): Character; - static isCharacter(maybeCharacter: any): maybeCharacter is Character; - - toJSON(): CharacterProperties; - } - - interface MarkProperties { - type: string; - data?: Immutable.Map | { [key: string]: any }; - } - - interface MarkJSON { - type: string; - data?: { [key: string]: any }; - } - - class Mark extends Immutable.Record({}) { - object: 'mark'; - type: string; - data: Immutable.Map; - - static create(properties: MarkProperties | Mark | string): Mark; - static createSet( - array: (MarkProperties[] | Mark[] | string[]) - ): Immutable.Set; - static fromJSON(properties: MarkJSON | Mark): Mark; - static isMark(maybeMark: any): maybeMark is Mark; - - toJSON(): MarkProperties; - } - - class Change extends Immutable.Record({}) { - object: 'change'; - value: Value; - operations: Immutable.List; - - call(customChange: (change: Change, ...args: any[]) => Change): Change; - - applyOperations(operations: Operation[]): Change; - applyOperation(operation: Operation): Change; - - // Full Value Change - setValue(properties: Value | ValueProperties): Change; - - // Current Value Changes - deleteBackward(n: number): Change; - deleteForward(n: number): Change; - delete(): Change; - insertBlock(block: Block | BlockProperties | string): Change; - insertFragment(fragment: Document): Change; - insertInline(inline: Inline | InlineProperties): Change; - insertText(text: string): Change; - addMark(mark: Mark | MarkProperties | string): Change; - setBlocks(properties: BlockProperties | string): Change; - setInlines(properties: InlineProperties | string): Change; - splitBlock(depth: number): Change; - splitInline(depth: number): Change; - removeMark(mark: Mark | MarkProperties | string): Change; - toggleMark(mark: Mark | MarkProperties | string): Change; - unwrapBlock(properties: BlockProperties | string): Change; - unwrapInline(properties: InlineProperties | string): Change; - wrapBlock(properties: BlockProperties | string): Change; - wrapInline(properties: InlineProperties | string): Change; - wrapText(prefix: string, suffix?: string): Change; - - // Selection Changes - blur(): Change; - collapseToAnchor(): Change; - collapseToFocus(): Change; - collapseToStart(): Change; - collapseToEnd(): Change; - collapseToStartOf(node: Node): Change; - collapseToEndOf(node: Node): Change; - collapseToStartOfNextBlock(): Change; - collapseToEndOfNextBlock(): Change; - collapseToStartOfPreviousBlock(): Change; - collapseToEndOfPreviousBlock(): Change; - collapseToStartOfNextText(): Change; - collapseToEndOfNextText(): Change; - collapseToStartOfPreviousText(): Change; - collapseToEndOfPreviousText(): Change; - extend(n: number): Change; - extendToStartOf(node: Node): Change; - extendToEndOf(node: Node): Change; - flip(): Change; - focus(): Change; - move(n: number): Change; - moveStart(n: number): Change; - moveEnd(n: number): Change; - moveOffsetsTo(anchorOffset: number, focusOffset: number): Change; - moveToRangeOf(node: Node): Change; - select(properties: Range | RangeProperties): Change; - selectAll(): Change; - deselect(): Change; - - // Document Changes - deleteBackwardAtRange(range: Range, n: number): Change; - deleteForwardAtRange(range: Range, n: number): Change; - deleteAtRange(range: Range): Change; - insertBlockAtRange( - range: Range, - block: Block | BlockProperties | string - ): Change; - insertFragmentAtRange(range: Range, fragment: Document): Change; - insertInlineAtRange( - range: Range, - inline: Inline | InlineProperties - ): Change; - insertTextAtRange(range: Range, text: string): Change; - addMarkAtRange(range: Range, mark: Mark | MarkProperties | string): Change; - setBlocksAtRange(range: Range, properties: BlockProperties | string): Change; - setInlinesAtRange( - range: Range, - properties: InlineProperties | string - ): Change; - splitBlockAtRange(range: Range, depth: number): Change; - splitInlineAtRange(range: Range, depth: number): Change; - removeMarkAtRange( - range: Range, - mark: Mark | MarkProperties | string - ): Change; - toggleMarkAtRange( - range: Range, - mark: Mark | MarkProperties | string - ): Change; - unwrapBlockAtRange( - range: Range, - properties: BlockProperties | string - ): Change; - unwrapInlineAtRange( - range: Range, - properties: InlineProperties | string - ): Change; - wrapBlockAtRange( - range: Range, - properties: BlockProperties | string - ): Change; - wrapInlineAtRange( - range: Range, - properties: InlineProperties | string - ): Change; - wrapTextAtRange(range: Range, prefix: string, suffix?: string): Change; - - // Node Changes - addMarkByKey( - key: string, - offset: number, - length: number, - mark: Mark - ): Change; - insertNodeByKey(key: string, index: number, node: Node): Change; - insertFragmentByKey(key: string, index: number, fragment: Document): Change; - insertTextByKey( - key: string, - offset: number, - text: string, - marks?: Immutable.Set | Mark[] - ): Change; - moveNodeByKey(key: string, newKey: string, newIndex: number): Change; - removeMarkByKey( - key: string, - offset: number, - length: number, - mark: Mark - ): Change; - removeNodeByKey(key: string): Change; - replaceNodeByKey(key: string, node: Node): Change; - removeTextByKey(key: string, offset: number, length: number): Change; - setMarkByKey( - key: string, - offset: number, - length: number, - mark: Mark, - properties: MarkProperties - ): Change; - setNodeByKey( - key: string, - properties: BlockProperties | InlineProperties | string - ): Change; - splitNodeByKey(key: string, offset: number): Change; - unwrapInlineByKey( - key: string, - properties: InlineProperties | string - ): Change; - unwrapBlockByKey(key: string, properties: BlockProperties | string): Change; - unwrapNodeByKey(key: string): Change; - wrapInlineByKey(key: string, properties: InlineProperties | string): Change; - wrapBlockByKey(key: string, properties: BlockProperties | string): Change; - - // History Changes - redo(): Change; - undo(): Change; - } - - interface RangeProperties { - anchorKey?: string | null; - anchorOffset?: number; - focusKey?: string | null; - focusOffset?: number; - isFocused?: boolean; - isBackward?: boolean | null; - marks?: Immutable.Set | null; - } - - interface RangeJSON { - anchorKey?: string | null; - anchorOffset?: number; - focusKey?: string | null; - focusOffset?: number; - isFocused?: boolean; - isBackward?: boolean | null; - marks?: MarkJSON[] | null; - } - - class Range extends Immutable.Record({}) { - object: 'range'; - anchorKey: string | null; - anchorOffset: number; - focusKey: string | null; - focusOffset: number; - isFocused: boolean; - isBackward: boolean | null; - marks: Immutable.Set | null; - - readonly isBlurred: boolean; - readonly isCollapsed: boolean; - readonly isExpanded: boolean; - readonly isForward: boolean; - readonly startKey: string; - readonly startOffset: number; - readonly endKey: string; - readonly endOffset: number; - - static create(properties: RangeProperties | Range): Range; - static fromJSON(properties: RangeJSON): Range; - static isRange(maybeRange: any): maybeRange is Range; - - toJSON(): RangeProperties; - - hasAnchorAtStartOf(node: Node): boolean; - hasFocusAtStartOf(node: Node): boolean; - hasStartAtStartOf(node: Node): boolean; - hasEndAtStartOf(node: Node): boolean; - hasEdgeAtStartOf(node: Node): boolean; - - hasAnchorAtEndOf(node: Node): boolean; - hasFocusAtEndOf(node: Node): boolean; - hasStartAtEndOf(node: Node): boolean; - hasEndAtEndOf(node: Node): boolean; - hasEdgeAtEndOf(node: Node): boolean; - - hasAnchorBetween(node: Node, start: number, end: number): boolean; - hasFocusBetween(node: Node, start: number, end: number): boolean; - hasStartBetween(node: Node, start: number, end: number): boolean; - hasEndBetween(node: Node, start: number, end: number): boolean; - hasEdgeBetween(node: Node, start: number, end: number): boolean; - - hasAnchorIn(node: Node): boolean; - hasFocusIn(node: Node): boolean; - hasStartIn(node: Node): boolean; - hasEndIn(node: Node): boolean; - hasEdgeIn(node: Node): boolean; - - isAtStartOf(node: Node): boolean; - isAtEndOf(node: Node): boolean; - } - - type Operation = - | InsertTextOperation - | RemoveTextOperation - | AddMarkOperation - | RemoveMarkOperation - | SetMarkOperation - | InsertNodeOperation - | MergeNodeOperation - | MoveNodeOperation - | RemoveNodeOperation - | SetNodeOperation - | SplitNodeOperation - | SetSelectionOperation - | SetValueOperation; - - interface InsertTextOperation { - type: 'insert_text'; - path: number[]; - offset: number; - text: string; - marks: Mark[]; - } - - interface RemoveTextOperation { - type: 'remove_text'; - path: number[]; - offset: number; - text: string; - } - - interface AddMarkOperation { - type: 'add_mark'; - path: number[]; - offset: number; - length: number; - mark: Mark; - } - - interface RemoveMarkOperation { - type: 'remove_mark'; - path: number[]; - offset: number; - length: number; - mark: Mark; - } - - interface SetMarkOperation { - type: 'set_mark'; - path: number[]; - offset: number; - length: number; - mark: Mark; - properties: MarkProperties; - } - - interface InsertNodeOperation { - type: 'insert_node'; - path: number[]; - node: Node; - } - - interface MergeNodeOperation { - type: 'merge_node'; - path: number[]; - position: number; - } - - interface MoveNodeOperation { - type: 'move_node'; - path: number[]; - newPath: number[]; - } - - interface RemoveNodeOperation { - type: 'remove_node'; - path: number[]; - node: Node; - } - - interface SetNodeOperation { - type: 'set_node'; - path: number[]; - properties: BlockProperties | InlineProperties | TextProperties; - } - - interface SplitNodeOperation { - type: 'split_node'; - path: number[]; - position: number; - target: number; - } - - interface SetSelectionOperation { - type: 'set_selection'; - properties: RangeProperties; - selection: Range; - } - - interface SetValueOperation { - type: 'set_value'; - properties: ValueProperties; - value: Value; - } - - const Operations: { - apply: (value: Value, operation: Operation) => Value; - invert: (operation: Operation) => Operation; - }; - - class Stack extends Immutable.Record({}) { - plugins: any[]; - } - - function setKeyGenerator(func: () => string): null; - function resetKeyGenerator(): null; + min?: number; + max?: number; + }>; + normalize?: ( + change: Change, + reason: InvalidReason, + context: { [key: string]: any } + ) => void; + parent?: KindsAndTypes; + text?: RegExp; } + +export interface SchemaProperties { + document?: Rules; + blocks?: RulesByNodeType; + inlines?: RulesByNodeType; +} + +export class Schema extends Immutable.Record({}) { + document: Rules; + blocks: RulesByNodeType; + inlines: RulesByNodeType; + + static create(properties: SchemaProperties | Schema): Schema; + static fromJSON(object: SchemaProperties): Schema; + static isSchema(maybeSchema: any): maybeSchema is Schema; + + toJSON(): SchemaProperties; +} + +export interface ValueProperties { + document?: Document; + selection?: Range; + history?: History; + schema?: Schema; + data?: Data; + decorations?: Immutable.List | null; +} + +export interface ValueJSON { + document?: DocumentJSON; + selection?: Range; + history?: History; + schema?: Schema; + data?: Data; + decorations?: Immutable.List | null; + object?: 'value'; +} + +export class Value extends Immutable.Record({}) { + document: Document; + selection: Range; + history: History; + schema: Schema; + data: Data; + object: 'value'; + decorations: Immutable.List | null; + + readonly anchorText: Text; + readonly focusText: Text; + readonly startText: Text; + readonly endText: Text; + + readonly anchorBlock: Block; + readonly focusBlock: Block; + readonly startBlock: Block; + readonly endBlock: Block; + + readonly marks: Immutable.Set; + readonly activeMarks: Immutable.Set; + readonly blocks: Immutable.List; + readonly fragment: Document; + readonly inlines: Immutable.List; + readonly text: Immutable.List; + readonly characters: Immutable.List; + readonly hasUndos: boolean; + readonly hasRedos: boolean; + + readonly anchorKey: string; + readonly focusKey: string; + readonly startKey: string; + readonly endKey: string; + readonly anchorOffset: number; + readonly focusOffset: number; + readonly startOffset: number; + readonly endOffset: number; + readonly isBackward: boolean; + readonly isBlurred: boolean; + readonly isCollapsed: boolean; + readonly isExpanded: boolean; + readonly isFocused: boolean; + readonly isForward: boolean; + + static create(properties?: ValueProperties | Value): Value; + static fromJSON(properties: ValueJSON): Value; + static isValue(maybeValue: any): maybeValue is Value; + + change(): Change; + toJSON(): ValueJSON; +} + +export interface DocumentProperties { + nodes?: Immutable.List | Node[]; + key?: string; + data?: Immutable.Map | { [key: string]: any }; +} + +export interface DocumentJSON { + nodes?: NodeJSON[]; + key?: string; + data?: { [key: string]: any }; + object?: 'document'; +} + +export class Document extends BaseNode< + DataMap +> { + object: 'document'; + nodes: Immutable.List; + + static create( + properties: DocumentProperties | Document | Immutable.List | Node[] + ): Document; + static fromJSON(properties: DocumentProperties | Document): Document; + static isDocument(maybeDocument: any): maybeDocument is Document; + + toJSON(): DocumentJSON; +} + +export interface BlockProperties { + type: string; + key?: string; + nodes?: Immutable.List; + isVoid?: boolean; + data?: Immutable.Map | { [key: string]: any }; +} + +export interface BlockJSON { + type: string; + key?: string; + nodes?: NodeJSON[]; + isVoid?: boolean; + data?: { [key: string]: any }; + object: 'block'; +} + +export class Block extends BaseNode { + isVoid: boolean; + object: 'block'; + nodes: Immutable.List; + + static create(properties: BlockProperties | Block | string): Block; + static createList( + array: (BlockProperties[] | Block[] | string[]) + ): Immutable.List; + static fromJSON(properties: BlockProperties | Block): Block; + static isBlock(maybeBlock: any): maybeBlock is Block; + + toJSON(): BlockJSON; +} + +export interface InlineProperties { + type: string; + key?: string; + nodes?: Immutable.List; + isVoid?: boolean; + data?: Immutable.Map | { [key: string]: any }; +} + +export interface InlineJSON { + type: string; + key?: string; + nodes?: NodeJSON[]; + isVoid?: boolean; + data?: { [key: string]: any }; + object: 'inline'; +} + +export class Inline extends BaseNode { + isVoid: boolean; + object: 'inline'; + nodes: Immutable.List; + + static create(properties: InlineProperties | Inline | string): Inline; + static createList( + array: (InlineProperties[] | Inline[] | string[]) + ): Immutable.List; + static fromJSON(properties: InlineProperties | Inline): Inline; + static isInline(maybeInline: any): maybeInline is Inline; + + toJSON(): InlineJSON; +} + +export interface Leaf { + marks?: Mark[]; + text: string; +} + +export interface TextProperties { + key?: string; + characters: Immutable.List; +} + +export interface TextJSON { + key?: string; + characters?: Character[]; + leaves: Leaf[]; + object: 'text'; +} + +export class Text extends Immutable.Record({}) { + object: 'text'; + characters: Immutable.List; + key: string; + text: string; + + static create(properties: TextProperties | Text | string): Text; + static fromJSON(properties: TextProperties | Text): Text; + static isText(maybeText: any): maybeText is Text; + + toJSON(): TextJSON; +} + +export type Node = Document | Block | Inline | Text; +export type NodeJSON = DocumentJSON | BlockJSON | InlineJSON | TextJSON; + +// tslint:disable-next-line strict-export-declare-modifiers +declare class BaseNode extends Immutable.Record( + {} +) { + data: Immutable.Map; + type: string; + key: string; + object: 'document' | 'block' | 'inline' | 'text'; + nodes: Immutable.List; + readonly text: string; + + filterDescendants(iterator: (node: Node) => boolean): Immutable.List; + findDescendants(iterator: (node: Node) => boolean): Node | null; + getBlocksAtRange(range: Range): Immutable.List; + getBlocks(): Immutable.List; + getCharactersAtRange(range: Range): Immutable.List; + getChild(key: string | Node): Node | null; + getClosestBlock(key: string | Node): Block | null; + getClosestInline(key: string | Node): Inline | null; + getClosest(key: string | Node, match: (node: Node) => boolean): Node | null; + getDepth(key: string | Node): number; + getDescendant(key: string | Node): Node | null; + getFirstText(): Text | null; + getFragmentAtRange(range: Range): Document; + getFurthest(key: string, iterator: (node: Node) => boolean): Node | null; + getFurthestAncestor(key: string): Node | null; + getFurthestBlock(key: string): Block | null; + getFurthestInline(key: string): Inline | null; + getFurthestOnlyChildAncestor(key: string): Node | null; + getInlinesAtRange(range: Range): Immutable.List; + getLastText(): Text | null; + getMarksAtRange(range: Range): Immutable.Set; + getNextBlock(key: string | Node): Block | null; + getNextSibling(key: string | Node): Node | null; + getNextText(key: string | Node): Text | null; + getParent(key: string | Node): Node | null; + getPreviousBlock(key: string | Node): Block | null; + getPreviousSibling(key: string | Node): Node | null; + getPreviousText(key: string | Node): Text | null; + getTexts(): Immutable.List; + getTextsAsArray(): Text[]; + getTextAtOffset(offset: number): Text | null; + getTextsAtRange(range: Range): Immutable.List; + getTextsAtRangeAsArray(range: Range): Text[]; + hasChild(key: string | Node): boolean; +} + +export interface CharacterProperties { + marks?: Immutable.Set | Mark[]; + text: string; +} + +export class Character extends Immutable.Record({}) { + object: 'character'; + marks: Immutable.Set; + text: string; + + static create( + properties: CharacterProperties | Character | string + ): Character; + static createList( + array: (CharacterProperties[] | Character[] | string[]) + ): Immutable.List; + static fromJSON(properties: CharacterProperties | Character): Character; + static isCharacter(maybeCharacter: any): maybeCharacter is Character; + + toJSON(): CharacterProperties; +} + +export interface MarkProperties { + type: string; + data?: Immutable.Map | { [key: string]: any }; +} + +export interface MarkJSON { + type: string; + data?: { [key: string]: any }; +} + +export class Mark extends Immutable.Record({}) { + object: 'mark'; + type: string; + data: Immutable.Map; + + static create(properties: MarkProperties | Mark | string): Mark; + static createSet( + array: (MarkProperties[] | Mark[] | string[]) + ): Immutable.Set; + static fromJSON(properties: MarkJSON | Mark): Mark; + static isMark(maybeMark: any): maybeMark is Mark; + + toJSON(): MarkProperties; +} + +export class Change extends Immutable.Record({}) { + object: 'change'; + value: Value; + operations: Immutable.List; + + call(customChange: (change: Change, ...args: any[]) => Change): Change; + + applyOperations(operations: Operation[]): Change; + applyOperation(operation: Operation): Change; + + // Full Value Change + setValue(properties: Value | ValueProperties): Change; + + // Current Value Changes + deleteBackward(n: number): Change; + deleteForward(n: number): Change; + delete(): Change; + insertBlock(block: Block | BlockProperties | string): Change; + insertFragment(fragment: Document): Change; + insertInline(inline: Inline | InlineProperties): Change; + insertText(text: string): Change; + addMark(mark: Mark | MarkProperties | string): Change; + setBlocks(properties: BlockProperties | string): Change; + setInlines(properties: InlineProperties | string): Change; + splitBlock(depth: number): Change; + splitInline(depth: number): Change; + removeMark(mark: Mark | MarkProperties | string): Change; + toggleMark(mark: Mark | MarkProperties | string): Change; + unwrapBlock(properties: BlockProperties | string): Change; + unwrapInline(properties: InlineProperties | string): Change; + wrapBlock(properties: BlockProperties | string): Change; + wrapInline(properties: InlineProperties | string): Change; + wrapText(prefix: string, suffix?: string): Change; + + // Selection Changes + blur(): Change; + collapseToAnchor(): Change; + collapseToFocus(): Change; + collapseToStart(): Change; + collapseToEnd(): Change; + collapseToStartOf(node: Node): Change; + collapseToEndOf(node: Node): Change; + collapseToStartOfNextBlock(): Change; + collapseToEndOfNextBlock(): Change; + collapseToStartOfPreviousBlock(): Change; + collapseToEndOfPreviousBlock(): Change; + collapseToStartOfNextText(): Change; + collapseToEndOfNextText(): Change; + collapseToStartOfPreviousText(): Change; + collapseToEndOfPreviousText(): Change; + extend(n: number): Change; + extendToStartOf(node: Node): Change; + extendToEndOf(node: Node): Change; + flip(): Change; + focus(): Change; + move(n: number): Change; + moveStart(n: number): Change; + moveEnd(n: number): Change; + moveOffsetsTo(anchorOffset: number, focusOffset: number): Change; + moveToRangeOf(node: Node): Change; + select(properties: Range | RangeProperties): Change; + selectAll(): Change; + deselect(): Change; + + // Document Changes + deleteBackwardAtRange(range: Range, n: number): Change; + deleteForwardAtRange(range: Range, n: number): Change; + deleteAtRange(range: Range): Change; + insertBlockAtRange( + range: Range, + block: Block | BlockProperties | string + ): Change; + insertFragmentAtRange(range: Range, fragment: Document): Change; + insertInlineAtRange( + range: Range, + inline: Inline | InlineProperties + ): Change; + insertTextAtRange(range: Range, text: string): Change; + addMarkAtRange(range: Range, mark: Mark | MarkProperties | string): Change; + setBlocksAtRange(range: Range, properties: BlockProperties | string): Change; + setInlinesAtRange( + range: Range, + properties: InlineProperties | string + ): Change; + splitBlockAtRange(range: Range, depth: number): Change; + splitInlineAtRange(range: Range, depth: number): Change; + removeMarkAtRange( + range: Range, + mark: Mark | MarkProperties | string + ): Change; + toggleMarkAtRange( + range: Range, + mark: Mark | MarkProperties | string + ): Change; + unwrapBlockAtRange( + range: Range, + properties: BlockProperties | string + ): Change; + unwrapInlineAtRange( + range: Range, + properties: InlineProperties | string + ): Change; + wrapBlockAtRange( + range: Range, + properties: BlockProperties | string + ): Change; + wrapInlineAtRange( + range: Range, + properties: InlineProperties | string + ): Change; + wrapTextAtRange(range: Range, prefix: string, suffix?: string): Change; + + // Node Changes + addMarkByKey( + key: string, + offset: number, + length: number, + mark: Mark + ): Change; + insertNodeByKey(key: string, index: number, node: Node): Change; + insertFragmentByKey(key: string, index: number, fragment: Document): Change; + insertTextByKey( + key: string, + offset: number, + text: string, + marks?: Immutable.Set | Mark[] + ): Change; + moveNodeByKey(key: string, newKey: string, newIndex: number): Change; + removeMarkByKey( + key: string, + offset: number, + length: number, + mark: Mark + ): Change; + removeNodeByKey(key: string): Change; + replaceNodeByKey(key: string, node: Node): Change; + removeTextByKey(key: string, offset: number, length: number): Change; + setMarkByKey( + key: string, + offset: number, + length: number, + mark: Mark, + properties: MarkProperties + ): Change; + setNodeByKey( + key: string, + properties: BlockProperties | InlineProperties | string + ): Change; + splitNodeByKey(key: string, offset: number): Change; + unwrapInlineByKey( + key: string, + properties: InlineProperties | string + ): Change; + unwrapBlockByKey(key: string, properties: BlockProperties | string): Change; + unwrapNodeByKey(key: string): Change; + wrapInlineByKey(key: string, properties: InlineProperties | string): Change; + wrapBlockByKey(key: string, properties: BlockProperties | string): Change; + + // History Changes + redo(): Change; + undo(): Change; +} + +export interface RangeProperties { + anchorKey?: string | null; + anchorOffset?: number; + focusKey?: string | null; + focusOffset?: number; + isFocused?: boolean; + isBackward?: boolean | null; + marks?: Immutable.Set | null; +} + +export interface RangeJSON { + anchorKey?: string | null; + anchorOffset?: number; + focusKey?: string | null; + focusOffset?: number; + isFocused?: boolean; + isBackward?: boolean | null; + marks?: MarkJSON[] | null; +} + +export class Range extends Immutable.Record({}) { + object: 'range'; + anchorKey: string | null; + anchorOffset: number; + focusKey: string | null; + focusOffset: number; + isFocused: boolean; + isBackward: boolean | null; + marks: Immutable.Set | null; + + readonly isBlurred: boolean; + readonly isCollapsed: boolean; + readonly isExpanded: boolean; + readonly isForward: boolean; + readonly startKey: string; + readonly startOffset: number; + readonly endKey: string; + readonly endOffset: number; + + static create(properties: RangeProperties | Range): Range; + static fromJSON(properties: RangeJSON): Range; + static isRange(maybeRange: any): maybeRange is Range; + + toJSON(): RangeProperties; + + hasAnchorAtStartOf(node: Node): boolean; + hasFocusAtStartOf(node: Node): boolean; + hasStartAtStartOf(node: Node): boolean; + hasEndAtStartOf(node: Node): boolean; + hasEdgeAtStartOf(node: Node): boolean; + + hasAnchorAtEndOf(node: Node): boolean; + hasFocusAtEndOf(node: Node): boolean; + hasStartAtEndOf(node: Node): boolean; + hasEndAtEndOf(node: Node): boolean; + hasEdgeAtEndOf(node: Node): boolean; + + hasAnchorBetween(node: Node, start: number, end: number): boolean; + hasFocusBetween(node: Node, start: number, end: number): boolean; + hasStartBetween(node: Node, start: number, end: number): boolean; + hasEndBetween(node: Node, start: number, end: number): boolean; + hasEdgeBetween(node: Node, start: number, end: number): boolean; + + hasAnchorIn(node: Node): boolean; + hasFocusIn(node: Node): boolean; + hasStartIn(node: Node): boolean; + hasEndIn(node: Node): boolean; + hasEdgeIn(node: Node): boolean; + + isAtStartOf(node: Node): boolean; + isAtEndOf(node: Node): boolean; +} + +export type Operation = + | InsertTextOperation + | RemoveTextOperation + | AddMarkOperation + | RemoveMarkOperation + | SetMarkOperation + | InsertNodeOperation + | MergeNodeOperation + | MoveNodeOperation + | RemoveNodeOperation + | SetNodeOperation + | SplitNodeOperation + | SetSelectionOperation + | SetValueOperation; + +export interface InsertTextOperation { + type: 'insert_text'; + path: number[]; + offset: number; + text: string; + marks: Mark[]; +} + +export interface RemoveTextOperation { + type: 'remove_text'; + path: number[]; + offset: number; + text: string; +} + +export interface AddMarkOperation { + type: 'add_mark'; + path: number[]; + offset: number; + length: number; + mark: Mark; +} + +export interface RemoveMarkOperation { + type: 'remove_mark'; + path: number[]; + offset: number; + length: number; + mark: Mark; +} + +export interface SetMarkOperation { + type: 'set_mark'; + path: number[]; + offset: number; + length: number; + mark: Mark; + properties: MarkProperties; +} + +export interface InsertNodeOperation { + type: 'insert_node'; + path: number[]; + node: Node; +} + +export interface MergeNodeOperation { + type: 'merge_node'; + path: number[]; + position: number; +} + +export interface MoveNodeOperation { + type: 'move_node'; + path: number[]; + newPath: number[]; +} + +export interface RemoveNodeOperation { + type: 'remove_node'; + path: number[]; + node: Node; +} + +export interface SetNodeOperation { + type: 'set_node'; + path: number[]; + properties: BlockProperties | InlineProperties | TextProperties; +} + +export interface SplitNodeOperation { + type: 'split_node'; + path: number[]; + position: number; + target: number; +} + +export interface SetSelectionOperation { + type: 'set_selection'; + properties: RangeProperties; + selection: Range; +} + +export interface SetValueOperation { + type: 'set_value'; + properties: ValueProperties; + value: Value; +} + +export const Operations: { + apply: (value: Value, operation: Operation) => Value; + invert: (operation: Operation) => Operation; +}; + +export class Stack extends Immutable.Record({}) { + plugins: any[]; +} + +export function setKeyGenerator(func: () => string): null; +export function resetKeyGenerator(): null; + +export {}; diff --git a/types/slate/slate-tests.ts b/types/slate/slate-tests.ts index 45aca77e7e..2c07a4571b 100644 --- a/types/slate/slate-tests.ts +++ b/types/slate/slate-tests.ts @@ -1,6 +1,6 @@ -import { Slate } from "slate"; +import { Value } from "slate"; -const value = Slate.Value.create(); +const value = Value.create(); value.change() .focus() .selectAll() From 5ba0287527b82b2d457c123fe92b2f735629cd14 Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Sat, 21 Jul 2018 08:39:32 +0800 Subject: [PATCH 128/738] update weixin-app's Component interface (#27333) --- types/weixin-app/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/weixin-app/index.d.ts b/types/weixin-app/index.d.ts index 612f0c62b0..03dfb8fc8f 100644 --- a/types/weixin-app/index.d.ts +++ b/types/weixin-app/index.d.ts @@ -3213,7 +3213,7 @@ interface Component { * 检查组件是否具有 behavior * 检查时会递归检查被直接或间接引入的所有behavior */ - hasBehavior(behavior: any): void; + hasBehavior(behavior: any): boolean; /** * 触发事件,参见 [组件事件](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/custom-component/events.html) */ @@ -3226,20 +3226,20 @@ interface Component { * 创建一个 SelectorQuery 对象 * 选择器选取范围为这个[组件实例](https://mp.weixin.qq.com/debug/wxadoc/dev/api/wxml-nodes-info.html)内 */ - createSelectorQuery(query: string): void; + createSelectorQuery(): wx.SelectorQuery; /** * 使用选择器选择组件实例节点 * 返回匹配到的第一个组件实例对象 */ - selectComponent(selector: string): void; + selectComponent(selector: string): Component; /** * selector 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组 */ - selectAllComponents(selector: string): void; + selectAllComponents(selector: string): Array>; /** * 获取所有这个关系对应的所有关联节点,参见 [组件间关系](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/custom-component/relations.html) */ - getRelationNodes(relationKey: string): void; + getRelationNodes(relationKey: string): { [key: string]: ComponentRelation }; } declare function Component(options?: ThisTypedComponentOptionsWithRecordProps, D, M, O, P>): ExtendedComponent, D, M, O, P>; /** From 421d259b3177cead00f22c5be87f5d7feb31162c Mon Sep 17 00:00:00 2001 From: Josh Cunningham Date: Fri, 20 Jul 2018 17:40:38 -0700 Subject: [PATCH 129/738] Allow type for Express.Request.user (#27339) --- types/passport/index.d.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/types/passport/index.d.ts b/types/passport/index.d.ts index 0be63d337e..fe0c26c775 100644 --- a/types/passport/index.d.ts +++ b/types/passport/index.d.ts @@ -12,7 +12,7 @@ declare global { namespace Express { interface Request { authInfo?: any; - user?: User; + user?: any; // These declarations are merged into express's Request type login(user: any, done: (err: any) => void): void; @@ -26,9 +26,6 @@ declare global { isAuthenticated(): boolean; isUnauthenticated(): boolean; } - interface User { - [_: string]: any; - } } } From 778aaa7f32b04ed3433762c26594aa4b464a3993 Mon Sep 17 00:00:00 2001 From: Jeff Willette Date: Sat, 21 Jul 2018 09:40:52 +0900 Subject: [PATCH 130/738] Added _debug to Instance interface (#27297) * Added _debug to Instance interface * removed trailing whitespace --- types/simple-peer/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/simple-peer/index.d.ts b/types/simple-peer/index.d.ts index 6e41100b41..d8ee612827 100644 --- a/types/simple-peer/index.d.ts +++ b/types/simple-peer/index.d.ts @@ -61,6 +61,9 @@ declare namespace SimplePeer { // methods which are not documented readonly bufferSize: number; address(): { port: string, family: string, address: string, }; + + // used for debug logging + _debug(message?: any, ...optionalParams: any[]): void; } } From ce73aaf4abf886859ce2c8be810b96565221d2c3 Mon Sep 17 00:00:00 2001 From: rfried Date: Fri, 20 Jul 2018 19:42:07 -0500 Subject: [PATCH 131/738] paper 11.5 comprehensive update (#27356) * Updating Matrix class to match 11.5 documentation and implementation. * Updating Point class to reflect 11.5 documentation and implementation. * Updating Rectangle class to reflect 11.5 documentation and implementation. * Updating Size class to reflect 11.5 documentation and implementation. * Updating PaperScope class to reflect 11.5 documentation and implementation. * Update Item class to better reflect 11.5 documentation and implementation. * Fixing up optional object property syntax in a couple places (',' should have been ';') * Updating Shaep class to better reflect 11.5 documentation and implementation. * Updating Raster class to better reflect 11.5 documentation and implementation. * Updating PathItem class to better reflect 11.5 documentation and implementation. Removed methods from Path that were inherited from PathItem. * Updating Path class to better reflect 11.5 documentation and implementation. * Updating CompoundPath class to better reflect 11.5 documentation and implementation. * Updating Segment class to better reflect 11.5 documentation and implementation. * Updating Curve class to better reflect 11.5 documentation and implementation. * Updating CurveLocation class to better reflect 11.5 documentation and implementation. * Updating Project class to better reflect 11.5 documentation and implementation. * Updating Symbol to better reflect 11.5 documentation and implementation. * Updating Style class to better reflect 11.5 documentation and implementation. * Updating GradientStop class to better reflect 11.5 documentation. * Updating Color class to better reflect 11.5 documentation and implementation. * Updating View class to better reflect 11.5 documentation and implementation. * Updating the event classes to better reflect 11.5 documentation and implementation. * Updating TextItem to better reflect 11.5 documentation and implementation. * More accurate return type guidance for event handlers. Small fix to resolve lint error (object[] changed to any[]). * Added name to 'Definitions by' section in header. * Adding an IHitTestOptions interface to improve the intellisense on a 14-property object capable of being paritally defined. Now users can create an object which includes any number of the 14 properties and get some guidance on what each property does. It's syntactic sugar and I'll allow that it may just be unecessary. * More hittest tests * Adding project to the hittest tests * After some testing I like the IHitTestOptions approach much better. It provides CTRL+SPACE intellisense with descriptions. It also allows any previous code that sent an object with at least 1 property to pass the test. As such I've removed the object literal as it increases future maintainence. * Updating hittests to make sure the right returns are coming from the hittest functions * test documentation * Adding the Example 'Boolean Operations' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Candy Crash' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * From reviewing the example Sadie Likes To Draw and looking through the implementation... it looks like the property "fully selected" is actually available on the parent Item and not first available on Path as indicated in the documentation. * Adding the Example 'SatieLikedToDraw' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Chain' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Tadpoles' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Nyan Rainbow' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Fixing a namespacing issue resolving the Rectangle class in the Path.Rectangle and Path.Ellipse constructors * Adding the Example 'Rounded Rectangles' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * The gradient components of a Color are sometimes undefined. Also origin and destination were missing from the documentation and definition. They are accessible for gradient colors. * Adding the Example 'Radial Rainbows' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Item's appendTop and appendBottom methods were hiding in the documentation. They aren't listed in the main Item class, they're listed as inherited by all its children. * Adding the Example 'Meta Balls' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Voronoi' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Future Splash' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Smoothing' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Spiral Raster' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Division Raster' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding equals and clone methods to Segment class. * Adding the Example 'Q-bertify' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Path Intersections' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Path Simplification' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Example 'Hit Testing' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Adding the Gradient constructor that is missing from the documentation. * Adding the Example 'Bouncing Balls' rewritten as typescript to the tests. This hopefully mimics what a user might have done to adapt the examples and ensure that all the example interfaces are implemented correctly. * Reading through the code and examples shows that there are a few more options for constructing the GradientStop class than documented officially. * Accidentally inserted a redundant declaration * More options for the Gradient class constructor. * Adding type-specific clones to all children of Item. This allows for user code to better reflect the clone operation without having to cast things all the time. * new constructor, addition, and insertiong parameter options for Paths in order to enable more streamlined code which better matches examples from the code reference. Namely the ability to shorthand a point/segment as [x,y] arrays. Fixing a weird type warning by adding yet another on/off event overload. * Added all of the example code found as paperscript inside the API documentation. Piece of code had to be rewritten to conform to typing strictness and I did my best to match the feel and brevity of the code. As possible I translated these shorthand notations into further improvements into the type definition. This included things like Point/Segment array shorthand for Path creation. To some degree I just applied my opinion on what users might prefer while still being guided by a type system. There are probably further tweaks we can make in this vein but I found the changes sufficient to make the example code require little porting effort. * I just realized that I have two github accounts. Before I have too many commits to my name I wanted to merge accounts and as a result I need to update my profile link in the 'Definitions by' header. --- types/paper/index.d.ts | 2049 ++++- types/paper/paper-tests.ts | 15230 ++++++++++++++++++++++++++++++++++- 2 files changed, 16846 insertions(+), 433 deletions(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index e942fcec2e..ff75266725 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Clark Stevenson , // Jon Lucas , // Sebastian Lopez +// Ryan Friedman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped type NativeMouseEvent = MouseEvent; @@ -90,6 +91,18 @@ declare module paper { */ constructor(a: number, c: number, b: number, d: number, tx: number, ty: number); + /** + * Creates a 2D affine transformation matrix + * @param array - the matrix values to initialize this matrix with + */ + constructor(values: number[]); + + /** + * Creates a 2D affine transformation matrix + * @param matrix - the matrix to copy the values from + */ + constructor(matrix: Matrix); + /** * The value that affects the transformation along the x axis when scaling or rotating, positioned at (0, 0) in the transformation matrix. */ @@ -124,25 +137,30 @@ declare module paper { * The transform values as an array, in the same sequence as they are passed to initialize(a, c,b,d,tx,ty). * Read only. */ - values: number; + readonly values: number[]; /** * The translation of the matrix as a vector. * Read only. */ - translation: Point; + readonly translation: Point; /** * The scaling values of the matrix, if it can be decomposed. * Read only. */ - scaling: Point; + readonly scaling: Point; /** * The rotation angle of the matrix, if it can be decomposed. * Read only. */ - rotation: number; + readonly rotation: number; + + /** + * Sets this transform to the matrix defaults + */ + set(): Matrix; /** * Sets this transform to the matrix specified by the 6 values. @@ -155,6 +173,18 @@ declare module paper { */ set(a: number, c: number, b: number, d: number, tx: number, ty: number): Matrix; + /** + * Sets a 2D affine transformation matrix + * @param array - the matrix values to set this matrix with + */ + set(values: number[]): Matrix; + + /** + * Sets a 2D affine transformation matrix + * @param matrix - the matrix to set the values from + */ + set(matrix: Matrix): Matrix; + /** * Returns a copy of this transform */ @@ -180,7 +210,7 @@ declare module paper { * Attempts to apply the matrix to the content of item that it belongs to, meaning its transformation is baked into the item's content or children. * @param recursively - controls whether to apply transformations recursively on children */ - apply(): boolean; + apply(recursively: boolean): boolean; /** * Concatenates this transform with a translate transformation. @@ -215,7 +245,7 @@ declare module paper { * @param angle - the angle of rotation measured in degrees * @param center - the anchor point to rotate around */ - rotate(angle: number, center?: Point): Matrix; + rotate(angle: number, center: Point): Matrix; /** * Concatenates this transform with a rotation transformation around an anchor point. @@ -273,6 +303,30 @@ declare module paper { */ chain(mx: Matrix): Matrix; + /** + * Prepends the specified matrix to this matrix. This is the equivalent of multiplying (specified matrix) * (this matrix). + * @param mx - the transform to concatenate + */ + append(mx: Matrix): Matrix; + + /** + * Pre-concatenates the given affine transform to this transform. + * @param mx - the transform to preconcatenate + */ + prepend(mx: Matrix): Matrix; + + /** + * Returns a new matrix as the result of appending the specified matrix to this matrix. This is the equivalent of multiplying (this matrix) * (specified matrix). + * @param mx - the transform to concatenate + */ + appended(mx: Matrix): Matrix; + + /** + * Returns a new matrix as the result of prepending the specified matrix to this matrix. This is the equivalent of multiplying (specified matrix) s* (this matrix). + * @param mx - the transform to concatenate + */ + prepended(mx: Matrix): Matrix; + /** * Returns whether this transform is the identity transform */ @@ -312,9 +366,14 @@ declare module paper { * Attempts to decompose the affine transformation described by this matrix into scaling, rotation and shearing, and returns an object with these properties if it succeeded, null otherwise. */ decompose(): any; + + /** + * Inverts the matrix, causing it to perform the opposite transformation. If the matrix is not invertible (in which case isSingular() returns true), null is returned. + */ + invert(): Matrix; /** - * Creates the inversion of the transformation of the matrix and returns it as a new insteance. If the matrix is not invertible (in which case isSingular() returns true), null is returned. + * Creates the inversion of the transformation of the matrix and returns it as a new instance. If the matrix is not invertible (in which case isSingular() returns true), null is returned. */ inverted(): Matrix; @@ -412,13 +471,44 @@ declare module paper { * Angles between 0 and 90 degrees are in quadrant 1. Angles between 90 and 180 degrees are in quadrant 2, angles between 180 and 270 degrees are in quadrant 3 and angles between 270 and 360 degrees are in quadrant 4. * Read only. */ - quadrant: number; + readonly quadrant: number; /** * This property is only present if the point is an anchor or control point of a Segment or a Curve. In this case, it returns true it is selected, false otherwise */ selected: boolean; + /** + * Sets the Point object with the given x and y coordinates. + * @param x - the x coordinate + * @param y - the y coordinate + */ + set(x: number, y: number): Point; + + /** + * Sets the Point object using the numbers in the given array as coordinates. + * @param array - an array of numbers to use as coordinates + */ + set(values: number[]): Point; + + /** + * Sets the Point object using the properties in the given object. + * @param object - the object describing the point's properties + */ + set(object: any): Point; + + /** + * Sets the Point object using the width and height values of the given Size object. + * @param size - the size width and height to use + */ + set(size: Size): Point; + + /** + * Sets the Point object using the coordinates of the given Point object. + * @param point - the point to copy + */ + set(point: Point): Point; + /** * Checks whether the coordinates of the point are equal to that of the supplied point. * @param point - the point to check against @@ -516,7 +606,14 @@ declare module paper { /** * Checks if this point has an undefined value for at least one of its coordinates. */ - isNan(): boolean; + isNaN(): boolean; + + /** + * Checks if the vector is within the specified quadrant. Note that if the vector lies on the boundary between two quadrants, true will be returned for both quadrants. + * @param quadrant + * @returns true if either x or y are not a number, false otherwise + */ + isInQuadrant(quadrant: number): boolean; /** * Returns the dot product of the point and another point. @@ -563,6 +660,7 @@ declare module paper { */ add(point: Point): Point; add(point: number[]): Point; + add(point: number): Point; /* * Returns a new point @@ -570,6 +668,7 @@ declare module paper { */ subtract(point: Point): Point; subtract(point: number[]): Point; + subtract(point: number): Point; /* * Returns the new multiplied point @@ -587,6 +686,14 @@ declare module paper { divide(point: number[]): Point; divide(point: number): Point; + /** + * The modulo operator returns the integer remainders of dividing the point by the supplied value as a new point + * @param point - The point you want to divide with + */ + modulo(point: Point): Point; + modulo(point: number[]): Point; + modulo(point: number): Point; + } /** * A Rectangle specifies an area that is enclosed by it's top-left point (x, y), its width, and its height. It should not be confused with a rectangular path, it is not an item. @@ -727,7 +834,7 @@ declare module paper { * The area of the rectangle in square points. * Read only. */ - area: number; + readonly area: number; /** * Specifies whether an item's bounds are selected and will also mark the item as selected. @@ -735,6 +842,41 @@ declare module paper { */ selected: boolean; + /** + * Sets the Rectangle object. + * @param point - the top-left point of the rectangle + * @param size - the size of the rectangle + */ + set(point: Point, size: Size): Rectangle; + + /** + * Sets the Rectangle object. + * @param object - an object containing properties to be set on the rectangle. + */ + set(object: any): Rectangle; + + /** + * Sets the Rectangle object. + * @param x - the left coordinate + * @param y - the top coordinate + * @param width - the width + * @param height - the height + */ + set(x: number, y: number, width: number, height: number): Rectangle; + + /** + * Sets the Rectangle object from the passed points. These do not necessarily need to be the top left and bottom right corners, the constructor figures out how to fit a rectangle between them. + * @param from - The first point defining the rectangle + * @param to - The second point defining the rectangle + */ + set(from: Point, to: Point): Rectangle; + + /** + * Sets the Rectangle object from the passed rectangle object. + * @param rt - the rectangle to copy from + */ + set(rt: Rectangle): Rectangle; + /** * Returns a copy of the rectangle. */ @@ -771,8 +913,10 @@ declare module paper { /** * Tests if the interior of this rectangle intersects the interior of another rectangle. Rectangles just touching each other are considered as non-intersecting. * @param rect - the specified rectangle + * @param epsilon - the epsilon against which to compare the rectangle’s dimensions. default 0 + * @returns true if the rectangle and the specified rectangle intersect each other, false */ - intersects(rect: Rectangle): boolean; + intersects(rect: Rectangle, epsilon?: number): boolean; /** * Returns a new rectangle representing the intersection of this rectangle with the specified rectangle. @@ -887,9 +1031,9 @@ declare module paper { height: number; /** - * WARNING - This seems undocumented/incorrect + * Checks whether the width and height of the size are equal to those of the supplied size. */ - equals(): boolean; + equals(size: Size): boolean; /** * Returns a copy of the size. @@ -909,7 +1053,7 @@ declare module paper { /** * Checks if the width or the height of the size are NaN. */ - isNan(): boolean; + isNaN(): boolean; /** * Returns a new size with rounded width and height values. The object itself is not modified! @@ -937,6 +1081,7 @@ declare module paper { */ add(size: Size): Size; add(size: number[]): Size; + add(size: number): Size; /* * Returns a new size @@ -944,6 +1089,7 @@ declare module paper { */ subtract(size: Size): Size; subtract(size: number[]): Size; + subtract(size: number): Size; /* * Returns the new multiplied size @@ -961,6 +1107,14 @@ declare module paper { divide(size: number[]): Size; divide(size: number): Size; + /** + * Returns the new modulo size + * @param size - The size you want to modulo with + */ + modulo(size: Size): Size; + modulo(size: number[]): Size; + modulo(size: number): Size; + } export interface IFrameEvent { @@ -1018,7 +1172,7 @@ declare module paper { * The reference to the active project's view. * Read Only. */ - view: View; + readonly view: View; /** * The reference to the active tool. @@ -1030,6 +1184,15 @@ declare module paper { */ tools: Tool[]; + /** + * Compiles the PaperScript code into a compiled function and executes it. The compiled function receives all properties of this PaperScope as arguments, to emulate a global scope with unaffected performance. It also installs global view and tool handlers automatically on the respective objects. + * @param code - the PaperScript code + * @param options [optional] - the compilation options + * @param options.url - the url of the source, for source-map debugging + * @param options.source - the source to be used for the source- mapping, in case the code that’s passed in has already been mingled. + */ + execute(code: string, option?:{url?:string; source?:string; }): void; + /** * Injects the paper scope into any other given scope. Can be used for examle to inject the currently active PaperScope into the window's global scope, to emulate PaperScript-style globally accessible Paper classes and objects * Please note: Using this method may override native constructors (e.g. Path, RGBColor). This may cause problems when using Paper.js in conjunction with other libraries that rely on these constructors. Keep the library scoped if you encounter issues caused by this. @@ -1050,10 +1213,83 @@ declare module paper { /** * Retrieves a PaperScope object with the given scope id. - * @param id - + * @param id - scope id to retrieve */ static get(id: string): PaperScope; + } + export interface IHitTestOptions{ + + /** + * the tolerance of the hit-test in points. Can also be controlled through paperScope.settings.hitTolerance + */ + tolerance?: number; + + /** + * only hit-test again a certain item class and its sub-classes: Group, Layer, Path, CompoundPath, Shape, Raster, PlacedSymbol, PointText, etc. + */ + class?: string; + + /** + * a match function to be called for each found hit result: Return true to return the result, false to keep searching + */ + match?: (hit: HitResult) => boolean; + + /** + * hit-test the fill of items. + */ + fill?: boolean; + + /** + * hit-test the stroke of path items, taking into account the setting of stroke color and width. + */ + stroke?: boolean; + + /** + * hit-test for segment.point of Path items. + */ + segments?: boolean; + + /** + * hit-test the curves of path items, without taking the stroke color or width into account. + */ + curves?: boolean; + + /** + * hit-test for the handles. (segment.handleIn / segment.handleOut) of path segments. + */ + handles?: boolean; + + /** + * only hit-test for the first or last segment points of open path items. + */ + ends?: boolean; + + /** + * hit-test the item.position of of items, which depends on the setting of item.pivot. + */ + position?: boolean; + + /** + * hit-test the rectangle.center of the bounding rectangle of items (item.bounds). + */ + center?: boolean; + + /** + * hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). + */ + bounds?: boolean; + + /** + * hit-test items that have Item#guide set to true. + */ + guides?: boolean; + + /** + * only hit selected items. + */ + selected?: boolean; + } /** * The Item type allows you to access and modify the items in Paper.js projects. Its functionality is inherited by different project item types such as Path, CompoundPath, Group, Layer and Raster. They each add a layer of functionality that is unique to their type, but share the underlying properties and functions that they inherit from Item. @@ -1079,7 +1315,7 @@ declare module paper { * The unique id of the item. * Read Only. */ - id: number; + readonly id: number; /** * The class name of the item as a string. @@ -1117,7 +1353,12 @@ declare module paper { * Specifies whether the item is selected. This will also return true for Group items if they are partially selected, e.g. groups containing selected or partially selected paths. * Paper.js draws the visual outlines of selected items on top of your project. This can be useful for debugging, as it allows you to see the construction of paths, position of path curves, individual segment points and bounding boxes of symbol and raster items. */ - selected: boolean; + selected: boolean; + + /** + * Specifies whether the item and all children are selected. + */ + fullySelected: boolean; /** * Specifies whether the item defines a clip mask. This can only be set on paths, compound paths, and text frame objects, and only if the item is already contained within a clipping group. @@ -1173,7 +1414,12 @@ declare module paper { * The item's global transformation matrix in relation to the global project coordinate space. Note that the view's transformations resulting from zooming and panning are not factored in. * Read Only. */ - globalMatrix: Matrix; + readonly globalMatrix: Matrix; + + /** + * The item’s global matrix in relation to the view coordinate space. This means that the view’s transformations resulting from zooming and panning are factored in. + */ + readonly viewMatrix: Matrix; /** * Controls whether the transformations applied to the item (e.g. through transform(matrix), rotate(angle), scale(scale), etc.) are stored in its matrix property, or whether they are directly applied to its contents or children (passed on to the segments in Path items, the children of Group items, etc.). @@ -1184,19 +1430,19 @@ declare module paper { * The project that this item belongs to. * Read only. */ - project: Project; + readonly project: Project; /** * The view that this item belongs to. * Read Only. */ - view: View; + readonly view: View; /** * The layer that this item is contained within. * Read Only. */ - layer: Layer; + readonly layer: Layer; /** * The item that this item is contained within. @@ -1212,30 +1458,30 @@ declare module paper { /** * The first item contained within this item. This is a shortcut for accessing item.children[0]. */ - firstChild: Item; + readonly firstChild: Item; /** * The last item contained within this item.This is a shortcut for accessing item.children[item.children.length - 1]. */ - lastChild: Item; + readonly lastChild: Item; /** * The next item on the same level as this item. * Read Only. */ - nextSibling: Item; + readonly nextSibling: Item; /** * The previous item on the same level as this item. * Read Only. */ - previousSibling: Item; + readonly previousSibling: Item; /** * The index of this item within the list of its parent's children. * Read only. */ - index: number; + readonly index: number; /** * The color of the stroke. @@ -1291,10 +1537,29 @@ declare module paper { fillColor: Color | string; /** - * The fill rule. + * The fill-rule with which the shape gets filled. Please note that only modern browsers support fill-rules other than 'nonzero'. + * Values - 'nonzero', 'evenodd' + * Default - 'nonzero' */ fillRule: string; + /** + * The shadow color. + */ + shadowColor: Color | string; + + /** + * The shadow’s blur radius. + * Default - 0 + */ + shadowBlur: number; + + /** + * The shadow’s offset. + * Default - 0 + */ + shadowOffset: number; + /** * The color the item is highlighted with when selected. If the item does not specify its own color, the color defined by its layer is used instead. */ @@ -1308,45 +1573,53 @@ declare module paper { /** * The function to be called when the mouse button is pushed down on the item. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseDown: (event: MouseEvent) => void; + onMouseDown: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse position changes while the mouse is being dragged. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseDrag: (event: MouseEvent) => void; + onMouseDrag: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse button is released over the item. * The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseUp: (event: MouseEvent) => void; + onMouseUp: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onClick: (event: MouseEvent) => void; + onClick: (event: MouseEvent) => void | boolean; /** - * The function to be called when the mouse double clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + * The function to be called when the mouse double clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. * + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onDoubleClick: (event: MouseEvent) => void; + onDoubleClick: (event: MouseEvent) => void | boolean; /** * The function to be called repeatedly when the mouse moves on top of the item. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseMove: (event: MouseEvent) => void; + onMouseMove: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse moves over the item. This function will only be called again, once the mouse moved outside of the item first. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseEnter: (event: MouseEvent) => void; + onMouseEnter: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse moves out of the item. * The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseLeave: (event: MouseEvent) => void; + onMouseLeave: (event: MouseEvent) => void | boolean; /** * Sets those properties of the passed object literal on this item to the values defined in the object literal, if the item has property of the given name (or a setter defined for it). @@ -1355,23 +1628,31 @@ declare module paper { /** * Clones the item within the same project and places the copy above the item. - * @param options [optional] - object with 2 parameters - * insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true - * deep: specifies whether the item’s children should also be cloned — default: true + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true */ - clone(options?: { insert?: boolean, deep?: boolean }): Item; + clone(options?: { insert?: boolean; deep?: boolean; }): Item; /** - * When passed a project, copies the item to the project, or duplicates it within the same project. When passed an item, copies the item into the specified item. - * @param item - the item or project to copy the item to + * Copies the content of the specified item over to this item. + * @param source - the item to copy the content from */ - copyTo(item: Item): Item; + copyContent(source: Item): void; + + /** + * Copies all attributes of the specified item over to this item. This includes its style, visibility, matrix, pivot, blend-mode, opacity, selection state, data, name, etc. + * @param source - the item to copy the attributes from + * @param excludeMatrix - whether to exclude the transformation matrix when copying all attributes + */ + copyAttributes(source: Item, excludeMatrix: boolean): void; /** * Rasterizes the item into a newly created Raster object. The item itself is not removed after rasterization. * @param resolution [optional] - the resolution of the raster in pixels per inch (DPI). If not specified, the value of view.resolution is used. default: view.resolution + * @param insert [optional] - specifies whether the raster should be inserted into the scene graph. When set to true, it is inserted above the original — default: true */ - rasterize(resolution?: number): Raster; + rasterize(resolution?: number, insert?: boolean): Raster; /** * Checks whether the item's geometry contains the given point. @@ -1392,42 +1673,46 @@ declare module paper { intersects(item: Item): boolean; /** - * Perform a hit-test on the items contained within the project at the location of the specified point. + * Performs a hit-test on the item and its children (if it is a Group or Layer) at the location of the specified point, returning the first found hit. * The options object allows you to control the specifics of the hit-test and may contain a combination of the following values: * @param point - the point where the hit-test should be performed * @param options.tolerance -the tolerance of the hit-test in points. Can also be controlled through paperScope.settings.hitTolerance * @param options.class - only hit-test again a certain item class and its sub-classes: Group, Layer, Path, CompoundPath, Shape, Raster, PlacedSymbol, PointText, etc. + * @param options.match -a match function to be called for each found hit result: Return true to return the result, false to keep searching * @param options.fill - hit-test the fill of items. * @param options.stroke - hit-test the stroke of path items, taking into account the setting of stroke color and width. * @param options.segments - hit-test for segment.point of Path items. * @param options.curves - hit-test the curves of path items, without taking the stroke color or width into account. * @param options.handles - hit-test for the handles. (segment.handleIn / segment.handleOut) of path segments. * @param options.ends - only hit-test for the first or last segment points of open path items. - * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). + * @param options.position - hit-test the item.position of of items, which depends on the setting of item.pivot. * @param options.center - hit-test the rectangle.center of the bounding rectangle of items (item.bounds). + * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). * @param options.guides - hit-test items that have Item#guide set to true. * @param options.selected - only hit selected items. */ - hitTest(point: Point, options?: { tolerance?: number; class?: string; fill?: boolean; stroke?: boolean; segments?: boolean; curves?: boolean; handles?: boolean; ends?: boolean; bounds?: boolean; center?: boolean; guides?: boolean; selected?: boolean; match?: (hit: HitResult) => boolean; }): HitResult; + hitTest(point: Point, options?: IHitTestOptions): HitResult; /** - * Perform a hit-test on the items contained within the project at the location of the specified point, returning all found hits. + * Performs a hit-test on the item and its children (if it is a Group or Layer) at the location of the specified point, returning all found hits. * The options object allows you to control the specifics of the hit-test and may contain a combination of the following values: * @param point - the point where the hit-test should be performed * @param options.tolerance -the tolerance of the hit-test in points. Can also be controlled through paperScope.settings.hitTolerance * @param options.class - only hit-test again a certain item class and its sub-classes: Group, Layer, Path, CompoundPath, Shape, Raster, PlacedSymbol, PointText, etc. + * @param options.match -a match function to be called for each found hit result: Return true to return the result, false to keep searching * @param options.fill - hit-test the fill of items. * @param options.stroke - hit-test the stroke of path items, taking into account the setting of stroke color and width. * @param options.segments - hit-test for segment.point of Path items. * @param options.curves - hit-test the curves of path items, without taking the stroke color or width into account. * @param options.handles - hit-test for the handles. (segment.handleIn / segment.handleOut) of path segments. * @param options.ends - only hit-test for the first or last segment points of open path items. - * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). + * @param options.position - hit-test the item.position of of items, which depends on the setting of item.pivot. * @param options.center - hit-test the rectangle.center of the bounding rectangle of items (item.bounds). + * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). * @param options.guides - hit-test items that have Item#guide set to true. * @param options.selected - only hit selected items. - */ - hitTestAll(point: Point, options?: { tolerance?: number; class?: string; fill?: boolean; stroke?: boolean; segments?: boolean; curves?: boolean; handles?: boolean; ends?: boolean; bounds?: boolean; center?: boolean; guides?: boolean; selected?: boolean; match?: (hit: HitResult) => boolean; }): HitResult[]; + * */ + hitTestAll(point: Point, options?: IHitTestOptions): HitResult[]; /** * Checks whether the item matches the criteria described by the given object, by iterating over all of its properties and matching against their values through matches(name, compare). @@ -1448,6 +1733,9 @@ declare module paper { * Fetch the descendants (children or children of children) of this item that match the properties in the specified object. * Extended matching is possible by providing a compare function or regular expression. Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x- coordinate to match all points with that x-value). Partial matching does work for item.data. * Matching items against a rectangular area is also possible, by setting either match.inside or match.overlapping to a rectangle describing the area in which the items either have to be fully or partly contained. + * @param match.recursive - whether to loop recursively through all children, or stop at the current level — default: true + * @param match.match - a match function to be called for each item, allowing the definition of more flexible item checks that are not bound to properties. If no other match properties are defined, this function can also be passed instead of the options object + * @param match.class - the constructor function of the item type to match against * @param match.inside - the rectangle in which the items need to be fully contained. * @param match.overlapping - the rectangle with which the items need to at least partly overlap. */ @@ -1466,7 +1754,7 @@ declare module paper { * @param options.asString - whether the JSON is returned as a Object or a String. * @param options.precision - the amount of fractional digits in numbers used in JSON data. */ - exportJSON(options?: { asString?: boolean; precision?: number }): string; + exportJSON(options?: { asString?: boolean; precision?: number; }): string; /** * Imports (deserializes) the stored JSON data into the project. @@ -1476,22 +1764,37 @@ declare module paper { /** * Exports the project with all its layers and child items as an SVG DOM, all contained in one top level SVG group node. - * @param options [optional] the export options, default: { asString: false, precision: 5, matchShapes: false } + * @param options [optional] the export options, default: { asString: false, precision: 5, matchShapes: false, bounds: 'view', matrix: paper.view.matrix, embedImages: true } * @param options.asString - whether a SVG node or a String is to be returned. * @param options.precision - the amount of fractional digits in numbers used in SVG data. * @param options.matchShapes - whether path items should tried to be converted to shape items, if their geometries can be made to match + * @param options.bounds - the bounds of the area to export, either as a string (‘view’, content’), or a Rectangle object: 'view' uses the view bounds, 'content' uses the stroke bounds of all content. + * @param options.matrix - the matrix with which to transform the exported content: If options.bounds is set to 'view', paper.view.matrix is used, for all other settings of options.bounds the identity matrix is used. + * @param options.embedImages: whether raster images should be embedded as base64 data inlined in the xlink:href attribute, or kept as a link to their external URL. */ - exportSVG(options?: { asString?: boolean; precision?: number; matchShapes?: boolean }): SVGElement; + exportSVG(options?: { asString?: boolean; precision?: number; matchShapes?: boolean; bounds?: string | Rectangle; matrix?: Matrix; embedImages?: boolean; }): SVGElement; /** * Converts the provided SVG content into Paper.js items and adds them to the active layer of this project. * Note that the project is not cleared first. You can call project.clear() to do so. * @param svg - the SVG content to import - * @param options [optional] - the import options, default: { expandShapes: false } + * @param options [optional] - the import options, default: { expandShapes: false, insert: true, applyMatrix: paperScope.settings.applyMatrix } * @param options.expandShapes - whether imported shape items should be expanded to path items. + * @param options.onLoad - the callback function to call once the SVG content is loaded from the given URL receiving two arguments: the converted item and the original svg data as a string. Only required when loading from external resources. + * @param options.onError - the callback function to call if an error occurs during loading. Only required when loading from external resources. + * @param options.insert: Boolean — whether the imported items should be added to the item that importSVG() is called on. + * @param options.applyMatrix Boolean — whether the imported items should have their transformation matrices applied to their contents or not. */ - importSVG(svg: SVGElement | string, options?: any): Item; + importSVG(svg: SVGElement | string, options?: { expandShapes?: boolean; onLoad?: (item: Item, svg: string) => void; onError?: (message: string, status: number) => void; insert?: true; applyMatrix?: Matrix; }): Item; + /** + * Converts the provided SVG content into Paper.js items and adds them to the active layer of this project. + * Note that the project is not cleared first. You can call project.clear() to do so. + * @param svg - the SVG content to import + * @param onLoad [optional] - the callback function to call once the SVG content is loaded from the given URL receiving two arguments: the converted item and the original svg data as a string. Only required when loading from external resources. + */ + importSVG(svg: SVGElement | string, onLoad?: (item: Item, svg: string) => void): Item; + /** * Adds the specified item as a child of this item at the end of the its children list. You can use this function for groups, compound paths and layers. * @param item - the item to add as a child @@ -1530,6 +1833,18 @@ declare module paper { */ insertBelow(item: Item): Item; + /** + * Inserts the specified item as a child of this item by appending it to the list of children and moving it above all other children. You can use this function for groups, compound paths and layers. + * @param item - the item to be appended as a child + */ + appendTop(item: Item): Item; + + /** + * Inserts the specified item as a child of this item by appending it to the list of children and moving it below all other children. You can use this function for groups, compound paths and layers. + * @param item - the item to be appended as a child + */ + appendBelow(item: Item): Item; + /** * Moves this item above the specified item. Returns true if the item * was moved. @@ -1555,9 +1870,22 @@ declare module paper { bringToFront(): void; /** - * If this is a group, layer or compound-path with only one child-item, the child-item is moved outside and the parent is erased. Otherwise, the item itself is returned unmodified. + * Adds it to the specified owner, which can be either a Item or a Project. + * @param owner - the item or project to add the item to */ - reduce(): Item; + addTo(owner: Project | Layer | Group | CompoundPath): Item; + + /** + * Clones the item and adds it to the specified owner, which can be either a Item or a Project. + * @param owner - the item or project to copy the item to + */ + copyTo(owner: Project | Layer | Group | CompoundPath): Item; + + /** + * If this is a group, layer or compound-path with only one child-item, the child-item is moved outside and the parent is erased. Otherwise, the item itself is returned unmodified. + * @param options [optional] + */ + reduce(options?: any): Item; /** * Removes the item and all its children from the project. The item is not destroyed and can be inserted again after removal. @@ -1577,10 +1905,10 @@ declare module paper { /** * Removes the children from the specified from index to the to index from the parent's children array. - * @param from - the beginning index, inclusive - * @param to [optional] - the ending index, exclusive, default: children.length + * @param start - the beginning index, inclusive + * @param end [optional] - the ending index, exclusive, default: children.length */ - removeChildren(from: number, to?: number): Item[]; + removeChildren(start: number, end?: number): Item[]; /** * Reverses the order of the item's children @@ -1760,44 +2088,54 @@ declare module paper { */ fitBounds(rectangle: Rectangle, fill?: boolean): void; - //I cannot use function: Function as it is a reserved keyword - /** - * Attach an event handler to the tool. - * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type - * @param function - The function to be called when the event occurs + * Attach an event handler to the item. + * @param type - the type of event: ‘frame’, mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ + * @param callback - The function to be called when the event occurs */ - on(type: string, callback: (event: ToolEvent) => void): Tool; - + on(type: string, callback: (event: MouseEvent) => void | boolean): Item; /** - * Attach one or more event handlers to the tool. - * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + * Attach an event handler to the item. + * @param type - the type of event: ‘frame’, mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ + * @param callback - The function to be called when the event occurs */ - on(param: any): Tool; + on(type: string, callback: (event: IFrameEvent) => void | boolean): Item; /** - * Detach an event handler from the tool. - * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * Attach one or more event handlers to the item. + * @param object - an object containing one or more of the following properties: frame, mousedown, mouseup, mousedrag, click, doubleclick, mousemove, mouseenter, mouseleave + */ + on(object: { frame?: (event: IFrameEvent) => void; mousedown?: (event: MouseEvent) => void | boolean; mouseup?: (event: MouseEvent) => void | boolean; mousedrag?: (event: MouseEvent) => void | boolean; click?: (event: MouseEvent) => void | boolean; doubleclick?: (event: MouseEvent) => void | boolean; mousemove?: (event: MouseEvent) => void | boolean; mouseenter?: (event: MouseEvent) => void | boolean; mouseleave?: (event: MouseEvent) => void | boolean; }): Item; + + /** + * Detach an event handler from the item. + * @param type - the type of event: ‘frame’, mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ * @param function - The function to be detached */ - off(type: string, callback: (event: ToolEvent) => void): Tool; + off(type: string, callback: (event: MouseEvent) => void | boolean): Item; + /** + * Detach an event handler from the item. + * @param type - the type of event: ‘frame’, mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ + * @param function - The function to be detached + */ + off(type: string, callback: (event: IFrameEvent) => void | boolean): Item; /** * Detach one or more event handlers from the tool. - * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + * @param object - an object containing one or more of the following properties: frame, mousedown, mouseup, mousedrag, click, doubleclick, mousemove, mouseenter, mouseleave */ - off(param: any): Tool; + off(object: { frame?: (event: IFrameEvent) => void; mousedown?: (event: MouseEvent) => void | boolean; mouseup?: (event: MouseEvent) => void | boolean; mousedrag?: (event: MouseEvent) => void | boolean; click?: (event: MouseEvent) => void | boolean; doubleclick?: (event: MouseEvent) => void | boolean; mousemove?: (event: MouseEvent) => void | boolean; mouseenter?: (event: MouseEvent) => void | boolean; mouseleave?: (event: MouseEvent) => void | boolean; }): Item; /** * Emit an event on the tool. - * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param type - the type of event: ‘frame’, mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ * @param event - an object literal containing properties describing the event. */ emit(type: string, event: any): boolean; /** * Check if the tool has one or more event handlers of the specified type. - * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param type - the type of event: ‘frame’, mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ */ responds(type: string): boolean;//I cannot use function: Function as it is a reserved keyword @@ -1806,49 +2144,49 @@ declare module paper { * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type * @param function - The function to be called when the event occurs */ - on(type: string, callback: () => void): Item; + on(type: string, callback: (event: Event | MouseEvent) => void | boolean): Item; /** * Attaches one or more event handlers to the item. - * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + * @param param - an object containing one or more of the following properties: frame, mousedown, mouseup, mousedrag, click, doubleclick, mousemove, mouseenter, mouseleave */ on(param: any): Item; /** * Detach an event handler from the item. - * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param type - the type of event: ‘frame’, mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ * @param function - The function to be detached */ - off(type: string, callback: (event: ToolEvent) => void): Item; + off(type: string, callback: (event: Event | MouseEvent) => void | boolean): Item; /** * Detach one or more event handlers to the item. - * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + * @param param - an object containing one or more of the following properties: frame, mousedown, mouseup, mousedrag, click, doubleclick, mousemove, mouseenter, mouseleave */ off(param: any): Item; /** * Emit an event on the item. - * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param type - the type of event: ‘frame’, mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ * @param event - an object literal containing properties describing the event. */ emit(type: string, event: any): boolean; /** * Check if the item has one or more event handlers of the specified type.. - * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param type - the type of event: ‘frame’, mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ */ responds(type: string): boolean; /** * Removes the item when the events specified in the passed object literal occur. - * @param object - The object literal can contain the following values - * @param object.move - Remove the item when the next tool.onMouseMove event is fired - * @param object.drag - Remove the item when the next tool.onMouseDrag event is fired - * @param object.down - Remove the item when the next tool.onMouseDown event is fired - * @param object.up - Remove the item when the next tool.onMouseUp event is fired + * @param options - The object literal can contain the following values + * @param options.move - Remove the item when the next tool.onMouseMove event is fired + * @param options.drag - Remove the item when the next tool.onMouseDrag event is fired + * @param options.down - Remove the item when the next tool.onMouseDown event is fired + * @param options.up - Remove the item when the next tool.onMouseUp event is fired */ - removeOn(object: { move?: boolean; drag?: boolean; down?: boolean; up?: boolean; }): void; + removeOn(options: { move?: boolean; drag?: boolean; down?: boolean; up?: boolean; }): void; /** * Removes the item when the next tool.onMouseMove event is fired. @@ -1888,6 +2226,14 @@ declare module paper { */ constructor(object?: any); + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Group; + /** * Specifies whether the group item is to be clipped. * When setting to true, the first child in the group is automatically defined as the clipping mask. @@ -1988,6 +2334,20 @@ declare module paper { */ radius: number | Size; + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Shape; + + /** + * Creates a new path item with same geometry as this shape item, and inherits all settings from it, similar to item.clone(). + * @param insert - specifies whether the new path should be inserted into the scene graph. When set to true, it is inserted above the shape item — optional, default: true + */ + toPath(insert?: boolean): Shape; + } /** * The Raster item represents an image in a Paper.js project. @@ -2017,11 +2377,16 @@ declare module paper { */ height: number; + /** + * The loading state of the raster image. + */ + readonly loaded: boolean; + /** * The resolution of the raster at its current size, in PPI (pixels per inch). * Read Only. */ - resolution: Size; + readonly resolution: Size; /** * The HTMLImageElement of the raster, if one is associated. @@ -2043,6 +2408,29 @@ declare module paper { */ source: HTMLImageElement | HTMLCanvasElement | string; + /** + * The crossOrigin value to be used when loading the image resource, in order to support CORS. Note that this needs to be set before setting the source property in order to always work (e.g. when the image is cached in the browser). + */ + crossOrigin: string; + + /** + * The event handler function to be called when the underlying image has finished loading and is ready to be used. This is also triggered when the image is already loaded, or when a canvas is used instead of an image. + */ + onLoad: any; + + /** + * The event handler function to be called when there is an error loading the underlying image. + */ + onError: any; + + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Raster; + /** * Extracts a part of the Raster's content as a sub image, and returns it as a Canvas object. * @param rect - the boundaries of the sub image in pixel coordinates @@ -2114,7 +2502,6 @@ declare module paper { getImageData(rect: Rectangle): ImageData; /** - * * * @param data * @param point @@ -2138,6 +2525,14 @@ declare module paper { */ symbol: Symbol; + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): PlacedSymbol; + } /** * A HitResult object contains information about the results of a hit test. It is returned by item.hitTest(point) and project.hitTest(point). @@ -2187,22 +2582,175 @@ declare module paper { */ export class PathItem extends Item { + /** + * Creates a path item from the given SVG path-data, determining if the data describes a plain path or a compound-path with multiple sub-paths. + * @param pathData - the SVG path-data to parse + */ + static create(pathData: string): Path | CompoundPath; + + /** + * Creates a path item from the given segments array, determining if the array describes a plain path or a compound-path with multiple sub-paths. + * @param segments - the segments array to parse + */ + static create(segments: number[] | any[]): Path | CompoundPath; + + /** + * Creates a path item from the given object, determining if the contained information describes a plain path or a compound-path with multiple sub-paths. + * @param object - an object containing the properties describing the item to be created + */ + static create(object: any): Path | CompoundPath; + + /** + * Returns a point that is guaranteed to be inside the path. + */ + readonly interiorPoint: Point; + + /** + * Specifies whether the path as a whole is oriented clock-wise, by looking at the path’s area. Note that self-intersecting paths and sub-paths of different orientation can result in areas that cancel each other out. + */ + clockwise: boolean; + /** * The path's geometry, formatted as SVG style path data. */ pathData: string; /** - * Returns all intersections between two PathItem items as an array of CurveLocation objects. CompoundPath items are also supported. - * @param path - the other item to find the intersections with - * @param sorted [optional] - specifies whether the returned CurveLocation objects should be sorted by path and offset, default: false + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true */ - getIntersections(path: PathItem, sorted?: boolean): CurveLocation[]; + clone(options?: { insert?: boolean; deep?: boolean; }): PathItem; /** - * Smooth bezier curves without changing the amount of segments or their points, by only smoothing and adjusting their handle points, for both open ended and closed paths. + * Merges the geometry of the specified path from this path's geometry and returns the result as a new path item. + * @param path - the path to unite with + * @param options [optional] - the boolean operation options. default { insert: true } + * @param options.insert - whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation. */ - smooth(): void; + unite(path: PathItem, options?: { insert?: boolean; }): PathItem; + + /** + * Intersects the geometry of the specified path with this path's geometry and returns the result as a new path item. + * @param path - the path to intersect with + * @param options [optional] - the boolean operation options. default { insert: true, trace: true } + * @param options.insert - whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation. + * @param options.trace - whether the tracing method is used, treating both paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, keeping the parts of the curves that intersect with the area of the second path. + */ + intersect(path: PathItem, options?: { insert?: boolean; trace?: boolean; }): PathItem; + + /** + * Subtracts the geometry of the specified path from this path's geometry and returns the result as a new path item. + * @param path - the path to subtract + * @param options [optional] - the boolean operation options. default { insert: true, trace: true } + * @param options.insert - whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation. + * @param options.trace - whether the tracing method is used, treating both paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, keeping the parts of the curves that intersect with the area of the second path. + */ + subtract(path: PathItem, options?: { insert?: boolean; trace?: boolean; }): PathItem; + + /** + * Excludes the intersection of the geometry of the specified path with this path's geometry and returns the result as a new group item. + * @param path - the path to exclude the intersection of + * @param options [optional] - the boolean operation options. default { insert: true } + * @param options.insert - whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation. + */ + exclude(path: PathItem, options?: { insert?: boolean; }): PathItem; + + /** + * Splits the geometry of this path along the geometry of the specified path returns the result as a new group item. + * @param path - the path to divide by + * @param options [optional] - the boolean operation options. default { insert: true, trace: true } + * @param options.insert - whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation. + * @param options.trace - whether the tracing method is used, treating both paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, keeping the parts of the curves that intersect with the area of the second path. + */ + divide(path: PathItem, options?: { insert?: boolean; trace?: boolean; }): PathItem; + + /** + * Fixes the orientation of the sub-paths of a compound-path, assuming that non of its sub-paths intersect, by reorienting them so that they are of different winding direction than their containing paths, except for disjoint sub-paths, i.e. islands, which are oriented so that they have the same winding direction as the the biggest path. + * @param nonZero [optional] - controls if the non-zero fill-rule is to be applied, by counting the winding of each nested path and discarding sub-paths that do not contribute to the final result. default: false + * @param clockwise [optional] - if provided, the orientation of the root paths will be set to the orientation specified by clockwise, otherwise the orientation of the largest root child is used. + */ + reorient(nonZero?: boolean, clockwise?: boolean): PathItem; + + /** + * Returns all intersections between two PathItem items as an array of CurveLocation objects. CompoundPath items are also supported. + * @param path - the other item to find the intersections with + * @param include [optional] - a callback function that can be used to filter out undesired locations right while they are collected. When defined, it shall return true to include a location, false otherwise. — optional + */ + getIntersections(path: PathItem, include?: (location: CurveLocation) => boolean): CurveLocation[]; + + /** + * Returns all crossings between two PathItem items as an array of CurveLocation objects. CompoundPath items are also supported. Crossings are intersections where the paths actually are crossing each other, as opposed to simply touching. + * @param path - the other item to find the crossings with + */ + getCrossings(path: PathItem): CurveLocation[]; + + /** + * Returns the nearest location on the path item to the specified point. + * @param point - the point for which we search the nearest location + */ + getNearestLocation(point: Point): CurveLocation; + + /** + * Returns the nearest point on the path item to the specified point. + * @param point - the point for which we search the nearest point + */ + getNearestPoint(point: Point): Point; + + /** + * Reverses the orientation of the path item. When called on CompoundPath items, each of the nested paths is reversed. On Path items, the sequence of path.segments is reversed. + */ + reverse(): void; + + /** + * Flattens the curves in path items to a sequence of straight lines, by subdividing them enough times until the specified maximum error is met. + * @param flatness [optional] - the maximum error between the flattened lines and the original curves. default: 0.25 + */ + flatten(flatness?: number): void; + + /** + * Smooths the path item without changing the amount of segments in the path or moving the segments’ locations, by smoothing and adjusting the angle and length of the segments’ handles based on the position and distance of neighboring segments. + * Smoothing works both for open paths and closed paths, and can be applied to the full path, as well as a sub-range of it. If a range is defined using the options.from and options.to properties, only the curve handles inside that range are touched. If one or both limits of the range are specified in negative indices, the indices are wrapped around the end of the curve. That way, a smoothing range in a close path can even wrap around the connection between the last and the first segment. + * Four different smoothing methods are available: + * 'continuous' smooths the path item by adjusting its curve handles so that the first and second derivatives of all involved curves are continuous across their boundaries. + * This method tends to result in the smoothest results, but does not allow for further parametrization of the handles. + * 'asymmetric' is based on the same principle as 'continuous' but uses different factors so that the result is asymmetric. This used to the only method available until v0.10.0, and is currently still the default when no method is specified, for reasons of backward compatibility. It will eventually be removed. + * 'catmull-rom' uses the Catmull-Rom spline to smooth the segment. + * The optionally passed factor controls the knot parametrization of the algorithm: + * 0.0: the standard, uniform Catmull-Rom spline + * 0.5: the centripetal Catmull-Rom spline, guaranteeing no self-intersections + * 1.0: the chordal Catmull-Rom spline + * 'geometric' use a simple heuristic and empiric geometric method to smooth the segment’s handles. The handles were weighted, meaning that big differences in distances between the segments will lead to probably undesired results. + * The optionally passed factor defines the tension parameter (0…1), controlling the amount of smoothing as a factor by which to scale each handle. + * @param options [optional] - default { type:'asymmetric', factor: 0.5 for 'catmull-rom', 0.4 for 'geometric' } + * @param options.type - the type of smoothing method: ‘continuous’, ‘asymmetric’, ‘catmull-rom’, ‘geometric’ — default: ‘asymmetric’ + * @param options.factor - the factor parameterizing the smoothing method — default: 0.5 for 'catmull-rom', 0.4 for 'geometric' + * @param options.from - the segment or curve at which to start smoothing, if not the full path shall be smoothed (inclusive). This can either be a segment index, or a segment or curve object that is part of the path. If the passed number is negative, the index is wrapped around the end of the path. + * @param options.to - the segment or curve to which the handles of the path shall be processed (inclusive). This can either be a segment index, or a segment or curve object that is part of the path. If the passed number is negative, the index is wrapped around the end of the path. + */ + smooth(options?: { type?: string; factor?: number; from?: number | Segment | Curve; to?: number | Segment | Curve; }): void; + + /** + * Fits a sequence of as few curves as possible through the path’s anchor points, ignoring the path items’s curve-handles, with an allowed maximum error. When called on CompoundPath items, each of the nested paths is simplified. On Path items, the path.segments array is processed and replaced by the resulting sequence of fitted curves. + * This method can be used to process and simplify the point data received from a mouse or touch device. + * @param tolerance [optional] - the allowed maximum error when fitting the curves through the segment points. default: 2.5 + */ + simplify(tolerance?: number): boolean; + + /** + * Interpolates between the two specified path items and uses the result as the geometry for this path item. The number of children and segments in the two paths involved in the operation should be the same. + * @param from - the path item defining the geometry when factor is 0 + * @param to - the path item defining the geometry when factor is 1 + * @param factor - the interpolation coefficient, typically between 0 and 1, but extrapolation is possible too + */ + interpolate(from: PathItem, to: PathItem, factor: number): void; + + /** + * Compares the geometry of two paths to see if they describe the same shape, detecting cases where paths start in different segments or even use different amounts of curves to describe the same shape, as long as their orientation is the same, and their segments and handles really result in the same visual appearance of curves. + * @param path - the path to compare this path’s geometry with + */ + compare(path: PathItem): boolean; /** * On a normal empty Path, the point is simply added as the path's first segment. If called on a CompoundPath, a new Path is created as a child and the point is added as its first segment. @@ -2215,6 +2763,28 @@ declare module paper { * @param point - the end point of the line */ lineTo(point: Point): void; + + /** + * Draws an arc from the position of the last segment point in the path that goes through the specified through point, to the specified to point by adding one or more segments to the path. + * @param through - the point where the arc should pass through + * @param to - the point where the arc should end + */ + arcTo(through: Point, to: Point): void; + + /** + * Draws an arc from the position of the last segment point in the path to the specified point by adding one or more segments to the path. + * @param to - the point where the arc should end + * @param clockwise [optional] - specifies whether the arc should be drawn in clockwise direction. default: true + */ + arcTo(to: Point, clockwise?: boolean): void; + + /** + * Draws a curve from the position of the last segment point in the path that goes through the specified through point, to the specified to point by adding one segment to the path. + * @param through - the point through which the curve should go + * @param to - the point where the curve should end + * @param time [optional] - the curve-time parameter at which the through point is to be located. default: 0.5 + */ + curveTo(through: Point, to: Point, time?: number): void; /** * Adds a cubic bezier curve to the path, defined by two handles and a to point. @@ -2231,33 +2801,11 @@ declare module paper { */ quadraticCurveTo(handle: Point, to: Point): void; - /** - * Draws a curve from the position of the last segment point in the path that goes through the specified through point, to the specified to point by adding one segment to the path. - * @param through - the point through which the curve should go - * @param to - the point where the curve should end - * @param parameter [optional] - default: 0.5 - */ - curveTo(through: Point, to: Point, parameter?: number): void; - - /** - * Draws an arc from the position of the last segment point in the path that goes through the specified through point, to the specified to point by adding one or more segments to the path. - * @param through - the point where the arc should pass through - * @param to - the point where the arc should end - */ - arcTo(through: Point, to: Point): void; - - /** - * Draws an arc from the position of the last segment point in the path to the specified point by adding one or more segments to the path. - * @param to - the point where the arc should end - * @param closewise [optional] - specifies whether the arc should be drawn in clockwise direction. optional, default: true - */ - arcTo(to: Point, clockwise?: boolean): void; - /** * Closes the path. When closed, Paper.js connects the first and last segment of the path with an additional curve. - * @param join - controls whether the method should attempt to merge the first segment with the last if they lie in the same location. + * @param tolerance [optional] - the maximum distance allowed when merging the first and last locations in the newly closed path. default: 0 */ - closePath(join: boolean): void; + closePath(tolerance?: number): void; /** * If called on a CompoundPath, a new Path is created as a child and a point is added as its first segment relative to the position of the last segment of the current path. @@ -2267,76 +2815,47 @@ declare module paper { /** * Adds a segment relative to the last segment point of the path. - * @param to - the vector which is added to the position of the last segment of the path, to get to the position of the new segment. + * @param point - the vector which is added to the position of the last segment of the path, to get to the position of the new segment. */ - lineBy(to: Point): void; + lineBy(point: Point): void; /** - * - * @param through - - * @param to - - * @param parameter [optional] - default 0.5 - */ - curveBy(through: Point, to: Point, parameter?: number): void; - - /** - * - * @param handle1 - - * @param handle2 - - * @param to - - */ - cubicCurveBy(handle1: Point, handle2: Point, to: Point): void; - - /** - * - * @param handle - - * @param to - - */ - quadraticCurveBy(handle: Point, to: Point): void; - - /** - * - * @param through - - * @param to - + * Adds an arc from the position of the last segment in the path, passing through the specified through vector, to the specified to vector, all specified relatively to it by these given vectors, by adding one or more segments to the path. + * @param through - the vector where the arc should pass through + * @param to - the vector where the arc should end */ arcBy(through: Point, to: Point): void; /** - * - * @param to - - * @param clockwise [optional] - default: true + * Adds an arc from the position of the last segment in the path to the to vector specified relatively to it, by adding one or more segments to the path. + * @param to - the vector where the arc should end + * @param clockwise [optional] - specifies whether the arc should be drawn in clockwise direction. default: true */ arcBy(to: Point, clockwise?: boolean): void; /** - * Merges the geometry of the specified path from this path's geometry and returns the result as a new path item. - * @param path - the path to unite with + * Adds a curve from the last segment in the path through the specified through vector, to the specified to vector, all specified relatively to it by these given vectors, by adding one segment to the path. + * @param through - the vector through which the curve should pass + * @param to - the destination vector of the newly added curve + * @param time [optional] - the curve-time parameter at which the through point is to be located. default: 0.5 */ - unite(path: PathItem): PathItem; + curveBy(through: Point, to: Point, time?: number): void; /** - * Intersects the geometry of the specified path with this path's geometry and returns the result as a new path item. - * @param path - the path to intersect with + * Adds a cubic bezier curve to the path, from the last segment to the to the specified to vector, with the curve itself defined by two specified handles. + * @param handle1 - the location of the first handle of the newly added curve + * @param handle2 - the location of the second handle of the newly added curve + * @param to - the destination point of the newly added curve */ - intersect(path: PathItem): PathItem; + cubicCurveBy(handle1: Point, handle2: Point, to: Point): void; /** - * Subtracts the geometry of the specified path from this path's geometry and returns the result as a new path item. - * @param - the path to subtract + * Adds a quadratic bezier curve to the path, from the last segment to the specified destination point, with the curve itself defined by the specified handle. + * Note that Paper.js only stores cubic curves, so the handle is actually converted. + * @param handle - the handle of the newly added quadratic curve out of which the values for segment.handleOut of the resulting cubic curve’s first segment and segment.handleIn of its second segment are calculated + * @param to - the destination point of the newly added curve */ - subtract(path: PathItem): PathItem; - - /** - * Excludes the intersection of the geometry of the specified path with this path's geometry and returns the result as a new group item. - * @param - the path to exclude the intersection of - */ - exclude(path: PathItem): PathItem; - - /** - * Splits the geometry of this path along the geometry of the specified path returns the result as a new group item. - * @param - the path to divide by - */ - divide(path: PathItem): PathItem; + quadraticCurveBy(handle: Point, to: Point): void; } /** @@ -2348,7 +2867,7 @@ declare module paper { * Creates a new path item and places it at the top of the active layer. * @param segments [optional] - An array of segments (or points to be converted to segments) that will be added to the path */ - constructor(segments?: Segment[] | Point[]); + constructor(segments?: Segment[] | Point[] | number[][]); /** * Creates a new path item from an object description and places it at the top of the active layer. @@ -2362,6 +2881,14 @@ declare module paper { */ constructor(pathData?: string); + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Path; + /** * The segments contained within the path. * Array of Segment objects @@ -2372,31 +2899,32 @@ declare module paper { * The first Segment contained within the path. * Read only. */ - firstSegment: Segment; + readonly firstSegment: Segment; /** * The last Segment contained within the path * Read only. */ - lastSegment: Segment; + readonly lastSegment: Segment; /** * The curves contained within the path. * Array of Curve objects + * Read only. */ - curves: Curve[]; + readonly curves: Curve[]; /** * The first Curve contained within the path. * Read only. */ - firstCurve: Curve; + readonly firstCurve: Curve; /** * The last Curve contained within the path. * Read only. */ - lastCurve: Curve; + readonly lastCurve: Curve; /** * Specifies whether the path is closed. If it is closed, Paper.js connects the first and last segments. @@ -2407,70 +2935,54 @@ declare module paper { * The approximate length of the path in points. * Read only. */ - length: number; + readonly length: number; /** * The area of the path in square points. Self-intersecting paths can contain sub-areas that cancel each other out. * Read only. */ - area: number; + readonly area: number; /** - * Specifies whether the path and all its segments are selected. Cannot be true on an empty path. - */ - fullySelected: boolean; - - /** - * Specifies whether the path is oriented clock-wise. - */ - clockwise: boolean; - - /** - * Returns a point that is guaranteed to be inside the path. - * Read only. - */ - interiorPoint: Point; - - /** - * Adds one or more segments to the end of the segments array of this path. + * Adds one segment to the end of the segments array of this path. * @param segment - the segment or point to be added. * Returns the added segment. This is not necessarily the same object, e.g. if the segment to be added already belongs to another path. */ - add(segment: Segment | Point): Segment; + add(segment: Segment | Point | number[]): Segment; /** - * Inserts one or more segments at a given index in the list of this path's segments. + * Inserts one segment at a given index in the list of this path's segments. * @param index - the index at which to insert the segment. * @param segment - the segment or point to be inserted. * Returns the added segment. This is not necessarily the same object, e.g. if the segment to be added already belongs to another path. */ - insert(index: number, segment: Segment | Point): Segment; + insert(index: number, segment: Segment | Point | number[]): Segment; /** * Adds an array of segments (or types that can be converted to segments) to the end of the segments array. * @param segments - Array of Segment objects - * Returns an array of the added segments. These segments are not necessarily the same objects, e.g. if the segment to be added already belongs to another path. + * @returns an array of the added segments. These segments are not necessarily the same objects, e.g. if the segment to be added already belongs to another path. */ - addSegments(segments: Segment[]): Segment[]; + addSegments(segments: Segment[] | Point[] | number[][]): Segment[]; /** * Inserts an array of segments at a given index in the path's segments array. * @param index - the index at which to insert the segments. * @param segments - the segments to be inserted. - * Returns an array of the added segments. These segments are not necessarily the same objects, e.g. if the segment to be added already belongs to another path. + * @returns an array of the added segments. These segments are not necessarily the same objects, e.g. if the segment to be added already belongs to another path. */ - insertSegments(index: number, segments: Segment[]): Segment[]; + insertSegments(index: number, segments: Segment[] | Point[] | number[][]): Segment[]; /** * Removes the segment at the specified index of the path's segments array. * @param index - the index of the segment to be removed - * Returns the removed segment + * @returns the removed segment */ removeSegment(index: number): Segment; /** * Removes all segments from the path's segments array. - * Returns an array containing the removed segments + * @returns an array containing the removed segments */ removeSegments(): Segment[]; @@ -2478,55 +2990,76 @@ declare module paper { * Removes the segments from the specified from index to the to index from the path's segments array. * @param from - the beginning index, inclusive * @param to [optional = segments.length] - the ending index - * Returns an array containing the removed segments + * @returns an array containing the removed segments */ removeSegments(from: number, to?: number): Segment[]; /** - * Converts the curves in a path to straight lines with an even distribution of points. The distance between the produced segments is as close as possible to the value specified by the maxDistance parameter. - * @param maxDistance - the maximum distance between the points + * Checks if any of the curves in the path have curve handles set. */ - flatten(maxDistance: number): void; + hasHandles(): boolean; /** - * Smooths a path by simplifying it. The path.segments array is analyzed and replaced by a more optimal set of segments, reducing memory usage and speeding up drawing. - * @param tolerance [optional = 2.5] - + * Clears the path’s handles by setting their coordinates to zero, turning the path into a polygon (or a polyline if it isn’t closed). */ - simplify(tolerance?: number): void; + clearHandles(): void; + + /** + * Divides the path on the curve at the given location into two curves, by inserting a new segment at the given location. + * @param location - the curve location at which to divide the existing curve by inserting a new segment + * @returns the newly inserted segment if the location is valid, {code null} otherwise + */ + divideAt(location: CurveLocation): Path; + + /** + * Divides the path on the curve at the given offset into two curves, by inserting a new segment at the given location. + * @param offset - the offset at which to divide the existing curve by inserting a new segment + * @returns the newly inserted segment if the location is valid, {code null} otherwise + */ + divideAt(offset: number): Path; /** * Splits the path at the given offset. After splitting, the path will be open. If the path was open already, splitting will result in two paths. * @param offset - the offset at which to split the path as a number between 0 and path.length - * Returns the newly created path after splitting, if any + * @returns the newly created path after splitting, if any */ split(offset: number): Path; /** * Splits the path at the given curve location. After splitting, the path will be open. If the path was open already, splitting will result in two paths. * @param location - the curve location at which to split the path - * Returns the newly created path after splitting, if any + * @returns the newly created path after splitting, if any */ split(location: CurveLocation): Path; /** * Splits the path at the given curve index and parameter. After splitting, the path will be open. If the path was open already, splitting will result in two paths. * @param index - the index of the curve in the path.curves array at which to split - * @param parameter - the parameter at which the curve will be split - * Returns the newly created path after splitting, if any + * @param offset - the offset at which to split the path as a number between 0 and path.length + * @returns the newly created path after splitting, if any */ - split(index: number, parameter: number): Path; - - /** - * Reverses the orientation of the path, by reversing all its segments. - */ - reverse(): void; + split(index: number, offset: number): Path; /** * Joins the path with the specified path, which will be removed in the process. * @param path - the path to join this path with - * Returns the joined path + * @param tolerance [optional] - the tolerance with which to decide if two segments are to be considered the same location when joining. default: 0 + * @returns the joined path */ - join(path: Path): Path; + join(path: Path, tolerance?: number): Path; + + /** + * Reduces the path by removing curves that have a length of 0, and unnecessary segments between two collinear flat curves. + * @param options [optional] - options for reducing the path. default { simplify: false } + * @param options.simplify - whether to be slightly tolerant of length when reducing the path. It not set the tolerance will be 1e-7 instead of 0. + */ + reducePath(options?: { simplify?: boolean; }): void; + + /** + * Attempts to create a new shape item with same geometry as this path item, and inherits all settings from it, similar to item.clone(). + * @param insert [optional] - specifies whether the new shape should be inserted into the scene graph. When set to true, it is inserted above the path item. default: true + */ + toShape(insert?: boolean): Shape; /** * Returns the curve location of the specified point if it lies on the path, null otherwise. @@ -2542,46 +3075,53 @@ declare module paper { /** * Returns the curve location of the specified offset on the path. - * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. - * @param isParameter [optional=false] - + * @param offset - the offset or time on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isTime [optional=false] - */ - getLocationAt(offset: number, isParameter?: boolean): CurveLocation; + getLocationAt(offset: number, isTime?: boolean): CurveLocation; /** * Calculates the point on the path at the given offset. Returns the point at the given offset - * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. - * @param isParameter [optional=false] - + * @param offset - the offset or time on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isTime [optional=false] - */ - getPointAt(offset: number, isPatameter?: boolean): Point; + getPointAt(offset: number, isTime?: boolean): Point; /** * Calculates the tangent vector of the path at the given offset. Returns the tangent vector at the given offset - * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. - * @param isParameter [optional=false] - + * @param offset - the offset or time on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isTime [optional=false] - */ - getTangentAt(offset: number, isPatameter?: boolean): Point; + getTangentAt(offset: number, isTime?: boolean): Point; /** * Calculates the normal vector of the path at the given offset. Returns the normal vector at the given offset - * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. - * @param isParameter [optional=false] - + * @param offset - the offset or time on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isTime [optional=false] - */ - getNormalAt(offset: number, isParameter?: boolean): Point; + getNormalAt(offset: number, isTime?: boolean): Point; + + /** + * Calculates the weighted tangent vector of the path at the given offset. + * @param offset - the offset or time on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isTime [optional=false] - + */ + getWeightedTangentAt(offset: number, isTime?: boolean): Point; + + /** + * Calculates the weighted normal vector of the path at the given offset. + * @param offset - the offset or time on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isTime [optional=false] - + */ + getWeightedNormalAt(offset: number, isTime?: boolean): Point; /** * Calculates the curvature of the path at the given offset. Curvatures indicate how sharply a path changes direction. A straight line has zero curvature, where as a circle has a constant curvature. The path's radius at the given offset is the reciprocal value of its curvature. * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. - * @param isParameter [optional=false] - - * @param point - the point for which we search the nearest location + * @param isTime [optional=false] - + * @param point [optional] - the point for which we search the nearest location */ - getCurvatureAt(offset: number, isParameter?: boolean, point?: Point): number; - - /** - * Returns the nearest point on the path to the specified point. - * @param point - the point for which we search the nearest point - */ - getNearestPoint(point: Point): Point; - + getCurvatureAt(offset: number, isTime?: boolean, point?: Point): number; } module Path { @@ -2598,6 +3138,14 @@ declare module paper { * @param object - an object literal containing properties describing the path's attributes */ constructor(object: any); + + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Line; } export class Circle extends Path { @@ -2613,6 +3161,14 @@ declare module paper { * @param object - an object literal containing properties describing the path's attributes */ constructor(object: any); + + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Circle; } export class Rectangle extends Path { @@ -2621,7 +3177,7 @@ declare module paper { * @param rectangle - the rectangle object describing the geometry of the rectangular path to be created. * @param radius [optional] - the size of the rounded corners default: null */ - constructor(rectangle: Rectangle, radius?: number); + constructor(rectangle: paper.Rectangle, radius?: number); /** * Creates a rectangular path item from a point and a size object. @@ -2642,6 +3198,14 @@ declare module paper { * @param object - an object literal containing properties describing the path's attributes */ constructor(object: any); + + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Rectangle; } export class Ellipse extends Path { @@ -2649,13 +3213,22 @@ declare module paper { * Creates an elliptical path item. * @param rectangle - the rectangle circumscribing the ellipse */ - constructor(rectangle: Rectangle); + constructor(rectangle: paper.Rectangle); /** * Creates an elliptical path item from the properties described by an object literal. * @param object - an object literal containing properties describing the path's attributes */ constructor(object: any); + + + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Ellipse; } export class Arc extends Path { @@ -2672,6 +3245,14 @@ declare module paper { * @param object - an object literal containing properties describing the path's attributes */ constructor(object: any); + + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Arc; } export class RegularPolygon extends Path { @@ -2688,6 +3269,14 @@ declare module paper { * @param object - an object literal containing properties describing the path's attributes */ constructor(object: any); + + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): RegularPolygon; } export class Star extends Path { @@ -2705,6 +3294,14 @@ declare module paper { * @param object - an object literal containing properties describing the path's attributes */ constructor(object: any); + + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): Star; } } @@ -2724,53 +3321,61 @@ declare module paper { * @param pathData - the SVG path-data that describes the geometry of this path. */ constructor(pathData: string); - + /** - * Specifies whether the compound path is oriented clock-wise. + * Specifies whether the path is closed. If it is closed, Paper.js connects the first and last segments. */ - clockwise: boolean; + closed: boolean; /** * The first Segment contained within the path. * Read Only */ - firstSegment: Segment; + readonly firstSegment: Segment; /** * The last Segment contained within the path. * Read Only */ - lastSegment: Segment; + readonly lastSegment: Segment; /** * All the curves contained within the compound-path, from all its child Path items. * Read Only */ - curves: Curve[]; + readonly curves: Curve[]; /** * The first Curve contained within the path. * Read Only */ - firstCurve: Curve; + readonly firstCurve: Curve; /** * The last Curve contained within the path. * Read only. */ - lastCurve: Curve; + readonly lastCurve: Curve; /** * The area of the path in square points. Self-intersecting paths can contain sub-areas that cancel each other out. * Read Only. */ - area: number; + readonly area: number; /** - * Reverses the orientation of all nested paths. + * The approximate length of the path in points. + * Read only. */ - reverse(): void; - + readonly length: number; + + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): CompoundPath; } /** * The Segment object represents the points of a path through which its Curve objects pass. The segments of a path can be accessed through its path.segments array. @@ -2807,11 +3412,6 @@ declare module paper { */ handleOut: Point; - /** - * Specifies whether the segment has no handles defined, meaning it connects two straight lines. - */ - linear: boolean; - /** * Specifies whether the point of the segment is selected. */ @@ -2821,48 +3421,83 @@ declare module paper { * The index of the segment in the path.segments array that the segment belongs to. * Read Only */ - index: number; + readonly index: number; /** * The path that the segment belongs to. * Read Only */ - path: Path; + readonly path: Path; /** * The curve that the segment belongs to. For the last segment of an open path, the previous segment is returned. * Read only. */ - curve: Curve; + readonly curve: Curve; /** * The curve location that describes this segment's position ont the path. * Read Only. */ - location: CurveLocation; + readonly location: CurveLocation; /** * The next segment in the path.segments array that the segment belongs to. If the segments belongs to a closed path, the first segment is returned for the last segment of the path. * Read Only. */ - next: Segment; + readonly next: Segment; /** * The previous segment in the path.segments array that the segment belongs to. If the segments belongs to a closed path, the last segment is returned for the first segment of the path. * Read Only. */ - previous: Segment; + readonly previous: Segment; /** - * Returns true if the the two segments are the beginning of two lines and if these two lines are running parallel. - * @param segment + * Checks if the segment has any curve handles set. */ - isColinear(segment: Segment): boolean; + hasHandles(): boolean; /** - * Returns true if the segment at the given index is the beginning of an orthogonal arc segment. The code looks at the length of the handles and their relation to the distance to the imaginary corner point. If the relation is kappa, then it's an arc. + * Checks if the segment connects two curves smoothly, meaning that its two handles are collinear and segment does not form a corner. */ - isArc(): boolean; + isSmooth(): boolean; + + /** + * Clears the segment’s handles by setting their coordinates to zero, turning the segment into a corner. + */ + clearHandles(): void; + + /** + * Smooths the bezier curves that pass through this segment by taking into account the segment’s position and distance to the neighboring segments and changing the direction and length of the segment’s handles accordingly without moving the segment itself. + * Two different smoothing methods are available: + * 'catmull-rom' uses the Catmull-Rom spline to smooth the segment. + * The optionally passed factor controls the knot parametrization of the algorithm: + * 0.0: the standard, uniform Catmull-Rom spline + * 0.5: the centripetal Catmull-Rom spline, guaranteeing no self-intersections + * 1.0: the chordal Catmull-Rom spline + * 'geometric' use a simple heuristic and empiric geometric method to smooth the segment’s handles. The handles were weighted, meaning that big differences in distances between the segments will lead to probably undesired results. + * The optionally passed factor defines the tension parameter (0…1), controlling the amount of smoothing as a factor by which to scale each handle. + * @param options [optional] - the smoothing options. default { type: 'catmull-rom', factor: 0.5 for 'catmull-rom', 0.4 for 'geometric'} + * @param options.type - the type of smoothing method: ‘catmull-rom’, ‘geometric’ + * @param options.factor - the factor parameterizing the smoothing method — default: 0.5 for 'catmull-rom', 0.4 for 'geometric' + */ + smooth(options?:{ type?: string; factor?: number; }): void; + + /** + * Checks if the this is the first segment in the path.segments array. + */ + isFirst(): boolean; + + /** + * Checks if the this is the last segment in the path.segments array. + */ + isLast(): boolean; + + /** + * Returns the reversed the segment, without modifying the segment itself. + */ + reversed(): Segment; /** * Returns the reversed the segment, without modifying the segment itself. @@ -2874,6 +3509,17 @@ declare module paper { */ remove(): boolean; + /** + * Checks whether the segment is equal to that of the supplied segment. + * @param segment - the segment to check against + */ + equals(segment: Segment): boolean; + + /** + * Returns a copy of the segment. + */ + clone(): Segment; + /** * A string representation of the segment */ @@ -2885,6 +3531,14 @@ declare module paper { */ transform(matrix: Matrix): void; + /** + * Interpolates between the two specified segments and sets the point and handles of this segment accordingly. + * @param from - the segment defining the geometry when factor is 0 + * @param to - the segment defining the geometry when factor is 1 + * @param factor - the interpolation coefficient, typically between 0 and 1, but extrapolation is possible too + */ + interpolate(from: Segment, to: Segment, factor: number): void; + } /** * The Curve object represents the parts of a path that are connected by two following Segment objects. The curves of a path can be accessed through its path.curves array. @@ -2932,48 +3586,68 @@ declare module paper { * The first segment of the curve. * Read Only. */ - segment1: Segment; + readonly segment1: Segment; /** * The second segment of the curve. * Read only. */ - segment2: Segment; + readonly segment2: Segment; /** * The path that the curve belongs to. * Read only. */ - path: Path; + readonly path: Path; /** * The index of the curve in the path.curves array. * Read Only. */ - index: number; + readonly index: number; /** * The next curve in the path.curves array that the curve belongs to. * Read Only */ - next: Curve; + readonly next: Curve; /** * The previous curve in the path.curves array that the curve belongs to. * Read Only. */ - previous: Curve; + readonly previous: Curve; /** * Specifies whether the points and handles of the curve are selected. */ selected: boolean; + /** + * An array of 8 float values, describing this curve’s geometry in four absolute x/y pairs (point1, handle1, handle2, point2). This format is used internally for efficient processing of curve geometries, e.g. when calculating intersections or bounds. + * Note that the handles are converted to absolute coordinates. + * Read only. + */ + readonly values: number[]; + + /** + * An array of 4 point objects, describing this curve’s geometry in absolute coordinates (point1, handle1, handle2, point2). + * Note that the handles are converted to absolute coordinates. + * Read only. + */ + readonly points: Point[]; + /** * The approximated length of the curve in points. * Read Only. */ - length: number; + readonly length: number; + + /** + * The area that the curve’s geometry is covering. + * Read only. + */ + readonly area: number; /** * The bounding rectangle of the curve excluding stroke width. @@ -2991,21 +3665,67 @@ declare module paper { handleBounds: Rectangle; /** - * Checks if this curve is linear, meaning it does not define any curve handle. + * Returns a copy of the curve. */ - isLinear(): boolean; + clone(): Curve; /** - * TODO? + * Returns a string representation of the curve */ - //isHorizontal(): boolean; + toString(): string; + + /** + * Determines the type of cubic Bézier curve via discriminant classification, as well as the curve-time parameters of the associated points of inflection, loops, cusps, etc. + * Returns the curve classification information as an object + * type - the type of Bézier curve, possible values are: ‘line’, ‘quadratic’, ‘serpentine’, ‘cusp’, ‘loop’, ‘arch’ + * roots - the curve-time parameters of the associated points of inflection for serpentine curves, loops, cusps, etc + */ + classify(): { type: string, roots: number[] }; + + /** + * Removes the curve from the path that it belongs to, by removing its second segment and merging its handle with the first segment. + */ + remove(): boolean; + + /** + * Checks if the this is the first curve in the path.curves array. + */ + isFirst(): boolean; + + /** + * Checks if the this is the last curve in the path.curves array. + */ + isLast(): boolean; + + /** + * Creates a new curve as a sub-curve from this curve, its range defined by the given curve-time parameters. If from is larger than to, then the resulting curve will have its direction reversed. + * @param from - the curve-time parameter at which the sub-curve starts + * @param to - the curve-time parameter at which the sub-curve ends + */ + getPart(from: number, to: number): Curve; /** * Divides the curve into two curves at the given offset. The curve itself is modified and becomes the first part, the second part is returned as a new curve. If the modified curve belongs to a path item, the second part is also added to the path. - * @param offset [optional] - the offset on the curve at which to split, or the curve time parameter if isParameter is true default: 0.5 - * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + * @param offset [optional] - the offset on the curve at which to split, or the curve time parameter if isParameter is true. default: 0.5 + * @param isTime [optional] - pass true if offset is a curve time parameter. default: false + * @returns the second part of the divided curve if the location is valid, {code null} otherwise */ - divide(offset?: number, isParameter?: boolean): Curve; + divide(offset?: number, isTime?: boolean): Curve; + + /** + * Divides the curve into two curves at the given offset or location. The curve itself is modified and becomes the first part, the second part is returned as a new curve. If the curve belongs to a path item, a new segment is inserted into the path at the given location, and the second part becomes a part of the path as well. + * @param location - the offset or location on the curve at which to divide + * @returns the second part of the divided curve if the location is valid, {code null} otherwise + */ + divideAt(location: number | CurveLocation): Curve; + + /** + * Divides the curve into two curves at the given offset or location. The curve itself is modified and becomes the first part, the second part is returned as a new curve. If the curve belongs to a path item, a new segment is inserted into the path at the given location, and the second part becomes a part of the path as well. + * @param time - the curve-time parameter on the curve at which to divide + * @param setHandles - whether to set handles on the new curves. default is the output of hasHandles(). + * @returns the second part of the divided curve if the location is valid, {code null} otherwise + */ + divideAtTime(time: number, setHandles?:boolean): Curve; /** * Splits the path this curve belongs to at the given offset. After splitting, the path will be open. If the path was open already, splitting will result in two paths. @@ -3014,46 +3734,100 @@ declare module paper { */ split(offset?: number, isParameter?: boolean): Path; + /** + * Splits the path this curve belongs to at the given offset. After splitting, the path will be open. If the path was open already, splitting will result in two paths. + * @param location - the offset or location on the curve at which to split + * @returns the newly created path after splitting, if any + */ + splitAt(location: number | CurveLocation): Path; + + /** + * Splits the path this curve belongs to at the given offset. After splitting, the path will be open. If the path was open already, splitting will result in two paths. + * @param time - the curve-time parameter on the curve at which to split + */ + splitAtTime(time: number): Path; + /** * Returns a reversed version of the curve, without modifying the curve itself. */ - reverse(): Curve; + reversed(): Curve; + + /** + * Clears the curve’s handles by setting their coordinates to zero, turning the curve into a straight line. + */ + clearHandles(): void; /** - * Removes the curve from the path that it belongs to, by merging its two path segments. - * returns true if the curve was removed, false otherwise + * Checks if this curve has any curve handles set. */ - remove(): boolean; + hasHandles(): boolean; /** - * Returns a copy of the curve. + * Checks if this curve has any length. + * @param epsilon [optional] - the epsilon against which to compare the curve’s length. default: 0 */ - clone(): Curve; + hasLength(epsilon?: number): boolean; /** - * returns a string representation of the curve + * Checks if this curve appears as a straight line. This can mean that it has no handles defined, or that the handles run collinear with the line that connects the curve’s start and end point, not falling outside of the line. */ - toString(): string; + isStraight(): boolean; + + /** + * Checks if this curve is linear, meaning it does not define any curve handle. + */ + isLinear(): boolean; + + /** + * Checks if the the two curves describe straight lines that are collinear, meaning they run in parallel. + * @param curve - the other curve to check against + */ + isCollinear(curve: Curve): boolean; + + /** + * Checks if the curve is a straight horizontal line. + */ + isHorizontal(): boolean; + + /** + * Checks if the curve is a straight vertical line. + */ + isVertical(): boolean; /** * Calculates the curve time parameter of the specified offset on the path, relative to the provided start parameter. If offset is a negative value, the parameter is searched to the left of the start parameter. If no start parameter is provided, a default of 0 for positive values of offset and 1 for negative values of offset. - * @param offset - - * @param start [optional] - + * @param offset - the offset at which to find the curve-time, in curve length units + * @param start [optional] - the curve-time in relation to which the offset is determined + * @deprecated use getTimeAt instead */ - getParameterAt(offset: Point, start?: number): number; + getParameterAt(offset: number, start?: number): number; /** * Returns the curve time parameter of the specified point if it lies on the curve, null otherwise. * @param point - the point on the curve. + * @deprecated use getTimeOf instead */ getParameterOf(point: Point): number; /** * Calculates the curve location at the specified offset or curve time parameter. * @param offset - the offset on the curve, or the curve time parameter if isParameter is true - * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + * @param isTime [optional] - pass true if offset is a curve time parameter. default: false */ - getLocationAt(offset: number, isParameter?: boolean): CurveLocation; + getLocationAt(offset: number, isTime?: boolean): CurveLocation; + + /** + * Calculates the curve-time parameter of the specified offset on the path, relative to the provided start parameter. If offset is a negative value, the parameter is searched to the left of the start parameter. If no start parameter is provided, a default of 0 for positive values of offset and 1 for negative values of offset. + * @param offset - the offset at which to find the curve-time, in curve length units + * @param start [optional] - the curve-time in relation to which the offset is determined + */ + getTimeAt(offset: number, start?: number): number; + + /** + * Calculates the curve offset at the specified curve-time parameter on the curve. + * @param time - the curve-time parameter on the curve + */ + getOffsetAtTime(time: number): number; /** * Returns the curve location of the specified point if it lies on the curve, null otherwise. @@ -3067,33 +3841,71 @@ declare module paper { */ getOffsetOf(point: Point): number; + /** + * Returns the curve-time parameter of the specified point if it lies on the curve, null otherwise. Note that if there is more than one possible solution in a self-intersecting curve, the first found result is returned. + * @param point - the point on the curve + */ + getTimeOf(point: Point): number; + + /** + * Returns the nearest location on the curve to the specified point. + * @param point - the point for which we search the nearest location + */ + getNearestLocation(point: Point): CurveLocation; + + /** + * Returns the nearest point on the curve to the specified point. + * @param point - the point for which we search the nearest point + */ + getNearestPoint(point: Point): Point; + /** * Calculates the point on the curve at the given offset. * @param offset - the offset on the curve, or the curve time parameter if isParameter is true - * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + * @param isTime [optional] - pass true if offset is a curve time parameter. default: false */ - getPointAt(offset: number, isParameter?: boolean): Point; + getPointAt(offset: number, isTime?: boolean): Point; /** * Calculates the tangent vector of the curve at the given offset. * @param offset - the offset on the curve, or the curve time parameter if isParameter is true - * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + * @param isTime [optional] - pass true if offset is a curve time parameter. default: false */ - getTangentAt(offset: number, isParameter?: boolean): Point; + getTangentAt(offset: number, isTime?: boolean): Point; /** * Calculates the normal vector of the curve at the given offset. * @param offset - the offset on the curve, or the curve time parameter if isParameter is true - * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + * @param isTime [optional] - pass true if offset is a curve time parameter. default: false */ - getNormalAt(offset: number, isParameter?: boolean): Point; + getNormalAt(offset: number, isTime?: boolean): Point; + + /** + * Calculates the weighted tangent vector of the curve at the given offset. + * @param offset - the offset on the curve, or the curve time parameter if isParameter is true + * @param isTime [optional] - pass true if offset is a curve time parameter. default: false + */ + getWeightedTangentAt(offset: number, isTime?: boolean): Point; + + /** + * Calculates the weighted normal vector of the curve at the given offset. + * @param offset - the offset on the curve, or the curve time parameter if isParameter is true + * @param isTime [optional] - pass true if offset is a curve time parameter. default: false + */ + getWeightedNormalAt(offset: number, isTime?: boolean): Point; /** * Calculates the curvature of the curve at the given offset. Curvatures indicate how sharply a curve changes direction. A straight line has zero curvature, where as a circle has a constant curvature. The curve's radius at the given offset is the reciprocal value of its curvature. * @param offset - the offset on the curve, or the curve time parameter if isParameter is true - * @param isParameter - pass true if offset is a curve time parameter. default: false + * @param isTime - pass true if offset is a curve time parameter. default: false */ - getCurvatureAt(offset: number, isParameter?: boolean): Point; + getCurvatureAt(offset: number, isTime?: boolean): Point; + + /** + * Returns all intersections between two Curve objects as an array of CurveLocation objects. + * @param curve - the other curve to find the intersections with (if the curve itself or null is passed, the self intersection of the curve is returned, if it exists) + */ + getIntersections(curve: Curve): CurveLocation[]; } /** @@ -3105,73 +3917,98 @@ declare module paper { /** * Creates a new CurveLocation object. * @param curve - - * @param parameter - - * @param point - + * @param time - + * @param point [optional] */ - constructor(curve: Curve, parameter: number, point: Point); + constructor(curve: Curve, time: number, point?: Point); /** * The segment of the curve which is closer to the described location. * Read Only */ - segment: Segment; + readonly segment: Segment; /** * The curve that this location belongs to. * Read Only */ - curve: Curve; - - /** - * The curve location on the intersecting curve, if this location is the result of a call to pathItem.getIntersections(path) / Curve#getIntersections(curve). - * Read Only - */ - intersection: CurveLocation; + readonly curve: Curve; /** * The path this curve belongs to, if any. * Read Only */ - path: Path; + readonly path: Path; /** * The index of the curve within the path.curves list, if the curve is part of a Path item. * Read Only. */ - index: number; + readonly index: number; + + /** + * The curve parameter, as used by various bezier curve calculations. It is value between 0 (beginning of the curve) and 1 (end of the curve). + * Read only. + * @deprecated use time instead + */ + readonly parameter: number; + + /** + * The curve-time parameter, as used by various bezier curve calculations. It is value between 0 (beginning of the curve) and 1 (end of the curve). + * Read Only. + */ + readonly time: number; + + /** + * The point which is defined by the curve and time. + * Read Only. + */ + readonly point: Point; /** * The length of the path from its beginning up to the location described by this object. If the curve is not part of a path, then the length within the curve is returned instead. * Read only. */ - offset: number; + readonly offset: number; /** * The length of the curve from its beginning up to the location described by this object. * Read Only. */ - curveOffset: number; + readonly curveOffset: number; /** - * The curve parameter, as used by various bezier curve calculations. It is value between 0 (beginning of the curve) and 1 (end of the curve). - * Read only. + * The curve location on the intersecting curve, if this location is the result of a call to pathItem.getIntersections(path) / Curve#getIntersections(curve). + * Read Only. */ - parameter: number; + readonly intersection: CurveLocation; /** - * The point which is defined by the curve and parameter. + * The tangential vector to the curve at the given location. * Read only. */ - point: Point; + readonly tangent: Point; + + /** + * The normal vector to the curve at the given location. + * Read only. + */ + readonly normal: Point; + + /** + * The curvature of the curve at the given location. + * Read only. + */ + readonly curvature: number; /** * The distance from the queried point to the returned location. * Read Only. */ - distance: number; + readonly distance: number; /** - * Checks whether tow CurveLocation objects are describing the same location on a path, by applying the same tolerances as elsewhere when dealing with curve time parameters. + * Checks whether two CurveLocation objects are describing the same location on a path, by applying the same tolerances as elsewhere when dealing with curve time parameters. * @param location CurveLocation */ equals(location: CurveLocation): boolean; @@ -3181,6 +4018,21 @@ declare module paper { */ toString(): string; + /** + * Checks if the location is an intersection with another curve and is merely touching the other curve, as opposed to crossing it. + */ + isTouching(): boolean; + + /** + * Checks if the location is an intersection with another curve and is crossing the other curve, as opposed to just touching it. + */ + isCrossing(): boolean; + + /** + * Checks if the location is an intersection with another curve and is part of an overlap between the two involved paths. + */ + hasOverlap(): boolean; + } /** * A Project object in Paper.js is what usually is referred to as the document: The top level object that holds all the items contained in the scene graph. As the term document is already taken in the browser context, it is called Project. @@ -3200,7 +4052,7 @@ declare module paper { * The reference to the project's view. * Read only. */ - view: View; + readonly view: View; /** * The currently active path style. All selected items and newly created items will be styled with this style. @@ -3211,23 +4063,30 @@ declare module paper { * The index of the project in the paperScope.projects list. * Read Only */ - index: number; + readonly index: number; /** * The layers contained within the project. + * Read Only. */ - layers: Layer[]; + readonly layers: Layer[]; /** * The layer which is currently active. New items will be created on this layer by default. * Read Only. */ - activeLayer: Layer; + readonly activeLayer: Layer; /** * The symbols contained within the project. */ - symbols: Symbol[]; + readonly symbols: Symbol[]; + + /** + * The selected items contained within the project. + * Read only. + */ + readonly selectedItems: Item[]; /** * Activates this project, so all newly created items will be placed in it. @@ -3270,28 +4129,56 @@ declare module paper { insertLayer(index: number, layer: Layer): Layer; /** - * Perform a hit-test on the items contained within the project at the location of the specified point. + * Perform a hit-test on the items and its children within the project at the location of the specified point. * The options object allows you to control the specifics of the hit-test and may contain a combination of the following values: * @param point - the point where the hit-test should be performed * @param options.tolerance -the tolerance of the hit-test in points. Can also be controlled through paperScope.settings.hitTolerance * @param options.class - only hit-test again a certain item class and its sub-classes: Group, Layer, Path, CompoundPath, Shape, Raster, PlacedSymbol, PointText, etc. + * @param options.match -a match function to be called for each found hit result: Return true to return the result, false to keep searching * @param options.fill - hit-test the fill of items. * @param options.stroke - hit-test the stroke of path items, taking into account the setting of stroke color and width. * @param options.segments - hit-test for segment.point of Path items. * @param options.curves - hit-test the curves of path items, without taking the stroke color or width into account. * @param options.handles - hit-test for the handles. (segment.handleIn / segment.handleOut) of path segments. * @param options.ends - only hit-test for the first or last segment points of open path items. - * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). + * @param options.position - hit-test the item.position of of items, which depends on the setting of item.pivot. * @param options.center - hit-test the rectangle.center of the bounding rectangle of items (item.bounds). + * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). * @param options.guides - hit-test items that have Item#guide set to true. * @param options.selected - only hit selected items. */ - hitTest(point: Point, options?: { tolerance?: number; class?: string; fill?: boolean; stroke?: boolean; segments?: boolean; curves?: boolean; handles?: boolean; ends?: boolean; bounds?: boolean; center?: boolean; guides?: boolean; selected?: boolean; }): HitResult; + hitTest(point: Point, options?: IHitTestOptions): HitResult; + + /** + * Performs a hit-test on the item and its children (if it is a Group or Layer) at the location of the specified point, returning all found hits. + * The options object allows you to control the specifics of the hit-test and may contain a combination of the following values: + * @param point - the point where the hit-test should be performed + * @param options.tolerance -the tolerance of the hit-test in points. Can also be controlled through paperScope.settings.hitTolerance + * @param options.class - only hit-test again a certain item class and its sub-classes: Group, Layer, Path, CompoundPath, Shape, Raster, PlacedSymbol, PointText, etc. + * @param options.match -a match function to be called for each found hit result: Return true to return the result, false to keep searching + * @param options.fill - hit-test the fill of items. + * @param options.stroke - hit-test the stroke of path items, taking into account the setting of stroke color and width. + * @param options.segments - hit-test for segment.point of Path items. + * @param options.curves - hit-test the curves of path items, without taking the stroke color or width into account. + * @param options.handles - hit-test for the handles. (segment.handleIn / segment.handleOut) of path segments. + * @param options.ends - only hit-test for the first or last segment points of open path items. + * @param options.position - hit-test the item.position of of items, which depends on the setting of item.pivot. + * @param options.center - hit-test the rectangle.center of the bounding rectangle of items (item.bounds). + * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). + * @param options.guides - hit-test items that have Item#guide set to true. + * @param options.selected - only hit selected items. + * */ + hitTestAll(point: Point, options?: IHitTestOptions): HitResult[]; /** * Fetch items contained within the project whose properties match the criteria in the specified object. * Extended matching is possible by providing a compare function or regular expression. Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x- coordinate to match all points with that x-value). Partial matching does work for item.data. * Matching items against a rectangular area is also possible, by setting either match.inside or match.overlapping to a rectangle describing the area in which the items either have to be fully or partly contained. + * @param match.recursive - whether to loop recursively through all children, or stop at the current level — default: true + * @param match.match - a match function to be called for each item, allowing the definition of more flexible item checks that are not bound to properties. If no other match properties are defined, this function can also be passed instead of the options object + * @param match.class - the constructor function of the item type to match against + * @param match.inside - the rectangle in which the items need to be fully contained. + * @param match.overlapping - the rectangle with which the items need to at least partly overlap. */ getItems(match: any): Item[]; @@ -3317,22 +4204,37 @@ declare module paper { /** * Exports the project with all its layers and child items as an SVG DOM, all contained in one top level SVG group node. - * @param options [optional] the export options, default: { asString: false, precision: 5, matchShapes: false } + * @param options [optional] the export options, default: { asString: false, precision: 5, matchShapes: false, bounds: 'view', matrix: paper.view.matrix, embedImages: true } * @param options.asString - whether a SVG node or a String is to be returned. * @param options.precision - the amount of fractional digits in numbers used in SVG data. * @param options.matchShapes - whether path items should tried to be converted to shape items, if their geometries can be made to match + * @param options.bounds - the bounds of the area to export, either as a string (‘view’, content’), or a Rectangle object: 'view' uses the view bounds, 'content' uses the stroke bounds of all content. + * @param options.matrix - the matrix with which to transform the exported content: If options.bounds is set to 'view', paper.view.matrix is used, for all other settings of options.bounds the identity matrix is used. + * @param options.embedImages: whether raster images should be embedded as base64 data inlined in the xlink:href attribute, or kept as a link to their external URL. */ - exportSVG(options?: { asString?: boolean; precision?: number; matchShapes?: boolean }): SVGElement; + exportSVG(options?: { asString?: boolean; precision?: number; matchShapes?: boolean; bounds?: string | Rectangle; matrix?: Matrix; embedImages?: boolean; }): SVGElement; /** * Converts the provided SVG content into Paper.js items and adds them to the active layer of this project. * Note that the project is not cleared first. You can call project.clear() to do so. * @param svg - the SVG content to import - * @param options [optional] - the import options, default: { expandShapes: false } + * @param options [optional] - the import options, default: { expandShapes: false, insert: true, applyMatrix: paperScope.settings.applyMatrix } * @param options.expandShapes - whether imported shape items should be expanded to path items. + * @param options.onLoad - the callback function to call once the SVG content is loaded from the given URL receiving two arguments: the converted item and the original svg data as a string. Only required when loading from external resources. + * @param options.onError - the callback function to call if an error occurs during loading. Only required when loading from external resources. + * @param options.insert: Boolean — whether the imported items should be added to the item that importSVG() is called on. + * @param options.applyMatrix Boolean — whether the imported items should have their transformation matrices applied to their contents or not. */ - importSVG(svg: SVGElement | string, options?: any): Item; + importSVG(svg: SVGElement | string, options?: { expandShapes?: boolean; onLoad?: (item: Item, svg: string) => void; onError?: (message: string, status: number) => void; insert?: true; applyMatrix?: Matrix; }): Item; + /** + * Converts the provided SVG content into Paper.js items and adds them to the active layer of this project. + * Note that the project is not cleared first. You can call project.clear() to do so. + * @param svg - the SVG content to import + * @param onLoad [optional] - the callback function to call once the SVG content is loaded from the given URL receiving two arguments: the converted item and the original svg data as a string. Only required when loading from external resources. + */ + importSVG(svg: SVGElement | string, onLoad?: (item: Item, svg: string) => void): Item; + } /** * Symbols allow you to place multiple instances of an item in your project. This can save memory, since all instances of a symbol simply refer to the original item and it can speed up moving around complex objects, since internal properties such as segment lists and gradient positions don't need to be updated with every transformation. @@ -3350,7 +4252,7 @@ declare module paper { * The project that this symbol belongs to. * Read Only. */ - project: Project; + readonly project: Project; /** * The symbol definition. @@ -3368,6 +4270,12 @@ declare module paper { */ clone(): Symbol; + /** + * Checks whether the symbol’s definition is equal to the supplied symbol. + * @param symbol Symbol + */ + equals(symbol: Symbol): boolean; + } /** * Style is used for changing the visual styles of items contained within a Paper.js project and is returned by item.style and project.currentStyle. @@ -3380,7 +4288,7 @@ declare module paper { * The view that this style belongs to. * Read only. */ - view?: View; + readonly view?: View; /** * The color of the stroke. @@ -3389,38 +4297,45 @@ declare module paper { /** * The width of the stroke. + * Default: 1 */ strokeWidth?: number; /** * The shape to be used at the beginning and end of open Path items, when they have a stroke. - * String('round', 'square', 'butt' + * Values: 'round', 'square', 'butt' + * Default: 'butt' */ strokeCap?: string; /** * The shape to be used at the segments and corners of Path items when they have a stroke. - * String('miter', 'round', 'bevel') + * Values: 'miter', 'round', 'bevel' + * Default: 'miter' */ strokeJoin?: string; /** * Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke. + * Default: true */ strokeScaling?: boolean; /** * The dash offset of the stroke. + * Default: 0 */ dashOffset?: number; /** * Specifies an array containing the dash and gap lengths of the stroke. + * Default: [] */ dashArray?: number[]; /** * The miter limit of the stroke. When two line segments meet at a sharp angle and miter joins have been specified for strokeJoin, it is possible for the miter to extend far beyond the strokeWidth of the path. The miterLimit imposes a limit on the ratio of the miter length to the strokeWidth. + * Default: 10 */ miterLimit?: number; @@ -3429,6 +4344,13 @@ declare module paper { */ fillColor?: Color | string; + /** + * The fill-rule with which the shape gets filled. Please note that only modern browsers support fill-rules other than 'nonzero'. + * Values: 'nonzero', 'evenodd' + * Default: 'nonzero' + */ + fillRule?: string; + /** * The shadow color. */ @@ -3436,11 +4358,13 @@ declare module paper { /** * The shadow's blur radius. + * Default: 0 */ shadowBlur?: number; /** * The shadow's offset. + * Default: 0 */ shadowOffset?: Point; @@ -3450,27 +4374,33 @@ declare module paper { selectedColor?: Color | string; /** - * The font-family to be used in text content. default 'sans-serif' + * The font-family to be used in text content. + * Default: 'sans-serif' */ fontFamily?: string; /** * The font-weight to be used in text content. + * Default: 'normal' */ fontWeight?: string | number; /** * The font size of text content, as {@Number} in pixels, or as {@String} with optional units 'px', 'pt' and 'em'. + * Default: 10 */ fontSize?: string | number; /** * The text leading of text content. + * Default: fontSize * 1.2 */ leading?: number | string; /** - * The justification of text paragraphs. default "left" + * The justification of text paragraphs. + * Values: 'left', 'right', 'center' + * Default: 'left' */ justification?: string; @@ -3570,10 +4500,10 @@ declare module paper { constructor(color: Gradient, origin: Point, destination: Point, highlight?: Point); /** - * Creates a RGB Color object. - * @param hex - the RGB color in hex, i.e. #000000 + * Creates a RGB Color object from CSS string + * @param css - the RGB color in hex, i.e. #000000, rbga, i.e. rgba(0,0,0,0) or named color. */ - constructor(hex: string); + constructor(css: string); /** * The type of the color as a string. @@ -3585,7 +4515,7 @@ declare module paper { * The color components that define the color, including the alpha value if defined. * Read Only. */ - components: number; + readonly components: number; /** * The color's alpha value as a number between 0 and 1. @@ -3635,14 +4565,61 @@ declare module paper { lightness: number; /** - * The gradient object describing the type of gradient and the stops. + * The gradient object describing the type of gradient and the stops. Only defined if the color was constructed as a gradient. */ - gradient: Gradient; + gradient?: Gradient; + + /** + * The starting point of the gradient. Only defined if the color was constructed as a gradient. + */ + origin?: Point; + + /** + * The ending point of the gradient. Only defined if the color was constructed as a gradient. + */ + destination?: Point; /** - * The highlight point of the gradient. + * The highlight point of the gradient. Only defined if the color was constructed as a gradient. */ - highlight: Point; + highlight?: Point; + + /** + * Sets color to a RGB Color object. + * @param red - the amount of red in the color as a value between 0 and 1 + * @param green - the amount of green in the color as a value between 0 and 1 + * @param blue - the amount of blue in the color as a value between 0 and 1 + * @param alpha [optional] - the alpha of the color as a value between 0 and 1 + */ + set(red: number, green: number, blue: number, alpha?: number): void; + + /** + * Sets color to a gray Color object. + * @param gray - the amount of gray in the color as a value between 0 and 1 + * @param alpha [optional] - the alpha of the color as a value between 0 and 1 + */ + set(gray: number, alpha?: number): void; + + /** + * Sets color to a HSB, HSL or gradient Color object from the properties of the provided object: + * @param object - an object describing the components and properties of the color. + */ + set(object: IHSBColor | IHSLColor | IGradientColor): void; + + /** + * Sets color to a gradient Color object. + * @param gradient - + * @param origin - + * @param destination - + * @param highlight [optional] - + */ + set(color: Gradient, origin: Point, destination: Point, highlight?: Point): void; + + /** + * Sets color to a RGB Color object from CSS string + * @param css - the RGB color in hex, i.e. #000000, rbga, i.e. rgba(0,0,0,0) or named color. + */ + set(css: string): void; /** * Converts the color another type. @@ -3683,12 +4660,73 @@ declare module paper { */ transform(matrix: Matrix): void; + /** + * Returns the addition of the supplied value to both coordinates of the color as a new color. The object itself is not modified! + * @param number - the number to add + */ + add(number: number): Color; + + /** + * Returns the addition of the supplied color to the color as a new color. The object itself is not modified! + * @param color - the color to add + */ + add(color: Color): Color; + + /** + * Returns the subtraction of the supplied value to both coordinates of the color as a new color. The object itself is not modified! + * @param number - the number to subtract + */ + subtract(number: number): Color; + + /** + * Returns the subtraction of the supplied color to the color as a new color. The object itself is not modified! + * @param color - the color to subtract + */ + subtract(color: Color): Color; + + /** + * Returns the multiplication of the supplied value to both coordinates of the color as a new color. The object itself is not modified! + * @param number - the number to multiply + */ + multiply(number: number): Color; + + /** + * Returns the multiplication of the supplied color to the color as a new color. The object itself is not modified! + * @param color - the color to multiply + */ + multiply(color: Color): Color; + + /** + * Returns the division of the supplied value to both coordinates of the color as a new color. The object itself is not modified! + * @param number - the number to divide + */ + divide(number: number): Color; + + /** + * Returns the division of the supplied color to the color as a new color. The object itself is not modified! + * @param color - the color to divide + */ + divide(color: Color): Color; + } /** * The Gradient object. */ export class Gradient { + /** + * Creates a Gradient object. + * @param stops [optional] - Array of GradientStops + * @param radial [optional] - Whether the gradient is radial or linear + */ + constructor(stops?:GradientStop[] | string[] | (string|number)[][], radial?:boolean); + + /** + * Creates a Gradient object. + * @param object [optional] - an object literal containing the properties to be set on the group. + */ + constructor(object?:any); + /** * The gradient stops on the gradient ramp. */ @@ -3721,12 +4759,30 @@ declare module paper { * @param color [optional] - the color of the stop, default: new Color(0, 0, 0) * @param rampPoint [optional] - the position of the stop on the gradient ramp as a value between 0 and 1, default: 0 */ - constructor(color?: Color, rampPoint?: number); + constructor(color?: Color | string, rampPoint?: number); + + /** + * Creates a new GradientStop object. + * @param object [optional] - an object literal containing the properties to be set on the group. + */ + constructor(object?: any); + + /** + * Creates a new GradientStop object. + * @param array [optional] - an object literal containing the properties to be set on the group. + */ + constructor(array?: [string, number]); + + /** + * The ramp-point of the gradient stop as a value between 0 and 1. + * @deprecated use offset instead. + */ + rampPoint: number; /** * The ramp-point of the gradient stop as a value between 0 and 1. */ - rampPoint: number; + offset: number; /** * The color of the gradient stop. @@ -3744,25 +4800,30 @@ declare module paper { */ export class View { + /** + * Controls whether the view is automatically updated in the next animation frame on changes, or whether you prefer to manually call update() or requestUpdate() after changes. Note that this is true by default, except for Node.js, where manual updates make more sense. + */ + autoUpdate: boolean; + /** * The underlying native element. * Read Only. */ - element: HTMLCanvasElement; + readonly element: HTMLCanvasElement; /** * The ratio between physical pixels and device-independent pixels (DIPs) of the underlying canvas / device. * It is 1 for normal displays, and 2 or more for high-resolution displays. * Read only. */ - pixelRatio: number; + readonly pixelRatio: number; /** * The resoltuion of the underlying canvas / device in pixel per inch (DPI). * It is 72 for normal displays, and 144 for high-resolution displays with a pixel-ratio of 2. * Read only. */ - resolution: number; + readonly resolution: number; /** * The size of the view. Changing the view's size will resize it's underlying element. @@ -3779,7 +4840,7 @@ declare module paper { * The size of the visible area in project coordinates. * Read only. */ - size: Size; + readonly size: Size; /** * The center of the visible area in project coordinates. @@ -3791,6 +4852,21 @@ declare module paper { */ zoom: number; + /** + * The current rotation angle of the view, as described by its matrix. + */ + rotation: number; + + /** + * The current scale factor of the view, as described by its matrix. + */ + scaling: number; + + /** + * The view’s transformation matrix, defining the view onto the project’s contents (position, zoom level, rotation, etc). + */ + matrix: Matrix; + /** * Handler function to be called on each frame of an animation. * The function receives an event object which contains information about the frame event: @@ -3804,45 +4880,53 @@ declare module paper { /** * The function to be called when the mouse button is pushed down on the item. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseDown: (event: MouseEvent) => void; + onMouseDown: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse position changes while the mouse is being dragged. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseDrag: (event: MouseEvent) => void; + onMouseDrag: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse button is released over the item. * The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseUp: (event: MouseEvent) => void; + onMouseUp: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onClick: (event: MouseEvent) => void; + onClick: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse double clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onDoubleClick: (event: MouseEvent) => void; + onDoubleClick: (event: MouseEvent) => void | boolean; /** * The function to be called repeatedly when the mouse moves on top of the item. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseMove: (event: MouseEvent) => void; + onMouseMove: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse moves over the item. This function will only be called again, once the mouse moved outside of the item first. The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseEnter: (event: MouseEvent) => void; + onMouseEnter: (event: MouseEvent) => void | boolean; /** * The function to be called when the mouse moves out of the item. * The function receives a MouseEvent object which contains information about the mouse event. + * Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with event.stopPropagation() or by returning false from the handler. */ - onMouseLeave: (event: MouseEvent) => void; + onMouseLeave: (event: MouseEvent) => void | boolean; /** * Removes this view from the project and frees the associated element. @@ -3854,6 +4938,11 @@ declare module paper { */ isVisible(): boolean; + /** + * Checks whether the view is inserted into the browser DOM. + */ + isInserted(): boolean; + /** * Scrolls the view by the given vector. * @param point - the vector to scroll by @@ -3876,25 +4965,99 @@ declare module paper { update(): void; /** - * - * @param point - + * Requests an update of the view if there are changes through the browser’s requestAnimationFrame() mechanism for smooth animation. Note that when using built-in event handlers for interaction, animation and load events, updates are automatically invoked for you automatically at the end. + */ + requestUpdate(): void; + + /** + * Translates (scrolls) the view by the given offset vector. + * @param delta - the offset to translate the view by + */ + translate(delta: Point): void; + + /** + * Rotates the view by a given angle around the given center point. + * Angles are oriented clockwise and measured in degrees. + * @param angle - the rotation angle + * @param center [optional] - default: view.center + */ + rotate(angle:number, center?: Point): void; + + /** + * Scales the view by the given value from its center point, or optionally from a supplied point. + * @param scale - the scale factor + * @param center [optional] - default: view.center + */ + scale(scale: number, center?: Point): void; + + /** + * Scales the view by the given values from its center point, or optionally from a supplied point. + * @param hor - the horizontal scale factor + * @param ver - the vertical scale factor + * @param center [optional] - default: view.center + */ + scale(hor: number, ver: number, center?: Point): void; + + /** + * Shears the view by the given value from its center point, or optionally from a supplied point. + * @param shear - the shear factor + * @param center [optional] - default: view.center + */ + shear(shear: Point, center?: Point): void; + + /** + * Shears the view by the given values from its center point, or optionally from a supplied point. + * @param hor - the horizontal shear factor + * @param ver - the vertical shear factor + * @param center [optional] - default: view.center + */ + shear(hor: number, ver: number, center?: Point): void; + + /** + * Skews the view by the given value from its center point, or optionally from a supplied point. + * @param skew - the horziontal and vertical skew angles in degrees + * @param center [optional] - default: view.center + */ + skew(skew: Point, center?: Point): void; + + /** + * Skews the view by the given values from its center point, or optionally from a supplied point. + * @param hor - the horizontal skew angle in degrees + * @param ver - the vertical skew angle in degrees + * @param center [optional] - default: view.center + */ + skew(hor: number, ver: number, center?: Point): void; + + /** + * Converts the passed point from project coordinate space to view coordinate space, which is measured in browser pixels in relation to the position of the view element. + * @param point - the point in project coordinates to be converted */ projectToView(point: Point): Point; /** - * - * @param point - + * Converts the passed point from view coordinate space to project coordinate space. + * @param point - the point in view coordinates to be converted */ viewToProject(point: Point): Point; - //I cannot use function: Function as it is a reserved keyword + /** + * Determines and returns the event location in project coordinate space. + * @param event - the native event object for which to determine the location. + */ + getEventPoint(event: Event): Point; /** * Attach an event handler to the view. - * @param type - String('frame'|'resize') the event type - * @param function - The function to be called when the event occurs + * @param type - the event type: ‘frame’, ‘resize’, ‘mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ + * @param callback - The function to be called when the event occurs */ - on(type: string, callback: (event: Event) => void): Item; + on(type: string, callback: (event: Event) => void | boolean): Item; + /** + * Attach an event handler to the view. + * @param type - the event type: ‘frame’, ‘resize’, ‘mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ + * @param callback - The function to be called when the event occurs + */ + on(type: string, callback: (event: IFrameEvent) => void | boolean): Item; /** * Attach one or more event handlers to the view. @@ -3903,10 +5066,16 @@ declare module paper { /** * Detach an event handler from the view. - * @param type - String('frame'|'resize') the event type - * @param function - The function to be detached + * @param type - the event type: ‘frame’, ‘resize’, ‘mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ + * @param callback - The function to be detached */ - off(type: string, callback: (event: Event) => void): Item; + off(type: string, callback: (event: Event) => void | boolean): Item; + /** + * Detach an event handler from the view. + * @param type - the event type: ‘frame’, ‘resize’, ‘mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ + * @param callback - The function to be detached + */ + off(type: string, callback: (event: IFrameEvent) => void | boolean): Item; /** * Detach one or more event handlers from the view. @@ -3916,14 +5085,14 @@ declare module paper { /** * Emit an event on the view. - * @param type - String('frame'|'resize') the event type + * @param type - the event type: ‘frame’, ‘resize’, ‘mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ * @param event - an object literal containing properties describing the event. */ emit(type: string, event: any): boolean; /** * Check if the view has one or more event handlers of the specified type. - * @param type - String('frame'|'resize') the event type + * @param type - the event type: ‘frame’, ‘resize’, ‘mousedown’, ‘mouseup’, ‘mousedrag’, ‘click’, ‘doubleclick’, ‘mousemove’, ‘mouseenter’, ‘mouseleave’ */ responds(type: string): boolean; @@ -3957,36 +5126,36 @@ declare module paper { /** * The function to be called when the mouse button is pushed down. The function receives a ToolEvent object which contains information about the mouse event. */ - onMouseDown: (event: ToolEvent) => void; + onMouseDown: (event: ToolEvent) => void | boolean; /** * The function to be called when the mouse position changes while the mouse is being dragged. The function receives a ToolEvent object which contains information about the mouse event. */ - onMouseDrag: (event: ToolEvent) => void; + onMouseDrag: (event: ToolEvent) => void | boolean; /** * The function to be called the mouse moves within the project view. The function receives a ToolEvent object which contains information about the mouse event. */ - onMouseMove: (event: ToolEvent) => void; + onMouseMove: (event: ToolEvent) => void | boolean; /** * The function to be called when the mouse button is released. The function receives a ToolEvent object which contains information about the mouse event. */ - onMouseUp: (event: ToolEvent) => void; + onMouseUp: (event: ToolEvent) => void | boolean; /** * The function to be called when the user presses a key on the keyboard. * The function receives a KeyEvent object which contains information about the keyboard event. * If the function returns false, the keyboard event will be prevented from bubbling up. This can be used for example to stop the window from scrolling, when you need the user to interact with arrow keys. */ - onKeyDown: (event: KeyEvent) => void; + onKeyDown: (event: KeyEvent) => void | boolean; /** * The function to be called when the user releases a key on the keyboard. * The function receives a KeyEvent object which contains information about the keyboard event. * If the function returns false, the keyboard event will be prevented from bubbling up. This can be used for example to stop the window from scrolling, when you need the user to interact with arrow keys. */ - onKeyUp: (event: KeyEvent) => void; + onKeyUp: (event: KeyEvent) => void | boolean; /** * Activates this tool, meaning paperScope.tool will point to it and it will be the one that recieves mouse events. @@ -3998,14 +5167,12 @@ declare module paper { */ remove(): void; - //I cannot use function: Function as it is a reserved keyword - /** * Attach an event handler to the tool. * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type * @param function - The function to be called when the event occurs */ - on(type: string, callback: (event: ToolEvent) => void): Tool; + on(type: string, callback: (event: ToolEvent | KeyEvent) => void | boolean): Tool; /** * Attach one or more event handlers to the tool. @@ -4018,7 +5185,7 @@ declare module paper { * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type * @param function - The function to be detached */ - off(type: string, callback: (event: ToolEvent) => void): Tool; + off(type: string, callback: (event: ToolEvent | KeyEvent) => void | boolean): Tool; /** * Detach one or more event handlers from the tool. @@ -4043,9 +5210,32 @@ declare module paper { export class Event { /** + * The time at which the event was created, in milliseconds since the epoch. + * Read only. + */ + readonly timeStamp: number; + + /** + * The current state of the keyboard modifiers. * Read Only */ - modifiers: any; + readonly modifiers: any; + + /** + * Cancels the event if it is cancelable, without stopping further propagation of the event. + */ + preventDefault(): void; + + /** + * Prevents further propagation of the current event. + */ + stopPropagation(): void; + + /** + * Cancels the event if it is cancelable, and stops stopping further propagation of the event. This is has the same effect as calling both stopPropagation() and preventDefault(). + * Any handler can also return false to indicate that stop() should be called right after. + */ + stop(): void; } /** @@ -4102,6 +5292,20 @@ declare module paper { } export class Key { + /** + * + * The current state of the keyboard modifiers. + * modifiers.shift - true if the shift key is pressed, false otherwise. + * modifiers.control - true if the control key is pressed, false otherwise. + * modifiers.alt — true if the alt/option key is pressed, false otherwise. + * modifiers.meta — true if the meta/windows/command key is pressed, false otherwise. + * modifiers.capsLock — true if the caps-lock key is active, false otherwise. + * modifiers.space — true if the space key is pressed, false otherwise. + * modifiers.option — true if the alt/option key is pressed, false otherwise. This is the same as modifiers.alt + * modifiers.command — true if the meta key is pressed on Mac, or the control key is pressed on Windows and Linux, false otherwise. + */ + static modifiers: { shift: boolean, control: boolean, alt: boolean, meta: boolean, capsLock: boolean, space: boolean, option: boolean, command: boolean}; + /** * Checks whether the specified key is pressed. * @param key - One of: 'backspace', 'enter', 'shift', 'control', 'option', 'pause', 'caps-lock', 'escape', 'space', 'end', 'home', 'left', 'up', 'right', 'down', 'delete', 'command' @@ -4148,30 +5352,43 @@ declare module paper { /** * The font-family to be used in text content. + * Default: 'sans-serif' */ fontFamily: string; /** * The font-weight to be used in text content. + * Default: 'normal' */ fontWeight: string | number; /** * The font size of text content, as {@Number} in pixels, or as {@String} with optional units 'px', 'pt' and 'em'. + * Default: 10 */ fontSize: string | number; /** * The text leading of text content. + * Default: fontSize * 1.2 */ leading: string | number; /** * The justification of text paragraphs. - * String('left', 'right', 'center') + * Values: 'left', 'right', 'center' + * Default: 'left' */ justification: string; + /** + * Clones the item within the same project and places the copy above the item. + * @param options [optional] - default: { insert: true, deep: true } + * @param options.insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options.deep: specifies whether the item’s children should also be cloned — default: true + */ + clone(options?: { insert?: boolean; deep?: boolean; }): TextItem; + } /** * A PointText item represents a piece of typography in your Paper.js project which starts from a certain point and extends by the amount of characters contained in it. @@ -4245,32 +5462,6 @@ declare module paper { */ type: 'mousedown' | 'mouseup' | 'mousedrag' | 'click' | 'doubleclick' | 'mousemove' | 'mouseenter' | 'mouseleave'; - /** - * The time at which the event was created, in milliseconds since the - * epoch. - */ - timeStamp(): number; - - /** - * Cancels the event if it is cancelable, without stopping further - * propagation of the event. - */ - preventDefault(): void; - - /** - * Prevents further propagation of the current event. - */ - stopPropagation(): void; - - /** - * Cancels the event if it is cancelable, and stops stopping further - * propagation of the event. This is has the same effect as calling - * both stopPropagation() and preventDefault(). - * - * Any handler can also return false to indicate that stop() should be - * called right after. - */ - stop(): void; } } diff --git a/types/paper/paper-tests.ts b/types/paper/paper-tests.ts index 444ffb8725..165c64b2d8 100644 --- a/types/paper/paper-tests.ts +++ b/types/paper/paper-tests.ts @@ -1,19 +1,19 @@ import paper = require('paper'); -var canvas = document.createElement('canvas') +let canvas = document.createElement('canvas') paper.setup(canvas); // Circle -var path = new paper.Path.Circle({ +let path = new paper.Path.Circle({ center: [80, 50], radius: 35, fillColor: 'red' }); // Dotted Line Tool -var dottedLinePath: paper.Path; -var dottedLineTool = new paper.Tool(); +let dottedLinePath: paper.Path = new paper.Path; +let dottedLineTool = new paper.Tool(); dottedLineTool.onMouseDown = function(event: any) { new paper.Layer().activate(); @@ -34,3 +34,15225 @@ dottedLineTool.onMouseUp = function(event: any) { dottedLinePath.smooth(); dottedLinePath.simplify(); }; + +// Hit Test stuff +// These objects are to make sure older code which didn't have the IHitTestOptions available still work. +let hitOptionsEmpty = {}; +let hitOptionsPartial = {tolerance: 0, extra: true}; +let hitOptionsFull = {tolerance: 0, class: 'Path', match: (hit: paper.HitResult)=>{return true;}, fill: true, stroke: false, segments: true, curves: false, handles: true, ends: true, position: false, center: true, bounds: true, guides: false, selected: true}; +// These objects are to make sure new code which uses the IHitTestOptions work. +let hitOptionsInterfaceEmpty:paper.IHitTestOptions = {}; +let hitOptionsInterfacePartial:paper.IHitTestOptions = {match: (hit: paper.HitResult)=>{return true;}}; +let hitOptionsInterfaceFull:paper.IHitTestOptions = {tolerance: 0, class: 'Path', match: (hit: paper.HitResult)=>{return true;}, fill: true, stroke: false, segments: true, curves: false, handles: true, ends: true, position: false, center: true, bounds: true, guides: false, selected: true}; +let compoundPath: paper.CompoundPath = new paper.CompoundPath(dottedLinePath); +let hitTestPoint = dottedLinePath.segments[0].point; +let hitTestResult: paper.HitResult; +let hitTestResults: paper.HitResult[]; +// These are Item hit tests +hitTestResult = compoundPath.hitTest(hitTestPoint); +hitTestResult = compoundPath.hitTest(hitTestPoint, hitOptionsEmpty); +hitTestResult = compoundPath.hitTest(hitTestPoint, hitOptionsPartial); +hitTestResult = compoundPath.hitTest(hitTestPoint, hitOptionsFull); +hitTestResult = compoundPath.hitTest(hitTestPoint, hitOptionsInterfaceEmpty); +hitTestResult = compoundPath.hitTest(hitTestPoint, hitOptionsInterfacePartial); +hitTestResult = compoundPath.hitTest(hitTestPoint, hitOptionsInterfaceFull); +hitTestResults = compoundPath.hitTestAll(hitTestPoint); +hitTestResults = compoundPath.hitTestAll(hitTestPoint, hitOptionsEmpty); +hitTestResults = compoundPath.hitTestAll(hitTestPoint, hitOptionsPartial); +hitTestResults = compoundPath.hitTestAll(hitTestPoint, hitOptionsFull); +hitTestResults = compoundPath.hitTestAll(hitTestPoint, hitOptionsInterfaceEmpty); +hitTestResults = compoundPath.hitTestAll(hitTestPoint, hitOptionsInterfacePartial); +hitTestResults = compoundPath.hitTestAll(hitTestPoint, hitOptionsInterfaceFull); +// These are project hit tests +hitTestResult = paper.project.hitTest(hitTestPoint); +hitTestResult = paper.project.hitTest(hitTestPoint, hitOptionsEmpty); +hitTestResult = paper.project.hitTest(hitTestPoint, hitOptionsPartial); +hitTestResult = paper.project.hitTest(hitTestPoint, hitOptionsFull); +hitTestResult = paper.project.hitTest(hitTestPoint, hitOptionsInterfaceEmpty); +hitTestResult = paper.project.hitTest(hitTestPoint, hitOptionsInterfacePartial); +hitTestResult = paper.project.hitTest(hitTestPoint, hitOptionsInterfaceFull); +hitTestResults = paper.project.hitTestAll(hitTestPoint); +hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsEmpty); +hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsPartial); +hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsFull); +hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsInterfaceEmpty); +hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsInterfacePartial); +hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsInterfaceFull); + +function Examples() { + function BooleanOperations(){ + let text = new paper.PointText({ + position: paper.view.center.add(new paper.Point([0, 200])), + fillColor: 'black', + justification: 'center', + fontSize: 20 + }); + + let originals = new paper.Group({ insert: false }); // Don't insert in DOM. + + let square = new paper.Path.Rectangle({ + position: paper.view.center, + size: 300, + parent: originals, + fillColor: 'white' + }); + + // Make a ring using subtraction of two circles: + let inner = new paper.Path.Circle({ + center: paper.view.center, + radius: 100, + parent: originals, + fillColor: 'white' + }); + + let outer = new paper.Path.Circle({ + center: paper.view.center, + radius: 140, + parent: originals, + fillColor: 'white' + }); + + let ring = outer.subtract(inner); + + let operations = ['unite', 'intersect', 'subtract', 'exclude', 'divide']; + let colors = ['red', 'green', 'blue', 'black']; + let curIndex = -1; + let operation: string; + let result: paper.PathItem | null; + let activeItem: paper.PathItem | null; + + // Change the mode every 3 seconds: + setInterval(setMode, 3000); + + // Set the initial mode: + setMode(); + + function setMode() { + curIndex++; + if (curIndex == operations.length * 2) + curIndex = 0; + operation = operations[curIndex % operations.length]; + } + + function onMouseDown(event: paper.ToolEvent) { + let hitResult = originals.hitTest(event.point); + activeItem = hitResult && hitResult.item as paper.PathItem; + } + + function onMouseDrag(event: paper.ToolEvent) { + if (activeItem) + activeItem.position = event.point; + } + + function onMouseUp() { + activeItem = null; + square.position = paper.view.center; + } + + function onFrame(event: paper.IFrameEvent) { + if (activeItem != ring) { + // Move the ring around: + let offset = new paper.Point(140, 80).multiply(new paper.Point([Math.sin(event.count / 60), Math.sin(event.count / 40)])); + ring.position = paper.view.center.add(offset); + } + + // Remove the result of the last path operation: + if (result) + result.remove(); + + function performOperation(operation:string, primaryItem:paper.PathItem, secondaryItem:paper.PathItem){ + switch(operation){ + case 'unite': + return primaryItem.unite(secondaryItem); + case 'intersect': + return primaryItem.intersect(secondaryItem); + case 'subtract': + return primaryItem.subtract(secondaryItem); + case 'exclude': + return primaryItem.exclude(secondaryItem); + case 'divide': + return primaryItem.divide(secondaryItem); + default: + return null; + } + } + // Perform the path operation on the ring: + if (curIndex < operations.length) { + result = performOperation(operation, square, ring); + text.content = 'square.' + operation + '(ring)'; + } else { + result = performOperation(operation, square, ring); + text.content = 'ring.' + operation + '(square)'; + } + if(result){ + result.selected = true; + result.fillColor = colors[curIndex % colors.length]; + result.moveBelow(text); + } + + // If the result is a group, color each of its children differently: + if (result instanceof paper.Group) { + for (let i = 0; i < result.children.length; i++) { + result.children[i].fillColor = colors[i]; + } + } + }; + + function onResize() { + text.position = paper.view.center.add(new paper.Point([0, 200])); + square.position = paper.view.center; + } + } + + function CandyCrash(){ + // kynd.info 2014 + class Ball{ + radius: number; + point: paper.Point; + vector: paper.Point; + maxVec: number; + numSegment: number; + boundOffset: number[]; + boundOffsetBuff: number[]; + sidePoints: paper.Point[]; + path: paper.Path; + + constructor(r: number, p: paper.Point, v: paper.Point) { + this.radius = r; + this.point = p; + this.vector = v; + this.maxVec = 15; + this.numSegment = Math.floor(r / 3 + 2); + this.boundOffset = []; + this.boundOffsetBuff = []; + this.sidePoints = []; + this.path = new paper.Path({ + fillColor: { + hue: Math.random() * 360, + saturation: 1, + brightness: 1 + }, + blendMode: 'lighter' + }); + + for (let i = 0; i < this.numSegment; i ++) { + this.boundOffset.push(this.radius); + this.boundOffsetBuff.push(this.radius); + this.path.add(new paper.Point({})); + this.sidePoints.push(new paper.Point({ + angle: 360 / this.numSegment * i, + length: 1 + })); + } + } + iterate() { + this.checkBorders(); + if (this.vector.length > this.maxVec) + this.vector.length = this.maxVec; + this.point = this.point.add(this.vector); + this.updateShape(); + } + checkBorders() { + let size = paper.view.size; + if (this.point.x < -this.radius) + this.point.x = size.width + this.radius; + if (this.point.x > size.width + this.radius) + this.point.x = -this.radius; + if (this.point.y < -this.radius) + this.point.y = size.height + this.radius; + if (this.point.y > size.height + this.radius) + this.point.y = -this.radius; + } + updateShape() { + let segments = this.path.segments; + for (let i = 0; i < this.numSegment; i ++) + segments[i].point = this.getSidePoint(i); + + this.path.smooth(); + for (let i = 0; i < this.numSegment; i ++) { + if (this.boundOffset[i] < this.radius / 4) + this.boundOffset[i] = this.radius / 4; + let next = (i + 1) % this.numSegment; + let prev = (i > 0) ? i - 1 : this.numSegment - 1; + let offset = this.boundOffset[i]; + offset += (this.radius - offset) / 15; + offset += ((this.boundOffset[next] + this.boundOffset[prev]) / 2 - offset) / 3; + this.boundOffsetBuff[i] = this.boundOffset[i] = offset; + } + } + react(b:Ball) { + let dist = this.point.getDistance(b.point); + if (dist < this.radius + b.radius && dist != 0) { + let overlap = this.radius + b.radius - dist; + let direc = (this.point.subtract(b.point)).normalize(overlap * 0.015); + this.vector = this.vector.add(direc); + b.vector = b.vector.subtract(direc); + + this.calcBounds(b); + b.calcBounds(this); + this.updateBounds(); + b.updateBounds(); + } + } + getBoundOffset(p:paper.Point) { + let diff = this.point.subtract(p); + let angle = (diff.angle + 180) % 360; + return this.boundOffset[Math.floor(angle / 360 * this.boundOffset.length)]; + } + calcBounds(b:Ball) { + for (let i = 0; i < this.numSegment; i ++) { + let tp = this.getSidePoint(i); + let bLen = b.getBoundOffset(tp); + let td = tp.getDistance(b.point); + if (td < bLen) { + this.boundOffsetBuff[i] -= (bLen - td) / 2; + } + } + } + getSidePoint(index: number) { + return this.point.add(this.sidePoints[index].multiply(this.boundOffset[index])); + } + updateBounds() { + for (let i = 0; i < this.numSegment; i ++) + this.boundOffset[i] = this.boundOffsetBuff[i]; + } + } + //--------------------- main --------------------- + let balls: Ball[] = []; + let numBalls = 18; + for (let i = 0; i < numBalls; i++) { + let position = paper.Point.random().multiply(new paper.Point(paper.view.size)); + let vector = new paper.Point({ + angle: 360 * Math.random(), + length: Math.random() * 10 + }); + let radius = Math.random() * 60 + 60; + balls.push(new Ball(radius, position, vector)); + } + + function onFrame() { + for (let i = 0; i < balls.length - 1; i++) { + for (let j = i + 1; j < balls.length; j++) { + balls[i].react(balls[j]); + } + } + for (let i = 0, l = balls.length; i < l; i++) { + balls[i].iterate(); + } + } + } + function SatieLikedToDraw(){ + let leftPath = new paper.Path({ + strokeColor: 'red', + opacity: 0.5 + }); + + let rightPath = new paper.Path({ + strokeColor: 'green', + opacity: 0.5 + }); + + let amount = 8; + let step = paper.view.size.width / (amount + 1); + let flip = true; + + for (let i = 0; i <= amount; i++) { + leftPath.add(new paper.Point(i * step, 0)); + rightPath.add(new paper.Point(i * step, 0)); + } + + let group = new paper.Group({ + children: [leftPath, rightPath], + transformContent: false, + strokeWidth: 30, + strokeJoin: 'round', + strokeCap: 'butt', + pivot: leftPath.position, + position: paper.view.center + }); + + function onMouseDown() { + flip = !flip; + } + + function onKeyDown(event: paper.KeyEvent) { + if (event.key === 'space') + group.fullySelected = !group.fullySelected; + } + + let audio: any; + let source: AudioBufferSourceNode; + let analyserL: AnalyserNode; + let analyserR: AnalyserNode; + let freqByteData: Uint8Array; + + paper.view.onFrame = function() { + let step = paper.view.size.width / (amount + 1); + let scale = paper.view.size.height / 1.75; + analyserL.getByteFrequencyData(freqByteData); + let leftBands = getEqualizerBands(freqByteData); + analyserR.getByteFrequencyData(freqByteData); + let rightBands = getEqualizerBands(freqByteData); + for (let i = 1; i <= amount; i++) { + leftPath.segments[i].point = new paper.Point([i * step, -leftBands[i - 1] * scale]); + rightPath.segments[i].point = new paper.Point([i * step, -rightBands[i - 1] * scale * (flip ? -1 : 1)]); + } + leftPath.smooth(); + rightPath.smooth(); + group.pivot = new paper.Point([leftPath.position.x, 0]); + group.position = paper.view.center; + } + + // Pause animation until we have data + paper.view.pause(); + + let AudioContext = (window as any).AudioContext || (window as any).webkitAudioContext; + if (AudioContext) { + audio = new AudioContext(); + source = audio.createBufferSource(); + // Create two separate analyzers for left and right channel. + analyserL = audio.createAnalyser(); + analyserL.smoothingTimeConstant = 0.25; + analyserL.fftSize = Math.pow(2, amount) * 2; + analyserR = audio.createAnalyser(); + analyserR.smoothingTimeConstant = analyserL.smoothingTimeConstant; + analyserR.fftSize = analyserL.fftSize; + // Create the buffer to receive the analyzed data. + freqByteData = new Uint8Array(analyserL.frequencyBinCount); + // Create a splitter to feed them both + let splitter = audio.createChannelSplitter(); + // Connect audio processing graph + source.connect(splitter); + splitter.connect(analyserL, 0, 0); + splitter.connect(analyserR, 1, 0); + // Connect source to output also so we can hear it + source.connect(audio.destination); + loadAudioBuffer('http://assets.paperjs.org/audio/gnossienne.mp3'); + } else { + // TODO: Print error message + alert('Audio not supported'); + } + + function loadAudioBuffer(url: string) { + // Load asynchronously + let request = new XMLHttpRequest(); + request.open("GET", url, true); + request.responseType = "arraybuffer"; + + request.onload = function() { + audio.decodeAudioData( + request.response, + function(buffer: AudioBuffer) { + source.buffer = buffer; + source.loop = true; + source.start(0); + paper.view.play(); + }, + + function() { + alert("Error loading MP3"); + } + ); + }; + request.send(); + } + + function getEqualizerBands(data:Uint8Array) { + let bands:number[] = []; + let amount = Math.sqrt(data.length) / 2; + for(let i = 0; i < amount; i++) { + let start = Math.pow(2, i) - 1; + let end = start * 2 + 1; + let sum = 0; + for (let j = start; j < end; j++) { + sum += data[j]; + } + let avg = sum / (255 * (end - start)); + bands[i] = Math.sqrt(avg / Math.sqrt(2)); + } + return bands; + } + } + function Chain(){ + // Adapted from the following Processing example: + // http://processing.org/learning/topics/follow3.html + + // The amount of points in the path: + let points = 25; + + // The distance between the points: + let length = 35; + + let path = new paper.Path({ + strokeColor: '#E4141B', + strokeWidth: 20, + strokeCap: 'round' + }); + + let start = paper.view.center.divide(new paper.Point([10, 1])); + for (let i = 0; i < points; i++) + path.add(start.add(new paper.Point(i * length, 0))); + + function onMouseMove(event: paper.ToolEvent) { + path.firstSegment.point = event.point; + for (let i = 0; i < points - 1; i++) { + let segment = path.segments[i]; + let nextSegment = segment.next; + let vector = segment.point.subtract(nextSegment.point); + vector.length = length; + nextSegment.point = segment.point.subtract(vector); + } + path.smooth({ type: 'continuous' }); + } + + function onMouseDown(event: paper.ToolEvent) { + path.fullySelected = true; + path.strokeColor = '#e08285'; + } + + function onMouseUp(event: paper.ToolEvent) { + path.fullySelected = false; + path.strokeColor = '#e4141b'; + } + } + function TadPoles(){ + // Adapted from Flocking Processing example by Daniel Schiffman: + // http://processing.org/learning/topics/flocking.html + + class Boid { + acceleration: paper.Point; + vector: paper.Point; + position: paper.Point; + radius: number; + maxSpeed: number; + maxForce: number; + amount: number; + count: number; + lastLoc: paper.Point; + path: paper.Path; + shortPath: paper.Path; + head: paper.Shape; + + constructor(position: paper.Point, maxSpeed: number, maxForce: number) { + let strength = Math.random() * 0.5; + this.acceleration = new paper.Point({}); + this.vector = paper.Point.random().multiply(2).subtract(1); + this.position = position.clone(); + this.radius = 30; + this.maxSpeed = maxSpeed + strength; + this.maxForce = maxForce + strength; + this.amount = strength * 10 + 10; + this.count = 0; + this.createItems(); + } + run(boids: Boid[]) { + this.lastLoc = this.position.clone(); + if (!groupTogether) { + this.flock(boids); + } else { + this.align(boids); + } + this.borders(); + this.update(); + this.calculateTail(); + this.moveHead(); + } + calculateTail() { + let segments = this.path.segments, + shortSegments = this.shortPath.segments; + let speed = this.vector.length; + let pieceLength = 5 + speed / 3; + let point = this.position; + segments[0].point = shortSegments[0].point = point; + // Chain goes the other way than the movement + let lastVector = this.vector.multiply(-1); + for (let i = 1; i < this.amount; i++) { + let vector = segments[i].point.subtract(point); + this.count += speed * 10; + let wave = Math.sin((this.count + i * 3) / 300); + let sway = lastVector.rotate(90).normalize(wave); + point = point.add(lastVector.normalize(pieceLength).add(sway)); + segments[i].point = point; + if (i < 3) + shortSegments[i].point = point; + lastVector = vector; + } + this.path.smooth(); + } + createItems() { + this.head = paper.Shape.Ellipse({ + center: [0, 0], + size: [13, 8], + fillColor: 'white' + }); + + this.path = new paper.Path({ + strokeColor: 'white', + strokeWidth: 2, + strokeCap: 'round' + }); + for (let i = 0; i < this.amount; i++) + this.path.add(new paper.Point({})); + + this.shortPath = new paper.Path({ + strokeColor: 'white', + strokeWidth: 4, + strokeCap: 'round' + }); + for (let i = 0; i < Math.min(3, this.amount); i++) + this.shortPath.add(new paper.Point({})); + } + moveHead() { + this.head.position = this.position; + this.head.rotation = this.vector.angle; + } + // We accumulate a new acceleration each time based on three rules + flock(boids:Boid[]) { + let separation = this.separate(boids).multiply(3); + let alignment = this.align(boids); + let cohesion = this.cohesion(boids); + this.acceleration = this.acceleration.add(separation).add(alignment).add(cohesion); + } + update() { + // Update velocity + this.vector = this.vector.add(this.acceleration); + // Limit speed (vector#limit?) + this.vector.length = Math.min(this.maxSpeed, this.vector.length); + this.position = this.position.add(this.vector); + // Reset acceleration to 0 each cycle + this.acceleration = new paper.Point({}); + } + seek(target:paper.Point) { + this.acceleration = this.acceleration.add(this.steer(target, false)); + } + arrive(target:paper.Point) { + this.acceleration = this.acceleration.add(this.steer(target, true)); + } + borders() { + let vector = new paper.Point({}); + let position = this.position; + let radius = this.radius; + let size = paper.view.size; + if (position.x < -radius) vector.x = size.width + radius; + if (position.y < -radius) vector.y = size.height + radius; + if (position.x > size.width + radius) vector.x = -size.width -radius; + if (position.y > size.height + radius) vector.y = -size.height -radius; + if (!vector.isZero()) { + this.position = this.position.add(vector); + let segments = this.path.segments; + for (let i = 0; i < this.amount; i++) { + segments[i].point = segments[i].point.add(vector); + } + } + } + // A method that calculates a steering vector towards a target + // Takes a second argument, if true, it slows down as it approaches + // the target + steer(target: paper.Point, slowdown:boolean) { + let steer:paper.Point; + let desired = target.subtract(this.position); + let distance = desired.length; + // Two options for desired vector magnitude + // (1 -- based on distance, 2 -- maxSpeed) + if (slowdown && distance < 100) { + // This damping is somewhat arbitrary: + desired.length = this.maxSpeed * (distance / 100); + } else { + desired.length = this.maxSpeed; + } + steer = desired.subtract(this.vector); + steer.length = Math.min(this.maxForce, steer.length); + return steer; + } + separate(boids:Boid[]) { + let desiredSeperation = 60; + let steer = new paper.Point({}); + let count = 0; + // For every boid in the system, check if it's too close + for (let i = 0, l = boids.length; i < l; i++) { + let other = boids[i]; + let vector = this.position.subtract(other.position); + let distance = vector.length; + if (distance > 0 && distance < desiredSeperation) { + // Calculate vector pointing away from neighbor + steer= steer.add(vector.normalize(1 / distance)); + count++; + } + } + // Average -- divide by how many + if (count > 0) + steer = steer.divide(count); + if (!steer.isZero()) { + // Implement Reynolds: Steering = Desired - Velocity + steer.length = this.maxSpeed; + steer = steer.subtract(this.vector); + steer.length = Math.min(steer.length, this.maxForce); + } + return steer; + } + // Alignment + // For every nearby boid in the system, calculate the average velocity + align(boids: Boid[]) { + let neighborDist = 25; + let steer = new paper.Point({}); + let count = 0; + for (let i = 0, l = boids.length; i < l; i++) { + let other = boids[i]; + let distance = this.position.getDistance(other.position); + if (distance > 0 && distance < neighborDist) { + steer = steer.add(other.vector); + count++; + } + } + + if (count > 0) + steer = steer.divide(count); + if (!steer.isZero()) { + // Implement Reynolds: Steering = Desired - Velocity + steer.length = this.maxSpeed; + steer = steer.subtract(this.vector); + steer.length = Math.min(steer.length, this.maxForce); + } + return steer; + } + // Cohesion + // For the average location (i.e. center) of all nearby boids, + // calculate steering vector towards that location + cohesion(boids:Boid[]) { + let neighborDist = 100; + let sum = new paper.Point({}); + let count = 0; + for (let i = 0, l = boids.length; i < l; i++) { + let other = boids[i]; + let distance = this.position.getDistance(other.position); + if (distance > 0 && distance < neighborDist) { + sum = sum.add(other.position); // Add location + count++; + } + } + if (count > 0) { + sum = sum.divide(count); + // Steer towards the location + return this.steer(sum, false); + } + return sum; + } + } + + let heartPath = new paper.Path('M514.69629,624.70313c-7.10205,-27.02441 -17.2373,-52.39453 -30.40576,-76.10059c-13.17383,-23.70703 -38.65137,-60.52246 -76.44434,-110.45801c-27.71631,-36.64355 -44.78174,-59.89355 -51.19189,-69.74414c-10.5376,-16.02979 -18.15527,-30.74951 -22.84717,-44.14893c-4.69727,-13.39893 -7.04297,-26.97021 -7.04297,-40.71289c0,-25.42432 8.47119,-46.72559 25.42383,-63.90381c16.94775,-17.17871 37.90527,-25.76758 62.87354,-25.76758c25.19287,0 47.06885,8.93262 65.62158,26.79834c13.96826,13.28662 25.30615,33.10059 34.01318,59.4375c7.55859,-25.88037 18.20898,-45.57666 31.95215,-59.09424c19.00879,-18.32178 40.99707,-27.48535 65.96484,-27.48535c24.7373,0 45.69531,8.53564 62.87305,25.5957c17.17871,17.06592 25.76855,37.39551 25.76855,60.98389c0,20.61377 -5.04102,42.08691 -15.11719,64.41895c-10.08203,22.33203 -29.54687,51.59521 -58.40723,87.78271c-37.56738,47.41211 -64.93457,86.35352 -82.11328,116.8125c-13.51758,24.0498 -23.82422,49.24902 -30.9209,75.58594z'); + + let boids:Boid[] = []; + let groupTogether = false; + + // Add the boids: + for (let i = 0; i < 30; i++) { + let position = paper.Point.random().multiply(new paper.Point(paper.view.size)); + boids.push(new Boid(position, 10, 0.05)); + } + + + function onFrame(event: paper.IFrameEvent) { + for (let i = 0, l = boids.length; i < l; i++) { + if (groupTogether) { + let length = ((i + event.count / 30) % l) / l * heartPath.length; + let point = heartPath.getPointAt(length); + if (point) + boids[i].arrive(point); + } + boids[i].run(boids); + } + } + + // Reposition the heart path whenever the window is resized: + function onResize(event:paper.Event) { + heartPath.fitBounds(paper.view.bounds); + heartPath.scale(0.8); + } + + function onMouseDown(event:paper.ToolEvent) { + groupTogether = !groupTogether; + } + + function onKeyDown(event:paper.KeyEvent) { + if (event.key == 'space') { + let layer = paper.project.activeLayer; + layer.selected = !layer.selected; + return false; + } + } + } + function NyanRainbow(){ + // A tribute to Nyan Cat http://www.youtube.com/watch?v=QH2-TGUlwu4 + let mediaElement: any; + let playing = false; + /*MediaElement('nyan', { + pluginPath: '/assets/mediaelement/', + success: function(me) { + mediaElement = me; + me.play(); + me.addEventListener('timeupdate', function(time: any) { + if (me.currentTime > 3.7) + playing = true; + }); + } + });*/ + + let mousePos = paper.view.center .add(new paper.Point([paper.view.bounds.width / 3, 100])); + let position = paper.view.center; + + function onFrame(event:paper.IFrameEvent) { + position = position.add((mousePos.subtract(position)).divide(10)); + let vector = (paper.view.center.subtract(position)).divide(10); + moveStars(vector.multiply(3)); + moveRainbow(vector, event); + } + + function onMouseMove(event:paper.ToolEvent) { + mousePos = event.point; + } + + function onKeyDown(event:paper.KeyEvent) { + if (event.key == 'space') + paper.project.activeLayer.selected = !paper.project.activeLayer.selected; + } + + let moveStars: (vector:paper.Point)=>void = moveStarsFunctionCreator(); + function moveStarsFunctionCreator(): (vector:paper.Point)=>void { + // The amount of symbol we want to place; + let count = 50; + + // Create a symbol, which we will use to place instances of later: + let path = new paper.Path.Circle({ + center: [0, 0], + radius: 5, + fillColor: 'white', + strokeColor: 'black' + }); + + let symbol = new paper.Symbol(path); + + // Place the instances of the symbol: + for (let i = 0; i < count; i++) { + // The center position is a random point in the paper.view: + let center = paper.Point.random().multiply(new paper.Point(paper.view.size)); + let placed = symbol.place(center); + placed.scale(i / count + 0.01); + placed.data = { + vector: new paper.Point({ + angle: Math.random() * 360, + length : (i / count) * Math.random() / 5 + }) + }; + } + + let vector = new paper.Point({ + angle: 45, + length: 0 + }); + + function keepInView(item:paper.Item) { + let position = item.position; + let viewBounds = paper.view.bounds; + if (position.isInside(viewBounds)) + return; + let itemBounds = item.bounds; + if (position.x > viewBounds.width + 5) { + position.x = -item.bounds.width; + } + + if (position.x < -itemBounds.width - 5) { + position.x = viewBounds.width; + } + + if (position.y > viewBounds.height + 5) { + position.y = -itemBounds.height; + } + + if (position.y < -itemBounds.height - 5) { + position.y = viewBounds.height + } + } + + return function(vector:paper.Point) { + // Run through the active layer's children list and change + // the position of the placed symbols: + let layer = paper.project.activeLayer; + for (let i = 0; i < count; i++) { + let item = layer.children[i]; + let size = item.bounds.size; + let length = vector.length / 10 * size.width / 10; + item.position += vector.normalize(length) + item.data.vector; + keepInView(item); + } + }; + }; + + let moveRainbow: (vector:paper.Point, event:paper.IFrameEvent)=>void = moveRainbowunctionCreator(); + function moveRainbowunctionCreator(): (vector:paper.Point, event: paper.IFrameEvent)=>void { + let paths:paper.Path[] = []; + let colors = ['red', 'orange', 'yellow', 'lime', 'blue', 'purple']; + for (let i = 0; i < colors.length; i++) { + let path = new paper.Path({ + fillColor: colors[i] + }); + paths.push(path); + } + + let count = 30; + let group = new paper.Group(paths); + let headGroup:paper.Group; + let eyePosition = new paper.Point({}); + let eyeFollow = (paper.Point.random().subtract(0.5)); + let blinkTime = 200; + function createHead(vector: paper.Point, count: number) { + let eyeVector = (eyePosition.subtract(eyeFollow)); + eyePosition = eyePosition.subtract(eyeVector.divide(4)); + if (eyeVector.length < 0.00001) + eyeFollow = (paper.Point.random().subtract(0.5)); + if (headGroup) + headGroup.remove(); + let top = paths[0].lastSegment.point; + let bottom = paths[paths.length - 1].firstSegment.point; + let radius = (bottom.subtract(top)).length / 2; + let circle = new paper.Path.Circle({ + center: top.add((bottom.subtract(top)).divide(2)), + radius: radius, + fillColor: 'black' + }); + circle.scale(vector.length / 100, 1); + circle.rotate(vector.angle); + + let innerCircle = circle.clone(); + innerCircle.scale(0.5); + innerCircle.fillColor = (count % blinkTime < 3) + || (count % (blinkTime + 5) < 3) ? 'black' : 'white'; + if (count % (blinkTime + 40) == 0) + blinkTime = Math.round(Math.random() * 40) + 200; + let eye = circle.clone(); + eye.position = eye.position.add(eyePosition.multiply(radius)); + eye.scale(0.15, innerCircle.position); + eye.fillColor = 'black'; + headGroup = new paper.Group([circle, innerCircle, eye]); + } + + return function(v:paper.Point, event:paper.IFrameEvent) { + let vector:paper.Point = (paper.view.center.subtract(position)).divide(10); + + if (vector.length < 5) + vector.length = 5; + count += vector.length / 100; + group.translate(vector); + let rotated = vector.rotate(90); + let middle = paths.length / 2; + for (let j = 0; j < paths.length; j++) { + let path = paths[j]; + let nyanSwing = playing ? Math.sin(event.count / 2) * vector.length : 1; + let unitLength = vector.length * (2 + Math.sin(event.count / 10)) / 2; + let length = (j - middle) * unitLength + nyanSwing; + let top = paper.view.center.add(rotated.normalize(length)); + let bottom = paper.view.center.add(rotated.normalize(length + unitLength)); + path.add(top); + path.insert(0, bottom); + if (path.segments.length > 200) { + let index = Math.round(path.segments.length / 2); + path.segments[index].remove(); + path.segments[index - 1].remove(); + } + path.smooth(); + } + createHead(vector, event.count); + if (mediaElement) + mediaElement.setVolume(vector.length / 200); + } + } + } + function RoundedRectangles(){ + let mousePoint = paper.view.center; + let amount = 25; + let colors = ['red', 'white', 'blue', 'white']; + + for (let i = 0; i < amount; i++) { + let rect = new paper.Rectangle(new paper.Point([0, 0]), new paper.Point([25, 25])); + rect.center = mousePoint; + let path = new paper.Path.Rectangle(rect, 6); + path.fillColor = colors[i % 4]; + let scale = (1 - i / amount) * 20; + path.scale(scale); + } + + function onMouseMove(event: paper.ToolEvent) { + mousePoint = event.point; + } + + let children = paper.project.activeLayer.children; + function onFrame(event: paper.IFrameEvent) { + for (let i = 0, l = children.length; i < l; i++) { + let item = children[i]; + let delta = (mousePoint.subtract(item.position)).divide(i + 5); + item.rotate(Math.sin((event.count + i) / 10) * 7); + if (delta.length > 0.1) + item.position = item.position.add(delta); + } + } + } + function RadialRainbows(){ + let point = paper.view.center; + + let colors:paper.Color[] = []; + let cycles = 4; + for (let i = 0, l = 60; i < l; i++) { + let brightness = 1 - (i / l) * 1.5; + let hue = i / l * cycles * 360; + let color = new paper.Color({ + hue: hue, + saturation: 1, + brightness: brightness + }); + colors.push(color); + } + + let radius = Math.max(paper.view.size.width, paper.view.size.height) * 0.75; + + let path = new paper.Path.Rectangle({ + rectangle: paper.view.bounds, + fillColor: { + origin: point, + destination: point.add(new paper.Point([radius, 0])), + gradient: { + stops: colors, + radial: true + } + } + }); + + let color = path.fillColor as paper.Color; + let gradient = color.gradient; + let mouseDown = false; + let mousePoint = paper.view.center; + + function onMouseDown(event: paper.ToolEvent) { + mouseDown = true; + mousePoint = event.point; + } + + function onMouseDrag(event: paper.ToolEvent) { + mousePoint = event.point; + } + + function onMouseUp(event: paper.ToolEvent) { + vector.length = 10; + mouseDown = false; + } + + let grow = false; + let vector = new paper.Point(150, 0); + + function onFrame() { + if(gradient){ + for (let i = 0, l = gradient.stops.length; i < l; i++) + gradient.stops[i].color.hue -= 20; + if (grow && vector.length > 300) { + grow = false; + } else if (!grow && vector.length < 75) { + grow = true; + } + if (mouseDown) { + point = point.add((mousePoint.subtract(point)).divide(10)); + } else { + vector.length += (grow ? 1 : -1); + vector.angle += 5; + } + color.highlight = mouseDown ? point : point.add(vector); + } + } + + function onResize(event: paper.Event) { + point = paper.view.center; + path.bounds = paper.view.bounds; + let color = path.fillColor as paper.Color; + color.origin = point; + let radius = Math.max(paper.view.size.width, paper.view.size.height) * 0.75; + color.destination = point.add(new paper.Point([radius, 0])); + } + } + function MetaBalls(){ + // Ported from original Metaball script by SATO Hiroyuki + // http://park12.wakwak.com/~shp/lc/et/en_aics_script.html + paper.project.currentStyle = { + fillColor: 'black' + }; + + let ballPositions = [[255, 129], [610, 73], [486, 363], + [117, 459], [484, 726], [843, 306], [789, 615], [1049, 82], + [1292, 428], [1117, 733], [1352, 86], [92, 798]]; + + let handle_len_rate = 2.4; + let circlePaths:paper.Path[] = []; + let radius = 50; + for (let i = 0, l = ballPositions.length; i < l; i++) { + let circlePath = new paper.Path.Circle({ + center: ballPositions[i], + radius: 50 + }); + circlePaths.push(circlePath); + } + + let largeCircle = new paper.Path.Circle({ + center: [676, 433], + radius: 100 + }); + circlePaths.push(largeCircle); + + function onMouseMove(event:paper.ToolEvent) { + largeCircle.position = event.point; + generateConnections(circlePaths); + } + + let connections = new paper.Group(); + function generateConnections(paths:paper.Path[]) { + // Remove the last connection paths: + connections.children = []; + + for (let i = 0, l = paths.length; i < l; i++) { + for (let j = i - 1; j >= 0; j--) { + let path = metaball(paths[i], paths[j], 0.5, handle_len_rate, 300); + if (path) { + connections.appendTop(path); + path.removeOnMove(); + } + } + } + } + + generateConnections(circlePaths); + + // --------------------------------------------- + function metaball(ball1:paper.Path, ball2:paper.Path, v:number, handle_len_rate:number, maxDistance:number) { + let center1 = ball1.position; + let center2 = ball2.position; + let radius1 = ball1.bounds.width / 2; + let radius2 = ball2.bounds.width / 2; + let pi2 = Math.PI / 2; + let d = center1.getDistance(center2); + let u1:number; + let u2:number; + + if (radius1 == 0 || radius2 == 0) + return; + + if (d > maxDistance || d <= Math.abs(radius1 - radius2)) { + return; + } else if (d < radius1 + radius2) { // case circles are overlapping + u1 = Math.acos((radius1 * radius1 + d * d - radius2 * radius2) / + (2 * radius1 * d)); + u2 = Math.acos((radius2 * radius2 + d * d - radius1 * radius1) / + (2 * radius2 * d)); + } else { + u1 = 0; + u2 = 0; + } + + let angle1 = (center2.subtract(center1)).angleInRadians; + let angle2 = Math.acos((radius1 - radius2) / d); + let angle1a = angle1 + u1 + (angle2 - u1) * v; + let angle1b = angle1 - u1 - (angle2 - u1) * v; + let angle2a = angle1 + Math.PI - u2 - (Math.PI - u2 - angle2) * v; + let angle2b = angle1 - Math.PI + u2 + (Math.PI - u2 - angle2) * v; + let p1a = center1.add(getVector(angle1a, radius1)); + let p1b = center1.add(getVector(angle1b, radius1)); + let p2a = center2.add(getVector(angle2a, radius2)); + let p2b = center2.add(getVector(angle2b, radius2)); + + // define handle length by the distance between + // both ends of the curve to draw + let totalRadius = (radius1 + radius2); + let d2 = Math.min(v * handle_len_rate, (p1a.subtract(p2a)).length / totalRadius); + + // case circles are overlapping: + d2 *= Math.min(1, d * 2 / (radius1 + radius2)); + + radius1 *= d2; + radius2 *= d2; + + let path = new paper.Path({ + segments: [p1a, p2a, p2b, p1b], + style: ball1.style, + closed: true + }); + let segments = path.segments; + segments[0].handleOut = getVector(angle1a - pi2, radius1); + segments[1].handleIn = getVector(angle2a + pi2, radius2); + segments[2].handleOut = getVector(angle2b - pi2, radius2); + segments[3].handleIn = getVector(angle1b + pi2, radius1); + return path; + } + + // ------------------------------------------------ + function getVector(radians:number, length:number) { + return new paper.Point({ + // Convert radians to degrees: + angle: radians * 180 / Math.PI, + length: length + }); + } + } + function Voronoi(){ + let voronoi:any = {}; + let sites = generateBeeHivePoints(paper.view.size.divide(200), true); + let bbox:any; + let diagram:any; + let oldSize = paper.view.size; + let spotColor = new paper.Color('red'); + let mousePos = paper.view.center; + let selected = false; + + onResize(); + + function onMouseDown(event: paper.ToolEvent) { + sites.push(event.point); + renderDiagram(); + } + + function onMouseMove(event: paper.ToolEvent) { + mousePos = event.point; + if (event.count == 0) + sites.push(event.point); + sites[sites.length - 1] = event.point; + renderDiagram(); + } + + function renderDiagram() { + paper.project.activeLayer.children = []; + let diagram = voronoi.compute(sites, bbox); + if (diagram) { + for (let i = 0, l = sites.length; i < l; i++) { + let cell = diagram.cells[(sites[i] as any).voronoiId]; + if (cell) { + let halfedges = cell.halfedges, + length = halfedges.length; + if (length > 2) { + let points:paper.Point[] = []; + for (let j = 0; j < length; j++) { + let v = halfedges[j].getEndpoint(); + points.push(new paper.Point(v)); + } + createPath(points, sites[i]); + } + } + } + } + } + + function removeSmallBits(path:paper.Path) { + let averageLength = path.length / path.segments.length; + let min = path.length / 50; + for(let i = path.segments.length - 1; i >= 0; i--) { + let segment = path.segments[i]; + let cur = segment.point; + let nextSegment = segment.next; + let next = nextSegment.point.add(nextSegment.handleIn); + if (cur.getDistance(next) < min) { + segment.remove(); + } + } + } + + function generateBeeHivePoints(size:paper.Size, loose: boolean) { + let points:paper.Point[] = []; + let col = paper.view.size.divide(size); + for(let i = -1; i < size.width + 1; i++) { + for(let j = -1; j < size.height + 1; j++) { + let point = new paper.Point(i, j).divide(new paper.Point(size)).multiply(new paper.Point(paper.view.size)).add(new paper.Point(col).divide(2)); + if(j % 2) + point = point.add(new paper.Point(col.width / 2, 0)); + if(loose) + point = point.add(new paper.Point(col).divide(4).multiply(paper.Point.random()).subtract(new paper.Point(col.divide(4)))); + points.push(point); + } + } + return points; + } + function createPath(points: paper.Point[], center: paper.Point) { + let path = new paper.Path(); + if (!selected) { + path.fillColor = spotColor; + } else { + path.fullySelected = selected; + } + path.closed = true; + + for (let i = 0, l = points.length; i < l; i++) { + let point = points[i]; + let next = points[(i + 1) == points.length ? 0 : i + 1]; + let vector = (next.subtract(point)).divide(2); + path.add(new paper.Point({ + point: point.add(vector), + handleIn: vector.multiply(-1), + handleOut: vector + })); + } + path.scale(0.95); + removeSmallBits(path); + return path; + } + + function onResize() { + let margin = 20; + bbox = { + xl: margin, + xr: paper.view.bounds.width - margin, + yt: margin, + yb: paper.view.bounds.height - margin + }; + for (let i = 0, l = sites.length; i < l; i++) { + sites[i] = sites[i].multiply(new paper.Point(paper.view.size.divide(oldSize))); + } + oldSize = paper.view.size; + renderDiagram(); + } + + function onKeyDown(event: paper.KeyEvent) { + if (event.key == 'space') { + selected = !selected; + renderDiagram(); + } + } + } + function FutureSplash(){ + // Code ported to Paper.js from http://the389.com/9/1/ + // with permission. + + let values = { + friction: 0.8, + timeStep: 0.01, + amount: 15, + mass: 2, + count: 0, + invMass: 1/2 + }; + values.invMass = 1 / values.mass; + + let path: paper.Path; + let springs: Spring[]; + let size = paper.view.size.multiply(new paper.Size([1.2, 1])); + + class SpringPoint extends paper.Point{ + fixed: boolean; + px: number; + py: number; + } + + class Spring { + a: SpringPoint; + b: SpringPoint; + restLength: number; + strength: number; + mamb: number; + + constructor(a:SpringPoint, b:SpringPoint, strength:number, restLength:number=0){ + this.a = a; + this.b = b; + this.restLength = restLength || 80; + this.strength = strength ? strength : 0.55; + this.mamb = values.invMass * values.invMass; + } + update() { + let delta = this.b.subtract(this.a); + let dist = delta.length; + let normDistStrength = (dist - this.restLength) / + (dist * this.mamb) * this.strength; + delta.y *= normDistStrength * values.invMass * 0.2; + if (!this.a.fixed) + this.a.y += delta.y; + if (!this.b.fixed) + this.b.y -= delta.y; + } + }; + + + function createPath(strength: number) { + let path = new paper.Path({ + fillColor: 'black' + }); + springs = []; + for (let i = 0; i <= values.amount; i++) { + let segment = path.add(new paper.Point(i / values.amount, 0.5).multiply(new paper.Point(size))); + let point = segment.point as SpringPoint; + if (i == 0 || i == values.amount) + point.y += size.height; + point.px = point.x; + point.py = point.y; + // The first two and last two points are fixed: + point.fixed = i < 2 || i > values.amount - 2; + if (i > 0) { + let spring = new Spring(segment.previous.point as SpringPoint, point, strength); + springs.push(spring); + } + } + path.position.x -= size.width / 4; + return path; + } + + function onResize() { + if (path) + path.remove(); + size = paper.view.bounds.size.multiply(new paper.Size([2, 1])); + path = createPath(0.1); + } + + function onMouseMove(event: paper.ToolEvent) { + let location = path.getNearestLocation(event.point); + let segment = location.segment; + let point = segment.point as SpringPoint; + + if (!point.fixed && location.distance < size.height / 4) { + let y = event.point.y; + point.y += (y - point.y) / 6; + if (segment.previous && !(segment.previous.point as SpringPoint).fixed) { + let previous = segment.previous.point; + previous.y += (y - previous.y) / 24; + } + if (segment.next && !(segment.next.point as SpringPoint).fixed) { + let next = segment.next.point; + next.y += (y - next.y) / 24; + } + } + } + + function onFrame(event:paper.IFrameEvent) { + updateWave(path); + } + + function updateWave(path:paper.Path) { + let force = 1 - values.friction * values.timeStep * values.timeStep; + for (let i = 0, l = path.segments.length; i < l; i++) { + let point = path.segments[i].point as SpringPoint; + let dy = (point.y - point.py) * force; + point.py = point.y; + point.y = Math.max(point.y + dy, 0); + } + + for (let j = 0, l = springs.length; j < l; j++) { + springs[j].update(); + } + path.smooth({ type: 'continuous' }); + } + + function onKeyDown(event:paper.KeyEvent) { + if (event.key == 'space') { + path.fullySelected = !path.fullySelected; + path.fillColor = path.fullySelected ? new paper.Color('') : 'black'; + } + } + } + function Smoothing(){ + let width: number; + let height: number; + let center: paper.Point; + let points = 10; + let smooth = true; + let path = new paper.Path(); + let mousePos = paper.view.center.divide(2); + let pathHeight = mousePos.y; + path.fillColor = 'black'; + initializePath(); + + function initializePath() { + center = paper.view.center; + width = paper.view.size.width; + height = paper.view.size.height / 2; + path.segments = []; + path.add(paper.view.bounds.bottomLeft); + for (let i = 1; i < points; i++) { + let point = new paper.Point(width / points * i, center.y); + path.add(point); + } + path.add(paper.view.bounds.bottomRight); + path.fullySelected = true; + } + + function onFrame(event:paper.IFrameEvent) { + pathHeight += (center.y - mousePos.y - pathHeight) / 10; + for (let i = 1; i < points; i++) { + let sinSeed = event.count + (i + i % 10) * 100; + let sinHeight = Math.sin(sinSeed / 200) * pathHeight; + let yPos = Math.sin(sinSeed / 100) * sinHeight + height; + path.segments[i].point.y = yPos; + } + if (smooth) + path.smooth({ type: 'continuous' }); + } + + function onMouseMove(event:paper.ToolEvent) { + mousePos = event.point; + } + + function onMouseDown(event:paper.ToolEvent) { + smooth = !smooth; + if (!smooth) { + // If smooth has been turned off, we need to reset + // the handles of the path: + for (let i = 0, l = path.segments.length; i < l; i++) { + let segment = path.segments[i]; + segment.clearHandles(); + } + } + } + + // Reposition the path whenever the window is resized: + function onResize(event:paper.Event) { + initializePath(); + } + } + function SpiralRaster(){ + // Please note: dragging and dropping images only works for + // certain browsers when serving this script online: + let path:paper.Path; + let position:paper.Point; + let max:number; + let count = 0; + let grow = false; + + // As the web is asynchronous, we need to wait for the raster to + // load before we can perform any operation on its pixels. + let raster = new paper.Raster('mona'); + raster.visible = false; + raster.on('load', resetSpiral); + + let text = new paper.PointText({ + justification: 'right', + fontSize: 12, + content: (window as any).FileReader + ? 'drag & drop an image from your desktop to rasterize it' + : 'to drag & drop images, please use Webkit, Firefox, Chrome or IE 10' + }); + + function onFrame(event:paper.IFrameEvent) { + if (grow) { + if (raster.loaded && (paper.view.center.subtract(position)).length < max) { + for (let i = 0, l = count / 36 + 1; i < l; i++) { + growSpiral(); + } + path.smooth(); + } else { + grow = false; + } + } + } + + function growSpiral() { + count++; + let vector = new paper.Point({ + angle: count * 5, + length: count / 100 + }); + let rot = vector.rotate(90); + let color = raster.getAverageColor(position.add(vector.divide(2))); + let value = color ? (1 - color.gray) * 3.7 : 0; + rot.length = Math.max(value, 0.2); + path.add(position.add(vector).subtract(rot)); + path.insert(0, position.add(vector).add(rot)); + position = position.add(vector); + } + + function resetSpiral() { + grow = true; + + // Transform the raster, so it fills the paper.view: + raster.fitBounds(paper.view.bounds); + + if (path) + path.remove(); + + position = paper.view.center; + count = 0; + path = new paper.Path({ + fillColor: 'black', + closed: true + }); + + position = paper.view.center; + max = Math.min(raster.bounds.width, raster.bounds.height) * 0.5; + } + + function onResize() { + if (raster.loaded) + resetSpiral(); + text.point = paper.view.bounds.bottomRight.subtract(new paper.Point([30, 30])); + } + + function onKeyDown(event:paper.KeyEvent) { + if (event.key == 'space') { + path.selected = !path.selected; + } + } + + function onDocumentDrag(event:Event) { + event.preventDefault(); + } + + function onDocumentDrop(event:Event) { + event.preventDefault(); + + let file = (event as any).dataTransfer.files[0]; + let reader = new FileReader(); + + reader.onload = function (event) { + let image = document.createElement('img'); + image.onload = function () { + raster = new paper.Raster(image); + raster.visible = false; + resetSpiral(); + }; + if(event.target) + image.src = (event.target as any).result; + }; + reader.readAsDataURL(file); + } + + document.addEventListener('drop', onDocumentDrop, false); + document.addEventListener('dragover', onDocumentDrag, false); + document.addEventListener('dragleave', onDocumentDrag, false); + } + function DivisionRaster(){ + // Based on 'JPEG Raster' by Jonathan Puckey: + // http://www.flickr.com/photos/puckey/3179779686/in/photostream/ + + // Create a raster item: + let raster = new paper.Raster('mona.jpg'); + let loaded = false; + + raster.on('load', function(event: paper.Event) { + loaded = true; + paper.view.onResize(event); + }); + + // Make the raster invisible: + raster.visible = false; + + let lastPos = paper.view.center; + function moveHandler(this: paper.Path, event:paper.MouseEvent) { + if (!loaded) + return; + if (lastPos.getDistance(event.point) < 10) + return; + lastPos = event.point; + + let size: paper.Size = this.bounds.size.clone(); + let isLandscape = size.width > size.height; + + // If the path is in landscape orientation, we're going to + // split the path horizontally, otherwise vertically: + + size= size.divide(new paper.Size(isLandscape ? [2, 1] : [1, 2])); + + let path = new paper.Path.Rectangle({ + point: this.bounds.topLeft.floor(), + size: size.ceil(), + onMouseMove: moveHandler + }); + path.fillColor = raster.getAverageColor(path); + + let path2 = new paper.Path.Rectangle({ + point: isLandscape + ? this.bounds.topCenter.ceil() + : this.bounds.leftCenter.ceil(), + size: size.floor(), + onMouseMove: moveHandler + }); + path2.fillColor = raster.getAverageColor(path2); + + this.remove(); + } + + function onResize(event:paper.Event) { + if (!loaded) + return; + paper.project.activeLayer.removeChildren(); + + // Transform the raster so that it fills the bounding rectangle + // of the paper.view: + raster.fitBounds(paper.view.bounds, true); + + // Create a path that fills the paper.view, and fill it with + // the average color of the raster: + new paper.Path.Rectangle({ + rectangle: paper.view.bounds, + fillColor: raster.getAverageColor(paper.view.bounds), + onMouseMove: moveHandler + }); + } + } + function Qbertify(){ + // Please note: dragging and dropping images only works for + // certain browsers when serving this script online: + + let values = { + amount: 30 + }; + + let raster: paper.Raster; + let group: paper.Group; + let piece = createPiece(); + let count = 0; + + handleImage('mona'); + + let text = new paper.PointText({ + point: paper.view.center, + justification: 'center', + fillColor: 'white', + fontSize: 15, + content: (window as any).FileReader + ? 'Drag & drop an image from your desktop' + : 'To drag & drop images, please use Webkit, Firefox, Chrome or IE 10' + }); + + function createPiece() { + let group = new paper.Group(); + let hexagon = new paper.Path.RegularPolygon({ + center: paper.view.center, + sides: 6, + radius: 50, + fillColor: 'gray', + parent: group + }); + for (let i = 0; i < 2; i++) { + let path = new paper.Path({ + closed: true, + parent: group, + fillColor: i == 0 ? 'white' : 'black' + }); + for (let j = 0; j < 3; j++) { + let index = (i * 2 + j) % hexagon.segments.length; + path.add(hexagon.segments[index].clone()); + } + path.add(hexagon.bounds.center); + } + // Remove the group from the document, so it is not drawn: + group.remove(); + return group; + } + + function handleImage(image:HTMLImageElement|string) { + count = 0; + let size = piece.bounds.size; + + if (group) + group.remove(); + + // As the web is asynchronous, we need to wait for the raster to + // load before we can perform any operation on its pixels. + raster = new paper.Raster(image); + raster.visible = false; + raster.on('load', function() { + // Transform the raster, so it fills the paper.view: + raster.fitBounds(paper.view.bounds, true); + group = new paper.Group(); + for (let y = 0; y < values.amount; y++) { + for (let x = 0; x < values.amount; x++) { + let copy = piece.clone(); + copy.position = copy.position.add(new paper.Point(size.multiply(new paper.Size([x + (y % 2 ? 0.5 : 0), y * 0.75])))); + group.addChild(copy); + } + } + + // Transform the group so it covers the paper.view: + group.fitBounds(paper.view.bounds, true); + group.scale(1.1); + }) + } + + function onFrame(event:paper.IFrameEvent) { + if (!group) + return; + // Loop through the uncolored hexagons in the group and fill them + // with the average color: + let length = Math.min(count + values.amount, group.children.length); + for (let i = count; i < length; i++) { + piece = group.children[i] as paper.Group; + let hexagon = piece.children[0] as paper.Path; + let color = raster.getAverageColor(hexagon); + if (color) { + hexagon.fillColor = color; + let top = piece.children[1]; + top.fillColor = color.clone(); + top.fillColor.brightness *= 1.5; + + let right = piece.children[2]; + right.fillColor = color.clone(); + right.fillColor.brightness *= 0.5; + } + } + count += values.amount; + } + + function onResize() { + paper.project.activeLayer.position = paper.view.center; + } + + function onDocumentDrag(event:Event) { + event.preventDefault(); + } + + function onDocumentDrop(event:Event) { + event.preventDefault(); + + let file = (event as any).dataTransfer.files[0]; + let reader = new FileReader(); + + reader.onload = function(event) { + let image = document.createElement('img'); + image.onload = function () { + handleImage(image); + paper.view.draw(); + }; + image.src = (event as any).target.result; + }; + reader.readAsDataURL(file); + } + + document.addEventListener('drop', onDocumentDrop, false); + document.addEventListener('dragover', onDocumentDrag, false); + document.addEventListener('dragleave', onDocumentDrag, false); + } + function PathIntersections(){ + // Imported SVG Groups have their applyMatrix flag turned off by + // default. This is required for SVG importing to work correctly. Turn + // it on now, so we don't have to deal with nested coordinate spaces. + let words = paper.project.importSVG((document.getElementById('svg') as any) as SVGElement); + words.visible = true; // Turn off the effect of display:none; + words.fillColor = new paper.Color(''); + words.strokeColor = 'black'; + let yesGroup = words.getItem({name:'yes'}) as paper.Group; + + let noGroup = words.getItem({name:'no'}) as paper.Group; + // Resize the words to fit snugly inside the paper.view: + words.fitBounds(paper.view.bounds); + words.scale(0.8); + + yesGroup.position = paper.view.center; + noGroup.position = new paper.Point([-900, -900]); + + function onMouseMove(event:paper.MouseEvent) { + noGroup.position = event.point; + for (let i = 0; i < yesGroup.children.length; i++) { + for (let j = 0; j < noGroup.children.length; j++) { + showIntersections(noGroup.children[j] as paper.PathItem, yesGroup.children[i] as paper.PathItem) + } + } + } +0 + function showIntersections(path1:paper.PathItem, path2:paper.PathItem) { + let intersections = path1.getIntersections(path2); + for (let i = 0; i < intersections.length; i++) { + new paper.Path.Circle({ + center: intersections[i].point, + radius: 5, + fillColor: '#009dec' + }).removeOnMove(); + } + } + } + function PathSimplification(){ + let path:paper.Path; + + let textItem = new paper.PointText({ + content: 'Click and drag to draw a line.', + point: new paper.Point(20, 30), + fillColor: 'black', + }); + + function onMouseDown(event:paper.ToolEvent) { + // If we produced a path before, deselect it: + if (path) { + path.selected = false; + } + + // Create a new path and set its stroke color to black: + path = new paper.Path({ + segments: [event.point], + strokeColor: 'black', + // Select the path, so we can see its segment points: + fullySelected: true + }); + } + + // While the user drags the mouse, points are added to the path + // at the position of the mouse: + function onMouseDrag(event:paper.ToolEvent) { + path.add(event.point); + + // Update the content of the text item to show how many + // segments it has: + textItem.content = 'Segment count: ' + path.segments.length; + } + + // When the mouse is released, we simplify the path: + function onMouseUp(event:paper.ToolEvent) { + let segmentCount = path.segments.length; + + // When the mouse is released, simplify it: + path.simplify(10); + + // Select the path, so we can see its segments: + path.fullySelected = true; + + let newSegmentCount = path.segments.length; + let difference = segmentCount - newSegmentCount; + let percentage = 100 - Math.round(newSegmentCount / segmentCount * 100); + textItem.content = difference + ' of the ' + segmentCount + ' segments were removed. Saving ' + percentage + '%'; + } + } + function HitTesting(){ + let values = { + paths: 50, + minPoints: 5, + maxPoints: 15, + minRadius: 30, + maxRadius: 90 + }; + + let hitOptions = { + segments: true, + stroke: true, + fill: true, + tolerance: 5 + }; + + createPaths(); + + function createPaths() { + let radiusDelta = values.maxRadius - values.minRadius; + let pointsDelta = values.maxPoints - values.minPoints; + for (let i = 0; i < values.paths; i++) { + let radius = values.minRadius + Math.random() * radiusDelta; + let points = values.minPoints + Math.floor(Math.random() * pointsDelta); + let path = createBlob(paper.Point.random().multiply(new paper.Point(paper.view.size)), radius, points); + let lightness = (Math.random() - 0.5) * 0.4 + 0.4; + let hue = Math.random() * 360; + path.fillColor = new paper.Color({ hue: hue, saturation: 1, lightness: lightness }); + path.strokeColor = 'black'; + }; + } + + function createBlob(center:paper.Point, maxRadius:number, points:number) { + let path = new paper.Path(); + path.closed = true; + for (let i = 0; i < points; i++) { + let delta = new paper.Point({ + length: (maxRadius * 0.5) + (Math.random() * maxRadius * 0.5), + angle: (360 / points) * i + }); + path.add(center.add(delta)); + } + path.smooth(); + return path; + } + + let segment:paper.Segment | null; + let path:paper.Path | null; + let movePath = false; + function onMouseDown(event:paper.ToolEvent) { + segment = path = null; + let hitResult = paper.project.hitTest(event.point, hitOptions); + if (!hitResult) + return; + + if (event.modifiers.shift) { + if (hitResult.type == 'segment') { + hitResult.segment.remove(); + }; + return; + } + + if (hitResult) { + path = hitResult.item as paper.Path; + if (hitResult.type == 'segment') { + segment = hitResult.segment; + } else if (hitResult.type == 'stroke') { + let location = hitResult.location; + segment = path.insert(location.index + 1, event.point); + path.smooth(); + } + } + movePath = hitResult.type == 'fill'; + if (movePath) + paper.project.activeLayer.addChild(hitResult.item); + } + + function onMouseMove(event:paper.ToolEvent) { + paper.project.activeLayer.selected = false; + if (event.item) + event.item.selected = true; + } + + function onMouseDrag(event:paper.ToolEvent) { + if (segment) { + segment.point= segment.point.add(event.delta); + if(path) + path.smooth(); + } else if (path) { + path.position = path.position.add(event.delta); + } + } + } + function BouncingBalls(){ + class Ball{ + point: paper.Point; + vector:paper.Point; + dampen:number; + gravity:number; + bounce:number; + radius: number; + item: paper.Item; + + constructor(point:paper.Point, vector:paper.Point) { + if (!vector || vector.isZero()) { + this.vector = paper.Point.random().multiply(5); + } else { + this.vector = vector.multiply(2);; + } + this.point = point; + this.dampen = 0.4; + this.gravity = 3; + this.bounce = -0.6; + + let color = new paper.Color({ + hue: Math.random() * 360, + saturation: 1, + brightness: 1 + }); + let gradient = new paper.Gradient([new paper.GradientStop(color), new paper.GradientStop(new paper.Color('black'))], true); + + let radius = this.radius = 50 * Math.random() + 30; + // Wrap CompoundPath in a Group, since CompoundPaths directly + // applies the transformations to the content, just like Path. + let ball = new paper.CompoundPath({ + children: [ + new paper.Path.Circle({ + radius: radius + }), + new paper.Path.Circle({ + center: radius / 8, + radius: radius / 3 + }) + ], + fillColor: new paper.Color(gradient, new paper.Point([0]), new paper.Point([radius]), new paper.Point([radius / 8])), + }); + + this.item = new paper.Group({ + children: [ball], + transformContent: false, + position: this.point + }); + } + iterate() { + let size = paper.view.size; + this.vector.y += this.gravity; + this.vector.x *= 0.99; + let pre = this.point.add(this.vector); + if (pre.x < this.radius || pre.x > size.width - this.radius) + this.vector.x *= -this.dampen; + if (pre.y < this.radius || pre.y > size.height - this.radius) { + if (Math.abs(this.vector.x) < 3) + this.vector = paper.Point.random().multiply(new paper.Point([150, 100]).add(new paper.Point([-75, 20]))); + this.vector.y *= this.bounce; + } + + let max = paper.Point.max(new paper.Point([this.radius]), this.point.add(this.vector)); + this.item.position = this.point = paper.Point.min(max, new paper.Point(size).subtract(this.radius)); + this.item.rotate(this.vector.x); + } + } + + let balls:Ball[] = []; + for (let i = 0; i < 10; i++) { + let position = paper.Point.random().multiply(new paper.Point(paper.view.size)); + let vector = (paper.Point.random().subtract(new paper.Point([0.5, 0])).multiply(new paper.Point([50, 100]))); + let ball = new Ball(position, vector); + balls.push(ball); + } + + let textItem = new paper.PointText({ + point: [20, 30], + fillColor: 'black', + content: 'Click, drag and release to add balls.' + }); + + let lastDelta:paper.Point|null; + function onMouseDrag(event:paper.ToolEvent) { + lastDelta = event.delta; + } + + function onMouseUp(event:paper.ToolEvent) { + if(lastDelta){ + let ball = new Ball(event.point, lastDelta); + balls.push(ball); + } + lastDelta = null; + } + + function onFrame() { + for (let i = 0, l = balls.length; i < l; i++) + balls[i].iterate(); + } + } +} + +function APIReferenceExamples() { + function Color0() { + + // Create a circle shaped path at {x: 80, y: 50} + // with a radius of 30. + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + // Pass a color name to the fillColor property, which is internally + // converted to a Color. + circle.fillColor = 'green'; + + } + function Color1() { + + // Create a circle shaped path at {x: 80, y: 50} + // with a radius of 30. + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + // Pass a hex string to the fillColor property, which is internally + // converted to a Color. + circle.fillColor = '#ff0000'; + + } + function Color2() { + + // Create a circle shaped path at {x: 80, y: 50} + // with a radius of 30: + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + // 100% red, 0% blue, 50% blue: + circle.fillColor = new paper.Color(1, 0, 0.5); + + } + function Color3() { + + // Create a circle shaped path at {x: 80, y: 50} + // with a radius of 30: + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + // Create a GrayColor with 50% gray: + circle.fillColor = new paper.Color(0.5); + + } + function Color4() { + + // Create a circle shaped path at {x: 80, y: 50} + // with a radius of 30: + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + // Create an HSB Color with a hue of 90 degrees, a saturation + // 100% and a brightness of 100%: + circle.fillColor = new paper.Color({ hue: 90, saturation: 1, brightness: 1 }); + + } + function Color5() { + + // Create a circle shaped path at {x: 80, y: 50} + // with a radius of 30: + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + // Create an HSL Color with a hue of 90 degrees, a saturation + // 100% and a lightness of 50%: + circle.fillColor = new paper.Color({ hue: 90, saturation: 1, lightness: 0.5 }); + + } + function Color6() { + + // Define two points which we will be using to construct + // the path and to position the gradient color: + let topLeft = paper.view.center.subtract(new paper.Point([80, 80])); + let bottomRight = paper.view.center.add(new paper.Point([80, 80])); + + let path = new paper.Path.Rectangle({ + topLeft: topLeft, + bottomRight: bottomRight, + // Fill the path with a gradient of three color stops + // that runs between the two points we defined earlier: + fillColor: { + stops: ['yellow', 'red', 'blue'], + origin: topLeft, + destination: bottomRight + } + }); + + } + function Color7() { + + // Define two points which we will be using to construct + // the path and to position the gradient color: + let topLeft = paper.view.center.subtract(new paper.Point([80, 80])); + let bottomRight = paper.view.center.add(new paper.Point([80, 80])); + + // Create a rectangle shaped path between + // the topLeft and bottomRight points: + let path = new paper.Path.Rectangle(topLeft, bottomRight); + + // Create the gradient, passing it an array of colors to be converted + // to evenly distributed color stops: + let gradient = new paper.Gradient(['yellow','red','blue']); + + // Have the gradient color run between the topLeft and + // bottomRight points we defined earlier: + let gradientColor = new paper.Color(gradient, topLeft, bottomRight); + + // Set the fill color of the path to the gradient color: + path.fillColor = gradientColor; + + } + function Color8() { + + // Create a circle shaped path at the center of the paper.view + // with a radius of 80: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 80 + }); + + // The stops array: yellow mixes with red between 0 and 15%, + // 15% to 30% is pure red, red mixes with black between 30% to 100%: + let stops = [ + ['yellow', 0], + ['red', 0.15], + ['red', 0.3], + ['black', 0.9] + ]; + + // Create a radial gradient using the color stops array: + let gradient = new paper.Gradient(stops, true); + + // We will use the center point of the circle shaped path as + // the origin point for our gradient color + let from = path.position; + + // The destination point of the gradient color will be the + // center point of the path + 80pt in horizontal direction: + let to = path.position.add(new paper.Point([80, 0])); + + // Create the gradient color: + let gradientColor = new paper.Color(gradient, from, to); + + // Set the fill color of the path to the gradient color: + path.fillColor = gradientColor; + + } + function Color9() { + + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + // Fill the circle with red and give it a 20pt green stroke: + circle.style = { + fillColor: 'red', + strokeColor: 'green', + strokeWidth: 20 + }; + + // Make the stroke half transparent: + (circle.strokeColor as paper.Color).alpha = 0.5; + + } + function Color10() { + + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + circle.fillColor = new paper.Color('blue'); + + // Blue + red = purple: + circle.fillColor.red = 1; + + } + function Color11() { + + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + // First we set the fill color to red: + circle.fillColor = new paper.Color('red'); + + // Red + green = yellow: + circle.fillColor.green = 1; + + } + function Color12() { + + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + // First we set the fill color to red: + circle.fillColor = new paper.Color('red'); + + // Red + blue = purple: + circle.fillColor.blue = 1; + + } + function Color13() { + + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + circle.fillColor = new paper.Color('red'); + circle.fillColor.hue += 30; + + } + function Color14() { + + // Create a rectangle shaped path, using the dimensions + // of the paper.view: + let path = new paper.Path.Rectangle(paper.view.bounds); + path.fillColor = new paper.Color('red'); + + function onFrame(event:paper.IFrameEvent) { + (path.fillColor as paper.Color).hue += 0.5; + } + + } + function Color15() { + + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: paper.view.bounds.height * 0.4 + }); + + path.fillColor = new paper.Color({ + gradient: new paper.Gradient({ + stops: ['yellow', 'red', 'black'], + radial: true }), + origin: path.position, + destination: path.bounds.rightCenter + }); + + function onMouseMove(event:paper.ToolEvent) { + // Set the origin highlight of the path's gradient color + // to the position of the mouse: + (path.fillColor as paper.Color).highlight = event.point; + } + + } + function CompoundPath0() { + + let path = new paper.CompoundPath({ + children: [ + new paper.Path.Circle({ + center: new paper.Point(50, 50), + radius: 30 + }), + new paper.Path.Circle({ + center: new paper.Point(50, 50), + radius: 10 + }) + ], + fillColor: 'black', + selected: true + }); + + } + function CompoundPath1() { + + let pathData = 'M20,50c0,-16.56854 13.43146,-30 30,-30c16.56854,0 30,13.43146 30,30c0,16.56854 -13.43146,30 -30,30c-16.56854,0 -30,-13.43146 -30,-30z M50,60c5.52285,0 10,-4.47715 10,-10c0,-5.52285 -4.47715,-10 -10,-10c-5.52285,0 -10,4.47715 -10,10c0,5.52285 4.47715,10 10,10z'; + let path = new paper.CompoundPath(pathData); + path.fillColor = 'black'; + + } + function CompoundPath2() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function CompoundPath3() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function CompoundPath4() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function CompoundPath5() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function CompoundPath6() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function CompoundPath7() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function CompoundPath8() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function CompoundPath9() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function CompoundPath10() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function CompoundPath11() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function CompoundPath12() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function CompoundPath13() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function CompoundPath14() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function CompoundPath15() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function CompoundPath16() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function CompoundPath17() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function CompoundPath18() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function CompoundPath19() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function CompoundPath20() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function CompoundPath21() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function CompoundPath22() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function CompoundPath23() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function CompoundPath24() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function CompoundPath25() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function CompoundPath26() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function CompoundPath27() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function CompoundPath28() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function CompoundPath29() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function CompoundPath30() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function CompoundPath31() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function CompoundPath32() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function CompoundPath33() { + + function enter(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function CompoundPath34() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function CompoundPath35() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function CompoundPath36() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function CompoundPath37() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function CompoundPath38() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function CompoundPath39() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function CompoundPath40() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function CompoundPath41() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function CompoundPath42() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function CompoundPath43() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function CompoundPath44() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function CompoundPath45() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function CompoundPath46() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function CompoundPath47() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function CompoundPath48() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Item, event:paper.MouseEvent) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Item, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + }); + + } + function CompoundPath49() { + + let pathHandlers = { + mouseenter: function(this:paper.Item, event:paper.MouseEvent) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Item, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function CompoundPath50() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function CompoundPath51() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function CompoundPath52() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function CompoundPath53() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function CompoundPath54() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function CompoundPath55() { + + let path = new paper.Path.Rectangle(new paper.Point(30, 25), new paper.Size(50, 50)); + path.strokeColor = 'black'; + + let secondPath = path.clone(); + let intersectionGroup = new paper.Group(); + + function onFrame(event:paper.IFrameEvent) { + secondPath.rotate(1); + + let intersections = path.getIntersections(secondPath); + intersectionGroup.removeChildren(); + + for (let i = 0; i < intersections.length; i++) { + let intersectionPath = new paper.Path.Circle({ + center: intersections[i].point, + radius: 4, + fillColor: 'red', + parent: intersectionGroup + }); + } + } + + } + function CompoundPath56() { + + let star = new paper.Path.Star({ + center: paper.view.center, + points: 10, + radius1: 30, + radius2: 60, + strokeColor: 'black' + }); + + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 3, + fillColor: 'red' + }); + + function onMouseMove(event:paper.ToolEvent) { + // Get the nearest point from the mouse position + // to the star shaped path: + let nearestPoint = star.getNearestPoint(event.point); + + // Move the red circle to the nearest point: + circle.position = nearestPoint; + } + + } + function CompoundPath57() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Select the path, so we can inspect its segments: + path.selected = true; + + // Create a copy of the path and move it by 150 points: + let copy = path.clone(); + copy.position.x += 150; + + // Flatten the copied path, with a maximum error of 4 points: + copy.flatten(4); + + } + function CompoundPath58() { + + // Create a rectangular path with its top-left point at + // {x: 30, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle({ + point: [30, 25], + size: [50, 50], + strokeColor: 'black', + }); + + // Select the path, so we can see its handles: + path.fullySelected = true; + + // Create a copy of the path and move it 100 to the right: + let copy = path.clone(); + copy.position.x += 100; + + // Smooth the segments of the copy: + copy.smooth({ type: 'continuous' }); + + } + function CompoundPath59() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + path.add(new paper.Point(30, 50)); + + let y = 5; + let x = 3; + + for (let i = 0; i < 28; i++) { + y *= -1.1; + x *= 1.1; + path.lineBy(new paper.Point(x, y)); + } + + // Create a copy of the path and move it 100 down: + let copy = path.clone(); + copy.position.y += 120; + + // Select the path, so we can see its handles: + copy.fullySelected = true; + + // Smooth the path using centripetal Catmull-Rom splines: + copy.smooth({ type: 'catmull-rom', factor: 0.5 }); + + } + function CompoundPath60() { + + // Create 5 rectangles, next to each other: + let paths:paper.Path[] = []; + for (let i = 0; i < 5; i++) { + paths.push(new paper.Path.Rectangle({ + point: [30 + i * 100, 30], + size: [50, 50], + fullySelected: true + })); + } + // Smooth a range, using segments: + paths[1].smooth({ + type: 'continuous', + from: paths[1].segments[0], + to: paths[1].segments[2] + }); + + // Smooth a range, using curves: + paths[2].smooth({ + type: 'continuous', + from: paths[2].curves[0], + to: paths[2].curves[1] + }); + + // Smooth a range, using indices: + paths[3].smooth({ type: 'continuous', from: 0, to: 2 }); + + // Smooth a range, using negative indices: + paths[4].smooth({ type: 'continuous', from: -1, to: 1 }); + + } + function CompoundPath61() { + + let path: paper.Path | null; + function onMouseDown(event:paper.ToolEvent) { + // If we already made a path before, deselect it: + if (path) { + path.selected = false; + } + + // Create a new path and add the position of the mouse + // as its first segment. Select it, so we can see the + // segment points: + path = new paper.Path({ + segments: [event.point], + strokeColor: 'black', + selected: true + }); + } + + function onMouseDrag(event:paper.ToolEvent) { + // On every drag event, add a segment to the path + // at the position of the mouse: + if(path){ + path.add(event.point); + } + } + + function onMouseUp(event:paper.ToolEvent) { + // When the mouse is released, simplify the path: + if(path){ + path.simplify(); + path.selected = true; + } + } + + } + function CompoundPath62() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + let firstPoint = new paper.Point(30, 75); + path.add(firstPoint); + + // The point through which we will create the arc: + let throughPoint = new paper.Point(40, 40); + + // The point at which the arc will end: + let toPoint = new paper.Point(130, 75); + + // Draw an arc through 'throughPoint' to 'toPoint' + path.arcTo(throughPoint, toPoint); + + // Add a red circle shaped path at the position of 'throughPoint': + let circle = new paper.Path.Circle(throughPoint, 3); + circle.fillColor = 'red'; + + } + function CompoundPath63() { + + let myPath: paper.Path | null; + function onMouseDrag(event:paper.ToolEvent) { + // If we created a path before, remove it: + if (myPath) { + myPath.remove(); + } + + // Create a new path and add a segment point to it + // at {x: 150, y: 150): + myPath = new paper.Path(); + myPath.add(new paper.Point(150, 150)); + + // Draw an arc through the position of the mouse to 'toPoint' + let toPoint = new paper.Point(350, 150); + myPath.arcTo(event.point, toPoint); + + // Select the path, so we can see its segments: + myPath.selected = true; + } + + // When the mouse is released, deselect the path + // and fill it with black. + function onMouseUp(event:paper.ToolEvent) { + if(myPath){ + myPath.selected = false; + myPath.fillColor = 'black'; + } + } + + } + function CompoundPath64() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + path.add(new paper.Point(30, 75)); + path.arcTo(new paper.Point(130, 75)); + + let path2 = new paper.Path(); + path2.strokeColor = 'red'; + path2.add(new paper.Point(180, 25)); + + // To draw an arc in anticlockwise direction, + // we pass `false` as the second argument to arcTo: + path2.arcTo(new paper.Point(280, 25), false); + + } + function CompoundPath65() { + + let myPath:paper.Path; + + // The mouse has to move at least 20 points before + // the next mouse drag event is fired: + paper.tool.minDistance = 20; + + // When the user clicks, create a new path and add + // the current mouse position to it as its first segment: + function onMouseDown(event:paper.ToolEvent) { + myPath = new paper.Path(); + myPath.strokeColor = 'black'; + myPath.add(event.point); + } + + // On each mouse drag event, draw an arc to the current + // position of the mouse: + function onMouseDrag(event:paper.ToolEvent) { + myPath.arcTo(event.point); + } + + } + function CompoundPath66() { + + let myPath: paper.Path | null; + function onMouseMove(event:paper.ToolEvent) { + // If we created a path before, remove it: + if (myPath) { + myPath.remove(); + } + + // Create a new path and add a segment point to it + // at {x: 150, y: 150): + myPath = new paper.Path(); + myPath.add(new paper.Point(150, 150)); + + // Draw a curve through the position of the mouse to 'toPoint' + let toPoint = new paper.Point(350, 150); + myPath.curveTo(event.point, toPoint); + + // Select the path, so we can see its segments: + myPath.selected = true; + } + + } + function CompoundPath67() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + // Add a segment at {x: 50, y: 50} + path.add(new paper.Point(25, 25)); + + // Add a segment relative to the last segment of the path. + // 50 in x direction and 0 in y direction, becomes {x: 75, y: 25} + path.lineBy(new paper.Point(50, 0)); + + // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75} + path.lineBy(new paper.Point(0, 50)); + + } + function CompoundPath68() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + // Add the first segment at {x: 50, y: 50} + path.add(paper.view.center); + + // Loop 500 times: + for (let i = 0; i < 500; i++) { + // Create a vector with an ever increasing length + // and an angle in increments of 45 degrees + let vector = new paper.Point({ + angle: i * 45, + length: i / 2 + }); + // Add the vector relatively to the last segment point: + path.lineBy(vector); + } + + // Smooth the handles of the path: + path.smooth(); + + // Uncomment the following line and click on 'run' to see + // the construction of the path: + // path.selected = true; + + } + function Gradient0() { + + // Define two points which we will be using to construct + // the path and to position the gradient color: + let topLeft = paper.view.center.subtract(new paper.Point([80, 80])); + let bottomRight = paper.view.center.add(new paper.Point([80, 80])); + + // Create a rectangle shaped path between + // the topLeft and bottomRight points: + let path = new paper.Path.Rectangle({ + topLeft: topLeft, + bottomRight: bottomRight, + // Fill the path with a gradient of three color stops + // that runs between the two points we defined earlier: + fillColor: { + gradient: { + stops: ['yellow', 'red', 'blue'] + }, + origin: topLeft, + destination: bottomRight + } + }); + + } + function Gradient1() { + + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: paper.view.bounds.height * 0.4 + }); + + // Fill the path with a radial gradient color with three stops: + // yellow from 0% to 5%, mix between red from 5% to 20%, + // mix between red and black from 20% to 100%: + path.fillColor = new paper.Color({ + gradient: new paper.Gradient({ + stops: [['yellow', 0.05], ['red', 0.2], ['black', 1]], + radial: true + }), + origin: path.position, + destination: path.bounds.rightCenter + }); + + } + function GradientStop0() { + + // Create a circle shaped path at the center of the paper.view, + // using 40% of the height of the paper.view as its radius + // and fill it with a radial gradient color: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: paper.view.bounds.height * 0.4 + }); + + path.fillColor = new paper.Color({ + gradient: new paper.Gradient({ + stops: [['yellow', 0.05], ['red', 0.2], ['black', 1]], + radial: true + }), + origin: path.position, + destination: path.bounds.rightCenter + }); + + let gradient = path.fillColor.gradient; + + // This function is called each frame of the animation: + function onFrame(event:paper.IFrameEvent) { + if(gradient){ + let blackStop = gradient.stops[2]; + // Animate the offset between 0.7 and 0.9: + blackStop.offset = Math.sin(event.time * 5) * 0.1 + 0.8; + + // Animate the offset between 0.2 and 0.4 + let redStop = gradient.stops[1]; + redStop.offset = Math.sin(event.time * 3) * 0.1 + 0.3; + } + } + + } + function GradientStop1() { + + // Create a circle shaped path at the center of the paper.view, + // using 40% of the height of the paper.view as its radius + // and fill it with a radial gradient color: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: paper.view.bounds.height * 0.4 + }); + + path.fillColor = new paper.Color({ + gradient: new paper.Gradient({ + stops: [['yellow', 0.05], ['red', 0.2], ['black', 1]], + radial: true + }), + origin: path.position, + destination: path.bounds.rightCenter + }); + + let redStop:paper.GradientStop; + let blackStop:paper.GradientStop; + if(path.fillColor.gradient){ + redStop = path.fillColor.gradient.stops[1]; + blackStop = path.fillColor.gradient.stops[2]; + } + + // This function is called each frame of the animation: + function onFrame(event:paper.IFrameEvent) { + // Animate the offset between 0.7 and 0.9: + blackStop.offset = Math.sin(event.time * 5) * 0.1 + 0.8; + + // Animate the offset between 0.2 and 0.4 + redStop.offset = Math.sin(event.time * 3) * 0.1 + 0.3; + } + + } + function Group0() { + + let path = new paper.Path([new paper.Point([100, 100]), new paper.Point([100, 200])]); + let path2 = new paper.Path([new paper.Point([50, 150]), new paper.Point([150, 150])]); + + // Create a group from the two paths: + let group = new paper.Group([path, path2]); + + // Set the stroke color of all items in the group: + group.strokeColor = 'black'; + + // Move the group to the center of the paper.view: + group.position = paper.view.center; + + } + function Group1() { + + let group = new paper.Group(); + + function onMouseDown(event:paper.ToolEvent) { + // Create a new circle shaped path at the position + // of the mouse: + let path = new paper.Path.Circle(event.point, 5); + path.fillColor = 'black'; + + // Add the path to the group's children list: + group.addChild(path); + } + + function onFrame(event:paper.IFrameEvent) { + // Rotate the group by 1 degree from + // the centerpoint of the paper.view: + group.rotate(1, paper.view.center); + } + + } + function Group2() { + + let path = new paper.Path([new paper.Point([100, 100]), new paper.Point([100, 200])]); + let path2 = new paper.Path([new paper.Point([50, 150]), new paper.Point([150, 150])]); + + // Create a group from the two paths: + let group = new paper.Group({ + children: [path, path2], + // Set the stroke color of all items in the group: + strokeColor: 'black', + // Move the group to the center of the paper.view: + position: paper.view.center + }); + + } + function Group3() { + + let star = new paper.Path.Star({ + center: paper.view.center, + points: 6, + radius1: 20, + radius2: 40, + fillColor: 'red' + }); + + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + strokeColor: 'black' + }); + + // Create a group of the two items and clip it: + let group = new paper.Group([circle, star]); + group.clipped = true; + + // Lets animate the circle: + function onFrame(event:paper.IFrameEvent) { + let offset = Math.sin(event.count / 30) * 30; + circle.position.x = paper.view.center.x + offset; + } + + } + function Group4() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function Group5() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function Group6() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function Group7() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function Group8() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function Group9() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function Group10() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function Group11() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function Group12() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function Group13() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function Group14() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function Group15() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function Group16() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function Group17() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function Group18() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function Group19() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function Group20() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function Group21() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function Group22() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function Group23() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function Group24() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function Group25() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Group26() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function Group27() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function Group28() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Group29() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Group30() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Group31() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Group32() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Group33() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function Group34() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function Group35() { + + function enter(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function Group36() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Group37() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function Group38() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function Group39() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function Group40() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function Group41() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function Group42() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function Group43() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function Group44() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function Group45() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function Group46() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function Group47() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function Group48() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function Group49() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function Group50() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + }); + + } + function Group51() { + + let pathHandlers = { + mouseenter: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function Group52() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function Group53() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function Group54() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function Group55() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function Group56() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function Item0() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function Item1() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function Item2() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function Item3() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function Item4() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function Item5() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function Item6() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function Item7() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function Item8() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function Item9() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function Item10() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function Item11() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function Item12() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function Item13() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function Item14() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function Item15() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function Item16() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function Item17() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function Item18() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function Item19() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function Item20() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function Item21() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Item22() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function Item23() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function Item24() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Item25() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Item26() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Item27() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Item28() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Item29() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function Item30() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function Item31() { + + function enter(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function Item32() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Item33() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function Item34() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function Item35() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function Item36() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function Item37() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function Item38() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function Item39() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function Item40() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function Item41() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function Item42() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function Item43() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function Item44() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function Item45() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function Item46() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + }); + + } + function Item47() { + + let pathHandlers = { + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function Item48() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function Item49() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function Item50() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function Item51() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function Item52() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function Layer0() { + + let path = new paper.Path([[100, 100], [100, 200]]); + let path2 = new paper.Path([[50, 150], [150, 150]]); + + // Create a layer. The properties in the object literal + // are set on the newly created layer. + let layer = new paper.Layer({ + children: [path, path2], + strokeColor: 'black', + position: paper.view.center + }); + + } + function Layer1() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function Layer2() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function Layer3() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function Layer4() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function Layer5() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function Layer6() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function Layer7() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function Layer8() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function Layer9() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function Layer10() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function Layer11() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function Layer12() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function Layer13() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function Layer14() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function Layer15() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function Layer16() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function Layer17() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function Layer18() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function Layer19() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function Layer20() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function Layer21() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function Layer22() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Layer23() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function Layer24() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function Layer25() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Layer26() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Layer27() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Layer28() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Layer29() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Layer30() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function Layer31() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function Layer32() { + + function enter(this:paper.Path) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function Layer33() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Layer34() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function Layer35() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function Layer36() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function Layer37() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function Layer38() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function Layer39() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function Layer40() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function Layer41() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function Layer42() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function Layer43() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function Layer44() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function Layer45() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function Layer46() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function Layer47() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + }); + + } + function Layer48() { + + let pathHandlers = { + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function Layer49() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function Layer50() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function Layer51() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function Layer52() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function Layer53() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function Layer54() { + + let star = new paper.Path.Star({ + center: paper.view.center, + points: 6, + radius1: 20, + radius2: 40, + fillColor: 'red' + }); + + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + strokeColor: 'black' + }); + + // Create a group of the two items and clip it: + let group = new paper.Group([circle, star]); + group.clipped = true; + + // Lets animate the circle: + function onFrame(event:paper.IFrameEvent) { + let offset = Math.sin(event.count / 30) * 30; + circle.position.x = paper.view.center.x + offset; + } + + } + function Path0() { + + let path = new paper.Path({ + segments: [[20, 20], [80, 80], [140, 20]], + fillColor: 'black', + closed: true + }); + + } + function Path1() { + + let path = new paper.Path({ + segments: [[20, 20], [80, 80], [140, 20]], + strokeColor: 'red', + strokeWidth: 20, + strokeCap: 'round', + selected: true + }); + + } + function Path2() { + + let pathData = 'M100,50c0,27.614-22.386,50-50,50S0,77.614,0,50S22.386,0,50,0S100,22.386,100,50'; + let path = new paper.Path(pathData); + path.fillColor = 'red'; + + } + function Path3() { + + let from = new paper.Point(20, 20); + let to = new paper.Point(80, 80); + let path = new paper.Path.Line(from, to); + path.strokeColor = 'black'; + + } + function Path4() { + + let path = new paper.Path.Line({ + from: [20, 20], + to: [80, 80], + strokeColor: 'black' + }); + + } + function Path5() { + + let path = new paper.Path.Circle(new paper.Point(80, 50), 30); + path.strokeColor = 'black'; + + } + function Path6() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + strokeColor: 'black' + }); + + } + function Path7() { + + let rectangle = new paper.Rectangle(new paper.Point(20, 20), new paper.Size(60, 60)); + let path = new paper.Path.Rectangle(rectangle); + path.strokeColor = 'black'; + + } + function Path8() { + + let rectangle = new paper.Rectangle(new paper.Point(20, 20), new paper.Size(60, 60)); + let cornerSize = new paper.Size(10, 10); + let path = new paper.Path.Rectangle(rectangle, cornerSize.height); + path.strokeColor = 'black'; + + } + function Path9() { + + let point = new paper.Point(20, 20); + let size = new paper.Size(60, 60); + let path = new paper.Path.Rectangle(point, size); + path.strokeColor = 'black'; + + } + function Path10() { + + let from = new paper.Point(20, 20); + let to = new paper.Point(80, 80); + let path = new paper.Path.Rectangle(from, to); + path.strokeColor = 'black'; + + } + function Path11() { + + let path = new paper.Path.Rectangle({ + point: [20, 20], + size: [60, 60], + strokeColor: 'black' + }); + + } + function Path12() { + + let path = new paper.Path.Rectangle({ + from: [20, 20], + to: [80, 80], + strokeColor: 'black' + }); + + } + function Path13() { + + let path = new paper.Path.Rectangle({ + rectangle: { + topLeft: [20, 20], + bottomRight: [80, 80] + }, + strokeColor: 'black' + }); + + } + function Path14() { + + let path = new paper.Path.Rectangle({ + topLeft: [20, 20], + bottomRight: [80, 80], + radius: 10, + strokeColor: 'black' + }); + + } + function Path15() { + + let rectangle = new paper.Rectangle(new paper.Point(20, 20), new paper.Size(180, 60)); + let path = new paper.Path.Ellipse(rectangle); + path.fillColor = 'black'; + + } + function Path16() { + + let path = new paper.Path.Ellipse({ + point: [20, 20], + size: [180, 60], + fillColor: 'black' + }); + + } + function Path17() { + + let shape = new paper.Path.Ellipse({ + center: [110, 50], + radius: [90, 30], + fillColor: 'black' + }); + + } + function Path18() { + + let from = new paper.Point(20, 20); + let through = new paper.Point(60, 20); + let to = new paper.Point(80, 80); + let path = new paper.Path.Arc(from, through, to); + path.strokeColor = 'black'; + + } + function Path19() { + + let path = new paper.Path.Arc({ + from: [20, 20], + through: [60, 20], + to: [80, 80], + strokeColor: 'black' + }); + + } + function Path20() { + + let center = new paper.Point(50, 50); + let sides = 3; + let radius = 40; + let triangle = new paper.Path.RegularPolygon(center, sides, radius); + triangle.fillColor = 'black'; + + } + function Path21() { + + let triangle = new paper.Path.RegularPolygon({ + center: [50, 50], + sides: 10, + radius: 40, + fillColor: 'black' + }); + + } + function Path22() { + + let center = new paper.Point(50, 50); + let points = 12; + let radius1 = 25; + let radius2 = 40; + let path = new paper.Path.Star(center, points, radius1, radius2); + path.fillColor = 'black'; + + } + function Path23() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 25, + radius2: 40, + fillColor: 'black' + }); + + } + function Path24() { + + let myPath = new paper.Path(); + myPath.strokeColor = 'black'; + myPath.add(new paper.Point(50, 75)); + myPath.add(new paper.Point(100, 25)); + myPath.add(new paper.Point(150, 75)); + + // Close the path: + myPath.closed = true; + + } + function Path25() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.fullySelected = true; + + let path2 = new paper.Path.Circle({ + center: [180, 50], + radius: 35 + }); + + // Deselect the second segment of the second path: + path2.segments[1].selected = false; + + // If the path is fully selected (which it is), + // set its fill color to red: + if (path.fullySelected) { + path.fillColor = 'red'; + } + + // If the second path is fully selected (which it isn't, since we just + // deselected its second segment), + // set its fill color to red: + if (path2.fullySelected) { + path2.fillColor = 'red'; + } + + } + function Path26() { + + let path = new paper.Path({ + strokeColor: 'black' + }); + + // Add a segment at {x: 30, y: 75} + path.add(new paper.Point(30, 75)); + + // Add two segments in one go at {x: 100, y: 20} + // and {x: 170, y: 75}: + path.addSegments([new paper.Point(100, 20), new paper.Point(170, 75)]); + + } + function Path27() { + + let path = new paper.Path({ + strokeColor: 'black' + }); + + // Add a segment at {x: 30, y: 75} + path.add([30, 75]); + + // Add two segments in one go at {x: 100, y: 20} + // and {x: 170, y: 75}: + path.addSegments([[100, 20], [170, 75]]); + + } + function Path28() { + + let path = new paper.Path({ + strokeColor: 'black' + }); + + // Add a segment at {x: 30, y: 75} + path.add(new paper.Point({x: 30, y: 75})); + + // Add two segments in one go at {x: 100, y: 20} + // and {x: 170, y: 75}: + path.addSegments([new paper.Point({x: 100, y: 20}), new paper.Point({x: 170, y: 75})]); + + } + function Path29() { + + let path = new paper.Path({ + strokeColor: 'black' + }); + + path.add(new paper.Point(30, 75)); + + // Add a segment with handles: + let point = new paper.Point(100, 20); + let handleIn = new paper.Point(-50, 0); + let handleOut = new paper.Point(50, 0); + let added = path.add(new paper.Segment(point, handleIn, handleOut)); + + // Select the added segment, so we can see its handles: + added.selected = true; + + path.add(new paper.Point(170, 75)); + + } + function Path30() { + + let myPath = new paper.Path(); + myPath.strokeColor = 'black'; + myPath.add(new paper.Point(50, 75)); + myPath.add(new paper.Point(150, 75)); + + // Insert a new segment into myPath at index 1: + myPath.insert(1, new paper.Point(100, 25)); + + // Select the segment which we just inserted: + myPath.segments[1].selected = true; + + } + function Path31() { + + let myPath = new paper.Path(); + myPath.strokeColor = 'black'; + myPath.add(new paper.Point(50, 75)); + myPath.add(new paper.Point(150, 75)); + + // Insert two segments into myPath at index 1: + myPath.insertSegments(1, [[80, 25], [120, 25]]); + + // Select the segments which we just inserted: + myPath.segments[1].selected = true; + myPath.segments[2].selected = true; + + } + function Path32() { + + let path = new paper.Path({ + strokeColor: 'black' + }); + let points = [new paper.Point(30, 50), new paper.Point(170, 50)]; + path.addSegments(points); + + } + function Path33() { + + let path = new paper.Path({ + strokeColor: 'black' + }); + let array = [[30, 75], [100, 20], [170, 75]]; + path.addSegments(array); + + } + function Path34() { + + let path = new paper.Path({ + strokeColor: 'black' + }); + path.addSegments([[30, 75], [100, 20], [170, 75]]); + + let path2 = new paper.Path(); + path2.strokeColor = 'red'; + + // Add the second and third segments of path to path2: + path2.addSegments([path.segments[1], path.segments[2]]); + + // Move path2 30pt to the right: + path2.position.x += 30; + + } + function Path35() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let path = new paper.Path.Circle({ + center: new paper.Point(80, 50), + radius: 35, + strokeColor: 'black' + }); + + // Remove its second segment: + path.removeSegment(1); + + // Select the path, so we can see its segments: + path.selected = true; + + } + function Path36() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let path = new paper.Path.Circle({ + center: new paper.Point(80, 50), + radius: 35, + strokeColor: 'black' + }); + + // Remove the segments from index 1 till index 2: + path.removeSegments(1, 2); + + // Select the path, so we can see its segments: + path.selected = true; + + } + function Path37() { + + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 40, + strokeColor: 'black' + }); + + let pointOnCircle = paper.view.center.add(new paper.Point({ + length: 40, + angle: 30 + })); + + let location = path.getNearestLocation(pointOnCircle); + + path.split(location); + path.lastSegment.selected = true; + + } + function Path38() { + + let path = new paper.Path([[20, 20], [50, 80], [80, 20]]); + path.strokeColor = 'black'; + + // Split the path half-way: + let path2 = path.split(path.length / 2); + + // Give the resulting path a red stroke-color + // and move it 20px to the right: + path2.strokeColor = 'red'; + path2.position.x += 20; + + } + function Path39() { + + let path = new paper.Path.Rectangle({ + from: [20, 20], + to: [80, 80], + strokeColor: 'black' + }); + + // Split the path half-way: + path.split(path.length / 2); + + // Move the first segment, to show where the path + // was split: + path.firstSegment.point.x += 20; + + // Select the first segment: + path.firstSegment.selected = true; + + } + function Path40() { + + let path = new paper.Path({ + segments: [[30, 25], [30, 75]], + strokeColor: 'black' + }); + + let path2 = new paper.Path({ + segments: [[200, 25], [200, 75]], + strokeColor: 'black' + }); + + // Join the paths: + path.join(path2); + + } + function Path41() { + + let path = new paper.Path({ + segments: [[30, 25], [30, 75]], + strokeColor: 'black' + }); + + let path2 = new paper.Path({ + segments: [[30, 25], [80, 25]], + strokeColor: 'black' + }); + + // Join the paths: + path.join(path2); + + // After joining, path with have 3 segments, since it + // shared its first segment point with the first + // segment point of path2. + + // Select the path to show that they have joined: + path.selected = true; + + } + function Path42() { + + let path = new paper.Path({ + segments: [[30, 25], [80, 25], [80, 75]], + strokeColor: 'black' + }); + + let path2 = new paper.Path({ + segments: [[30, 25], [30, 75], [80, 75]], + strokeColor: 'black' + }); + + // Join the paths: + path.join(path2); + + // Because the paths were joined at two points, the path is closed + // and has 4 segments. + + // Select the path to show that they have joined: + path.selected = true; + + } + function Path43() { + + // Create an arc shaped path: + let path = new paper.Path({ + strokeColor: 'black' + }); + + path.add(new paper.Point(40, 100)); + path.arcTo(new paper.Point(150, 100)); + + // We're going to be working with a third of the length + // of the path as the offset: + let offset = path.length / 3; + + // Find the point on the path: + let point = path.getPointAt(offset); + + // Create a small circle shaped path at the point: + let circle = new paper.Path.Circle({ + center: point, + radius: 3, + fillColor: 'red' + }); + + } + function Path44() { + + // Create an arc shaped path: + let path = new paper.Path({ + strokeColor: 'black' + }); + + path.add(new paper.Point(40, 100)); + path.arcTo(new paper.Point(150, 100)); + + let amount = 5; + let length = path.length; + for (let i = 0; i < amount + 1; i++) { + let offset = i / amount * length; + + // Find the point on the path at the given offset: + let point = path.getPointAt(offset); + + // Create a small circle shaped path at the point: + let circle = new paper.Path.Circle({ + center: point, + radius: 3, + fillColor: 'red' + }); + } + + } + function Path45() { + + // Create an arc shaped path: + let path = new paper.Path({ + strokeColor: 'black' + }); + + path.add(new paper.Point(40, 100)); + path.arcTo(new paper.Point(150, 100)); + + // We're going to be working with a third of the length + // of the path as the offset: + let offset = path.length / 3; + + // Find the point on the path: + let point = path.getPointAt(offset); + + // Find the tangent vector at the given offset + // and give it a length of 60: + let tangent = path.getTangentAt(offset).multiply(60); + + let line = new paper.Path({ + segments: [point, point.add(tangent)], + strokeColor: 'red' + }) + + } + function Path46() { + + // Create an arc shaped path: + let path = new paper.Path({ + strokeColor: 'black' + }); + + path.add(new paper.Point(40, 100)); + path.arcTo(new paper.Point(150, 100)); + + let amount = 6; + let length = path.length; + for (let i = 0; i < amount + 1; i++) { + let offset = i / amount * length; + + // Find the point on the path at the given offset: + let point = path.getPointAt(offset); + + // Find the tangent vector on the path at the given offset + // and give it a length of 60: + let tangent = path.getTangentAt(offset).multiply(60); + + let line = new paper.Path({ + segments: [point, point.add(tangent)], + strokeColor: 'red' + }) + } + + } + function Path47() { + + // Create an arc shaped path: + let path = new paper.Path({ + strokeColor: 'black' + }); + + path.add(new paper.Point(40, 100)); + path.arcTo(new paper.Point(150, 100)); + + // We're going to be working with a third of the length + // of the path as the offset: + let offset = path.length / 3; + + // Find the point on the path: + let point = path.getPointAt(offset); + + // Find the normal vector on the path at the given offset + // and give it a length of 30: + let normal = path.getNormalAt(offset).multiply(30); + + let line = new paper.Path({ + segments: [point, point.add(normal)], + strokeColor: 'red' + }); + + } + function Path48() { + + // Create an arc shaped path: + let path = new paper.Path({ + strokeColor: 'black' + }); + + path.add(new paper.Point(40, 100)); + path.arcTo(new paper.Point(150, 100)); + + let amount = 10; + let length = path.length; + for (let i = 0; i < amount + 1; i++) { + let offset = i / amount * length; + + // Find the point on the path at the given offset: + let point = path.getPointAt(offset); + + // Find the normal vector on the path at the given offset + // and give it a length of 30: + let normal = path.getNormalAt(offset).multiply(30); + + let line = new paper.Path({ + segments: [point, point.add(normal)], + strokeColor: 'red' + }); + } + + } + function Path49() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function Path50() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function Path51() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function Path52() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function Path53() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function Path54() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function Path55() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function Path56() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function Path57() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function Path58() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function Path59() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function Path60() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function Path61() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function Path62() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function Path63() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function Path64() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function Path65() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function Path66() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function Path67() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function Path68() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function Path69() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function Path70() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Path71() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function Path72() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function Path73() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Path74() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Path75() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Path76() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Path77() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Path78() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function Path79() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function Path80() { + + function enter(this:paper.Path) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function Path81() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Path82() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function Path83() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function Path84() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function Path85() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function Path86() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function Path87() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function Path88() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function Path89() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function Path90() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function Path91() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function Path92() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function Path93() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function Path94() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function Path95() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + }); + + } + function Path96() { + + let pathHandlers = { + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function Path97() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function Path98() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function Path99() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function Path100() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function Path101() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function Path102() { + + let path = new paper.Path.Rectangle(new paper.Point(30, 25), new paper.Size(50, 50)); + path.strokeColor = 'black'; + + let secondPath = path.clone(); + let intersectionGroup = new paper.Group(); + + function onFrame(event:paper.IFrameEvent) { + secondPath.rotate(1); + + let intersections = path.getIntersections(secondPath); + intersectionGroup.removeChildren(); + + for (let i = 0; i < intersections.length; i++) { + let intersectionPath = new paper.Path.Circle({ + center: intersections[i].point, + radius: 4, + fillColor: 'red', + parent: intersectionGroup + }); + } + } + + } + function Path103() { + + let star = new paper.Path.Star({ + center: paper.view.center, + points: 10, + radius1: 30, + radius2: 60, + strokeColor: 'black' + }); + + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 3, + fillColor: 'red' + }); + + function onMouseMove(event:paper.ToolEvent) { + // Get the nearest point from the mouse position + // to the star shaped path: + let nearestPoint = star.getNearestPoint(event.point); + + // Move the red circle to the nearest point: + circle.position = nearestPoint; + } + + } + function Path104() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Select the path, so we can inspect its segments: + path.selected = true; + + // Create a copy of the path and move it by 150 points: + let copy = path.clone(); + copy.position.x += 150; + + // Flatten the copied path, with a maximum error of 4 points: + copy.flatten(4); + + } + function Path105() { + + // Create a rectangular path with its top-left point at + // {x: 30, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle({ + point: [30, 25], + size: [50, 50], + strokeColor: 'black', + }); + + // Select the path, so we can see its handles: + path.fullySelected = true; + + // Create a copy of the path and move it 100 to the right: + let copy = path.clone(); + copy.position.x += 100; + + // Smooth the segments of the copy: + copy.smooth({ type: 'continuous' }); + + } + function Path106() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + path.add(new paper.Point(30, 50)); + + let y = 5; + let x = 3; + + for (let i = 0; i < 28; i++) { + y *= -1.1; + x *= 1.1; + path.lineBy(new paper.Point(x, y)); + } + + // Create a copy of the path and move it 100 down: + let copy = path.clone(); + copy.position.y += 120; + + // Select the path, so we can see its handles: + copy.fullySelected = true; + + // Smooth the path using centripetal Catmull-Rom splines: + copy.smooth({ type: 'catmull-rom', factor: 0.5 }); + + } + function Path107() { + + // Create 5 rectangles, next to each other: + let paths:paper.Path[] = []; + for (let i = 0; i < 5; i++) { + paths.push(new paper.Path.Rectangle({ + point: [30 + i * 100, 30], + size: [50, 50], + fullySelected: true + })); + } + // Smooth a range, using segments: + paths[1].smooth({ + type: 'continuous', + from: paths[1].segments[0], + to: paths[1].segments[2] + }); + + // Smooth a range, using curves: + paths[2].smooth({ + type: 'continuous', + from: paths[2].curves[0], + to: paths[2].curves[1] + }); + + // Smooth a range, using indices: + paths[3].smooth({ type: 'continuous', from: 0, to: 2 }); + + // Smooth a range, using negative indices: + paths[4].smooth({ type: 'continuous', from: -1, to: 1 }); + + } + function Path108() { + + let path: paper.Path | null; + function onMouseDown(event:paper.ToolEvent) { + // If we already made a path before, deselect it: + if (path) { + path.selected = false; + } + + // Create a new path and add the position of the mouse + // as its first segment. Select it, so we can see the + // segment points: + path = new paper.Path({ + segments: [event.point], + strokeColor: 'black', + selected: true + }); + } + + function onMouseDrag(event:paper.ToolEvent) { + // On every drag event, add a segment to the path + // at the position of the mouse: + if(path) + path.add(event.point); + } + + function onMouseUp(event:paper.ToolEvent) { + // When the mouse is released, simplify the path: + if(path){ + path.simplify(); + path.selected = true; + } + } + + } + function Path109() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + let firstPoint = new paper.Point(30, 75); + path.add(firstPoint); + + // The point through which we will create the arc: + let throughPoint = new paper.Point(40, 40); + + // The point at which the arc will end: + let toPoint = new paper.Point(130, 75); + + // Draw an arc through 'throughPoint' to 'toPoint' + path.arcTo(throughPoint, toPoint); + + // Add a red circle shaped path at the position of 'throughPoint': + let circle = new paper.Path.Circle(throughPoint, 3); + circle.fillColor = 'red'; + + } + function Path110() { + + let myPath:paper.Path | null; + function onMouseDrag(event:paper.ToolEvent) { + // If we created a path before, remove it: + if (myPath) { + myPath.remove(); + } + + // Create a new path and add a segment point to it + // at {x: 150, y: 150): + myPath = new paper.Path(); + myPath.add(new paper.Point(150, 150)); + + // Draw an arc through the position of the mouse to 'toPoint' + let toPoint = new paper.Point(350, 150); + myPath.arcTo(event.point, toPoint); + + // Select the path, so we can see its segments: + myPath.selected = true; + } + + // When the mouse is released, deselect the path + // and fill it with black. + function onMouseUp(event:paper.ToolEvent) { + if(myPath){ + myPath.selected = false; + myPath.fillColor = 'black'; + } + } + + } + function Path111() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + path.add(new paper.Point(30, 75)); + path.arcTo(new paper.Point(130, 75)); + + let path2 = new paper.Path(); + path2.strokeColor = 'red'; + path2.add(new paper.Point(180, 25)); + + // To draw an arc in anticlockwise direction, + // we pass `false` as the second argument to arcTo: + path2.arcTo(new paper.Point(280, 25), false); + + } + function Path112() { + + let myPath:paper.Path; + + // The mouse has to move at least 20 points before + // the next mouse drag event is fired: + paper.tool.minDistance = 20; + + // When the user clicks, create a new path and add + // the current mouse position to it as its first segment: + function onMouseDown(event:paper.ToolEvent) { + myPath = new paper.Path(); + myPath.strokeColor = 'black'; + myPath.add(event.point); + } + + // On each mouse drag event, draw an arc to the current + // position of the mouse: + function onMouseDrag(event:paper.ToolEvent) { + myPath.arcTo(event.point); + } + + } + function Path113() { + + let myPath: paper.Path | null; + function onMouseMove(event:paper.ToolEvent) { + // If we created a path before, remove it: + if (myPath) { + myPath.remove(); + } + + // Create a new path and add a segment point to it + // at {x: 150, y: 150): + myPath = new paper.Path(); + myPath.add(new paper.Point(150, 150)); + + // Draw a curve through the position of the mouse to 'toPoint' + let toPoint = new paper.Point(350, 150); + myPath.curveTo(event.point, toPoint); + + // Select the path, so we can see its segments: + myPath.selected = true; + } + + } + function Path114() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + // Add a segment at {x: 50, y: 50} + path.add(new paper.Point(25, 25)); + + // Add a segment relative to the last segment of the path. + // 50 in x direction and 0 in y direction, becomes {x: 75, y: 25} + path.lineBy(new paper.Point(50, 0)); + + // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75} + path.lineBy(new paper.Point(0, 50)); + + } + function Path115() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + // Add the first segment at {x: 50, y: 50} + path.add(paper.view.center); + + // Loop 500 times: + for (let i = 0; i < 500; i++) { + // Create a vector with an ever increasing length + // and an angle in increments of 45 degrees + let vector = new paper.Point({ + angle: i * 45, + length: i / 2 + }); + // Add the vector relatively to the last segment point: + path.lineBy(vector); + } + + // Smooth the handles of the path: + path.smooth(); + + // Uncomment the following line and click on 'run' to see + // the construction of the path: + // path.selected = true; + + } + function PathItem0() { + + let path = new paper.Path.Rectangle(new paper.Point(30, 25), new paper.Size(50, 50)); + path.strokeColor = 'black'; + + let secondPath = path.clone(); + let intersectionGroup = new paper.Group(); + + function onFrame(event:paper.IFrameEvent) { + secondPath.rotate(1); + + let intersections = path.getIntersections(secondPath); + intersectionGroup.removeChildren(); + + for (let i = 0; i < intersections.length; i++) { + let intersectionPath = new paper.Path.Circle({ + center: intersections[i].point, + radius: 4, + fillColor: 'red', + parent: intersectionGroup + }); + } + } + + } + function PathItem1() { + + let star = new paper.Path.Star({ + center: paper.view.center, + points: 10, + radius1: 30, + radius2: 60, + strokeColor: 'black' + }); + + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 3, + fillColor: 'red' + }); + + function onMouseMove(event:paper.ToolEvent) { + // Get the nearest point from the mouse position + // to the star shaped path: + let nearestPoint = star.getNearestPoint(event.point); + + // Move the red circle to the nearest point: + circle.position = nearestPoint; + } + + } + function PathItem2() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Select the path, so we can inspect its segments: + path.selected = true; + + // Create a copy of the path and move it by 150 points: + let copy = path.clone(); + copy.position.x += 150; + + // Flatten the copied path, with a maximum error of 4 points: + copy.flatten(4); + + } + function PathItem3() { + + // Create a rectangular path with its top-left point at + // {x: 30, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle({ + point: [30, 25], + size: [50, 50], + strokeColor: 'black', + }); + + // Select the path, so we can see its handles: + path.fullySelected = true; + + // Create a copy of the path and move it 100 to the right: + let copy = path.clone(); + copy.position.x += 100; + + // Smooth the segments of the copy: + copy.smooth({ type: 'continuous' }); + + } + function PathItem4() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + path.add(new paper.Point(30, 50)); + + let y = 5; + let x = 3; + + for (let i = 0; i < 28; i++) { + y *= -1.1; + x *= 1.1; + path.lineBy(new paper.Point(x, y)); + } + + // Create a copy of the path and move it 100 down: + let copy = path.clone(); + copy.position.y += 120; + + // Select the path, so we can see its handles: + copy.fullySelected = true; + + // Smooth the path using centripetal Catmull-Rom splines: + copy.smooth({ type: 'catmull-rom', factor: 0.5 }); + + } + function PathItem5() { + + // Create 5 rectangles, next to each other: + let paths:paper.Path[] = []; + for (let i = 0; i < 5; i++) { + paths.push(new paper.Path.Rectangle({ + point: [30 + i * 100, 30], + size: [50, 50], + fullySelected: true + })); + } + // Smooth a range, using segments: + paths[1].smooth({ + type: 'continuous', + from: paths[1].segments[0], + to: paths[1].segments[2] + }); + + // Smooth a range, using curves: + paths[2].smooth({ + type: 'continuous', + from: paths[2].curves[0], + to: paths[2].curves[1] + }); + + // Smooth a range, using indices: + paths[3].smooth({ type: 'continuous', from: 0, to: 2 }); + + // Smooth a range, using negative indices: + paths[4].smooth({ type: 'continuous', from: -1, to: 1 }); + + } + function PathItem6() { + + let path:paper.Path | null; + function onMouseDown(event:paper.ToolEvent) { + // If we already made a path before, deselect it: + if (path) { + path.selected = false; + } + + // Create a new path and add the position of the mouse + // as its first segment. Select it, so we can see the + // segment points: + path = new paper.Path({ + segments: [event.point], + strokeColor: 'black', + selected: true + }); + } + + function onMouseDrag(event:paper.ToolEvent) { + // On every drag event, add a segment to the path + // at the position of the mouse: + if(path) + path.add(event.point); + } + + function onMouseUp(event:paper.ToolEvent) { + // When the mouse is released, simplify the path: + if(path){ + path.simplify(); + path.selected = true; + } + } + + } + function PathItem7() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + let firstPoint = new paper.Point(30, 75); + path.add(firstPoint); + + // The point through which we will create the arc: + let throughPoint = new paper.Point(40, 40); + + // The point at which the arc will end: + let toPoint = new paper.Point(130, 75); + + // Draw an arc through 'throughPoint' to 'toPoint' + path.arcTo(throughPoint, toPoint); + + // Add a red circle shaped path at the position of 'throughPoint': + let circle = new paper.Path.Circle(throughPoint, 3); + circle.fillColor = 'red'; + + } + function PathItem8() { + + let myPath: paper.Path | null; + function onMouseDrag(event:paper.ToolEvent) { + // If we created a path before, remove it: + if (myPath) { + myPath.remove(); + } + + // Create a new path and add a segment point to it + // at {x: 150, y: 150): + myPath = new paper.Path(); + myPath.add(new paper.Point(150, 150)); + + // Draw an arc through the position of the mouse to 'toPoint' + let toPoint = new paper.Point(350, 150); + myPath.arcTo(event.point, toPoint); + + // Select the path, so we can see its segments: + myPath.selected = true; + } + + // When the mouse is released, deselect the path + // and fill it with black. + function onMouseUp(event:paper.ToolEvent) { + if(myPath){ + myPath.selected = false; + myPath.fillColor = 'black'; + } + } + + } + function PathItem9() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + path.add(new paper.Point(30, 75)); + path.arcTo(new paper.Point(130, 75)); + + let path2 = new paper.Path(); + path2.strokeColor = 'red'; + path2.add(new paper.Point(180, 25)); + + // To draw an arc in anticlockwise direction, + // we pass `false` as the second argument to arcTo: + path2.arcTo(new paper.Point(280, 25), false); + + } + function PathItem10() { + + let myPath:paper.Path | null; + + // The mouse has to move at least 20 points before + // the next mouse drag event is fired: + paper.tool.minDistance = 20; + + // When the user clicks, create a new path and add + // the current mouse position to it as its first segment: + function onMouseDown(event:paper.ToolEvent) { + myPath = new paper.Path(); + myPath.strokeColor = 'black'; + myPath.add(event.point); + } + + // On each mouse drag event, draw an arc to the current + // position of the mouse: + function onMouseDrag(event:paper.ToolEvent) { + if(myPath) + myPath.arcTo(event.point); + } + + } + function PathItem11() { + + let myPath:paper.Path | null; + function onMouseMove(event:paper.ToolEvent) { + // If we created a path before, remove it: + if (myPath) { + myPath.remove(); + } + + // Create a new path and add a segment point to it + // at {x: 150, y: 150): + myPath = new paper.Path(); + myPath.add(new paper.Point(150, 150)); + + // Draw a curve through the position of the mouse to 'toPoint' + let toPoint = new paper.Point(350, 150); + myPath.curveTo(event.point, toPoint); + + // Select the path, so we can see its segments: + myPath.selected = true; + } + + } + function PathItem12() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + // Add a segment at {x: 50, y: 50} + path.add(new paper.Point(25, 25)); + + // Add a segment relative to the last segment of the path. + // 50 in x direction and 0 in y direction, becomes {x: 75, y: 25} + path.lineBy(new paper.Point(50, 0)); + + // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75} + path.lineBy(new paper.Point(0, 50)); + + } + function PathItem13() { + + let path = new paper.Path(); + path.strokeColor = 'black'; + + // Add the first segment at {x: 50, y: 50} + path.add(paper.view.center); + + // Loop 500 times: + for (let i = 0; i < 500; i++) { + // Create a vector with an ever increasing length + // and an angle in increments of 45 degrees + let vector = new paper.Point({ + angle: i * 45, + length: i / 2 + }); + // Add the vector relatively to the last segment point: + path.lineBy(vector); + } + + // Smooth the handles of the path: + path.smooth(); + + // Uncomment the following line and click on 'run' to see + // the construction of the path: + // path.selected = true; + + } + function PathItem14() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function PathItem15() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function PathItem16() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function PathItem17() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function PathItem18() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function PathItem19() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function PathItem20() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function PathItem21() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function PathItem22() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function PathItem23() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function PathItem24() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function PathItem25() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function PathItem26() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function PathItem27() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function PathItem28() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function PathItem29() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function PathItem30() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function PathItem31() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function PathItem32() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function PathItem33() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function PathItem34() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function PathItem35() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PathItem36() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function PathItem37() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function PathItem38() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PathItem39() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PathItem40() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function PathItem41() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PathItem42() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function PathItem43() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function PathItem44() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function PathItem45() { + + function enter(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function PathItem46() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PathItem47() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function PathItem48() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function PathItem49() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function PathItem50() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function PathItem51() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function PathItem52() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function PathItem53() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function PathItem54() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function PathItem55() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function PathItem56() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function PathItem57() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function PathItem58() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function PathItem59() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function PathItem60() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + }); + + } + function PathItem61() { + + let pathHandlers = { + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function PathItem62() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function PathItem63() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function PathItem64() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function PathItem65() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function PathItem66() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function Point0() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40 + }); + + // Select the third segment point: + path.segments[2].point.selected = true; + + // Select the item's position, which is the pivot point + // around which it is transformed: + path.position.selected = true; + + } + function PointText0() { + + let text = new paper.PointText(new paper.Point(200, 50)); + text.justification = 'center'; + text.fillColor = 'black'; + text.content = 'The contents of the point text'; + + } + function PointText1() { + + let text = new paper.PointText({ + point: [50, 50], + content: 'The contents of the point text', + fillColor: 'black', + fontFamily: 'Courier New', + fontWeight: 'bold', + fontSize: 25 + }); + + } + function PointText2() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function PointText3() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function PointText4() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function PointText5() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function PointText6() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function PointText7() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function PointText8() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function PointText9() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function PointText10() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function PointText11() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function PointText12() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function PointText13() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function PointText14() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function PointText15() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function PointText16() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function PointText17() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function PointText18() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function PointText19() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function PointText20() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function PointText21() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function PointText22() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function PointText23() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PointText24() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function PointText25() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function PointText26() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PointText27() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PointText28() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function PointText29() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PointText30() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function PointText31() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function PointText32() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function PointText33() { + + function enter(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function PointText34() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function PointText35() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function PointText36() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function PointText37() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function PointText38() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function PointText39() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function PointText40() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function PointText41() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function PointText42() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function PointText43() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function PointText44() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function PointText45() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function PointText46() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function PointText47() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function PointText48() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + }); + + } + function PointText49() { + + let pathHandlers = { + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function PointText50() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function PointText51() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function PointText52() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function PointText53() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function PointText54() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function PointText55() { + + // Create a point-text item at {x: 30, y: 30}: + let text = new paper.PointText(new paper.Point(30, 30)); + text.fillColor = 'black'; + + // Set the content of the text item: + text.content = 'Hello world'; + + } + function PointText56() { + + // Create a point-text item at {x: 30, y: 30}: + let text = new paper.PointText(new paper.Point(30, 30)); + text.fillColor = 'black'; + + text.content = 'Move your mouse over the paper.view, to see its position'; + + function onMouseMove(event:paper.ToolEvent) { + // Each time the mouse is moved, set the content of + // the point text to describe the position of the mouse: + text.content = 'Your position is: ' + event.point.toString(); + } + + } + function Project0() { + + paper.project.currentStyle = { + fillColor: 'red', + strokeColor: 'black', + strokeWidth: 5 + } + + // The following paths will take over all style properties of + // the current style: + let path = new paper.Path.Circle(new paper.Point(75, 50), 30); + let path2 = new paper.Path.Circle(new paper.Point(175, 50), 20); + + } + function Project1() { + + paper.project.currentStyle.fillColor = 'red'; + + // The following path will take over the fill color we just set: + let path = new paper.Path.Circle(new paper.Point(75, 50), 30); + let path2 = new paper.Path.Circle(new paper.Point(175, 50), 20); + + } + function Project2() { + + let path1 = new paper.Path.Circle({ + center: [50, 50], + radius: 25, + fillColor: 'black' + }); + + let path2 = new paper.Path.Circle({ + center: [150, 50], + radius: 25, + fillColor: 'black' + }); + + // Select path2: + path2.selected = true; + + // Fetch all selected path items: + let items = paper.project.getItems({ + selected: true, + class: paper.Path + }); + + // Change the fill color of the selected path to red: + items[0].fillColor = 'red'; + + } + function Project3() { + + let path1 = new paper.Path.Circle({ + center: [50, 50], + radius: 25, + fillColor: 'black' + }); + + let path2 = new paper.Path.Circle({ + center: [150, 50], + radius: 25, + fillColor: 'purple' + }); + + // Fetch all items with a purple fill color: + let items = paper.project.getItems({ + fillColor: 'purple' + }); + + // Select the fetched item: + items[0].selected = true; + + } + function Project4() { + + let path1 = new paper.Path.Circle({ + center: [50, 50], + radius: 25, + fillColor: 'black' + }); + + let path2 = new paper.Path.Circle({ + center: [150, 50], + radius: 25, + fillColor: 'black' + }); + + // Fetch all path items positioned at {x: 150, y: 150}: + let items = paper.project.getItems({ + position: [150, 50] + }); + + // Select the fetched path: + items[0].selected = true; + + } + function Project5() { + + // Create a circle shaped path: + let path1 = new paper.Path.Circle({ + center: [50, 50], + radius: 25, + fillColor: 'black' + }); + + // Create a circle shaped path with 50% opacity: + let path2 = new paper.Path.Circle({ + center: [150, 50], + radius: 25, + fillColor: 'black', + opacity: 0.5 + }); + + // Fetch all items whose opacity is smaller than 1 + let items = paper.project.getItems({ + opacity: function(value:number) { + return value < 1; + } + }); + + // Select the fetched item: + items[0].selected = true; + + } + function Project6() { + + // Create a rectangle shaped path (4 segments): + let path1 = new paper.Path.Rectangle({ + from: [25, 25], + to: [75, 75], + strokeColor: 'black', + strokeWidth: 10 + }); + + // Create a line shaped path (2 segments): + let path2 = new paper.Path.Line({ + from: [125, 50], + to: [175, 50], + strokeColor: 'black', + strokeWidth: 10 + }); + + // Fetch all paths with 2 segments: + let items = paper.project.getItems({ + class: paper.Path, + segments: function(segments: paper.Segment[]) { + return segments.length == 2; + } + }); + + // Select the fetched path: + items[0].selected = true; + + } + function Project7() { + + // Create a black circle shaped path: + let path1 = new paper.Path.Circle({ + center: [50, 50], + radius: 25, + fillColor: 'black', + data: { + person: { + name: 'john', + length: 200, + hair: true + } + } + }); + + // Create a red circle shaped path: + let path2 = new paper.Path.Circle({ + center: [150, 50], + radius: 25, + fillColor: 'red', + data: { + person: { + name: 'john', + length: 180, + hair: false + } + } + }); + + // Fetch all items whose data object contains a person + // object whose name is john and length is 180: + let items = paper.project.getItems({ + data: { + person: { + name: 'john', + length: 180 + } + } + }); + + // Select the fetched item: + items[0].selected = true; + + } + function Project8() { + + // Create a path named 'aardvark': + let path1 = new paper.Path.Circle({ + center: [50, 50], + radius: 25, + fillColor: 'black', + name: 'aardvark' + }); + + // Create a path named 'apple': + let path2 = new paper.Path.Circle({ + center: [150, 50], + radius: 25, + fillColor: 'black', + name: 'apple' + }); + + // Create a path named 'banana': + path2 = new paper.Path.Circle({ + center: [250, 50], + radius: 25, + fillColor: 'black', + name: 'banana' + }); + + // Fetch all items that have a name starting with 'a': + let items = paper.project.getItems({ + name: /^a/ + }); + + // Change the fill color of the matched items: + for (let i = 0; i < items.length; i++) { + items[i].fillColor = 'red'; + } + + } + function Raster0() { + + let url = 'http://assets.paperjs.org/images/marilyn.jpg'; + let raster = new paper.Raster(url); + + // If you create a Raster using a url, you can use the onLoad + // handler to do something once it is loaded: + raster.onLoad = function() { + console.log('The image has loaded.'); + }; + + } + function Raster1() { + + let raster = new paper.Raster({ + source: 'http://assets.paperjs.org/images/marilyn.jpg', + position: paper.view.center + }); + + raster.scale(0.5); + raster.rotate(10); + + } + function Raster2() { + + let raster = new paper.Raster(); + raster.source = 'http://paperjs.org/about/paper-js.gif'; + raster.position = paper.view.center; + + } + function Raster3() { + + let raster = new paper.Raster({ + source: 'http://paperjs.org/about/paper-js.gif', + position: paper.view.center + }); + + } + function Raster4() { + + let raster = new paper.Raster({ + crossOrigin: 'anonymous', + source: 'http://assets.paperjs.org/images/marilyn.jpg', + position: paper.view.center + }); + + console.log(paper.view.element.toDataURL('image/png').substring(0, 32)); + + } + function Raster5() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function Raster6() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function Raster7() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function Raster8() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function Raster9() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function Raster10() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function Raster11() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function Raster12() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function Raster13() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function Raster14() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function Raster15() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function Raster16() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function Raster17() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function Raster18() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function Raster19() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function Raster20() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function Raster21() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function Raster22() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function Raster23() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function Raster24() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function Raster25() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function Raster26() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Raster27() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function Raster28() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function Raster29() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Raster30() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Raster31() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Raster32() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Raster33() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Raster34() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function Raster35() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function Raster36() { + + function enter(this:paper.Path) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function Raster37() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Raster38() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function Raster39() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function Raster40() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function Raster41() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function Raster42() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function Raster43() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function Raster44() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function Raster45() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function Raster46() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function Raster47() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function Raster48() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function Raster49() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function Raster50() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function Raster51() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + }); + + } + function Raster52() { + + let pathHandlers = { + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function Raster53() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function Raster54() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function Raster55() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function Raster56() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function Raster57() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function Rectangle0() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + selected: true + }); + + path.bounds.selected = true; + + } + function Rectangle1() { + + // Create a circle shaped path at {x: 80, y: 50} + // with a radius of 30. + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + circle.fillColor = 'red'; + + function onMouseMove(event:paper.ToolEvent) { + // Check whether the mouse position intersects with the + // bounding box of the item: + if (circle.bounds.contains(event.point)) { + // If it intersects, fill it with green: + circle.fillColor = 'green'; + } else { + // If it doesn't intersect, fill it with red: + circle.fillColor = 'red'; + } + } + + } + function Rectangle2() { + + // All newly created paths will inherit these styles: + paper.project.currentStyle = { + fillColor: 'green', + strokeColor: 'black' + }; + + // Create a circle shaped path at {x: 80, y: 50} + // with a radius of 45. + let largeCircle = new paper.Path.Circle(new paper.Point(80, 50), 45); + + // Create a smaller circle shaped path in the same position + // with a radius of 30. + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + function onMouseMove(event:paper.ToolEvent) { + // Move the circle to the position of the mouse: + circle.position = event.point; + + // Check whether the bounding box of the smaller circle + // is contained within the bounding box of the larger item: + if (largeCircle.bounds.contains(circle.bounds)) { + // If it does, fill it with green: + circle.fillColor = 'green'; + largeCircle.fillColor = 'green'; + } else { + // If doesn't, fill it with red: + circle.fillColor = 'red'; + largeCircle.fillColor = 'red'; + } + } + + } + function Rectangle3() { + + // All newly created paths will inherit these styles: + paper.project.currentStyle = { + fillColor: 'green', + strokeColor: 'black' + }; + + // Create a circle shaped path at {x: 80, y: 50} + // with a radius of 45. + let largeCircle = new paper.Path.Circle(new paper.Point(80, 50), 45); + + // Create a smaller circle shaped path in the same position + // with a radius of 30. + let circle = new paper.Path.Circle(new paper.Point(80, 50), 30); + + function onMouseMove(event:paper.ToolEvent) { + // Move the circle to the position of the mouse: + circle.position = event.point; + + // Check whether the bounding box of the two circle + // shaped paths intersect: + if (largeCircle.bounds.intersects(circle.bounds)) { + // If it does, fill it with green: + circle.fillColor = 'green'; + largeCircle.fillColor = 'green'; + } else { + // If doesn't, fill it with red: + circle.fillColor = 'red'; + largeCircle.fillColor = 'red'; + } + } + + } + function Rectangle4() { + + // Create two rectangles that overlap each other + let size = new paper.Size(50, 50); + let rectangle1 = new paper.Rectangle(new paper.Point(25, 15), size); + let rectangle2 = new paper.Rectangle(new paper.Point(50, 40), size); + + // The rectangle that represents the intersection of the + // two rectangles: + let intersected = rectangle1.intersect(rectangle2); + + // To visualize the intersecting of the rectangles, we will + // create rectangle shaped paths using the Path.Rectangle + // constructor. + + // Have all newly created paths inherit a black stroke: + paper.project.currentStyle.strokeColor = 'black'; + + // Create two rectangle shaped paths using the abstract rectangles + // we created before: + new paper.Path.Rectangle(rectangle1); + new paper.Path.Rectangle(rectangle2); + + // Create a path that represents the intersected rectangle, + // and fill it with red: + let intersectionPath = new paper.Path.Rectangle(intersected); + intersectionPath.fillColor = 'red'; + + } + function Segment0() { + + let handleIn = new paper.Point(-80, -100); + let handleOut = new paper.Point(80, 100); + + let firstPoint = new paper.Point(100, 50); + let firstSegment = new paper.Segment(firstPoint, undefined, handleOut); + + let secondPoint = new paper.Point(300, 50); + let secondSegment = new paper.Segment(secondPoint, handleIn, undefined); + + let path = new paper.Path([firstSegment, secondSegment]); + path.strokeColor = 'black'; + + } + function Segment1() { + + let firstSegment = new paper.Segment({ + point: [100, 50], + handleOut: [80, 100] + }); + + let secondSegment = new paper.Segment({ + point: [300, 50], + handleIn: [-80, -100] + }); + + let path = new paper.Path({ + segments: [firstSegment, secondSegment], + strokeColor: 'black' + }); + + } + function Segment2() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40 + }); + + // Select the third segment point: + path.segments[2].selected = true; + + } + function Shape0() { + + let shape = paper.Shape.Circle(new paper.Point(80, 50), 30); + shape.strokeColor = 'black'; + + } + function Shape1() { + + let shape = paper.Shape.Circle({ + center: [80, 50], + radius: 30, + strokeColor: 'black' + }); + + } + function Shape2() { + + let rectangle = new paper.Rectangle(new paper.Point(20, 20), new paper.Size(60, 60)); + let shape = paper.Shape.Rectangle(rectangle); + shape.strokeColor = 'black'; + + } + function Shape3() { + + let rectangle = new paper.Rectangle(new paper.Point(20, 20), new paper.Size(60, 60)); + let cornerSize = new paper.Size(10, 10); + let shape = paper.Shape.Rectangle([rectangle, cornerSize]); + shape.strokeColor = 'black'; + + } + function Shape4() { + + let point = new paper.Point(20, 20); + let size = new paper.Size(60, 60); + let shape = paper.Shape.Rectangle(point, size); + shape.strokeColor = 'black'; + + } + function Shape5() { + + let from = new paper.Point(20, 20); + let to = new paper.Point(80, 80); + let shape = paper.Shape.Rectangle(from, to); + shape.strokeColor = 'black'; + + } + function Shape6() { + + let shape = paper.Shape.Rectangle({ + point: [20, 20], + size: [60, 60], + strokeColor: 'black' + }); + + } + function Shape7() { + + let shape = paper.Shape.Rectangle({ + from: [20, 20], + to: [80, 80], + strokeColor: 'black' + }); + + } + function Shape8() { + + let shape = paper.Shape.Rectangle({ + rectangle: { + topLeft: [20, 20], + bottomRight: [80, 80] + }, + strokeColor: 'black' + }); + + } + function Shape9() { + + let shape = paper.Shape.Rectangle({ + topLeft: [20, 20], + bottomRight: [80, 80], + radius: 10, + strokeColor: 'black' + }); + + } + function Shape10() { + + let rectangle = new paper.Rectangle(new paper.Point(20, 20), new paper.Size(180, 60)); + let shape = paper.Shape.Ellipse(rectangle); + shape.fillColor = 'black'; + + } + function Shape11() { + + let shape = paper.Shape.Ellipse({ + point: [20, 20], + size: [180, 60], + fillColor: 'black' + }); + + } + function Shape12() { + + let shape = paper.Shape.Ellipse({ + center: [110, 50], + radius: [90, 30], + fillColor: 'black' + }); + + } + function Shape13() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function Shape14() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function Shape15() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function Shape16() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function Shape17() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function Shape18() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function Shape19() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function Shape20() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function Shape21() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function Shape22() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function Shape23() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function Shape24() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function Shape25() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function Shape26() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function Shape27() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function Shape28() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function Shape29() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function Shape30() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function Shape31() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function Shape32() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function Shape33() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function Shape34() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Shape35() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function Shape36() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function Shape37() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Shape38() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Shape39() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Shape40() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Shape41() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function Shape42() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function Shape43() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function Shape44() { + + function enter(this:paper.Path) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function Shape45() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function Shape46() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function Shape47() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function Shape48() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function Shape49() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function Shape50() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function Shape51() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function Shape52() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function Shape53() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function Shape54() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function Shape55() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function Shape56() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function Shape57() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function Shape58() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function Shape59() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + }); + + } + function Shape60() { + + let pathHandlers = { + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function Shape61() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function Shape62() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function Shape63() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function Shape64() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function Shape65() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function Style0() { + + let path = new paper.Path.Circle(new paper.Point(80, 50), 30); + path.style = { + fillColor: new paper.Color(1, 0, 0), + strokeColor: 'black', + strokeWidth: 5 + }; + + } + function Style1() { + + let text = new paper.PointText(paper.view.center); + text.content = 'Hello world.'; + text.style = { + fontFamily: 'Courier New', + fontWeight: 'bold', + fontSize: 20, + fillColor: 'red', + justification: 'center' + }; + + } + function Style2() { + + let path1 = new paper.Path.Circle({ + center: [100, 50], + radius: 30 + }); + + let path2 = new paper.Path.Rectangle({ + from: [170, 20], + to: [230, 80] + }); + + let group = new paper.Group([path1, path2]); + + // All styles set on a group are automatically + // set on the children of the group: + group.style = { + strokeColor: 'black', + dashArray: [4, 10], + strokeWidth: 4, + strokeCap: 'round' + }; + + } + function Style3() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle(new paper.Point(80, 50), 35); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function Style4() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle(new paper.Point(80, 50), 35); + + // Set its stroke color to black: + circle.strokeColor = 'black'; + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function Style5() { + + let line = new paper.Path([new paper.Point(80, 50), new paper.Point(420, 50)]); + line.strokeColor = 'black'; + line.strokeWidth = 20; + + // Select the path, so we can see where the stroke is formed: + line.selected = true; + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function Style6() { + + let path = new paper.Path(); + path.add(new paper.Point(80, 100)); + path.add(new paper.Point(120, 40)); + path.add(new paper.Point(160, 100)); + path.strokeColor = 'black'; + path.strokeWidth = 20; + + // Select the path, so we can see where the stroke is formed: + path.selected = true; + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function Style7() { + + let path = new paper.Path.Circle(new paper.Point(80, 50), 40); + path.strokeWidth = 2; + path.strokeColor = 'black'; + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function Style8() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle(new paper.Point(80, 50), 35); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function Style9() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function SymbolDefinition0() { + + let path = new paper.Path.Star(new paper.Point(0, 0), 6, 5, 13); + path.style = { + fillColor: 'white', + strokeColor: 'black' + }; + + // Create a symbol definition from the path: + let definition = new paper.Symbol(path); + + // Place 100 instances of the symbol definition: + for (let i = 0; i < 100; i++) { + // Place an instance of the symbol definition in the project: + let instance = definition.place(); + + // Move the instance to a random position within the paper.view: + instance.position = paper.Point.random().multiply(new paper.Point(paper.view.size)); + + // Rotate the instance by a random amount between + // 0 and 360 degrees: + instance.rotate(Math.random() * 360); + + // Scale the instance between 0.25 and 1: + instance.scale(0.25 + Math.random() * 0.75); + } + + } + function SymbolItem0() { + + let path = new paper.Path.Star({ + center: new paper.Point(0, 0), + points: 6, + radius1: 5, + radius2: 13, + fillColor: 'white', + strokeColor: 'black' + }); + + // Create a symbol definition from the path: + let definition = new paper.Symbol(path); + + // Place 100 instances of the symbol: + for (let i = 0; i < 100; i++) { + // Place an instance of the symbol in the project: + let instance = new paper.PlacedSymbol(definition); + + // Move the instance to a random position within the paper.view: + instance.position = paper.Point.random().multiply(new paper.Point(paper.view.size)); + + // Rotate the instance by a random amount between + // 0 and 360 degrees: + instance.rotate(Math.random() * 360); + + // Scale the instance between 0.25 and 1: + instance.scale(0.25 + Math.random() * 0.75); + } + + } + function SymbolItem1() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function SymbolItem2() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function SymbolItem3() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function SymbolItem4() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function SymbolItem5() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function SymbolItem6() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function SymbolItem7() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function SymbolItem8() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function SymbolItem9() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function SymbolItem10() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function SymbolItem11() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function SymbolItem12() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function SymbolItem13() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function SymbolItem14() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function SymbolItem15() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function SymbolItem16() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function SymbolItem17() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function SymbolItem18() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function SymbolItem19() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function SymbolItem20() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function SymbolItem21() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function SymbolItem22() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function SymbolItem23() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function SymbolItem24() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function SymbolItem25() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function SymbolItem26() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function SymbolItem27() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function SymbolItem28() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function SymbolItem29() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function SymbolItem30() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function SymbolItem31() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function SymbolItem32() { + + function enter(this:paper.Path) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function SymbolItem33() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function SymbolItem34() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function SymbolItem35() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function SymbolItem36() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function SymbolItem37() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function SymbolItem38() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function SymbolItem39() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function SymbolItem40() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function SymbolItem41() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function SymbolItem42() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function SymbolItem43() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function SymbolItem44() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function SymbolItem45() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function SymbolItem46() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function SymbolItem47() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + }); + + } + function SymbolItem48() { + + let pathHandlers = { + mouseenter: function(this:paper.Path) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function SymbolItem49() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function SymbolItem50() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function SymbolItem51() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function SymbolItem52() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function SymbolItem53() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function TextItem0() { + + // Create a point-text item at {x: 30, y: 30}: + let text = new paper.PointText(new paper.Point(30, 30)); + text.fillColor = 'black'; + + // Set the content of the text item: + text.content = 'Hello world'; + + } + function TextItem1() { + + // Create a point-text item at {x: 30, y: 30}: + let text = new paper.PointText(new paper.Point(30, 30)); + text.fillColor = 'black'; + + text.content = 'Move your mouse over the paper.view, to see its position'; + + function onMouseMove(event:paper.ToolEvent) { + // Each time the mouse is moved, set the content of + // the point text to describe the position of the mouse: + text.content = 'Your position is: ' + event.point.toString(); + } + + } + function TextItem2() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and add path to it as a child: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'red'; + + } + function TextItem3() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 30 + }); + circle.style = { + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 5 + }; + + } + function TextItem4() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30, + fillColor: 'red' + }); + + let path2 = new paper.Path.Circle({ + center: new paper.Point(180, 50), + radius: 20 + }); + + // Copy the path style of path: + path2.style = path.style; + + } + function TextItem5() { + + let myStyle = { + fillColor: 'red', + strokeColor: 'blue', + strokeWidth: 4 + }; + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 30 + }); + path.style = myStyle; + + let path2 = new paper.Path.Circle({ + center: new paper.Point(150, 50), + radius: 20 + }); + path2.style = myStyle; + + } + function TextItem6() { + + let path = new paper.Path.Circle({ + center: [50, 50], + radius: 20, + fillColor: 'red' + }); + + // Hide the path: + path.visible = false; + + } + function TextItem7() { + + // Create a white rectangle in the background + // with the same dimensions as the paper.view: + let background = new paper.Path.Rectangle(paper.view.bounds); + background.fillColor = 'white'; + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue' + }); + + // Set the blend mode of circle2: + circle2.blendMode = 'multiply'; + + } + function TextItem8() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' + }); + + let circle2 = new paper.Path.Circle({ + center: new paper.Point(120, 50), + radius: 35, + fillColor: 'blue', + strokeColor: 'green', + strokeWidth: 10 + }); + + // Make circle2 50% transparent: + circle2.opacity = 0.5; + + } + function TextItem9() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + path.selected = true; // Select the path + + } + function TextItem10() { + + // Create a circle at position { x: 10, y: 10 } + let circle = new paper.Path.Circle({ + center: new paper.Point(10, 10), + radius: 10, + fillColor: 'red' + }); + + // Move the circle to { x: 20, y: 20 } + circle.position = new paper.Point(20, 20); + + // Move the circle 100 points to the right and 50 points down + circle.position = circle.position.add(new paper.Point(100, 50)); + + } + function TextItem11() { + + // Create a circle at position { x: 20, y: 20 } + let circle = new paper.Path.Circle({ + center: new paper.Point(20, 20), + radius: 10, + fillColor: 'red' + }); + + // Move the circle 100 points to the right + circle.position.x += 100; + + } + function TextItem12() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // Access the path through the group's children array: + group.children[0].fillColor = 'red'; + + } + function TextItem13() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + // Set the name of the path: + path.name = 'example'; + + // Create a group and move the path into it: + let group = new paper.Group(); + group.addChild(path); + + // The path can be accessed by name: + group.getItem('example').fillColor = 'orange'; + + } + function TextItem14() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + let group = new paper.Group(); + group.children = [path]; + + // The path is the first child of the group: + group.firstChild.fillColor = 'green'; + + } + function TextItem15() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set its stroke color to RGB red: + circle.strokeColor = new paper.Color(1, 0, 0); + + } + function TextItem16() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + strokeColor: 'red' + }); + + // Set its stroke width to 10: + circle.strokeWidth = 10; + + } + function TextItem17() { + + let line = new paper.Path({ + segments: [[80, 50], [420, 50]], + strokeColor: 'black', + strokeWidth: 20, + selected: true + }); + + // Set the stroke cap of the line to be round: + line.strokeCap = 'round'; + + // Copy the path and set its stroke cap to be square: + let line2 = line.clone(); + line2.position.y += 50; + line2.strokeCap = 'square'; + + // Make another copy and set its stroke cap to be butt: + line2 = line.clone(); + line2.position.y += 100; + line2.strokeCap = 'butt'; + + } + function TextItem18() { + + let path = new paper.Path({ + segments: [[80, 100], [120, 40], [160, 100]], + strokeColor: 'black', + strokeWidth: 20, + // Select the path, in order to see where the stroke is formed: + selected: true + }); + + let path2 = path.clone(); + path2.position.x += path2.bounds.width * 1.5; + path2.strokeJoin = 'round'; + + let path3 = path2.clone(); + path3.position.x += path3.bounds.width * 1.5; + path3.strokeJoin = 'bevel'; + + } + function TextItem19() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 40, + strokeWidth: 2, + strokeColor: 'black' + }); + + // Set the dashed stroke to [10pt dash, 4pt gap]: + path.dashArray = [10, 4]; + + } + function TextItem20() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 35: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + // Set the fill color of the circle to RGB red: + circle.fillColor = new paper.Color(1, 0, 0); + + } + function TextItem21() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'white', + // Set the shadow color of the circle to RGB black: + shadowColor: new paper.Color(0, 0, 0), + // Set the shadow blur radius to 12: + shadowBlur: 12, + // Offset the shadow by { x: 5, y: 5 } + shadowOffset: new paper.Point(5, 5) + }); + + } + function TextItem22() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + path.onFrame = function(this:paper.Path) { + // Every frame, rotate the path by 3 degrees: + this.rotate(3); + } + + } + function TextItem23() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is pressed on the item, + // set its fill color to red: + path.onMouseDown = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function TextItem24() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is pressed on the item, remove it: + path.onMouseDown = function(this:paper.Path) { + this.remove(); + } + } + + } + function TextItem25() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 50, + fillColor: 'blue' + }); + + // Install a drag event handler that moves the path along. + path.onMouseDrag = function(this:paper.Path, event:paper.MouseEvent) { + path.position = path.position.add(event.delta); + } + + } + function TextItem26() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is released over the item, + // set its fill color to red: + path.onMouseUp = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function TextItem27() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is clicked on the item, + // set its fill color to red: + path.onClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function TextItem28() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse clicks on the item, remove it: + path.onClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function TextItem29() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse is double clicked on the item, + // set its fill color to red: + path.onDoubleClick = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function TextItem30() { + + // Loop 30 times: + for (let i = 0; i < 30; i++) { + // Create a circle shaped path at a random position + // in the paper.view: + let path = new paper.Path.Circle({ + center: paper.Point.random().multiply(new paper.Point(paper.view.size)), + radius: 25, + fillColor: 'black', + strokeColor: 'white' + }); + + // When the mouse is double clicked on the item, remove it: + path.onDoubleClick = function(this:paper.Path) { + this.remove(); + } + } + + } + function TextItem31() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse moves on top of the item, set its opacity + // to a random value between 0 and 1: + path.onMouseMove = function(this:paper.Path) { + this.opacity = Math.random(); + } + + } + function TextItem32() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = function(this:paper.Path) { + this.fillColor = 'red'; + } + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'black'; + } + + } + function TextItem33() { + + function enter(this:paper.Path) { + this.fillColor = 'red'; + } + + function leave(this:paper.Path) { + this.fillColor = 'black'; + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle(event.point, 25); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.onMouseEnter = enter; + + // When the mouse leaves the item, set its fill color to black: + path.onMouseLeave = leave; + } + + } + function TextItem34() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse leaves the item, set its fill color to red: + path.onMouseLeave = function(this:paper.Path) { + this.fillColor = 'red'; + } + + } + function TextItem35() { + + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 35 + }); + + circle.set({ + strokeColor: 'red', + strokeWidth: 10, + fillColor: 'black', + selected: true + }); + + } + function TextItem36() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 10, + fillColor: 'red' + }); + + // Make 20 copies of the circle: + for (let i = 0; i < 20; i++) { + let copy = circle.clone(); + + // Distribute the copies horizontally, so we can see them: + copy.position.x += i * copy.bounds.width; + } + + } + function TextItem37() { + + let circle = new paper.Path.Circle({ + center: [50, 50], + radius: 5, + fillColor: 'red' + }); + + // Create a rasterized version of the path: + let raster = circle.rasterize(); + + // Move it 100pt to the right: + raster.position.x += 100; + + // Scale the path and the raster by 300%, so we can compare them: + circle.scale(5); + raster.scale(5); + + } + function TextItem38() { + + let path = new paper.Path.Star({ + center: [50, 50], + points: 12, + radius1: 20, + radius2: 40, + fillColor: 'black' + }); + + // Whenever the user presses the mouse: + function onMouseDown(event:paper.ToolEvent) { + // If the position of the mouse is within the path, + // set its fill color to red, otherwise set it to + // black: + if (path.contains(event.point)) { + path.fillColor = 'red'; + } else { + path.fillColor = 'black'; + } + } + + } + function TextItem39() { + + // Create a rectangle shaped path with its top left + // point at {x: 80, y: 25} and a size of {width: 50, height: 50}: + let path = new paper.Path.Rectangle(new paper.Point(80, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + // Rotate the path by 30 degrees: + path.rotate(30); + + } + function TextItem40() { + + // Create a rectangle shaped path with its top left + // point at {x: 175, y: 50} and a size of {width: 100, height: 100}: + let topLeft = new paper.Point(175, 50); + let size = new paper.Size(100, 100); + let path = new paper.Path.Rectangle(topLeft, size); + path.fillColor = 'black'; + + // Draw a circle shaped path in the center of the paper.view, + // to show the rotation point: + let circle = new paper.Path.Circle({ + center: paper.view.center, + radius: 5, + fillColor: 'white' + }); + + // Each frame rotate the path 3 degrees around the center point + // of the paper.view: + function onFrame(event:paper.IFrameEvent) { + path.rotate(3, paper.view.center); + } + + } + function TextItem41() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path by 150% from its center point + circle.scale(1.5); + + } + function TextItem42() { + + // Create a circle shaped path at { x: 80, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [80, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path 150% from its bottom left corner + circle.scale(1.5, circle.bounds.bottomLeft); + + } + function TextItem43() { + + // Create a circle shaped path at { x: 100, y: 50 } + // with a radius of 20: + let circle = new paper.Path.Circle({ + center: [100, 50], + radius: 20, + fillColor: 'red' + }); + + // Scale the path horizontally by 300% + circle.scale(3, 1); + + } + function TextItem44() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds); + + } + function TextItem45() { + + // Create a rectangle shaped path with its top left corner + // at {x: 80, y: 25} and a size of {width: 75, height: 50}: + let path = new paper.Path.Rectangle({ + point: [80, 25], + size: [75, 50], + fillColor: 'black' + }); + + // Create a circle shaped path with its center at {x: 80, y: 50} + // and a radius of 30. + let circlePath = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the circlePath to the bounding rectangle of + // the rectangular path: + circlePath.fitBounds(path.bounds, true); + + } + function TextItem46() { + + let path = new paper.Path.Circle({ + center: [80, 50], + radius: 30, + fillColor: 'red' + }); + + // Fit the path to the bounding rectangle of the paper.view: + path.fitBounds(paper.view.bounds); + + } + function TextItem47() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25, + fillColor: 'black' + }); + + // When the mouse enters the item, set its fill color to red: + path.on('mouseenter', function(this:paper.Path) { + this.fillColor = 'red'; + }); + + // When the mouse leaves the item, set its fill color to black: + path.on('mouseleave', function(this:paper.Path) { + this.fillColor = 'black'; + }); + + } + function TextItem48() { + + // Create a circle shaped path at the center of the paper.view: + let path = new paper.Path.Circle({ + center: paper.view.center, + radius: 25 + }); + path.fillColor = 'black'; + + // When the mouse enters the item, set its fill color to red: + path.on({ + mouseenter: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + }); + + } + function TextItem49() { + + let pathHandlers = { + mouseenter: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'red'; + }, + mouseleave: function(this:paper.Path, event:paper.MouseEvent) { + this.fillColor = 'black'; + } + } + + // When the mouse is pressed: + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the position of the mouse: + let path = new paper.Path.Circle({ + center: event.point, + radius: 25, + fillColor: 'black' + }); + + // Attach the handers inside the object literal to the path: + path.on(pathHandlers); + } + + } + function TextItem50() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path on the next onMouseDrag or onMouseDown event: + path.removeOn({ + drag: true, + down: true + }); + } + + } + function TextItem51() { + + function onMouseMove(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next move event, automatically remove the path: + path.removeOnMove(); + } + + } + function TextItem52() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, next time the mouse is pressed: + path.removeOnDown(); + } + + } + function TextItem53() { + + function onMouseDrag(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // On the next drag event, automatically remove the path: + path.removeOnDrag(); + } + + } + function TextItem54() { + + function onMouseDown(event:paper.ToolEvent) { + // Create a circle shaped path at the mouse position, + // with a radius of 10: + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + + // Remove the path, when the mouse is released: + path.removeOnUp(); + } + + } + function Tool0() { + + let path:paper.Path; + + // Only execute onMouseDrag when the mouse + // has moved at least 10 points: + paper.tool.minDistance = 10; + + paper.tool.onMouseDown = function(this:paper.Tool, event:paper.ToolEvent) { + // Create a new path every time the mouse is clicked + path = new paper.Path(); + path.add(event.point); + path.strokeColor = 'black'; + } + + paper.tool.onMouseDrag = function(this:paper.Tool, event:paper.ToolEvent) { + // Add a point to the path every time the mouse is dragged + path.add(event.point); + } + + } + function Tool1() { + + paper.tool.onMouseDown = function(event:paper.ToolEvent) { + // Create a new circle shaped path with a radius of 10 + // at the position of the mouse (event.point): + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + } + + } + function Tool2() { + + // Create an empty path: + let path = new paper.Path({ + strokeColor: 'black' + }); + + paper.tool.onMouseDrag = function(event:paper.ToolEvent) { + // Add a segment to the path at the position of the mouse: + path.add(event.point); + } + + } + function Tool3() { + + // Create a circle shaped path with a radius of 10 at {x: 0, y: 0}: + let path = new paper.Path.Circle({ + center: [0, 0], + radius: 10, + fillColor: 'black' + }); + + paper.tool.onMouseMove = function(event:paper.ToolEvent) { + // Whenever the user moves the mouse, move the path + // to that position: + path.position = event.point; + } + + } + function Tool4() { + + paper.tool.onMouseUp = function(event:paper.ToolEvent) { + // Create a new circle shaped path with a radius of 10 + // at the position of the mouse (event.point): + let path = new paper.Path.Circle({ + center: event.point, + radius: 10, + fillColor: 'black' + }); + } + + } + function Tool5() { + + // Create a circle shaped path: + let path = new paper.Path.Circle({ + center: new paper.Point(50, 50), + radius: 30, + fillColor: 'red' + }); + + paper.tool.onKeyDown = function(event:paper.KeyEvent) { + if (event.key == 'space') { + // Scale the path by 110%: + path.scale(1.1); + + // Prevent the key event from bubbling + return false; + } + } + + } + function View0() { + + // Create a rectangle shaped path with its top left point at: + // {x: 50, y: 25} and a size of {width: 50, height: 50} + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + paper.view.onFrame = function(event:paper.IFrameEvent) { + // Every frame, rotate the path by 3 degrees: + path.rotate(3); + } + + } + function View1() { + + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + let frameHandler = function(event: paper.IFrameEvent){ + // Every frame, rotate the path by 3 degrees: + path.rotate(3); + }; + + paper.view.on('frame', frameHandler); + + } + function View2() { + + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + let frameHandler = function(event:paper.IFrameEvent) { + // Every frame, rotate the path by 3 degrees: + path.rotate(3); + }; + + paper.view.on({ + frame: frameHandler + }); + + } + function View3() { + + let path = new paper.Path.Rectangle(new paper.Point(50, 25), new paper.Size(50, 50)); + path.fillColor = 'black'; + + let frameHandler = function(event:paper.IFrameEvent) { + // Every frame, rotate the path by 3 degrees: + path.rotate(3); + }; + + paper.view.on({ + frame: frameHandler + }); + + // When the user presses the mouse, + // detach the frame handler from the paper.view: + function onMouseDown(event:paper.ToolEvent) { + paper.view.off('frame'); + } + + } + +} From a9394b8436ae70e1abc775d145be8dff3e4c5674 Mon Sep 17 00:00:00 2001 From: Jon Freedman Date: Sat, 21 Jul 2018 01:42:18 +0100 Subject: [PATCH 132/738] update plotly.js typing (#27355) * update typing - add missing event handlers from https://github.com/plotly/react-plotly.js/#event-handler-props - add addFrames / deleteFrames functions - use Font interface in ScatterMarker.colorbar - change Font.color type from string to Color - fix 'common mistakes': tabs to spaces * fix linting errors * use tab indentation and require in tslint --- types/plotly.js/index.d.ts | 1123 +++++++++++++++++---------- types/plotly.js/test/core-tests.ts | 95 ++- types/plotly.js/test/index-tests.ts | 95 ++- types/plotly.js/tslint.json | 3 +- 4 files changed, 892 insertions(+), 424 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 39ecb64d37..b8532af0a6 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -1,13 +1,14 @@ // Type definitions for plotly.js 1.38 // Project: https://plot.ly/javascript/ // Definitions by: Chris Gervang -// Martin Duparc -// Frederik Aalund -// taoqf -// Dadstart -// Jared Szechy -// Drew Diamantoukos -// Sooraj Pudiyadath +// Martin Duparc +// Frederik Aalund +// taoqf +// Dadstart +// Jared Szechy +// Drew Diamantoukos +// Sooraj Pudiyadath +// Jon Freedman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -27,14 +28,14 @@ export interface Point { } export interface PlotScatterDataPoint { - curveNumber: number; - data: ScatterData; - pointIndex: number; - pointNumber: number; - x: number; - xaxis: LayoutAxis; - y: number; - yaxis: LayoutAxis; + curveNumber: number; + data: ScatterData; + pointIndex: number; + pointNumber: number; + x: number; + xaxis: LayoutAxis; + y: number; + yaxis: LayoutAxis; } export interface PlotMouseEvent { @@ -53,8 +54,8 @@ export interface PlotSelectionEvent { } export type PlotRestyleEvent = [ - any, // update object -- attribute updated: new value - number[] // array of traces updated + any, // update object -- attribute updated: new value + number[] // array of traces updated ]; export interface PlotAxis { @@ -81,14 +82,69 @@ export interface ClickAnnotationEvent { event: MouseEvent; } +export interface FrameAnimationEvent { + name: string; + frame: Frame; + animation: { + frame: { + duration: number; + redraw: boolean; + }; + transition: Transition; + }; +} + +export interface LegendClickEvent { + event: MouseEvent; + node: PlotlyHTMLElement; + curveNumber: number; + expandedIndex: number; + data: Data[]; + layout: Partial; + frames: Frame[]; + config: Partial; + fullData: Data[]; + fullLayout: Partial; +} + +export interface SliderChangeEvent { + slider: Slider; + step: SliderStep; + interaction: boolean; + previousActive: number; +} + +export interface SliderStartEvent { + slider: Slider; +} + +export interface SliderEndEvent { + slider: Slider; + step: SliderStep; +} + +export interface BeforePlotEvent { + data: Data[]; + layout: Partial; + config: Partial; +} + export interface PlotlyHTMLElement extends HTMLElement { on(event: 'plotly_click' | 'plotly_hover' | 'plotly_unhover', callback: (event: PlotMouseEvent) => void): void; on(event: 'plotly_selecting' | 'plotly_selected', callback: (event: PlotSelectionEvent) => void): void; on(event: 'plotly_restyle', callback: (data: PlotRestyleEvent) => void): void; on(event: 'plotly_relayout', callback: (event: PlotRelayoutEvent) => void): void; on(event: 'plotly_clickannotation', callback: (event: ClickAnnotationEvent) => void): void; - // on(event: 'plotly_event', callback: (data: any) => void): void; - on(event: 'plotly_afterplot' | 'plotly_autosize' | 'plotly_deselect' | 'plotly_doubleclick' | 'plotly_redraw' | 'plotly_animated', callback: () => void): void; + on(event: 'plotly_animatingframe', callback: (event: FrameAnimationEvent) => void): void; + on(event: 'plotly_legendclick' | 'plotly_legenddoubleclick', callback: (event: LegendClickEvent) => boolean): void; + on(event: 'plotly_sliderchange', callback: (event: SliderChangeEvent) => void): void; + on(event: 'plotly_sliderend', callback: (event: SliderEndEvent) => void): void; + on(event: 'plotly_sliderstart', callback: (event: SliderStartEvent) => void): void; + on(event: 'plotly_event', callback: (data: any) => void): void; + on(event: 'plotly_beforeplot' , callback: (event: BeforePlotEvent) => boolean): void; + on(event: 'plotly_afterexport' | 'plotly_afterplot' | 'plotly_animated' | 'plotly_animationinterrupted' | 'plotly_autosize' | + 'plotly_beforeexport' | 'plotly_deselect' | 'plotly_doubleclick' | 'plotly_framework' | 'plotly_redraw' | + 'plotly_transitioning' | 'plotly_transitioninterrupted' , callback: () => void): void; } export interface ToImgopts { @@ -122,6 +178,8 @@ export function prependTraces(root: Root, update: Data | Data[], indices: number export function toImage(root: Root, opts: ToImgopts): Promise; export function downloadImage(root: Root, opts: DownloadImgopts): Promise; export function react(root: Root, data: Data[], layout?: Partial, config?: Partial): Promise; +export function addFrames(root: Root, frames: Array>): Promise; +export function deleteFrames(root: Root, frames: number[]): Promise; // Layout export interface Layout { @@ -129,11 +187,11 @@ export interface Layout { titlefont: Partial; autosize: boolean; showlegend: boolean; - paper_bgcolor: Color; - plot_bgcolor: Color; - separators: string; - hidesources: boolean; - xaxis: Partial; + paper_bgcolor: Color; + plot_bgcolor: Color; + separators: string; + hidesources: boolean; + xaxis: Partial; yaxis: Partial; yaxis2: Partial; yaxis3: Partial; @@ -148,8 +206,8 @@ export interface Layout { width: number; hovermode: 'closest' | 'x' | 'y' | false; hoverlabel: Partial

{ rerenderOnEveryChange?: boolean; } -export interface GenericFieldArray extends Component & P> { +export interface GenericFieldArray extends Component & Partial

> { name: string; valid: boolean; getRenderedComponent(): Component & P>; } -export class FieldArray

extends Component & P> implements GenericFieldArray { +export class FieldArray

extends Component & Partial

> implements GenericFieldArray { name: string; valid: boolean; getRenderedComponent(): Component & P>; From c5b489e1464a6fed11ba32c6280a3c1f513cacfa Mon Sep 17 00:00:00 2001 From: BehindTheMath <9314934+BehindTheMath@users.noreply.github.com> Date: Fri, 20 Jul 2018 20:42:56 -0400 Subject: [PATCH 135/738] [numeral] Remove method that no longer exists (#27352) * [numeral] Remove method that no longer exists This method was removed in adamwdraper/Numeral-js@f8f2696, and it was changed in adamwdraper/Numeral-js#398 from a dedicated method to using `$` in the format. * [numeral] Fix tests --- types/numeral/index.d.ts | 2 +- types/numeral/numeral-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/numeral/index.d.ts b/types/numeral/index.d.ts index 16d5a68692..0f1fbd5115 100644 --- a/types/numeral/index.d.ts +++ b/types/numeral/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Numeral.js // Project: https://github.com/adamwdraper/Numeral-js // Definitions by: Vincent Bortone +// Behind The Math // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -71,7 +72,6 @@ interface Numeral { defaultFormat(format: string): void; clone(): Numeral; format(inputString?: string, roundingFunction?: RoundingFunction): string; - formatCurrency(inputString?: string): string; unformat(inputString: string): number; value(): number; valueOf(): number; diff --git a/types/numeral/numeral-tests.ts b/types/numeral/numeral-tests.ts index 79f66efed4..8307faf72c 100644 --- a/types/numeral/numeral-tests.ts +++ b/types/numeral/numeral-tests.ts @@ -93,5 +93,5 @@ numeral.locale(); // test changing an option numeral.options.scalePercentBy100 = false -numeral(50).formatCurrency('0%') +numeral(50).format('0%') // '50%' \ No newline at end of file From 32d5aacd14c82397e9c9420c105a2fd66e1d956c Mon Sep 17 00:00:00 2001 From: pau1m Date: Sat, 21 Jul 2018 01:43:10 +0100 Subject: [PATCH 136/738] Fix mistaken required for address in getPastLogs (#27340) @Levino --- types/web3/eth/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/web3/eth/index.d.ts b/types/web3/eth/index.d.ts index 14e8c2d26a..d69b561a63 100644 --- a/types/web3/eth/index.d.ts +++ b/types/web3/eth/index.d.ts @@ -117,7 +117,7 @@ export default interface Eth { options: { fromBlock?: BlockType; toBlock?: BlockType; - address: string; + address?: string; topics?: Array; }, cb?: Callback From 6fefa9cf293a4f280af9395833bcb277db748f17 Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Sat, 21 Jul 2018 01:43:19 +0100 Subject: [PATCH 137/738] Apply standard lint rules to restify. (#27323) --- types/restify/tslint.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/types/restify/tslint.json b/types/restify/tslint.json index f0f7a6f17a..f93cf8562a 100644 --- a/types/restify/tslint.json +++ b/types/restify/tslint.json @@ -1,7 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-unnecessary-class": false - } + "extends": "dtslint/dt.json" } From 5d9d95a67da42f35f717649093c3e9f645e53a7c Mon Sep 17 00:00:00 2001 From: Michael Ferris Date: Fri, 20 Jul 2018 17:43:30 -0700 Subject: [PATCH 138/738] yargs: Add `scriptName` method according to http://yargs.js.org/docs/#api-scriptname0 (#27234) --- types/yargs/index.d.ts | 2 ++ types/yargs/yargs-tests.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/types/yargs/index.d.ts b/types/yargs/index.d.ts index 50901570a4..07d8d9958f 100644 --- a/types/yargs/index.d.ts +++ b/types/yargs/index.d.ts @@ -185,6 +185,8 @@ declare namespace yargs { */ reset(): Argv; + scriptName($0: string): Argv; + showCompletionScript(): Argv; showhidden(option?: string | boolean): Argv; diff --git a/types/yargs/yargs-tests.ts b/types/yargs/yargs-tests.ts index f98120d1c4..d2d06e5bc6 100644 --- a/types/yargs/yargs-tests.ts +++ b/types/yargs/yargs-tests.ts @@ -661,3 +661,8 @@ function Argv$showhidden() { .showhidden('show-hidden') .showhidden('show-hidden', 'Show hidden options'); } + +function Argv$scriptName() { + const ya = yargs + .scriptName("my-script"); +} From 0bb8006e2fda2f51c2078c3a6e83b55ef99b947c Mon Sep 17 00:00:00 2001 From: Futa Ogawa Date: Sat, 21 Jul 2018 09:43:39 +0900 Subject: [PATCH 139/738] [@types/google-cloud__storage] Update WriteStreamOptions interface (#27329) * google-cloud__storage / Update WriteStreamOptions interface, WriteStreamOptions interface * google-cloud__storage / Import @types/request's interface `CoreOptions` * google-cloud__storage / Fix definitions metadata. --- types/google-cloud__storage/index.d.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index 9eb90db25a..b95375e11e 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -1,13 +1,16 @@ -// Type definitions for @google-cloud/storage 1.1 -// Project: https://github.com/GoogleCloudPlatform/google-cloud-node/tree/master/packages/storage +// Type definitions for @google-cloud/storage 1.7 +// Project: https://github.com/googleapis/nodejs-storage // Definitions by: Brian Love // Nathan Brooker Perry // Matt Welke +// Futa Ogawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// import { ReadStream, WriteStream } from "fs"; +import { CoreOptions } from "request"; type PromiseLibrary = () => PromiseLike; @@ -313,21 +316,26 @@ declare namespace Storage { * Options when uploading file to bucket. */ interface UploadOptions extends WriteStreamOptions { - destination?: string; + destination?: string | File; + encryptionKey?: string; + kmsKeyName?: string; + requestOptions?: CoreOptions; } /** * Options when writing to a file stream. */ interface WriteStreamOptions { - gzip?: boolean; + contentType?: string; + gzip?: string | boolean; metadata?: FileMetadata; - offset?: number; + offset?: string; predefinedAcl?: string; private?: boolean; public?: boolean; resumable?: boolean; uri?: string; + userProject?: string; validation?: string | boolean; } From 7720980c46aeb47ac9b4bae8bd89834c8e4b2e55 Mon Sep 17 00:00:00 2001 From: Futa Ogawa Date: Sat, 21 Jul 2018 09:44:00 +0900 Subject: [PATCH 140/738] [@types/google-cloud__storage] Fix `getSignedUrl()` method (#27328) * Fix required options. * google-cloud__storage / Fix `getSignedUrl()` test. --- types/google-cloud__storage/google-cloud__storage-tests.ts | 2 +- types/google-cloud__storage/index.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/google-cloud__storage/google-cloud__storage-tests.ts b/types/google-cloud__storage/google-cloud__storage-tests.ts index dec2846f26..cd0bcaaab2 100644 --- a/types/google-cloud__storage/google-cloud__storage-tests.ts +++ b/types/google-cloud__storage/google-cloud__storage-tests.ts @@ -204,7 +204,7 @@ export class TestFile { } /** Get a signed URL to allow limited time access to the file */ - getSignedUrl(config?: SignedUrlConfig): Promise<[string]> { + getSignedUrl(config: SignedUrlConfig): Promise<[string]> { return this.file.getSignedUrl(config); } diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index b95375e11e..4a2a2498c5 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -133,7 +133,7 @@ declare namespace Storage { get(): Promise<[File, ApiResponse]>; getMetadata(): Promise<[FileMetadata, ApiResponse]>; getSignedPolicy(options?: SignedPolicyOptions): Promise<[SignedPolicy]>; - getSignedUrl(config?: SignedUrlConfig): Promise<[string]>; + getSignedUrl(config: SignedUrlConfig): Promise<[string]>; makePrivate(options?: FilePrivateOptions): Promise<[ApiResponse]>; makePublic(): Promise<[ApiResponse]>; move(destination: string | Bucket | File): Promise<[File, ApiResponse]>; @@ -199,7 +199,7 @@ declare namespace Storage { cname?: string; contentMd5?: string; contentType?: string; - expires?: number | string; + expires: any; extensionHeaders?: { [key: string]: string }; promptSaveAs?: string; responseDisposition?: string; From 8cb2a181f33de7690ca8cb09a510013aca56723b Mon Sep 17 00:00:00 2001 From: Futa Ogawa Date: Sat, 21 Jul 2018 09:44:18 +0900 Subject: [PATCH 141/738] google-cloud__storage / Update FileMetadata interface (#27172) --- types/google-cloud__storage/index.d.ts | 74 ++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index 4a2a2498c5..8d7cf6c45d 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -144,20 +144,88 @@ declare namespace Storage { metadata?: FileMetadata; } + /** + * Access controls on the object, containing one or more objectAccessControls Resources. + */ + interface AclFileMetadata { + bucket?: string; + domain?: string; + email?: string; + entity?: string; + entityId?: string; + etag?: string; + generation?: number; + id?: string; + kind?: string; + object?: string; + projectTeam?: ProjectTeam; + role?: string; + selfLink?: string; + } + + /** + * The project team associated with the entity, if any. + */ + interface ProjectTeam { + projectNumber?: string; + team?: string; + } + + /** + * Metadata of customer-supplied encryption key, if the object is encrypted by such a key. + */ + interface CustomerEncryption { + encryptionAlgorithm?: string; + keySha256?: string; + } + /** * User-defined metadata. */ interface CustomFileMetadata { - [key: string]: boolean | number | string | null; + [key: string]: string; + } + + /** + * The owner of the object. This will always be the uploader of the object. + */ + interface Owner { + entity?: string; + entityId?: string; } /** * File metadata. */ interface FileMetadata { - contentType?: string; - metadata?: CustomFileMetadata; + acl?: AclFileMetadata[]; + bucket?: string; cacheControl?: string; + componentCount?: number; + contentDisposition?: string; + contentEncoding?: string; + contentLanguage?: string; + contentType?: string; + crc32c?: string; + customerEncryption?: CustomerEncryption; + etag?: string; + generation?: number; + id?: string; + kind?: string; + kmsKeyName?: string; + md5Hash?: string; + mediaLink?: string; + metadata?: CustomFileMetadata; + metageneration?: number; + name?: string; + owner?: Owner; + selfLink?: string; + size?: null | number; + storageClass?: string; + timeCreated?: string; + timeDeleted?: string; + timeStorageClassUpdated?: string; + updated?: string; } /** From 6ae40947bb810876107fe530494379edbfab1942 Mon Sep 17 00:00:00 2001 From: Michael Zlatkovsky Date: Fri, 20 Jul 2018 17:46:08 -0700 Subject: [PATCH 142/738] Update Office.js with latest Excel/Word/Visio/OneNote additions & docs (#27377) * Update Office.js with latest Excel/Word/Visio/OneNote additions & documentation * Fix build break --- types/office-js/index.d.ts | 3438 ++++++++++++++++++++++++------------ 1 file changed, 2325 insertions(+), 1113 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index e44bf07c3c..81f4979015 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -14395,7 +14395,7 @@ declare namespace Excel { readonly runtime: Runtime; } interface RunOptions extends OfficeExtension.RunOptions { - /** + /** * Determines whether Excel will delay the batch request until the user exits cell edit mode. * * When false, if the user is in cell edit when the batch request is processed by the host, the batch will automatically fail. @@ -14403,47 +14403,49 @@ declare namespace Excel { */ delayForCellEdit?: boolean; } - /** - * Executes a batch script that performs actions on the Excel object model, using the RequestContext of a previously-created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param object - A previously-created API object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. - */ - export function run(object: OfficeExtension.ClientObject, batch: (context: Excel.RequestContext) => Promise): Promise; - - /** - * Executes a batch script that performs actions on the Excel object model, using the RequestContext of previously-created API objects. - * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by "context.sync()". - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. - */ - export function run(objects: OfficeExtension.ClientObject[], batch: (context: Excel.RequestContext) => Promise): Promise; - - /** - * Executes a batch script that performs actions on the Excel object model, using the RequestContext of a previously-created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param options - The additional options for this Excel.run which specify previous objects, whether to delay the request for cell edit, session info, etc. - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. - */ - export function run(options: Excel.RunOptions, batch: (context: Excel.RequestContext) => Promise): Promise; /** - * Executes a batch script that performs actions on the Excel object model, using a new RequestContext. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. - */ - export function run(batch: (context: Excel.RequestContext) => Promise): Promise; + * Executes a batch script that performs actions on the Excel object model, using a new RequestContext. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + */ + function run(batch: (context: Excel.RequestContext) => Promise): Promise; /** + * Executes a batch script that performs actions on the Excel object model, using the RequestContext of a previously-created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * @param object - A previously-created API object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + */ + function run(object: OfficeExtension.ClientObject, batch: (context: Excel.RequestContext) => Promise): Promise; + /** + * Executes a batch script that performs actions on the Excel object model, using the RequestContext of previously-created API objects. + * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by "context.sync()". + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + */ + function run(objects: OfficeExtension.ClientObject[], batch: (context: Excel.RequestContext) => Promise): Promise; + /** + * Executes a batch script that performs actions on the Excel object model, using the RequestContext of a previously-created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * @param options - The additional options for this Excel.run which specify previous objects, whether to delay the request for cell edit, session info, etc. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + */ + function run(options: Excel.RunOptions, batch: (context: Excel.RequestContext) => Promise): Promise; + /** * Executes a batch script that performs actions on the Excel object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param contextObject - A previously-created object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". + * + * @remarks + * + * In addition to this signature, the method also has the following signatures: + * + * `run(object: OfficeExtension.ClientObject, batch: (context: Excel.RequestContext) => Promise): Promise;` + * + * `run(objects: OfficeExtension.ClientObject[], batch: (context: Excel.RequestContext) => Promise): Promise;` + * + * `run(options: Excel.RunOptions, batch: (context: Excel.RequestContext) => Promise): Promise;` + * + * `run(batch: (context: Excel.RequestContext) => Promise): Promise;` + * + * @param context - A previously-created object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. - * @remarks - * In addition to this signature, the method also has the following signatures: - * - * `run(object: OfficeExtension.ClientObject, batch: (context: Excel.RequestContext) => Promise): Promise;` - * - * `run(objects: OfficeExtension.ClientObject[], batch: (context: Excel.RequestContext) => Promise): Promise;` - * - * `run(options: Excel.RunOptions, batch: (context: Excel.RequestContext) => Promise): Promise;` - * - * `run(batch: (context: Excel.RequestContext) => Promise): Promise;` */ - export function run(contextObject: OfficeExtension.ClientRequestContext, batch: (context: Excel.RequestContext) => Promise): Promise; + function run(context: OfficeExtension.ClientRequestContext, batch: (context: Excel.RequestContext) => Promise): Promise; + function createWorkbook(base64?: string): Promise; /** * * Provides information about the binding that raised the SelectionChanged event. @@ -15073,6 +15075,8 @@ declare namespace Excel { * Occurs when the selection in the document is changed. * * [Api set: ExcelApi 1.2] + * + * @eventproperty */ readonly onSelectionChanged: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.WorkbookData; @@ -15084,6 +15088,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ class WorkbookProtection extends OfficeExtension.ClientObject { + /** + * + * Indicates if the workbook is protected. Read-Only. + * + * [Api set: ExcelApi 1.7] + */ + readonly protected: boolean; /** * * Protects a workbook. Fails if the workbook has been protected. @@ -15102,9 +15113,28 @@ declare namespace Excel { * @param password workbook protection password. */ unprotect(password?: string): void; - toJSON(): { - [key: string]: string; - }; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.WorkbookProtection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.WorkbookProtection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.WorkbookProtection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.WorkbookProtectionLoadOptions): Excel.WorkbookProtection; + load(option?: string | string[]): Excel.WorkbookProtection; + load(option?: { + select?: string; + expand?: string; + }): Excel.WorkbookProtection; + toJSON(): Excel.Interfaces.WorkbookProtectionData; } /** * @@ -15242,7 +15272,7 @@ declare namespace Excel { * Copy a worksheet and place it at the specified position. Return the copied worksheet. * * [Api set: ExcelApi 1.7] - * + * * @param positionType Optional. * @param relativeTo Optional. */ @@ -15375,6 +15405,8 @@ declare namespace Excel { * Occurs when the worksheet is activated. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onActivated: OfficeExtension.EventHandlers; /** @@ -15382,6 +15414,8 @@ declare namespace Excel { * Occurs when data changed on a specific worksheet. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onChanged: OfficeExtension.EventHandlers; /** @@ -15389,6 +15423,8 @@ declare namespace Excel { * Occurs when the worksheet is deactivated. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onDeactivated: OfficeExtension.EventHandlers; /** @@ -15396,6 +15432,8 @@ declare namespace Excel { * Occurs when the selection changes on a specific worksheet. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onSelectionChanged: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.WorksheetData; @@ -15493,6 +15531,8 @@ declare namespace Excel { * Occurs when any worksheet in the workbook is activated. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onActivated: OfficeExtension.EventHandlers; /** @@ -15500,6 +15540,8 @@ declare namespace Excel { * Occurs when a new worksheet is added to the workbook. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onAdded: OfficeExtension.EventHandlers; /** @@ -15507,6 +15549,8 @@ declare namespace Excel { * Occurs when any worksheet in the workbook is deactivated. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onDeactivated: OfficeExtension.EventHandlers; /** @@ -15514,6 +15558,8 @@ declare namespace Excel { * Occurs when a worksheet is deleted from the workbook. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onDeleted: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.WorksheetCollectionData; @@ -16574,6 +16620,8 @@ declare namespace Excel { * Occurs when the Settings in the document are changed. * * [Api set: ExcelApi 1.4] + * + * @eventproperty */ readonly onSettingsChanged: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.SettingCollectionData; @@ -16978,6 +17026,8 @@ declare namespace Excel { * Occurs when data or formatting within the binding is changed. * * [Api set: ExcelApi 1.2] + * + * @eventproperty */ readonly onDataChanged: OfficeExtension.EventHandlers; /** @@ -16985,6 +17035,8 @@ declare namespace Excel { * Occurs when the selected content in the binding is changed. * * [Api set: ExcelApi 1.2] + * + * @eventproperty */ readonly onSelectionChanged: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.BindingData; @@ -17210,6 +17262,8 @@ declare namespace Excel { * Occurs when data changes on any table in a workbook, or a worksheet. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onChanged: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.TableCollectionData; @@ -17415,6 +17469,8 @@ declare namespace Excel { * Occurs when data in cells changes on a specific table. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onChanged: OfficeExtension.EventHandlers; /** @@ -17422,6 +17478,8 @@ declare namespace Excel { * Occurs when the selection changes on a specific table. * * [Api set: ExcelApi 1.7] + * + * @eventproperty */ readonly onSelectionChanged: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.TableData; @@ -17624,7 +17682,7 @@ declare namespace Excel { /** * * Represents a collection of all the rows that are part of the table. - + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, a TableRow object represent the physical location of the table row, but not the data. That is, if the data is sorted or if new rows are added, a table row will continue @@ -17645,7 +17703,7 @@ declare namespace Excel { /** * * Adds one or more rows to the table. The return object will be the top of the newly added row(s). - + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, a TableRow object represent the physical location of the table row, but not the data. That is, if the data is sorted or if new rows are added, a table row will continue @@ -17667,7 +17725,7 @@ declare namespace Excel { /** * * Gets a row based on its position in the collection. - + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, a TableRow object represent the physical location of the table row, but not the data. That is, if the data is sorted or if new rows are added, a table row will continue @@ -17701,7 +17759,7 @@ declare namespace Excel { /** * * Represents a row in a table. - + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, a TableRow object represent the physical location of the table row, but not the data. That is, if the data is sorted or if new rows are added, a table row will continue @@ -18299,7 +18357,7 @@ declare namespace Excel { * @param sourceData The Range object corresponding to the source data. * @param seriesBy Optional. Specifies the way columns or rows are used as data series on the chart. See Excel.ChartSeriesBy for details. */ - add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar", sourceData: Range | string, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart; + add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap", sourceData: Range | string, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart; /** * * Returns the number of charts in the worksheet. @@ -18417,7 +18475,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar"; + chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; /** * * Represents the height, in points, of the chart object. @@ -18726,7 +18784,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar"; + chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -21413,7 +21471,7 @@ declare namespace Excel { * * The first criterion used to filter data. Used as an operator in the case of "custom" filtering. For example ">50" for number greater than 50 or "=*s" for values ending in "s". - + Used as a number in the case of top/bottom items/percents. E.g. "5" for the top 5 items if filterOn is set to "topItems" * * [Api set: ExcelApi 1.2] @@ -24352,6 +24410,9 @@ declare namespace Excel { area = "Area", doughnut = "Doughnut", radar = "Radar", + histogram = "Histogram", + pareto = "Pareto", + regionMap = "RegionMap", } /** * [Api set: ExcelApi 1.1] @@ -24905,6 +24966,7 @@ declare namespace Excel { justify = "Justify", distributed = "Distributed", } + /** * [Api set: ExcelApi 1.7] */ @@ -25073,12 +25135,36 @@ declare namespace Excel { * */ visualSelectionChanged = "VisualSelectionChanged", + /** + * + * AgaveVisualUpdate represents the type of an event that is associated with an agave visual, and carries a new data view following a data change + * + */ + agaveVisualUpdate = "AgaveVisualUpdate", /** * * TableAdded represents the type of event registered on TableCollection, and occurs when a table is added. * */ tableAdded = "TableAdded", + /** + * + * TableDeleted represents the type of event that is registered on TableCollection, and occurs when a table is deleted. + * + */ + tableDeleted = "TableDeleted", + /** + * + * ShapeActivated represents the type of event that is registered on Shape, and occurs when shape activates. + * + */ + shapeActivated = "ShapeActivated", + /** + * + * ShapeDeactivated represents the type of event that is registered on Shape, and occurs when shape deactivates. + * + */ + shapeDeactivated = "ShapeDeactivated", } /** * [Api set: ExcelApi 1.7] @@ -29626,7 +29712,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; /** * * Represents the height, in points, of the chart object. @@ -29706,7 +29792,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -31457,6 +31543,13 @@ declare namespace Excel { properties?: Excel.Interfaces.DocumentPropertiesData; /** * + * Returns workbook protection object for a workbook. Read-only. + * + * [Api set: ExcelApi 1.7] + */ + protection?: Excel.Interfaces.WorkbookProtectionData; + /** + * * Represents a collection of Settings associated with the workbook. Read-only. * * [Api set: ExcelApi 1.4] @@ -31491,6 +31584,16 @@ declare namespace Excel { */ name?: string; } + /** An interface describing the data returned by calling "workbookProtection.toJSON()". */ + interface WorkbookProtectionData { + /** + * + * Indicates if the workbook is protected. Read-Only. + * + * [Api set: ExcelApi 1.7] + */ + protected?: boolean; + } /** An interface describing the data returned by calling "worksheet.toJSON()". */ interface WorksheetData { /** @@ -32446,7 +32549,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; /** * * Represents the height, in points, of the chart object. @@ -32547,7 +32650,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -34511,6 +34614,13 @@ declare namespace Excel { properties?: Excel.Interfaces.DocumentPropertiesLoadOptions; /** * + * Returns workbook protection object for a workbook. + * + * [Api set: ExcelApi 1.7] + */ + protection?: Excel.Interfaces.WorkbookProtectionLoadOptions; + /** + * * Represents a collection of tables associated with the workbook. * * [Api set: ExcelApi 1.1] @@ -34524,6 +34634,22 @@ declare namespace Excel { */ name?: boolean; } + /** + * + * Represents the protection of a workbook object. + * + * [Api set: ExcelApi 1.7] + */ + interface WorkbookProtectionLoadOptions { + $all?: boolean; + /** + * + * Indicates if the workbook is protected. Read-Only. + * + * [Api set: ExcelApi 1.7] + */ + protected?: boolean; + } /** * * An Excel worksheet is a grid of cells. It can contain data, tables, charts, etc. @@ -35646,7 +35772,7 @@ declare namespace Excel { /** * * Represents a collection of all the rows that are part of the table. - + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, a TableRow object represent the physical location of the table row, but not the data. That is, if the data is sorted or if new rows are added, a table row will continue @@ -35674,7 +35800,7 @@ declare namespace Excel { /** * * Represents a row in a table. - + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, a TableRow object represent the physical location of the table row, but not the data. That is, if the data is sorted or if new rows are added, a table row will continue @@ -39119,14 +39245,14 @@ declare namespace Excel { declare namespace Word { /** * - * The Application object. + * Represents the application object. * * [Api set: WordApi 1.3] */ class Application extends OfficeExtension.ClientObject { /** * - * Creates a new hidden document by using an optional base64 encoded .docx file. + * Creates a new document by using an optional base64 encoded .docx file. * * [Api set: WordApi 1.3] * @@ -39164,7 +39290,7 @@ declare namespace Word { readonly font: Word.Font; /** * - * Gets the collection of inlinePicture objects in the body. The collection does not include floating images. Read-only. + * Gets the collection of InlinePicture objects in the body. The collection does not include floating images. Read-only. * * [Api set: WordApi 1.1] */ @@ -39291,7 +39417,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After' or 'Content'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After', or 'Content'. */ getRange(rangeLocation?: Word.RangeLocation): Word.Range; /** @@ -39300,7 +39426,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After' or 'Content'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After', or 'Content'. */ getRange(rangeLocation?: "Whole" | "Start" | "End" | "Before" | "After" | "Content"): Word.Range; /** @@ -39332,42 +39458,42 @@ declare namespace Word { insertContentControl(): Word.ContentControl; /** * - * Inserts a document into the body at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts a document into the body at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param base64File Required. The base64 encoded content of a .docx file. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts a document into the body at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts a document into the body at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param base64File Required. The base64 encoded content of a .docx file. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertFileFromBase64(base64File: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts HTML at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts HTML at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param html Required. The HTML to be inserted in the document. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertHtml(html: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts HTML at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts HTML at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param html Required. The HTML to be inserted in the document. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertHtml(html: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** @@ -39392,22 +39518,22 @@ declare namespace Word { insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.InlinePicture; /** * - * Inserts OOXML at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts OOXML at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param ooxml Required. The OOXML to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertOoxml(ooxml: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts OOXML at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts OOXML at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param ooxml Required. The OOXML to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertOoxml(ooxml: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** @@ -39456,27 +39582,27 @@ declare namespace Word { insertTable(rowCount: number, columnCount: number, insertLocation: "Before" | "After" | "Start" | "End" | "Replace", values?: string[][]): Word.Table; /** * - * Inserts text into the body at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts text into the body at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param text Required. Text to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertText(text: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts text into the body at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts text into the body at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param text Required. Text to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertText(text: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Performs a search with the specified searchOptions on the scope of the body object. The search results are a collection of range objects. + * Performs a search with the specified SearchOptions on the scope of the body object. The search results are a collection of range objects. * * [Api set: WordApi 1.1] * @@ -39498,7 +39624,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: Word.SelectionMode): void; /** @@ -39507,7 +39633,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: "Select" | "Start" | "End"): void; /** @@ -39629,7 +39755,7 @@ declare namespace Word { readonly tables: Word.TableCollection; /** * - * Gets or sets the appearance of the content control. The value can be 'boundingBox', 'tags' or 'hidden'. + * Gets or sets the appearance of the content control. The value can be 'BoundingBox', 'Tags', or 'Hidden'. * * [Api set: WordApi 1.1] */ @@ -39765,7 +39891,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Before', 'Start', 'End', 'After' or 'Content'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Before', 'Start', 'End', 'After', or 'Content'. */ getRange(rangeLocation?: Word.RangeLocation): Word.Range; /** @@ -39774,7 +39900,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Before', 'Start', 'End', 'After' or 'Content'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Before', 'Start', 'End', 'After', or 'Content'. */ getRange(rangeLocation?: "Whole" | "Start" | "End" | "Before" | "After" | "Content"): Word.Range; /** @@ -39784,176 +39910,176 @@ declare namespace Word { * [Api set: WordApi 1.3] * * @param endingMarks Required. The punctuation marks and/or other ending marks as an array of strings. - * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. + * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks, and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. */ getTextRanges(endingMarks: string[], trimSpacing?: boolean): Word.RangeCollection; /** * - * Inserts a break at the specified location in the main document. The insertLocation value can be 'Start', 'End', 'Before' or 'After'. This method cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. + * Inserts a break at the specified location in the main document. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. This method cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. * * [Api set: WordApi 1.1] * * @param breakType Required. Type of break. - * @param insertLocation Required. The value can be 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Start', 'End', 'Before', or 'After'. */ insertBreak(breakType: Word.BreakType, insertLocation: Word.InsertLocation): void; /** * - * Inserts a break at the specified location in the main document. The insertLocation value can be 'Start', 'End', 'Before' or 'After'. This method cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. + * Inserts a break at the specified location in the main document. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. This method cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. * * [Api set: WordApi 1.1] * * @param breakType Required. Type of break. - * @param insertLocation Required. The value can be 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Start', 'End', 'Before', or 'After'. */ insertBreak(breakType: "Page" | "Next" | "SectionNext" | "SectionContinuous" | "SectionEven" | "SectionOdd" | "Line", insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): void; /** * - * Inserts a document into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts a document into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param base64File Required. The base64 encoded content of a .docx file. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts a document into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts a document into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param base64File Required. The base64 encoded content of a .docx file. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertFileFromBase64(base64File: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts HTML into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts HTML into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param html Required. The HTML to be inserted in to the content control. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertHtml(html: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts HTML into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts HTML into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param html Required. The HTML to be inserted in to the content control. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertHtml(html: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts an inline picture into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts an inline picture into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.2] * * @param base64EncodedImage Required. The base64 encoded image to be inserted in the content control. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: Word.InsertLocation): Word.InlinePicture; /** * - * Inserts an inline picture into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts an inline picture into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.2] * * @param base64EncodedImage Required. The base64 encoded image to be inserted in the content control. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.InlinePicture; /** * - * Inserts OOXML into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts OOXML into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param ooxml Required. The OOXML to be inserted in to the content control. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertOoxml(ooxml: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts OOXML into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts OOXML into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param ooxml Required. The OOXML to be inserted in to the content control. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertOoxml(ooxml: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before' or 'After'. + * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * - * @param paragraphText Required. The paragrph text to be inserted. - * @param insertLocation Required. The value can be 'Start', 'End', 'Before' or 'After'. 'Before' and 'After' cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. + * @param paragraphText Required. The paragraph text to be inserted. + * @param insertLocation Required. The value can be 'Start', 'End', 'Before', or 'After'. 'Before' and 'After' cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. */ insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation): Word.Paragraph; /** * - * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before' or 'After'. + * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * - * @param paragraphText Required. The paragrph text to be inserted. - * @param insertLocation Required. The value can be 'Start', 'End', 'Before' or 'After'. 'Before' and 'After' cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. + * @param paragraphText Required. The paragraph text to be inserted. + * @param insertLocation Required. The value can be 'Start', 'End', 'Before', or 'After'. 'Before' and 'After' cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. */ insertParagraph(paragraphText: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Paragraph; /** * - * Inserts a table with the specified number of rows and columns into, or next to, a content control. The insertLocation value can be 'Start', 'End', 'Before' or 'After'. + * Inserts a table with the specified number of rows and columns into, or next to, a content control. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.3] * * @param rowCount Required. The number of rows in the table. * @param columnCount Required. The number of columns in the table. - * @param insertLocation Required. The value can be 'Start', 'End', 'Before' or 'After'. 'Before' and 'After' cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. + * @param insertLocation Required. The value can be 'Start', 'End', 'Before', or 'After'. 'Before' and 'After' cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. * @param values Optional 2D array. Cells are filled if the corresponding strings are specified in the array. */ insertTable(rowCount: number, columnCount: number, insertLocation: Word.InsertLocation, values?: string[][]): Word.Table; /** * - * Inserts a table with the specified number of rows and columns into, or next to, a content control. The insertLocation value can be 'Start', 'End', 'Before' or 'After'. + * Inserts a table with the specified number of rows and columns into, or next to, a content control. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.3] * * @param rowCount Required. The number of rows in the table. * @param columnCount Required. The number of columns in the table. - * @param insertLocation Required. The value can be 'Start', 'End', 'Before' or 'After'. 'Before' and 'After' cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. + * @param insertLocation Required. The value can be 'Start', 'End', 'Before', or 'After'. 'Before' and 'After' cannot be used with 'RichTextTable', 'RichTextTableRow' and 'RichTextTableCell' content controls. * @param values Optional 2D array. Cells are filled if the corresponding strings are specified in the array. */ insertTable(rowCount: number, columnCount: number, insertLocation: "Before" | "After" | "Start" | "End" | "Replace", values?: string[][]): Word.Table; /** * - * Inserts text into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts text into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param text Required. The text to be inserted in to the content control. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertText(text: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts text into the content control at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts text into the content control at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param text Required. The text to be inserted in to the content control. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and 'RichTextTableRow' content controls. */ insertText(text: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Performs a search with the specified searchOptions on the scope of the content control object. The search results are a collection of range objects. + * Performs a search with the specified SearchOptions on the scope of the content control object. The search results are a collection of range objects. * * [Api set: WordApi 1.1] * @@ -39975,7 +40101,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: Word.SelectionMode): void; /** @@ -39984,7 +40110,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: "Select" | "Start" | "End"): void; /** @@ -39996,7 +40122,7 @@ declare namespace Word { * @param delimiters Required. The delimiters as an array of strings. * @param multiParagraphs Optional. Indicates whether a returned child range can cover multiple paragraphs. Default is false which indicates that the paragraph boundaries are also used as delimiters. * @param trimDelimiters Optional. Indicates whether to trim delimiters from the ranges in the range collection. Default is false which indicates that the delimiters are included in the ranges returned in the range collection. - * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. + * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks, and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. */ split(delimiters: string[], multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean): Word.RangeCollection; /** @@ -40020,7 +40146,7 @@ declare namespace Word { } /** * - * Contains a collection of [contentControl](contentControl.md) objects. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as images, tables, or paragraphs of formatted text. Currently, only rich text content controls are supported. + * Contains a collection of {@link Word.ContentControl} objects. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as images, tables, or paragraphs of formatted text. Currently, only rich text content controls are supported. * * [Api set: WordApi 1.1] */ @@ -40171,7 +40297,7 @@ declare namespace Word { } /** * - * Contains the collection of [customProperty](customProperty.md) objects. + * Contains the collection of {@link Word.CustomProperty} objects. * * [Api set: WordApi 1.3] */ @@ -40363,7 +40489,7 @@ declare namespace Word { set(properties: DocumentCreated): void; /** * - * Open the document. + * Opens the document. * * [Api set: WordApi 1.3] */ @@ -40573,14 +40699,14 @@ declare namespace Word { color: string; /** * - * Gets or sets a value that indicates whether the font has a double strike through. True if the font is formatted as double strikethrough text, otherwise, false. + * Gets or sets a value that indicates whether the font has a double strikethrough. True if the font is formatted as double strikethrough text, otherwise, false. * * [Api set: WordApi 1.1] */ doubleStrikeThrough: boolean; /** * - * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, or an empty string for mixed highlight colors, or null for no highlight color. + * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * * [Api set: WordApi 1.1] */ @@ -40608,7 +40734,7 @@ declare namespace Word { size: number; /** * - * Gets or sets a value that indicates whether the font has a strike through. True if the font is formatted as strikethrough text, otherwise, false. + * Gets or sets a value that indicates whether the font has a strikethrough. True if the font is formatted as strikethrough text, otherwise, false. * * [Api set: WordApi 1.1] */ @@ -40715,7 +40841,7 @@ declare namespace Word { readonly parentTableOrNullObject: Word.Table; /** * - * Gets or sets a string that represents the alternative text associated with the inline image + * Gets or sets a string that represents the alternative text associated with the inline image. * * [Api set: WordApi 1.1] */ @@ -40793,7 +40919,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start' or 'End'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', or 'End'. */ getRange(rangeLocation?: Word.RangeLocation): Word.Range; /** @@ -40802,7 +40928,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start' or 'End'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', or 'End'. */ getRange(rangeLocation?: "Whole" | "Start" | "End" | "Before" | "After" | "Content"): Word.Range; /** @@ -40874,22 +41000,22 @@ declare namespace Word { insertHtml(html: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts an inline picture at the specified location. The insertLocation value can be 'Replace', 'Before' or 'After'. + * Inserts an inline picture at the specified location. The insertLocation value can be 'Replace', 'Before', or 'After'. * * [Api set: WordApi 1.2] * * @param base64EncodedImage Required. The base64 encoded image to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Before', or 'After'. */ insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: Word.InsertLocation): Word.InlinePicture; /** * - * Inserts an inline picture at the specified location. The insertLocation value can be 'Replace', 'Before' or 'After'. + * Inserts an inline picture at the specified location. The insertLocation value can be 'Replace', 'Before', or 'After'. * * [Api set: WordApi 1.2] * * @param base64EncodedImage Required. The base64 encoded image to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Before', or 'After'. */ insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.InlinePicture; /** @@ -40958,7 +41084,7 @@ declare namespace Word { * * [Api set: WordApi 1.2] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: Word.SelectionMode): void; /** @@ -40967,7 +41093,7 @@ declare namespace Word { * * [Api set: WordApi 1.2] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: "Select" | "Start" | "End"): void; /** @@ -40991,7 +41117,7 @@ declare namespace Word { } /** * - * Contains a collection of [inlinePicture](inlinePicture.md) objects. + * Contains a collection of {@link Word.InlinePicture} objects. * * [Api set: WordApi 1.1] */ @@ -41030,7 +41156,7 @@ declare namespace Word { } /** * - * Contains a collection of [paragraph](paragraph.md) objects. + * Contains a collection of {@link Word.Paragraph} objects. * * [Api set: WordApi 1.3] */ @@ -41058,7 +41184,7 @@ declare namespace Word { readonly levelExistences: boolean[]; /** * - * Gets all 9 level types in the list. Each type can be 'Bullet', 'Number' or 'Picture'. Read-only. + * Gets all 9 level types in the list. Each type can be 'Bullet', 'Number', or 'Picture'. Read-only. * * [Api set: WordApi 1.3] */ @@ -41083,22 +41209,22 @@ declare namespace Word { getLevelString(level: number): OfficeExtension.ClientResult; /** * - * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before' or 'After'. + * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.3] * * @param paragraphText Required. The paragraph text to be inserted. - * @param insertLocation Required. The value can be 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Start', 'End', 'Before', or 'After'. */ insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation): Word.Paragraph; /** * - * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before' or 'After'. + * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.3] * * @param paragraphText Required. The paragraph text to be inserted. - * @param insertLocation Required. The value can be 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Start', 'End', 'Before', or 'After'. */ insertParagraph(paragraphText: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Paragraph; /** @@ -41108,7 +41234,7 @@ declare namespace Word { * [Api set: WordApi 1.3] * * @param level Required. The level in the list. - * @param alignment Required. The level alignment that can be 'left', 'centered' or 'right'. + * @param alignment Required. The level alignment that can be 'Left', 'Centered', or 'Right'. */ setLevelAlignment(level: number, alignment: Word.Alignment): void; /** @@ -41118,7 +41244,7 @@ declare namespace Word { * [Api set: WordApi 1.3] * * @param level Required. The level in the list. - * @param alignment Required. The level alignment that can be 'left', 'centered' or 'right'. + * @param alignment Required. The level alignment that can be 'Left', 'Centered', or 'Right'. */ setLevelAlignment(level: number, alignment: "Mixed" | "Unknown" | "Left" | "Centered" | "Right" | "Justified"): void; /** @@ -41209,7 +41335,7 @@ declare namespace Word { } /** * - * Contains a collection of [list](list.md) objects. + * Contains a collection of {@link Word.List} objects. * * [Api set: WordApi 1.3] */ @@ -41289,7 +41415,7 @@ declare namespace Word { level: number; /** * - * Gets the list item bullet, number or picture as a string. Read-only. + * Gets the list item bullet, number, or picture as a string. Read-only. * * [Api set: WordApi 1.3] */ @@ -41307,20 +41433,20 @@ declare namespace Word { set(properties: ListItem): void; /** * - * Gets the list item parent, or the closest ancestor if the parent does not exist. Throws if the list item has no ancester. + * Gets the list item parent, or the closest ancestor if the parent does not exist. Throws if the list item has no ancestor. * * [Api set: WordApi 1.3] * - * @param parentOnly Optional. Specified only the list item's parent will be returned. The default is false that specifies to get the lowest ancestor. + * @param parentOnly Optional. Specifies only the list item's parent will be returned. The default is false that specifies to get the lowest ancestor. */ getAncestor(parentOnly?: boolean): Word.Paragraph; /** * - * Gets the list item parent, or the closest ancestor if the parent does not exist. Returns a null object if the list item has no ancester. + * Gets the list item parent, or the closest ancestor if the parent does not exist. Returns a null object if the list item has no ancestor. * * [Api set: WordApi 1.3] * - * @param parentOnly Optional. Specified only the list item's parent will be returned. The default is false that specifies to get the lowest ancestor. + * @param parentOnly Optional. Specifies only the list item's parent will be returned. The default is false that specifies to get the lowest ancestor. */ getAncestorOrNullObject(parentOnly?: boolean): Word.Paragraph; /** @@ -41329,7 +41455,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param directChildrenOnly Optional. Specified only the list item's direct children will be returned. The default is false that indicates to get all descendant items. + * @param directChildrenOnly Optional. Specifies only the list item's direct children will be returned. The default is false that indicates to get all descendant items. */ getDescendants(directChildrenOnly?: boolean): Word.ParagraphCollection; /** @@ -41374,7 +41500,7 @@ declare namespace Word { readonly font: Word.Font; /** * - * Gets the collection of inlinePicture objects in the paragraph. The collection does not include floating images. Read-only. + * Gets the collection of InlinePicture objects in the paragraph. The collection does not include floating images. Read-only. * * [Api set: WordApi 1.1] */ @@ -41500,7 +41626,7 @@ declare namespace Word { lineSpacing: number; /** * - * Gets or sets the amount of spacing, in grid lines. after the paragraph. + * Gets or sets the amount of spacing, in grid lines, after the paragraph. * * [Api set: WordApi 1.1] */ @@ -41651,7 +41777,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After' or 'Content'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After', or 'Content'. */ getRange(rangeLocation?: Word.RangeLocation): Word.Range; /** @@ -41660,7 +41786,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After' or 'Content'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After', or 'Content'. */ getRange(rangeLocation?: "Whole" | "Start" | "End" | "Before" | "After" | "Content"): Word.Range; /** @@ -41670,7 +41796,7 @@ declare namespace Word { * [Api set: WordApi 1.3] * * @param endingMarks Required. The punctuation marks and/or other ending marks as an array of strings. - * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. + * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks, and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. */ getTextRanges(endingMarks: string[], trimSpacing?: boolean): Word.RangeCollection; /** @@ -41702,82 +41828,82 @@ declare namespace Word { insertContentControl(): Word.ContentControl; /** * - * Inserts a document into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts a document into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param base64File Required. The base64 encoded content of a .docx file. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts a document into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts a document into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param base64File Required. The base64 encoded content of a .docx file. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertFileFromBase64(base64File: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts HTML into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts HTML into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param html Required. The HTML to be inserted in the paragraph. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertHtml(html: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts HTML into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts HTML into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param html Required. The HTML to be inserted in the paragraph. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertHtml(html: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts a picture into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts a picture into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param base64EncodedImage Required. The base64 encoded image to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: Word.InsertLocation): Word.InlinePicture; /** * - * Inserts a picture into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts a picture into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param base64EncodedImage Required. The base64 encoded image to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.InlinePicture; /** * - * Inserts OOXML into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts OOXML into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param ooxml Required. The OOXML to be inserted in the paragraph. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertOoxml(ooxml: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts OOXML into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts OOXML into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param ooxml Required. The OOXML to be inserted in the paragraph. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertOoxml(ooxml: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** @@ -41826,27 +41952,27 @@ declare namespace Word { insertTable(rowCount: number, columnCount: number, insertLocation: "Before" | "After" | "Start" | "End" | "Replace", values?: string[][]): Word.Table; /** * - * Inserts text into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts text into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param text Required. Text to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertText(text: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts text into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start' or 'End'. + * Inserts text into the paragraph at the specified location. The insertLocation value can be 'Replace', 'Start', or 'End'. * * [Api set: WordApi 1.1] * * @param text Required. Text to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start' or 'End'. + * @param insertLocation Required. The value can be 'Replace', 'Start', or 'End'. */ insertText(text: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Performs a search with the specified searchOptions on the scope of the paragraph object. The search results are a collection of range objects. + * Performs a search with the specified SearchOptions on the scope of the paragraph object. The search results are a collection of range objects. * * [Api set: WordApi 1.1] * @@ -41868,7 +41994,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: Word.SelectionMode): void; /** @@ -41877,7 +42003,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: "Select" | "Start" | "End"): void; /** @@ -41888,7 +42014,7 @@ declare namespace Word { * * @param delimiters Required. The delimiters as an array of strings. * @param trimDelimiters Optional. Indicates whether to trim delimiters from the ranges in the range collection. Default is false which indicates that the delimiters are included in the ranges returned in the range collection. - * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. + * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks, and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. */ split(delimiters: string[], trimDelimiters?: boolean, trimSpacing?: boolean): Word.RangeCollection; /** @@ -41919,7 +42045,7 @@ declare namespace Word { } /** * - * Contains a collection of [paragraph](paragraph.md) objects. + * Contains a collection of {@link Word.Paragraph} objects. * * [Api set: WordApi 1.1] */ @@ -42169,7 +42295,7 @@ declare namespace Word { * [Api set: WordApi 1.3] * * @param endingMarks Required. The punctuation marks and/or other ending marks as an array of strings. - * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks and paragraph end marks) from the start and end of the returned range. Default is false which indicates that spacing characters at the start and end of the range are included. + * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks, and paragraph end marks) from the start and end of the returned range. Default is false which indicates that spacing characters at the start and end of the range are included. */ getNextTextRange(endingMarks: string[], trimSpacing?: boolean): Word.Range; /** @@ -42179,7 +42305,7 @@ declare namespace Word { * [Api set: WordApi 1.3] * * @param endingMarks Required. The punctuation marks and/or other ending marks as an array of strings. - * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks and paragraph end marks) from the start and end of the returned range. Default is false which indicates that spacing characters at the start and end of the range are included. + * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks, and paragraph end marks) from the start and end of the returned range. Default is false which indicates that spacing characters at the start and end of the range are included. */ getNextTextRangeOrNullObject(endingMarks: string[], trimSpacing?: boolean): Word.Range; /** @@ -42195,7 +42321,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After' or 'Content'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After', or 'Content'. */ getRange(rangeLocation?: Word.RangeLocation): Word.Range; /** @@ -42204,7 +42330,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After' or 'Content'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', 'After', or 'Content'. */ getRange(rangeLocation?: "Whole" | "Start" | "End" | "Before" | "After" | "Content"): Word.Range; /** @@ -42214,7 +42340,7 @@ declare namespace Word { * [Api set: WordApi 1.3] * * @param endingMarks Required. The punctuation marks and/or other ending marks as an array of strings. - * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. + * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks, and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. */ getTextRanges(endingMarks: string[], trimSpacing?: boolean): Word.RangeCollection; /** @@ -42246,82 +42372,82 @@ declare namespace Word { insertContentControl(): Word.ContentControl; /** * - * Inserts a document at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts a document at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * * @param base64File Required. The base64 encoded content of a .docx file. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts a document at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts a document at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * * @param base64File Required. The base64 encoded content of a .docx file. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertFileFromBase64(base64File: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts HTML at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts HTML at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * * @param html Required. The HTML to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertHtml(html: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts HTML at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts HTML at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * * @param html Required. The HTML to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertHtml(html: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts a picture at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts a picture at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.2] * * @param base64EncodedImage Required. The base64 encoded image to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: Word.InsertLocation): Word.InlinePicture; /** * - * Inserts a picture at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts a picture at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.2] * * @param base64EncodedImage Required. The base64 encoded image to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.InlinePicture; /** * - * Inserts OOXML at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts OOXML at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * * @param ooxml Required. The OOXML to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertOoxml(ooxml: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts OOXML at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts OOXML at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * * @param ooxml Required. The OOXML to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertOoxml(ooxml: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** @@ -42370,22 +42496,22 @@ declare namespace Word { insertTable(rowCount: number, columnCount: number, insertLocation: "Before" | "After" | "Start" | "End" | "Replace", values?: string[][]): Word.Table; /** * - * Inserts text at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts text at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * * @param text Required. Text to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertText(text: string, insertLocation: Word.InsertLocation): Word.Range; /** * - * Inserts text at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * Inserts text at the specified location. The insertLocation value can be 'Replace', 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * * @param text Required. Text to be inserted. - * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before' or 'After'. + * @param insertLocation Required. The value can be 'Replace', 'Start', 'End', 'Before', or 'After'. */ insertText(text: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** @@ -42408,7 +42534,7 @@ declare namespace Word { intersectWithOrNullObject(range: Word.Range): Word.Range; /** * - * Performs a search with the specified searchOptions on the scope of the range object. The search results are a collection of range objects. + * Performs a search with the specified SearchOptions on the scope of the range object. The search results are a collection of range objects. * * [Api set: WordApi 1.1] * @@ -42430,7 +42556,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: Word.SelectionMode): void; /** @@ -42439,7 +42565,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: "Select" | "Start" | "End"): void; /** @@ -42451,7 +42577,7 @@ declare namespace Word { * @param delimiters Required. The delimiters as an array of strings. * @param multiParagraphs Optional. Indicates whether a returned child range can cover multiple paragraphs. Default is false which indicates that the paragraph boundaries are also used as delimiters. * @param trimDelimiters Optional. Indicates whether to trim delimiters from the ranges in the range collection. Default is false which indicates that the delimiters are included in the ranges returned in the range collection. - * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. + * @param trimSpacing Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks, and paragraph end marks) from the start and end of the ranges returned in the range collection. Default is false which indicates that spacing characters at the start and end of the ranges are included in the range collection. */ split(delimiters: string[], multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean): Word.RangeCollection; /** @@ -42475,7 +42601,7 @@ declare namespace Word { } /** * - * Contains a collection of [range](range.md) objects. + * Contains a collection of {@link Word.Range} objects. * * [Api set: WordApi 1.1] */ @@ -42536,7 +42662,7 @@ declare namespace Word { ignoreSpace: boolean; /** * - * Gets or sets a value that indicates whether to perform a case sensitive search. Corresponds to the Match case check box in the Find and Replace dialog box (Edit menu). + * Gets or sets a value that indicates whether to perform a case sensitive search. Corresponds to the Match case check box in the Find and Replace dialog box. * * [Api set: WordApi 1.1] */ @@ -42612,7 +42738,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param type Required. The type of footer to return. This value can be: 'primary', 'firstPage' or 'evenPages'. + * @param type Required. The type of footer to return. This value can be: 'Primary', 'FirstPage', or 'EvenPages'. */ getFooter(type: Word.HeaderFooterType): Word.Body; /** @@ -42621,7 +42747,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param type Required. The type of footer to return. This value can be: 'primary', 'firstPage' or 'evenPages'. + * @param type Required. The type of footer to return. This value can be: 'Primary', 'FirstPage', or 'EvenPages'. */ getFooter(type: "Primary" | "FirstPage" | "EvenPages"): Word.Body; /** @@ -42630,7 +42756,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param type Required. The type of header to return. This value can be: 'primary', 'firstPage' or 'evenPages'. + * @param type Required. The type of header to return. This value can be: 'Primary', 'FirstPage', or 'EvenPages'. */ getHeader(type: Word.HeaderFooterType): Word.Body; /** @@ -42639,7 +42765,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param type Required. The type of header to return. This value can be: 'primary', 'firstPage' or 'evenPages'. + * @param type Required. The type of header to return. This value can be: 'Primary', 'FirstPage', or 'EvenPages'. */ getHeader(type: "Primary" | "FirstPage" | "EvenPages"): Word.Body; /** @@ -42677,7 +42803,7 @@ declare namespace Word { } /** * - * Contains the collection of the document's [section](section.md) objects. + * Contains the collection of the document's {@link Word.Section} objects. * * [Api set: WordApi 1.1] */ @@ -42793,7 +42919,7 @@ declare namespace Word { readonly tables: Word.TableCollection; /** * - * Gets or sets the alignment of the table against the page column. The value can be 'left', 'centered' or 'right'. + * Gets or sets the alignment of the table against the page column. The value can be 'Left', 'Centered', or 'Right'. * * [Api set: WordApi 1.3] */ @@ -42807,7 +42933,7 @@ declare namespace Word { headerRowCount: number; /** * - * Gets and sets the horizontal alignment of every cell in the table. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of every cell in the table. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -42835,7 +42961,7 @@ declare namespace Word { readonly rowCount: number; /** * - * Gets and sets the shading color. + * Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -42898,7 +43024,7 @@ declare namespace Word { values: string[][]; /** * - * Gets and sets the vertical alignment of every cell in the table. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of every cell in the table. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -43050,7 +43176,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. */ getCellPadding(cellPaddingLocation: Word.CellPaddingLocation): OfficeExtension.ClientResult; /** @@ -43059,7 +43185,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. */ getCellPadding(cellPaddingLocation: "Top" | "Left" | "Bottom" | "Right"): OfficeExtension.ClientResult; /** @@ -43110,7 +43236,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End' or 'After'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', or 'After'. */ getRange(rangeLocation?: Word.RangeLocation): Word.Range; /** @@ -43119,7 +43245,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End' or 'After'. + * @param rangeLocation Optional. The range location can be 'Whole', 'Start', 'End', or 'After'. */ getRange(rangeLocation?: "Whole" | "Start" | "End" | "Before" | "After" | "Content"): Word.Range; /** @@ -43175,7 +43301,7 @@ declare namespace Word { insertTable(rowCount: number, columnCount: number, insertLocation: "Before" | "After" | "Start" | "End" | "Replace", values?: string[][]): Word.Table; /** * - * Performs a search with the specified searchOptions on the scope of the table object. The search results are a collection of range objects. + * Performs a search with the specified SearchOptions on the scope of the table object. The search results are a collection of range objects. * * [Api set: WordApi 1.3] * @@ -43197,7 +43323,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: Word.SelectionMode): void; /** @@ -43206,7 +43332,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: "Select" | "Start" | "End"): void; /** @@ -43215,7 +43341,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. * @param cellPadding Required. The cell padding. */ setCellPadding(cellPaddingLocation: Word.CellPaddingLocation, cellPadding: number): void; @@ -43225,7 +43351,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. * @param cellPadding Required. The cell padding. */ setCellPadding(cellPaddingLocation: "Top" | "Left" | "Bottom" | "Right", cellPadding: number): void; @@ -43324,7 +43450,7 @@ declare namespace Word { readonly cellCount: number; /** * - * Gets and sets the horizontal alignment of every cell in the row. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of every cell in the row. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -43352,7 +43478,7 @@ declare namespace Word { readonly rowIndex: number; /** * - * Gets and sets the shading color. + * Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -43366,7 +43492,7 @@ declare namespace Word { values: string[][]; /** * - * Gets and sets the vertical alignment of the cells in the row. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of the cells in the row. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -43413,7 +43539,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. */ getCellPadding(cellPaddingLocation: Word.CellPaddingLocation): OfficeExtension.ClientResult; /** @@ -43422,7 +43548,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. */ getCellPadding(cellPaddingLocation: "Top" | "Left" | "Bottom" | "Right"): OfficeExtension.ClientResult; /** @@ -43463,7 +43589,7 @@ declare namespace Word { insertRows(insertLocation: "Before" | "After" | "Start" | "End" | "Replace", rowCount: number, values?: string[][]): Word.TableRowCollection; /** * - * Performs a search with the specified searchOptions on the scope of the row. The search results are a collection of range objects. + * Performs a search with the specified SearchOptions on the scope of the row. The search results are a collection of range objects. * * [Api set: WordApi 1.3] * @@ -43485,7 +43611,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: Word.SelectionMode): void; /** @@ -43494,7 +43620,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param selectionMode Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. + * @param selectionMode Optional. The selection mode can be 'Select', 'Start', or 'End'. 'Select' is the default. */ select(selectionMode?: "Select" | "Start" | "End"): void; /** @@ -43503,7 +43629,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. * @param cellPadding Required. The cell padding. */ setCellPadding(cellPaddingLocation: Word.CellPaddingLocation, cellPadding: number): void; @@ -43513,7 +43639,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. * @param cellPadding Required. The cell padding. */ setCellPadding(cellPaddingLocation: "Top" | "Left" | "Bottom" | "Right", cellPadding: number): void; @@ -43619,7 +43745,7 @@ declare namespace Word { columnWidth: number; /** * - * Gets and sets the horizontal alignment of the cell. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of the cell. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -43647,7 +43773,7 @@ declare namespace Word { value: string; /** * - * Gets and sets the vertical alignment of the cell. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of the cell. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -43701,7 +43827,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. */ getCellPadding(cellPaddingLocation: Word.CellPaddingLocation): OfficeExtension.ClientResult; /** @@ -43710,7 +43836,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. */ getCellPadding(cellPaddingLocation: "Top" | "Left" | "Bottom" | "Right"): OfficeExtension.ClientResult; /** @@ -43734,7 +43860,7 @@ declare namespace Word { * [Api set: WordApi 1.3] * * @param insertLocation Required. It can be 'Before' or 'After'. - * @param columnCount Required. Number of columns to add + * @param columnCount Required. Number of columns to add. * @param values Optional 2D array. Cells are filled if the corresponding strings are specified in the array. */ insertColumns(insertLocation: Word.InsertLocation, columnCount: number, values?: string[][]): void; @@ -43745,7 +43871,7 @@ declare namespace Word { * [Api set: WordApi 1.3] * * @param insertLocation Required. It can be 'Before' or 'After'. - * @param columnCount Required. Number of columns to add + * @param columnCount Required. Number of columns to add. * @param values Optional 2D array. Cells are filled if the corresponding strings are specified in the array. */ insertColumns(insertLocation: "Before" | "After" | "Start" | "End" | "Replace", columnCount: number, values?: string[][]): void; @@ -43777,7 +43903,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. * @param cellPadding Required. The cell padding. */ setCellPadding(cellPaddingLocation: Word.CellPaddingLocation, cellPadding: number): void; @@ -43787,7 +43913,7 @@ declare namespace Word { * * [Api set: WordApi 1.3] * - * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'. + * @param cellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom', or 'Right'. * @param cellPadding Required. The cell padding. */ setCellPadding(cellPaddingLocation: "Top" | "Left" | "Bottom" | "Right", cellPadding: number): void; @@ -43851,14 +43977,14 @@ declare namespace Word { } /** * - * Specifies the border style + * Specifies the border style. * * [Api set: WordApi 1.3] */ class TableBorder extends OfficeExtension.ClientObject { /** * - * Gets or sets the table border color, as a hex value or name. + * Gets or sets the table border color. * * [Api set: WordApi 1.3] */ @@ -43910,8 +44036,23 @@ declare namespace Word { unknown = "Unknown", richTextInline = "RichTextInline", richTextParagraphs = "RichTextParagraphs", + /** + * + * Contains a whole cell. + * + */ richTextTableCell = "RichTextTableCell", + /** + * + * Contains a whole row. + * + */ richTextTableRow = "RichTextTableRow", + /** + * + * Contains a whole table. + * + */ richTextTable = "RichTextTable", plainTextInline = "PlainTextInline", plainTextParagraph = "PlainTextParagraph", @@ -43922,6 +44063,11 @@ declare namespace Word { dropDownList = "DropDownList", datePicker = "DatePicker", repeatingSection = "RepeatingSection", + /** + * + * Identifies a rich text content control. + * + */ richText = "RichText", plainText = "PlainText", } @@ -43932,8 +44078,23 @@ declare namespace Word { * [Api set: WordApi] */ enum ContentControlAppearance { + /** + * + * Represents a content control shown as a shaded rectangle or bounding box (with optional title). + * + */ boundingBox = "BoundingBox", + /** + * + * Represents a content control shown as start and end markers. + * + */ tags = "Tags", + /** + * + * Represents a content control that is not shown. + * + */ hidden = "Hidden", } /** @@ -43944,6 +44105,11 @@ declare namespace Word { */ enum UnderlineType { mixed = "Mixed", + /** + * + * No underline. + * + */ none = "None", /** * @@ -43955,34 +44121,79 @@ declare namespace Word { * @deprecated DotLine is no longer supported. */ dotLine = "DotLine", + /** + * + * A single underline. This is the default value. + * + */ single = "Single", + /** + * + * Only underline individual words. + * + */ word = "Word", + /** + * + * A double underline. + * + */ double = "Double", + /** + * + * A single thick underline. + * + */ thick = "Thick", + /** + * + * A dotted underline. + * + */ dotted = "Dotted", dottedHeavy = "DottedHeavy", + /** + * + * A single dash underline. + * + */ dashLine = "DashLine", dashLineHeavy = "DashLineHeavy", dashLineLong = "DashLineLong", dashLineLongHeavy = "DashLineLongHeavy", + /** + * + * An alternating dot-dash underline. + * + */ dotDashLine = "DotDashLine", dotDashLineHeavy = "DotDashLineHeavy", + /** + * + * An alternating dot-dot-dash underline. + * + */ twoDotDashLine = "TwoDotDashLine", twoDotDashLineHeavy = "TwoDotDashLineHeavy", + /** + * + * A single wavy underline. + * + */ wave = "Wave", waveHeavy = "WaveHeavy", waveDouble = "WaveDouble", } /** * - * Page break, line break, and four section breaks + * Specifies the form of a break. * * [Api set: WordApi] */ enum BreakType { /** * - * Page break. + * Page break at the insertion point. * */ page = "Page", @@ -43993,25 +44204,25 @@ declare namespace Word { next = "Next", /** * - * Section break, with the new section starting on the next page. + * Section break on next page. * */ sectionNext = "SectionNext", /** * - * Section break, with the new section starting on the same page. + * New section without a corresponding page break. * */ sectionContinuous = "SectionContinuous", /** * - * Section break, with the new section starting on the next even-numbered page. + * Section break with the next section beginning on the next even-numbered page. If the section break falls on an even-numbered page, Word leaves the next odd-numbered page blank. * */ sectionEven = "SectionEven", /** * - * Section break, with the new section starting on the next odd-numbered page. + * Section break with the next section beginning on the next odd-numbered page. If the section break falls on an odd-numbered page, Word leaves the next even-numbered page blank. * */ sectionOdd = "SectionOdd", @@ -44029,10 +44240,35 @@ declare namespace Word { * [Api set: WordApi] */ enum InsertLocation { + /** + * + * Add content before the contents of the calling object. + * + */ before = "Before", + /** + * + * Add content after the contents of the calling object. + * + */ after = "After", + /** + * + * Prepend content to the contents of the calling object. + * + */ start = "Start", + /** + * + * Append content to the contents of the calling object. + * + */ end = "End", + /** + * + * Replace the contents of the current object. + * + */ replace = "Replace", } /** @@ -44040,18 +44276,58 @@ declare namespace Word { */ enum Alignment { mixed = "Mixed", + /** + * + * Unknown alignment. + * + */ unknown = "Unknown", + /** + * + * Alignment to the left. + * + */ left = "Left", + /** + * + * Alignment to the center. + * + */ centered = "Centered", + /** + * + * Alignment to the right. + * + */ right = "Right", + /** + * + * Fully justified alignment. + * + */ justified = "Justified", } /** * [Api set: WordApi] */ enum HeaderFooterType { + /** + * + * Returns the header or footer on all pages of a section, with the first page or odd pages excluded if they are different. + * + */ primary = "Primary", + /** + * + * Returns the header or footer on the first page of a section. + * + */ firstPage = "FirstPage", + /** + * + * Returns all headers or footers on even-numbered pages of a section. + * + */ evenPages = "EvenPages", } /** @@ -44096,30 +44372,130 @@ declare namespace Word { * [Api set: WordApi] */ enum RangeLocation { + /** + * + * The object's whole range. If the object is a paragraph content control or table content control, the EOP or Table characters after the content control are also included. + * + */ whole = "Whole", + /** + * + * The starting point of the object. For content control, it is the point after the opening tag. + * + */ start = "Start", + /** + * + * The ending point of the object. For paragraph, it is the point before the EOP. For content control, it is the point before the closing tag. + * + */ end = "End", + /** + * + * For content control only. It is the point before the opening tag. + * + */ before = "Before", + /** + * + * The point after the object. If the object is a paragraph content control or table content control, it is the point after the EOP or Table characters. + * + */ after = "After", + /** + * + * The range between 'Start' and 'End'. + * + */ content = "Content", } /** * [Api set: WordApi] */ enum LocationRelation { + /** + * + * Indicates that this instance and the range are in different sub-documents. + * + */ unrelated = "Unrelated", + /** + * + * Indicates that this instance and the range represent the same range. + * + */ equal = "Equal", + /** + * + * Indicates that this instance contains the range and that it shares the same start character. The range does not share the same end character as this instance. + * + */ containsStart = "ContainsStart", + /** + * + * Indicates that this instance contains the range and that it shares the same end character. The range does not share the same start character as this instance. + * + */ containsEnd = "ContainsEnd", + /** + * + * Indicates that this instance contains the range, with the exception of the start and end character of this instance. + * + */ contains = "Contains", + /** + * + * Indicates that this instance is inside the range and that it shares the same start character. The range does not share the same end character as this instance. + * + */ insideStart = "InsideStart", + /** + * + * Indicates that this instance is inside the range and that it shares the same end character. The range does not share the same start character as this instance. + * + */ insideEnd = "InsideEnd", + /** + * + * Indicates that this instance is inside the range. The range does not share the same start and end characters as this instance. + * + */ inside = "Inside", + /** + * + * Indicates that this instance occurs before, and is adjacent to, the range. + * + */ adjacentBefore = "AdjacentBefore", + /** + * + * Indicates that this instance starts before the range and overlaps the range’s first character. + * + */ overlapsBefore = "OverlapsBefore", + /** + * + * Indicates that this instance occurs before the range. + * + */ before = "Before", + /** + * + * Indicates that this instance occurs after, and is adjacent to, the range. + * + */ adjacentAfter = "AdjacentAfter", + /** + * + * Indicates that this instance starts inside the range and overlaps the range’s last character. + * + */ overlapsAfter = "OverlapsAfter", + /** + * + * Indicates that this instance occurs after the range. + * + */ after = "After", } /** @@ -44463,7 +44839,7 @@ declare namespace Word { itemNotFound = "ItemNotFound", notImplemented = "NotImplemented", } - namespace Interfaces { + module Interfaces { interface CollectionLoadOptions { $top?: number; $skip?: number; @@ -44503,7 +44879,7 @@ declare namespace Word { font?: Word.Interfaces.FontUpdateData; /** * - * Gets or sets the appearance of the content control. The value can be 'boundingBox', 'tags' or 'hidden'. + * Gets or sets the appearance of the content control. The value can be 'BoundingBox', 'Tags', or 'Hidden'. * * [Api set: WordApi 1.1] */ @@ -44715,14 +45091,14 @@ declare namespace Word { color?: string; /** * - * Gets or sets a value that indicates whether the font has a double strike through. True if the font is formatted as double strikethrough text, otherwise, false. + * Gets or sets a value that indicates whether the font has a double strikethrough. True if the font is formatted as double strikethrough text, otherwise, false. * * [Api set: WordApi 1.1] */ doubleStrikeThrough?: boolean; /** * - * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, or an empty string for mixed highlight colors, or null for no highlight color. + * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * * [Api set: WordApi 1.1] */ @@ -44750,7 +45126,7 @@ declare namespace Word { size?: number; /** * - * Gets or sets a value that indicates whether the font has a strike through. True if the font is formatted as strikethrough text, otherwise, false. + * Gets or sets a value that indicates whether the font has a strikethrough. True if the font is formatted as strikethrough text, otherwise, false. * * [Api set: WordApi 1.1] */ @@ -44781,7 +45157,7 @@ declare namespace Word { interface InlinePictureUpdateData { /** * - * Gets or sets a string that represents the alternative text associated with the inline image + * Gets or sets a string that represents the alternative text associated with the inline image. * * [Api set: WordApi 1.1] */ @@ -44893,7 +45269,7 @@ declare namespace Word { lineSpacing?: number; /** * - * Gets or sets the amount of spacing, in grid lines. after the paragraph. + * Gets or sets the amount of spacing, in grid lines, after the paragraph. * * [Api set: WordApi 1.1] */ @@ -45005,7 +45381,7 @@ declare namespace Word { ignoreSpace?: boolean; /** * - * Gets or sets a value that indicates whether to perform a case sensitive search. Corresponds to the Match case check box in the Find and Replace dialog box (Edit menu). + * Gets or sets a value that indicates whether to perform a case sensitive search. Corresponds to the Match case check box in the Find and Replace dialog box. * * [Api set: WordApi 1.1] */ @@ -45064,7 +45440,7 @@ declare namespace Word { font?: Word.Interfaces.FontUpdateData; /** * - * Gets or sets the alignment of the table against the page column. The value can be 'left', 'centered' or 'right'. + * Gets or sets the alignment of the table against the page column. The value can be 'Left', 'Centered', or 'Right'. * * [Api set: WordApi 1.3] */ @@ -45078,14 +45454,14 @@ declare namespace Word { headerRowCount?: number; /** * - * Gets and sets the horizontal alignment of every cell in the table. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of every cell in the table. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ horizontalAlignment?: Word.Alignment | "Mixed" | "Unknown" | "Left" | "Centered" | "Right" | "Justified"; /** * - * Gets and sets the shading color. + * Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -45148,7 +45524,7 @@ declare namespace Word { values?: string[][]; /** * - * Gets and sets the vertical alignment of every cell in the table. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of every cell in the table. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -45176,7 +45552,7 @@ declare namespace Word { font?: Word.Interfaces.FontUpdateData; /** * - * Gets and sets the horizontal alignment of every cell in the row. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of every cell in the row. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -45190,7 +45566,7 @@ declare namespace Word { preferredHeight?: number; /** * - * Gets and sets the shading color. + * Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -45204,7 +45580,7 @@ declare namespace Word { values?: string[][]; /** * - * Gets and sets the vertical alignment of the cells in the row. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of the cells in the row. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -45232,7 +45608,7 @@ declare namespace Word { columnWidth?: number; /** * - * Gets and sets the horizontal alignment of the cell. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of the cell. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -45253,7 +45629,7 @@ declare namespace Word { value?: string; /** * - * Gets and sets the vertical alignment of the cell. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of the cell. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -45267,7 +45643,7 @@ declare namespace Word { interface TableBorderUpdateData { /** * - * Gets or sets the table border color, as a hex value or name. + * Gets or sets the table border color. * * [Api set: WordApi 1.3] */ @@ -45305,7 +45681,7 @@ declare namespace Word { font?: Word.Interfaces.FontData; /** * - * Gets the collection of inlinePicture objects in the body. The collection does not include floating images. Read-only. + * Gets the collection of InlinePicture objects in the body. The collection does not include floating images. Read-only. * * [Api set: WordApi 1.1] */ @@ -45497,7 +45873,7 @@ declare namespace Word { tables?: Word.Interfaces.TableData[]; /** * - * Gets or sets the appearance of the content control. The value can be 'boundingBox', 'tags' or 'hidden'. + * Gets or sets the appearance of the content control. The value can be 'BoundingBox', 'Tags', or 'Hidden'. * * [Api set: WordApi 1.1] */ @@ -45856,14 +46232,14 @@ declare namespace Word { color?: string; /** * - * Gets or sets a value that indicates whether the font has a double strike through. True if the font is formatted as double strikethrough text, otherwise, false. + * Gets or sets a value that indicates whether the font has a double strikethrough. True if the font is formatted as double strikethrough text, otherwise, false. * * [Api set: WordApi 1.1] */ doubleStrikeThrough?: boolean; /** * - * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, or an empty string for mixed highlight colors, or null for no highlight color. + * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * * [Api set: WordApi 1.1] */ @@ -45891,7 +46267,7 @@ declare namespace Word { size?: number; /** * - * Gets or sets a value that indicates whether the font has a strike through. True if the font is formatted as strikethrough text, otherwise, false. + * Gets or sets a value that indicates whether the font has a strikethrough. True if the font is formatted as strikethrough text, otherwise, false. * * [Api set: WordApi 1.1] */ @@ -45971,7 +46347,7 @@ declare namespace Word { parentTableOrNullObject?: Word.Interfaces.TableData; /** * - * Gets or sets a string that represents the alternative text associated with the inline image + * Gets or sets a string that represents the alternative text associated with the inline image. * * [Api set: WordApi 1.1] */ @@ -46041,7 +46417,7 @@ declare namespace Word { levelExistences?: boolean[]; /** * - * Gets all 9 level types in the list. Each type can be 'Bullet', 'Number' or 'Picture'. Read-only. + * Gets all 9 level types in the list. Each type can be 'Bullet', 'Number', or 'Picture'. Read-only. * * [Api set: WordApi 1.3] */ @@ -46062,7 +46438,7 @@ declare namespace Word { level?: number; /** * - * Gets the list item bullet, number or picture as a string. Read-only. + * Gets the list item bullet, number, or picture as a string. Read-only. * * [Api set: WordApi 1.3] */ @@ -46093,7 +46469,7 @@ declare namespace Word { font?: Word.Interfaces.FontData; /** * - * Gets the collection of inlinePicture objects in the paragraph. The collection does not include floating images. Read-only. + * Gets the collection of InlinePicture objects in the paragraph. The collection does not include floating images. Read-only. * * [Api set: WordApi 1.1] */ @@ -46219,7 +46595,7 @@ declare namespace Word { lineSpacing?: number; /** * - * Gets or sets the amount of spacing, in grid lines. after the paragraph. + * Gets or sets the amount of spacing, in grid lines, after the paragraph. * * [Api set: WordApi 1.1] */ @@ -46443,7 +46819,7 @@ declare namespace Word { ignoreSpace?: boolean; /** * - * Gets or sets a value that indicates whether to perform a case sensitive search. Corresponds to the Match case check box in the Find and Replace dialog box (Edit menu). + * Gets or sets a value that indicates whether to perform a case sensitive search. Corresponds to the Match case check box in the Find and Replace dialog box. * * [Api set: WordApi 1.1] */ @@ -46565,7 +46941,7 @@ declare namespace Word { tables?: Word.Interfaces.TableData[]; /** * - * Gets or sets the alignment of the table against the page column. The value can be 'left', 'centered' or 'right'. + * Gets or sets the alignment of the table against the page column. The value can be 'Left', 'Centered', or 'Right'. * * [Api set: WordApi 1.3] */ @@ -46579,7 +46955,7 @@ declare namespace Word { headerRowCount?: number; /** * - * Gets and sets the horizontal alignment of every cell in the table. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of every cell in the table. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -46607,7 +46983,7 @@ declare namespace Word { rowCount?: number; /** * - * Gets and sets the shading color. + * Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -46670,7 +47046,7 @@ declare namespace Word { values?: string[][]; /** * - * Gets and sets the vertical alignment of every cell in the table. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of every cell in the table. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -46719,7 +47095,7 @@ declare namespace Word { cellCount?: number; /** * - * Gets and sets the horizontal alignment of every cell in the row. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of every cell in the row. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -46747,7 +47123,7 @@ declare namespace Word { rowIndex?: number; /** * - * Gets and sets the shading color. + * Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -46761,7 +47137,7 @@ declare namespace Word { values?: string[][]; /** * - * Gets and sets the vertical alignment of the cells in the row. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of the cells in the row. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -46810,7 +47186,7 @@ declare namespace Word { columnWidth?: number; /** * - * Gets and sets the horizontal alignment of the cell. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of the cell. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -46838,7 +47214,7 @@ declare namespace Word { value?: string; /** * - * Gets and sets the vertical alignment of the cell. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of the cell. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -46859,7 +47235,7 @@ declare namespace Word { interface TableBorderData { /** * - * Gets or sets the table border color, as a hex value or name. + * Gets or sets the table border color. * * [Api set: WordApi 1.3] */ @@ -47031,7 +47407,7 @@ declare namespace Word { parentTableOrNullObject?: Word.Interfaces.TableLoadOptions; /** * - * Gets or sets the appearance of the content control. The value can be 'boundingBox', 'tags' or 'hidden'. + * Gets or sets the appearance of the content control. The value can be 'BoundingBox', 'Tags', or 'Hidden'. * * [Api set: WordApi 1.1] */ @@ -47130,7 +47506,7 @@ declare namespace Word { } /** * - * Contains a collection of [contentControl](contentControl.md) objects. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as images, tables, or paragraphs of formatted text. Currently, only rich text content controls are supported. + * Contains a collection of {@link Word.ContentControl} objects. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as images, tables, or paragraphs of formatted text. Currently, only rich text content controls are supported. * * [Api set: WordApi 1.1] */ @@ -47194,7 +47570,7 @@ declare namespace Word { parentTableOrNullObject?: Word.Interfaces.TableLoadOptions; /** * - * For EACH ITEM in the collection: Gets or sets the appearance of the content control. The value can be 'boundingBox', 'tags' or 'hidden'. + * For EACH ITEM in the collection: Gets or sets the appearance of the content control. The value can be 'BoundingBox', 'Tags', or 'Hidden'. * * [Api set: WordApi 1.1] */ @@ -47323,7 +47699,7 @@ declare namespace Word { } /** * - * Contains the collection of [customProperty](customProperty.md) objects. + * Contains the collection of {@link Word.CustomProperty} objects. * * [Api set: WordApi 1.3] */ @@ -47570,14 +47946,14 @@ declare namespace Word { color?: boolean; /** * - * Gets or sets a value that indicates whether the font has a double strike through. True if the font is formatted as double strikethrough text, otherwise, false. + * Gets or sets a value that indicates whether the font has a double strikethrough. True if the font is formatted as double strikethrough text, otherwise, false. * * [Api set: WordApi 1.1] */ doubleStrikeThrough?: boolean; /** * - * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, or an empty string for mixed highlight colors, or null for no highlight color. + * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * * [Api set: WordApi 1.1] */ @@ -47605,7 +47981,7 @@ declare namespace Word { size?: boolean; /** * - * Gets or sets a value that indicates whether the font has a strike through. True if the font is formatted as strikethrough text, otherwise, false. + * Gets or sets a value that indicates whether the font has a strikethrough. True if the font is formatted as strikethrough text, otherwise, false. * * [Api set: WordApi 1.1] */ @@ -47691,7 +48067,7 @@ declare namespace Word { parentTableOrNullObject?: Word.Interfaces.TableLoadOptions; /** * - * Gets or sets a string that represents the alternative text associated with the inline image + * Gets or sets a string that represents the alternative text associated with the inline image. * * [Api set: WordApi 1.1] */ @@ -47734,7 +48110,7 @@ declare namespace Word { } /** * - * Contains a collection of [inlinePicture](inlinePicture.md) objects. + * Contains a collection of {@link Word.InlinePicture} objects. * * [Api set: WordApi 1.1] */ @@ -47791,7 +48167,7 @@ declare namespace Word { parentTableOrNullObject?: Word.Interfaces.TableLoadOptions; /** * - * For EACH ITEM in the collection: Gets or sets a string that represents the alternative text associated with the inline image + * For EACH ITEM in the collection: Gets or sets a string that represents the alternative text associated with the inline image. * * [Api set: WordApi 1.1] */ @@ -47834,7 +48210,7 @@ declare namespace Word { } /** * - * Contains a collection of [paragraph](paragraph.md) objects. + * Contains a collection of {@link Word.Paragraph} objects. * * [Api set: WordApi 1.3] */ @@ -47856,7 +48232,7 @@ declare namespace Word { levelExistences?: boolean; /** * - * Gets all 9 level types in the list. Each type can be 'Bullet', 'Number' or 'Picture'. Read-only. + * Gets all 9 level types in the list. Each type can be 'Bullet', 'Number', or 'Picture'. Read-only. * * [Api set: WordApi 1.3] */ @@ -47864,7 +48240,7 @@ declare namespace Word { } /** * - * Contains a collection of [list](list.md) objects. + * Contains a collection of {@link Word.List} objects. * * [Api set: WordApi 1.3] */ @@ -47886,7 +48262,7 @@ declare namespace Word { levelExistences?: boolean; /** * - * For EACH ITEM in the collection: Gets all 9 level types in the list. Each type can be 'Bullet', 'Number' or 'Picture'. Read-only. + * For EACH ITEM in the collection: Gets all 9 level types in the list. Each type can be 'Bullet', 'Number', or 'Picture'. Read-only. * * [Api set: WordApi 1.3] */ @@ -47909,7 +48285,7 @@ declare namespace Word { level?: boolean; /** * - * Gets the list item bullet, number or picture as a string. Read-only. + * Gets the list item bullet, number, or picture as a string. Read-only. * * [Api set: WordApi 1.3] */ @@ -48058,7 +48434,7 @@ declare namespace Word { lineSpacing?: boolean; /** * - * Gets or sets the amount of spacing, in grid lines. after the paragraph. + * Gets or sets the amount of spacing, in grid lines, after the paragraph. * * [Api set: WordApi 1.1] */ @@ -48129,7 +48505,7 @@ declare namespace Word { } /** * - * Contains a collection of [paragraph](paragraph.md) objects. + * Contains a collection of {@link Word.Paragraph} objects. * * [Api set: WordApi 1.1] */ @@ -48263,7 +48639,7 @@ declare namespace Word { lineSpacing?: boolean; /** * - * For EACH ITEM in the collection: Gets or sets the amount of spacing, in grid lines. after the paragraph. + * For EACH ITEM in the collection: Gets or sets the amount of spacing, in grid lines, after the paragraph. * * [Api set: WordApi 1.1] */ @@ -48434,7 +48810,7 @@ declare namespace Word { } /** * - * Contains a collection of [range](range.md) objects. + * Contains a collection of {@link Word.Range} objects. * * [Api set: WordApi 1.1] */ @@ -48556,7 +48932,7 @@ declare namespace Word { ignoreSpace?: boolean; /** * - * Gets or sets a value that indicates whether to perform a case sensitive search. Corresponds to the Match case check box in the Find and Replace dialog box (Edit menu). + * Gets or sets a value that indicates whether to perform a case sensitive search. Corresponds to the Match case check box in the Find and Replace dialog box. * * [Api set: WordApi 1.1] */ @@ -48608,7 +48984,7 @@ declare namespace Word { } /** * - * Contains the collection of the document's [section](section.md) objects. + * Contains the collection of the document's {@link Word.Section} objects. * * [Api set: WordApi 1.1] */ @@ -48688,7 +49064,7 @@ declare namespace Word { parentTableOrNullObject?: Word.Interfaces.TableLoadOptions; /** * - * Gets or sets the alignment of the table against the page column. The value can be 'left', 'centered' or 'right'. + * Gets or sets the alignment of the table against the page column. The value can be 'Left', 'Centered', or 'Right'. * * [Api set: WordApi 1.3] */ @@ -48702,7 +49078,7 @@ declare namespace Word { headerRowCount?: boolean; /** * - * Gets and sets the horizontal alignment of every cell in the table. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of every cell in the table. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -48730,7 +49106,7 @@ declare namespace Word { rowCount?: boolean; /** * - * Gets and sets the shading color. + * Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -48793,7 +49169,7 @@ declare namespace Word { values?: boolean; /** * - * Gets and sets the vertical alignment of every cell in the table. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of every cell in the table. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -48872,7 +49248,7 @@ declare namespace Word { parentTableOrNullObject?: Word.Interfaces.TableLoadOptions; /** * - * For EACH ITEM in the collection: Gets or sets the alignment of the table against the page column. The value can be 'left', 'centered' or 'right'. + * For EACH ITEM in the collection: Gets or sets the alignment of the table against the page column. The value can be 'Left', 'Centered', or 'Right'. * * [Api set: WordApi 1.3] */ @@ -48886,7 +49262,7 @@ declare namespace Word { headerRowCount?: boolean; /** * - * For EACH ITEM in the collection: Gets and sets the horizontal alignment of every cell in the table. The value can be 'left', 'centered', 'right', or 'justified'. + * For EACH ITEM in the collection: Gets and sets the horizontal alignment of every cell in the table. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -48914,7 +49290,7 @@ declare namespace Word { rowCount?: boolean; /** * - * For EACH ITEM in the collection: Gets and sets the shading color. + * For EACH ITEM in the collection: Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -48977,7 +49353,7 @@ declare namespace Word { values?: boolean; /** * - * For EACH ITEM in the collection: Gets and sets the vertical alignment of every cell in the table. The value can be 'top', 'center' or 'bottom'. + * For EACH ITEM in the collection: Gets and sets the vertical alignment of every cell in the table. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -49021,7 +49397,7 @@ declare namespace Word { cellCount?: boolean; /** * - * Gets and sets the horizontal alignment of every cell in the row. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of every cell in the row. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -49049,7 +49425,7 @@ declare namespace Word { rowIndex?: boolean; /** * - * Gets and sets the shading color. + * Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -49063,7 +49439,7 @@ declare namespace Word { values?: boolean; /** * - * Gets and sets the vertical alignment of the cells in the row. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of the cells in the row. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -49100,7 +49476,7 @@ declare namespace Word { cellCount?: boolean; /** * - * For EACH ITEM in the collection: Gets and sets the horizontal alignment of every cell in the row. The value can be 'left', 'centered', 'right', or 'justified'. + * For EACH ITEM in the collection: Gets and sets the horizontal alignment of every cell in the row. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -49128,7 +49504,7 @@ declare namespace Word { rowIndex?: boolean; /** * - * For EACH ITEM in the collection: Gets and sets the shading color. + * For EACH ITEM in the collection: Gets and sets the shading color. Color is specified in "#RRGGBB" format or by using the color name. * * [Api set: WordApi 1.3] */ @@ -49142,7 +49518,7 @@ declare namespace Word { values?: boolean; /** * - * For EACH ITEM in the collection: Gets and sets the vertical alignment of the cells in the row. The value can be 'top', 'center' or 'bottom'. + * For EACH ITEM in the collection: Gets and sets the vertical alignment of the cells in the row. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -49193,7 +49569,7 @@ declare namespace Word { columnWidth?: boolean; /** * - * Gets and sets the horizontal alignment of the cell. The value can be 'left', 'centered', 'right', or 'justified'. + * Gets and sets the horizontal alignment of the cell. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -49221,7 +49597,7 @@ declare namespace Word { value?: boolean; /** * - * Gets and sets the vertical alignment of the cell. The value can be 'top', 'center' or 'bottom'. + * Gets and sets the vertical alignment of the cell. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -49279,7 +49655,7 @@ declare namespace Word { columnWidth?: boolean; /** * - * For EACH ITEM in the collection: Gets and sets the horizontal alignment of the cell. The value can be 'left', 'centered', 'right', or 'justified'. + * For EACH ITEM in the collection: Gets and sets the horizontal alignment of the cell. The value can be 'Left', 'Centered', 'Right', or 'Justified'. * * [Api set: WordApi 1.3] */ @@ -49307,7 +49683,7 @@ declare namespace Word { value?: boolean; /** * - * For EACH ITEM in the collection: Gets and sets the vertical alignment of the cell. The value can be 'top', 'center' or 'bottom'. + * For EACH ITEM in the collection: Gets and sets the vertical alignment of the cell. The value can be 'Top', 'Center', or 'Bottom'. * * [Api set: WordApi 1.3] */ @@ -49322,7 +49698,7 @@ declare namespace Word { } /** * - * Specifies the border style + * Specifies the border style. * * [Api set: WordApi 1.3] */ @@ -49330,7 +49706,7 @@ declare namespace Word { $all?: boolean; /** * - * Gets or sets the table border color, as a hex value or name. + * Gets or sets the table border color. * * [Api set: WordApi 1.3] */ @@ -49366,24 +49742,18 @@ declare namespace Word { * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the RequestContext is required to get access to the Word object model from the add-in. */ function run(batch: (context: Word.RequestContext) => Promise): Promise; + /** + * Executes a batch script that performs actions on the Word object model, using the RequestContext of a previously-created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * @param object - A previously-created API object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the RequestContext is required to get access to the Word object model from the add-in. + */ + function run(object: OfficeExtension.ClientObject, batch: (context: Word.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Word object model, using the RequestContext of previously-created API objects. * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by "context.sync()". * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the RequestContext is required to get access to the Word object model from the add-in. */ function run(objects: OfficeExtension.ClientObject[], batch: (context: Word.RequestContext) => Promise): Promise; - /** - * Executes a batch script that performs actions on the Word object model, using the RequestContext of a previously-created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param object - A previously-created API object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the RequestContext is required to get access to the Word object model from the add-in. - * @remarks - * In addition to this signature, the method also has the following signatures: - * - * `run(batch: (context: Word.RequestContext) => Promise): Promise;` - * - * `run(objects: OfficeExtension.ClientObject[], batch: (context: Word.RequestContext) => Promise): Promise;` - */ - function run(object: OfficeExtension.ClientObject, batch: (context: Word.RequestContext) => Promise): Promise; } @@ -49464,14 +49834,14 @@ declare namespace OneNote { * * Gets the active Paragraph if one exists, If no Paragraph is active, throws ItemNotFound. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ getActiveParagraph(): OneNote.Paragraph; /** * * Gets the active Paragraph if one exists, otherwise returns null. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ getActiveParagraphOrNull(): OneNote.Paragraph; /** @@ -49488,15 +49858,9 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ getActiveSectionOrNull(): OneNote.Section; - /** - * - * The collection of pages in the section. Read only - * - * [Api set: OneNoteApi 1.1] - */ - getSelectedPages(): OneNote.PageCollection; - getWindowSize(): OfficeExtension.ClientResult>; + getWindowSize(): OfficeExtension.ClientResult; insertHtmlAtCurrentPosition(html: string): void; + isViewingDeletedNotes(): OfficeExtension.ClientResult; /** * * Opens the specified page in the application instance. @@ -49517,6 +49881,18 @@ declare namespace OneNote { navigateToPageWithClientUrl(url: string): OneNote.Page; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.Application` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.Application` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.Application` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.ApplicationLoadOptions): OneNote.Application; load(option?: string | string[]): OneNote.Application; @@ -49540,13 +49916,6 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ readonly page: OneNote.Page; - /** - * - * Gets the ink analysis paragraphs in this page. Read-only. - * - * [Api set: OneNoteApi 1.1] - */ - readonly paragraphs: OneNote.InkAnalysisParagraphCollection; /** * * Gets the ID of the InkAnalysis object. Read-only. @@ -49554,17 +49923,34 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ readonly id: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.InkAnalysisUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.InkAnalysis): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.InkAnalysisUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: InkAnalysis): void; + set(properties: OneNote.InkAnalysis): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkAnalysis` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkAnalysis` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkAnalysis` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkAnalysisLoadOptions): OneNote.InkAnalysis; load(option?: string | string[]): OneNote.InkAnalysis; @@ -49610,17 +49996,34 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ readonly id: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.InkAnalysisParagraphUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.InkAnalysisParagraph): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.InkAnalysisParagraphUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: InkAnalysisParagraph): void; + set(properties: OneNote.InkAnalysisParagraph): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkAnalysisParagraph` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkAnalysisParagraph` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkAnalysisParagraph` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkAnalysisParagraphLoadOptions): OneNote.InkAnalysisParagraph; load(option?: string | string[]): OneNote.InkAnalysisParagraph; @@ -49646,7 +50049,7 @@ declare namespace OneNote { */ class InkAnalysisParagraphCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.InkAnalysisParagraph[]; /** * * Returns the number of InkAnalysisParagraphs in the page. Read-only. @@ -49674,6 +50077,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.InkAnalysisParagraph; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkAnalysisParagraphCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkAnalysisParagraphCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkAnalysisParagraphCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkAnalysisParagraphCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.InkAnalysisParagraphCollection; load(option?: string | string[]): OneNote.InkAnalysisParagraphCollection; @@ -49716,17 +50131,34 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ readonly id: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.InkAnalysisLineUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.InkAnalysisLine): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.InkAnalysisLineUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: InkAnalysisLine): void; + set(properties: OneNote.InkAnalysisLine): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkAnalysisLine` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkAnalysisLine` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkAnalysisLine` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkAnalysisLineLoadOptions): OneNote.InkAnalysisLine; load(option?: string | string[]): OneNote.InkAnalysisLine; @@ -49752,7 +50184,7 @@ declare namespace OneNote { */ class InkAnalysisLineCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.InkAnalysisLine[]; /** * * Returns the number of InkAnalysisLines in the page. Read-only. @@ -49780,6 +50212,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.InkAnalysisLine; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkAnalysisLineCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkAnalysisLineCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkAnalysisLineCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkAnalysisLineCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.InkAnalysisLineCollection; load(option?: string | string[]): OneNote.InkAnalysisLineCollection; @@ -49828,25 +50272,42 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - readonly strokePointers: Array; + readonly strokePointers: OneNote.InkStrokePointer[]; /** * * The words that were recognized in this ink word, in order of likelihood. Read-only. * * [Api set: OneNoteApi 1.1] */ - readonly wordAlternates: Array; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.InkAnalysisWordUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + readonly wordAlternates: string[]; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.InkAnalysisWord): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.InkAnalysisWordUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: InkAnalysisWord): void; + set(properties: OneNote.InkAnalysisWord): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkAnalysisWord` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkAnalysisWord` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkAnalysisWord` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkAnalysisWordLoadOptions): OneNote.InkAnalysisWord; load(option?: string | string[]): OneNote.InkAnalysisWord; @@ -49872,7 +50333,7 @@ declare namespace OneNote { */ class InkAnalysisWordCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.InkAnalysisWord[]; /** * * Returns the number of InkAnalysisWords in the page. Read-only. @@ -49900,6 +50361,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.InkAnalysisWord; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkAnalysisWordCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkAnalysisWordCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkAnalysisWordCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkAnalysisWordCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.InkAnalysisWordCollection; load(option?: string | string[]): OneNote.InkAnalysisWordCollection; @@ -49944,6 +50417,18 @@ declare namespace OneNote { readonly id: string; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.FloatingInk` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.FloatingInk` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.FloatingInk` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.FloatingInkLoadOptions): OneNote.FloatingInk; load(option?: string | string[]): OneNote.FloatingInk; @@ -49984,6 +50469,18 @@ declare namespace OneNote { readonly id: string; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkStroke` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkStroke` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkStroke` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkStrokeLoadOptions): OneNote.InkStroke; load(option?: string | string[]): OneNote.InkStroke; @@ -50009,7 +50506,7 @@ declare namespace OneNote { */ class InkStrokeCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.InkStroke[]; /** * * Returns the number of InkStrokes in the page. Read-only. @@ -50037,6 +50534,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.InkStroke; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkStrokeCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkStrokeCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkStrokeCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkStrokeCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.InkStrokeCollection; load(option?: string | string[]): OneNote.InkStrokeCollection; @@ -50083,11 +50592,23 @@ declare namespace OneNote { * * The words that were recognized in this ink word, in order of likelihood. Read-only. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ - readonly wordAlternates: Array; + readonly wordAlternates: string[]; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkWord` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkWord` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkWord` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkWordLoadOptions): OneNote.InkWord; load(option?: string | string[]): OneNote.InkWord; @@ -50113,7 +50634,7 @@ declare namespace OneNote { */ class InkWordCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.InkWord[]; /** * * Returns the number of InkWords in the page. Read-only. @@ -50141,6 +50662,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.InkWord; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.InkWordCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.InkWordCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.InkWordCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.InkWordCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.InkWordCollection; load(option?: string | string[]): OneNote.InkWordCollection; @@ -50197,6 +50730,13 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ readonly id: string; + /** + * + * True if the Notebook is not created by the user (i.e. 'Misplaced Sections'). Read only + * + * [Api set: OneNoteApi 1.2] + */ + readonly isVirtual: boolean; /** * * Gets the name of the notebook. Read-only. @@ -50226,11 +50766,23 @@ declare namespace OneNote { * * Gets the REST API ID. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ getRestApiId(): OfficeExtension.ClientResult; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.Notebook` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.Notebook` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.Notebook` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.NotebookLoadOptions): OneNote.Notebook; load(option?: string | string[]): OneNote.Notebook; @@ -50256,7 +50808,7 @@ declare namespace OneNote { */ class NotebookCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.Notebook[]; /** * * Returns the number of notebooks in the collection. Read-only. @@ -50293,6 +50845,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.Notebook; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.NotebookCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.NotebookCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.NotebookCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.NotebookCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.NotebookCollection; load(option?: string | string[]): OneNote.NotebookCollection; @@ -50392,11 +50956,23 @@ declare namespace OneNote { * * Gets the REST API ID. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ getRestApiId(): OfficeExtension.ClientResult; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.SectionGroup` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.SectionGroup` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.SectionGroup` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.SectionGroupLoadOptions): OneNote.SectionGroup; load(option?: string | string[]): OneNote.SectionGroup; @@ -50422,7 +50998,7 @@ declare namespace OneNote { */ class SectionGroupCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.SectionGroup[]; /** * * Returns the number of section groups in the collection. Read-only. @@ -50459,6 +51035,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.SectionGroup; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.SectionGroupCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.SectionGroupCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.SectionGroupCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.SectionGroupCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.SectionGroupCollection; load(option?: string | string[]): OneNote.SectionGroupCollection; @@ -50522,6 +51110,20 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ readonly id: string; + /** + * + * True if this section is encrypted with a password. Read only + * + * [Api set: OneNoteApi 1.2] + */ + readonly isEncrypted: boolean; + /** + * + * True if this section is locked. Read only + * + * [Api set: OneNoteApi 1.2] + */ + readonly isLocked: boolean; /** * * Gets the name of the section. Read-only. @@ -50567,7 +51169,7 @@ declare namespace OneNote { * * Gets the REST API ID. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ getRestApiId(): OfficeExtension.ClientResult; /** @@ -50579,9 +51181,31 @@ declare namespace OneNote { * @param location The location of the new section relative to the current section. * @param title The name of the new section. */ - insertSectionAsSibling(location: string, title: string): OneNote.Section; + insertSectionAsSibling(location: OneNote.InsertLocation, title: string): OneNote.Section; + /** + * + * Inserts a new section before or after the current section. + * + * [Api set: OneNoteApi 1.1] + * + * @param location The location of the new section relative to the current section. + * @param title The name of the new section. + */ + insertSectionAsSibling(location: "Before" | "After", title: string): OneNote.Section; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.Section` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.Section` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.Section` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.SectionLoadOptions): OneNote.Section; load(option?: string | string[]): OneNote.Section; @@ -50607,7 +51231,7 @@ declare namespace OneNote { */ class SectionCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.Section[]; /** * * Returns the number of sections in the collection. Read-only. @@ -50644,6 +51268,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.Section; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.SectionCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.SectionCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.SectionCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.SectionCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.SectionCollection; load(option?: string | string[]): OneNote.SectionCollection; @@ -50728,15 +51364,20 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ readonly webUrl: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.PageUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.Page): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PageUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Page): void; + set(properties: OneNote.Page): void; /** * * Adds an Outline to the page at the specified position. @@ -50745,14 +51386,14 @@ declare namespace OneNote { * * @param left The left position of the top, left corner of the Outline. * @param top The top position of the top, left corner of the Outline. - * @param html An HTML string that describes the visual presentation of the Outline. See [supported HTML](../../docs/onenote/onenote-add-ins-page-content.md#supported-html) for the OneNote add-ins JavaScript API. + * @param html An HTML string that describes the visual presentation of the Outline. See {@link https://docs.microsoft.com/en-us/office/dev/add-ins/onenote/onenote-add-ins-page-content#supported-html | Supported HTML} for the OneNote add-ins JavaScript API. */ addOutline(left: number, top: number, html: string): OneNote.Outline; /** * * Return a json string with node id and content in html format. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ analyzePage(): OfficeExtension.ClientResult; /** @@ -50784,14 +51425,14 @@ declare namespace OneNote { * * Gets the REST API ID. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ getRestApiId(): OfficeExtension.ClientResult; /** * * Does the page has content title. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ hasTitleContent(): OfficeExtension.ClientResult; /** @@ -50803,9 +51444,31 @@ declare namespace OneNote { * @param location The location of the new page relative to the current page. * @param title The title of the new page. */ - insertPageAsSibling(location: string, title: string): OneNote.Page; + insertPageAsSibling(location: OneNote.InsertLocation, title: string): OneNote.Page; + /** + * + * Inserts a new page before or after the current page. + * + * [Api set: OneNoteApi 1.1] + * + * @param location The location of the new page relative to the current page. + * @param title The title of the new page. + */ + insertPageAsSibling(location: "Before" | "After", title: string): OneNote.Page; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.Page` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.Page` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.Page` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.PageLoadOptions): OneNote.Page; load(option?: string | string[]): OneNote.Page; @@ -50831,7 +51494,7 @@ declare namespace OneNote { */ class PageCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.Page[]; /** * * Returns the number of pages in the collection. Read-only. @@ -50868,6 +51531,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.Page; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.PageCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.PageCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.PageCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.PageCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.PageCollection; load(option?: string | string[]): OneNote.PageCollection; @@ -50944,16 +51619,21 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - readonly type: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.PageContentUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + readonly type: OneNote.PageContentType | "Outline" | "Image" | "Ink" | "Other"; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.PageContent): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PageContentUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: PageContent): void; + set(properties: OneNote.PageContent): void; /** * * Deletes the PageContent object. @@ -50963,6 +51643,18 @@ declare namespace OneNote { delete(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.PageContent` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.PageContent` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.PageContent` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.PageContentLoadOptions): OneNote.PageContent; load(option?: string | string[]): OneNote.PageContent; @@ -50988,7 +51680,7 @@ declare namespace OneNote { */ class PageContentCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.PageContent[]; /** * * Returns the number of page contents in the collection. Read-only. @@ -51016,6 +51708,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.PageContent; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.PageContentCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.PageContentCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.PageContentCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.PageContentCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.PageContentCollection; load(option?: string | string[]): OneNote.PageContentCollection; @@ -51064,7 +51768,7 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] * - * @param html The HTML string to append. See [supported HTML](../../docs/onenote/onenote-add-ins-page-content.md#supported-html) for the OneNote add-ins JavaScript API. + * @param html The HTML string to append. See {@link https://docs.microsoft.com/en-us/office/dev/add-ins/onenote/onenote-add-ins-page-content#supported-html | Supported HTML} for the OneNote add-ins JavaScript API. */ appendHtml(html: string): void; /** @@ -51097,7 +51801,7 @@ declare namespace OneNote { * @param columnCount Required. The number of columns in the table. * @param values Optional 2D array. Cells are filled if the corresponding strings are specified in the array. */ - appendTable(rowCount: number, columnCount: number, values?: Array>): OneNote.Table; + appendTable(rowCount: number, columnCount: number, values?: string[][]): OneNote.Table; /** * * Check if the outline is title outline. @@ -51107,6 +51811,18 @@ declare namespace OneNote { isTitle(): OfficeExtension.ClientResult; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.Outline` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.Outline` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.Outline` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.OutlineLoadOptions): OneNote.Outline; load(option?: string | string[]): OneNote.Outline; @@ -51214,16 +51930,21 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - readonly type: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.ParagraphUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + readonly type: OneNote.ParagraphType | "RichText" | "Image" | "Table" | "Ink" | "Other"; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.Paragraph): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ParagraphUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Paragraph): void; + set(properties: OneNote.Paragraph): void; /** * * Add NoteTag to the paragraph. @@ -51233,7 +51954,17 @@ declare namespace OneNote { * @param type The type of the NoteTag. * @param status The status of the NoteTag. */ - addNoteTag(type: string, status: string): OneNote.NoteTag; + addNoteTag(type: OneNote.NoteTagType, status: OneNote.NoteTagStatus): OneNote.NoteTag; + /** + * + * Add NoteTag to the paragraph. + * + * [Api set: OneNoteApi 1.1] + * + * @param type The type of the NoteTag. + * @param status The status of the NoteTag. + */ + addNoteTag(type: "Unknown" | "ToDo" | "Important" | "Question" | "Contact" | "Address" | "PhoneNumber" | "Website" | "Idea" | "Critical" | "ToDoPriority1" | "ToDoPriority2", status: "Unknown" | "Normal" | "Completed" | "Disabled" | "OutlookTask" | "TaskNotSyncedYet" | "TaskRemoved"): OneNote.NoteTag; /** * * Deletes the paragraph @@ -51255,9 +51986,19 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] * * @param insertLocation The location of new contents relative to the current Paragraph. - * @param html An HTML string that describes the visual presentation of the content. See [supported HTML](../../docs/onenote/onenote-add-ins-page-content.md#supported-html) for the OneNote add-ins JavaScript API. + * @param html An HTML string that describes the visual presentation of the content. See {@link https://docs.microsoft.com/en-us/office/dev/add-ins/onenote/onenote-add-ins-page-content#supported-html | Supported HTML} for the OneNote add-ins JavaScript API. */ - insertHtmlAsSibling(insertLocation: string, html: string): void; + insertHtmlAsSibling(insertLocation: OneNote.InsertLocation, html: string): void; + /** + * + * Inserts the specified HTML content + * + * [Api set: OneNoteApi 1.1] + * + * @param insertLocation The location of new contents relative to the current Paragraph. + * @param html An HTML string that describes the visual presentation of the content. See {@link https://docs.microsoft.com/en-us/office/dev/add-ins/onenote/onenote-add-ins-page-content#supported-html | Supported HTML} for the OneNote add-ins JavaScript API. + */ + insertHtmlAsSibling(insertLocation: "Before" | "After", html: string): void; /** * * Inserts the image at the specified insert location.. @@ -51269,7 +52010,19 @@ declare namespace OneNote { * @param width Optional. Width in the unit of Points. The default value is null and image width will be respected. * @param height Optional. Height in the unit of Points. The default value is null and image height will be respected. */ - insertImageAsSibling(insertLocation: string, base64EncodedImage: string, width: number, height: number): OneNote.Image; + insertImageAsSibling(insertLocation: OneNote.InsertLocation, base64EncodedImage: string, width: number, height: number): OneNote.Image; + /** + * + * Inserts the image at the specified insert location.. + * + * [Api set: OneNoteApi 1.1] + * + * @param insertLocation The location of the table relative to the current Paragraph. + * @param base64EncodedImage HTML string to append. + * @param width Optional. Width in the unit of Points. The default value is null and image width will be respected. + * @param height Optional. Height in the unit of Points. The default value is null and image height will be respected. + */ + insertImageAsSibling(insertLocation: "Before" | "After", base64EncodedImage: string, width: number, height: number): OneNote.Image; /** * * Inserts the paragraph text at the specifiec insert location. @@ -51279,7 +52032,17 @@ declare namespace OneNote { * @param insertLocation The location of the table relative to the current Paragraph. * @param paragraphText HTML string to append. */ - insertRichTextAsSibling(insertLocation: string, paragraphText: string): OneNote.RichText; + insertRichTextAsSibling(insertLocation: OneNote.InsertLocation, paragraphText: string): OneNote.RichText; + /** + * + * Inserts the paragraph text at the specifiec insert location. + * + * [Api set: OneNoteApi 1.1] + * + * @param insertLocation The location of the table relative to the current Paragraph. + * @param paragraphText HTML string to append. + */ + insertRichTextAsSibling(insertLocation: "Before" | "After", paragraphText: string): OneNote.RichText; /** * * Adds a table with the specified number of rows and columns before or after the current paragraph. @@ -51291,9 +52054,33 @@ declare namespace OneNote { * @param columnCount The number of columns in the table. * @param values Optional 2D array. Cells are filled if the corresponding strings are specified in the array. */ - insertTableAsSibling(insertLocation: string, rowCount: number, columnCount: number, values?: Array>): OneNote.Table; + insertTableAsSibling(insertLocation: OneNote.InsertLocation, rowCount: number, columnCount: number, values?: string[][]): OneNote.Table; + /** + * + * Adds a table with the specified number of rows and columns before or after the current paragraph. + * + * [Api set: OneNoteApi 1.1] + * + * @param insertLocation The location of the table relative to the current Paragraph. + * @param rowCount The number of rows in the table. + * @param columnCount The number of columns in the table. + * @param values Optional 2D array. Cells are filled if the corresponding strings are specified in the array. + */ + insertTableAsSibling(insertLocation: "Before" | "After", rowCount: number, columnCount: number, values?: string[][]): OneNote.Table; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.Paragraph` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.Paragraph` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.Paragraph` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.ParagraphLoadOptions): OneNote.Paragraph; load(option?: string | string[]): OneNote.Paragraph; @@ -51319,7 +52106,7 @@ declare namespace OneNote { */ class ParagraphCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.Paragraph[]; /** * * Returns the number of paragraphs in the page. Read-only. @@ -51347,6 +52134,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.Paragraph; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.ParagraphCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.ParagraphCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.ParagraphCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.ParagraphCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.ParagraphCollection; load(option?: string | string[]): OneNote.ParagraphCollection; @@ -51381,16 +52180,28 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - readonly status: string; + readonly status: OneNote.NoteTagStatus | "Unknown" | "Normal" | "Completed" | "Disabled" | "OutlookTask" | "TaskNotSyncedYet" | "TaskRemoved"; /** * * Gets the type of the NoteTag object. Read-only. * * [Api set: OneNoteApi 1.1] */ - readonly type: string; + readonly type: OneNote.NoteTagType | "Unknown" | "ToDo" | "Important" | "Question" | "Contact" | "Address" | "PhoneNumber" | "Website" | "Idea" | "Critical" | "ToDoPriority1" | "ToDoPriority2"; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.NoteTag` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.NoteTag` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.NoteTag` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.NoteTagLoadOptions): OneNote.NoteTag; load(option?: string | string[]): OneNote.NoteTag; @@ -51447,12 +52258,24 @@ declare namespace OneNote { * * Get the HTML of the rich text * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] * @returns The html of the rich text */ getHtml(): OfficeExtension.ClientResult; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.RichText` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.RichText` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.RichText` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.RichTextLoadOptions): OneNote.RichText; load(option?: string | string[]): OneNote.RichText; @@ -51533,15 +52356,20 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ width: number; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.ImageUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.Image): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ImageUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Image): void; + set(properties: OneNote.Image): void; /** * * Gets the base64-encoded binary representation of the Image. @@ -51552,6 +52380,18 @@ declare namespace OneNote { getBase64Image(): OfficeExtension.ClientResult; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.Image` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.Image` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.Image` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.ImageLoadOptions): OneNote.Image; load(option?: string | string[]): OneNote.Image; @@ -51618,15 +52458,20 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ readonly rowCount: number; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.TableUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.Table): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.TableUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Table): void; + set(properties: OneNote.Table): void; /** * * Adds a column to the end of the table. Values, if specified, are set in the new column. Otherwise the column is empty. @@ -51635,7 +52480,7 @@ declare namespace OneNote { * * @param values Optional. Strings to insert in the new column, specified as an array. Must not have more values than rows in the table. */ - appendColumn(values?: Array): void; + appendColumn(values?: string[]): void; /** * * Adds a row to the end of the table. Values, if specified, are set in the new row. Otherwise the row is empty. @@ -51644,7 +52489,7 @@ declare namespace OneNote { * * @param values Optional. Strings to insert in the new row, specified as an array. Must not have more values than columns in the table. */ - appendRow(values?: Array): OneNote.TableRow; + appendRow(values?: string[]): OneNote.TableRow; /** * * Clears the contents of the table. @@ -51671,7 +52516,7 @@ declare namespace OneNote { * @param index Index where the column will be inserted in the table. * @param values Optional. Strings to insert in the new column, specified as an array. Must not have more values than rows in the table. */ - insertColumn(index: number, values?: Array): void; + insertColumn(index: number, values?: string[]): void; /** * * Inserts a row at the given index in the table. Values, if specified, are set in the new row. Otherwise the row is empty. @@ -51681,10 +52526,29 @@ declare namespace OneNote { * @param index Index where the row will be inserted in the table. * @param values Optional. Strings to insert in the new row, specified as an array. Must not have more values than columns in the table. */ - insertRow(index: number, values?: Array): OneNote.TableRow; + insertRow(index: number, values?: string[]): OneNote.TableRow; + /** + * + * Sets the shading color of all cells in the table. + The color code to set the cells to. + * + * [Api set: OneNoteApi 1.1] + */ setShadingColor(colorCode: string): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.Table` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.Table` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.Table` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.TableLoadOptions): OneNote.Table; load(option?: string | string[]): OneNote.Table; @@ -51760,10 +52624,39 @@ declare namespace OneNote { * @param insertLocation Where the new rows should be inserted relative to the current row. * @param values Strings to insert in the new row, specified as an array. Must not have more cells than in the current row. Optional. */ - insertRowAsSibling(insertLocation: string, values?: Array): OneNote.TableRow; + insertRowAsSibling(insertLocation: OneNote.InsertLocation, values?: string[]): OneNote.TableRow; + /** + * + * Inserts a row before or after the current row. + * + * [Api set: OneNoteApi 1.1] + * + * @param insertLocation Where the new rows should be inserted relative to the current row. + * @param values Strings to insert in the new row, specified as an array. Must not have more cells than in the current row. Optional. + */ + insertRowAsSibling(insertLocation: "Before" | "After", values?: string[]): OneNote.TableRow; + /** + * + * Sets the shading color of all cells in the row. + The color code to set the cells to. + * + * [Api set: OneNoteApi 1.1] + */ setShadingColor(colorCode: string): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.TableRow` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.TableRow` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.TableRow` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.TableRowLoadOptions): OneNote.TableRow; load(option?: string | string[]): OneNote.TableRow; @@ -51789,7 +52682,7 @@ declare namespace OneNote { */ class TableRowCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.TableRow[]; /** * * Returns the number of table rows in this collection. Read-only. @@ -51817,6 +52710,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.TableRow; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.TableRowCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.TableRowCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.TableRowCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.TableRowCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.TableRowCollection; load(option?: string | string[]): OneNote.TableRowCollection; @@ -51880,22 +52785,27 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ shadingColor: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.TableCellUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: OneNote.TableCell): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.TableCellUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: TableCell): void; + set(properties: OneNote.TableCell): void; /** * * Adds the specified HTML to the bottom of the TableCell. * * [Api set: OneNoteApi 1.1] * - * @param html The HTML string to append. See [supported HTML](../../docs/onenote/onenote-add-ins-page-content.md#supported-html) for the OneNote add-ins JavaScript API. + * @param html The HTML string to append. See {@link https://docs.microsoft.com/en-us/office/dev/add-ins/onenote/onenote-add-ins-page-content#supported-html | Supported HTML} for the OneNote add-ins JavaScript API. */ appendHtml(html: string): void; /** @@ -51928,7 +52838,7 @@ declare namespace OneNote { * @param columnCount Required. The number of columns in the table. * @param values Optional 2D array. Cells are filled if the corresponding strings are specified in the array. */ - appendTable(rowCount: number, columnCount: number, values?: Array>): OneNote.Table; + appendTable(rowCount: number, columnCount: number, values?: string[][]): OneNote.Table; /** * * Clears the contents of the cell. @@ -51938,6 +52848,18 @@ declare namespace OneNote { clear(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.TableCell` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.TableCell` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.TableCell` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.TableCellLoadOptions): OneNote.TableCell; load(option?: string | string[]): OneNote.TableCell; @@ -51963,7 +52885,7 @@ declare namespace OneNote { */ class TableCellCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: OneNote.TableCell[]; /** * * Returns the number of tablecells in this collection. Read-only. @@ -51991,6 +52913,18 @@ declare namespace OneNote { getItemAt(index: number): OneNote.TableCell; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): OneNote.TableCellCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): OneNote.TableCellCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): OneNote.TableCellCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: OneNote.Interfaces.TableCellCollectionLoadOptions & OneNote.Interfaces.CollectionLoadOptions): OneNote.TableCellCollection; load(option?: string | string[]): OneNote.TableCellCollection; @@ -52049,66 +52983,6 @@ declare namespace OneNote { */ inkStrokeId: string; } - /** - * - * Service token for Application::_GetServiceToken. - * - * [Api set: OneNoteApi 1.1] - */ - interface ServiceToken { - /** - * - * Account type - * - * [Api set: OneNoteApi 1.1] - */ - accountType: string; - /** - * - * // - Header name of the service token - * - * [Api set: OneNoteApi 1.1] - */ - headerName: string; - /** - * - * Header value of the service token - * - * [Api set: OneNoteApi 1.1] - */ - headerValue: string; - } - /** - * - * Account information. - * - * [Api set: OneNoteApi 1.1] - */ - interface AccountInfo { - /** - * - * Account type - * - * [Api set: OneNoteApi 1.1] - */ - accountType: string; - /** - * - * Account email - * - * [Api set: OneNoteApi 1.1] - */ - email: string; - /** - * - * // - Account user name - * - * [Api set: OneNoteApi 1.1] - */ - userName: string; - } /** * * List information for paragraph. @@ -52139,7 +53013,7 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - listType: string; + listType: OneNote.ListType | "None" | "Number" | "Bullet"; /** * * // @@ -52147,338 +53021,162 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - numberType: string; + numberType: OneNote.NumberType | "None" | "Arabic" | "UCRoman" | "LCRoman" | "UCLetter" | "LCLetter" | "Ordinal" | "Cardtext" | "Ordtext" | "Hex" | "ChiManSty" | "DbNum1" | "DbNum2" | "Aiueo" | "Iroha" | "DbChar" | "SbChar" | "DbNum3" | "DbNum4" | "Circlenum" | "DArabic" | "DAiueo" | "DIroha" | "ArabicLZ" | "Bullet" | "Ganada" | "Chosung" | "GB1" | "GB2" | "GB3" | "GB4" | "Zodiac1" | "Zodiac2" | "Zodiac3" | "TpeDbNum1" | "TpeDbNum2" | "TpeDbNum3" | "TpeDbNum4" | "ChnDbNum1" | "ChnDbNum2" | "ChnDbNum3" | "ChnDbNum4" | "KorDbNum1" | "KorDbNum2" | "KorDbNum3" | "KorDbNum4" | "Hebrew1" | "Arabic1" | "Hebrew2" | "Arabic2" | "Hindi1" | "Hindi2" | "Hindi3" | "Thai1" | "Thai2" | "NumInDash" | "LCRus" | "UCRus" | "LCGreek" | "UCGreek" | "Lim" | "Custom"; } /** - * - * Account information. - * * [Api set: OneNoteApi 1.1] */ - interface LoggingInfo { - /** - * - * // - Correlation Id - * - * [Api set: OneNoteApi 1.1] - */ - correlationId: string; - /** - * - * // - UI Language - * - * [Api set: OneNoteApi 1.1] - */ - market: string; - /** - * - * // - Session Id - * - * [Api set: OneNoteApi 1.1] - */ - sessionId: string; - /** - * - * // - UI Language - * - * [Api set: OneNoteApi 1.1] - */ - uiLanguage: string; - /** - * - * // - User Id - * - * [Api set: OneNoteApi 1.1] - */ - userId: string; + enum EntityType { + notebook = "Notebook", + sectionGroup = "SectionGroup", + section = "Section", + page = "Page", } /** - * - * Account information. - * * [Api set: OneNoteApi 1.1] */ - interface LogData { + enum InsertLocation { + before = "Before", + after = "After", + } + /** + * [Api set: OneNoteApi 1.1] + */ + enum PageContentType { + outline = "Outline", + image = "Image", + ink = "Ink", + other = "Other", + } + /** + * [Api set: OneNoteApi 1.1] + */ + enum ParagraphType { + richText = "RichText", + image = "Image", + table = "Table", + ink = "Ink", + other = "Other", + } + /** + * [Api set: OneNoteApi 1.1] + */ + enum NoteTagType { + unknown = "Unknown", + toDo = "ToDo", + important = "Important", + question = "Question", + contact = "Contact", + address = "Address", + phoneNumber = "PhoneNumber", + website = "Website", + idea = "Idea", + critical = "Critical", + toDoPriority1 = "ToDoPriority1", + toDoPriority2 = "ToDoPriority2", + } + /** + * [Api set: OneNoteApi 1.1] + */ + enum NoteTagStatus { + unknown = "Unknown", + normal = "Normal", + completed = "Completed", + disabled = "Disabled", + outlookTask = "OutlookTask", + taskNotSyncedYet = "TaskNotSyncedYet", + taskRemoved = "TaskRemoved", + } + /** + * [Api set: OneNoteApi 1.1] + */ + enum ListType { + none = "None", + number = "Number", + bullet = "Bullet", + } + /** + * [Api set: OneNoteApi 1.1] + */ + enum NumberType { + none = "None", + arabic = "Arabic", + ucroman = "UCRoman", + lcroman = "LCRoman", + ucletter = "UCLetter", + lcletter = "LCLetter", + ordinal = "Ordinal", + cardtext = "Cardtext", + ordtext = "Ordtext", + hex = "Hex", + chiManSty = "ChiManSty", + dbNum1 = "DbNum1", + dbNum2 = "DbNum2", + aiueo = "Aiueo", + iroha = "Iroha", + dbChar = "DbChar", + sbChar = "SbChar", + dbNum3 = "DbNum3", + dbNum4 = "DbNum4", + circlenum = "Circlenum", + darabic = "DArabic", + daiueo = "DAiueo", + diroha = "DIroha", + arabicLZ = "ArabicLZ", + bullet = "Bullet", + ganada = "Ganada", + chosung = "Chosung", + gb1 = "GB1", + gb2 = "GB2", + gb3 = "GB3", + gb4 = "GB4", + zodiac1 = "Zodiac1", + zodiac2 = "Zodiac2", + zodiac3 = "Zodiac3", + tpeDbNum1 = "TpeDbNum1", + tpeDbNum2 = "TpeDbNum2", + tpeDbNum3 = "TpeDbNum3", + tpeDbNum4 = "TpeDbNum4", + chnDbNum1 = "ChnDbNum1", + chnDbNum2 = "ChnDbNum2", + chnDbNum3 = "ChnDbNum3", + chnDbNum4 = "ChnDbNum4", + korDbNum1 = "KorDbNum1", + korDbNum2 = "KorDbNum2", + korDbNum3 = "KorDbNum3", + korDbNum4 = "KorDbNum4", + hebrew1 = "Hebrew1", + arabic1 = "Arabic1", + hebrew2 = "Hebrew2", + arabic2 = "Arabic2", + hindi1 = "Hindi1", + hindi2 = "Hindi2", + hindi3 = "Hindi3", + thai1 = "Thai1", + thai2 = "Thai2", + numInDash = "NumInDash", + lcrus = "LCRus", + ucrus = "UCRus", + lcgreek = "LCGreek", + ucgreek = "UCGreek", + lim = "Lim", + custom = "Custom", + } + enum ErrorCodes { + generalException = "GeneralException", + } + module Interfaces { /** - * - * // - None PII - * - * [Api set: OneNoteApi 1.1] - */ - isNonPII: boolean; - /** - * - * // - data tag - * - * [Api set: OneNoteApi 1.1] - */ - tag: string; - /** - * - * // - data value - * - * [Api set: OneNoteApi 1.1] - */ - value: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace InsertLocation { - var before: string; - var after: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace Platform { - var other: string; - var web: string; - var uwp: string; - var win32: string; - var mac: string; - var ios: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace Alignment { - var left: string; - var centered: string; - var right: string; - var justified: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace Selected { - var notSelected: string; - var partialSelected: string; - var selected: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace PageContentType { - var outline: string; - var image: string; - var ink: string; - var other: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace ParagraphType { - var richText: string; - var image: string; - var table: string; - var ink: string; - var other: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace NoteTagType { - var unknown: string; - var toDo: string; - var important: string; - var question: string; - var contact: string; - var address: string; - var phoneNumber: string; - var website: string; - var idea: string; - var critical: string; - var toDoPriority1: string; - var toDoPriority2: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace NoteTagStatus { - var unknown: string; - var normal: string; - var completed: string; - var disabled: string; - var outlookTask: string; - var taskNotSyncedYet: string; - var taskRemoved: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace ServiceId { - var form: string; - var entity: string; - var graph: string; - var oneService: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace IdentityFilter { - var selection: string; - var activeProfile: string; - var liveId: string; - var orgId: string; - var adal: string; - var notebook: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace ListType { - var none: string; - var number: string; - var bullet: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace AccountType { - var other: string; - var liveId: string; - var orgId: string; - var adal: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace LogLevel { - var trace: string; - var data: string; - var exception: string; - var warning: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace EventFlag { - /** - * - * DefaultEventFlags - * - */ - var defaultFlag: string; - /** - * - * CriticalDataEventFlags - * - */ - var criticalFlag: string; - /** - * - * MeasureDataEventFlags - * - */ - var measureFlag: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace NumberType { - var none: string; - var arabic: string; - var ucroman: string; - var lcroman: string; - var ucletter: string; - var lcletter: string; - var ordinal: string; - var cardtext: string; - var ordtext: string; - var hex: string; - var chiManSty: string; - var dbNum1: string; - var dbNum2: string; - var aiueo: string; - var iroha: string; - var dbChar: string; - var sbChar: string; - var dbNum3: string; - var dbNum4: string; - var circlenum: string; - var darabic: string; - var daiueo: string; - var diroha: string; - var arabicLZ: string; - var bullet: string; - var ganada: string; - var chosung: string; - var gb1: string; - var gb2: string; - var gb3: string; - var gb4: string; - var zodiac1: string; - var zodiac2: string; - var zodiac3: string; - var tpeDbNum1: string; - var tpeDbNum2: string; - var tpeDbNum3: string; - var tpeDbNum4: string; - var chnDbNum1: string; - var chnDbNum2: string; - var chnDbNum3: string; - var chnDbNum4: string; - var korDbNum1: string; - var korDbNum2: string; - var korDbNum3: string; - var korDbNum4: string; - var hebrew1: string; - var arabic1: string; - var hebrew2: string; - var arabic2: string; - var hindi1: string; - var hindi2: string; - var hindi3: string; - var thai1: string; - var thai2: string; - var numInDash: string; - var lcrus: string; - var ucrus: string; - var lcgreek: string; - var ucgreek: string; - var lim: string; - var custom: string; - } - /** - * [Api set: OneNoteApi] - */ - namespace ControlId { - var preinstallClassNotebook: string; - var distributePageId: string; - var distributeSection: string; - var reviewStudentWork: string; - var openTabForCreateClassNotebook: string; - var openTabForManageStudent: string; - var openTabForManageTeacher: string; - var openTabForGetNotebookLink: string; - var openTabForTeacherTraining: string; - var openTabForAddinGuide: string; - var openTabForEducationBlog: string; - var openTabForEducatorCommunity: string; - var openTabToSendFeedback: string; - var openTabForViewKnowledgeBase: string; - var openTabForSuggestingFeature: string; - var createAssignment: string; - var connections: string; - var mapClassNotebooks: string; - var mapStudents: string; - var manageClasses: string; - } - namespace ErrorCodes { - var generalException: string; - } - namespace Interfaces { + * Provides ways to load properties of only a subset of members of a collection. + */ interface CollectionLoadOptions { + /** + * Specify the number of items in the queried collection to be included in the result. + */ $top?: number; + /** + * Specify the number of items in the collection that are to be skipped and not included in the result. If top is specified, the selection of result will start after skipping the specified number of items. + */ $skip?: number; } /** An interface for updating data on the InkAnalysis object, for use in "inkAnalysis.set({ ... })". */ @@ -52808,14 +53506,14 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - strokePointers?: Array; + strokePointers?: OneNote.InkStrokePointer[]; /** * * The words that were recognized in this ink word, in order of likelihood. Read-only. * * [Api set: OneNoteApi 1.1] */ - wordAlternates?: Array; + wordAlternates?: string[]; } /** An interface describing the data returned by calling "inkAnalysisWordCollection.toJSON()". */ interface InkAnalysisWordCollectionData { @@ -52893,9 +53591,9 @@ declare namespace OneNote { * * The words that were recognized in this ink word, in order of likelihood. Read-only. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ - wordAlternates?: Array; + wordAlternates?: string[]; } /** An interface describing the data returned by calling "inkWordCollection.toJSON()". */ interface InkWordCollectionData { @@ -52938,6 +53636,13 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ id?: string; + /** + * + * True if the Notebook is not created by the user (i.e. 'Misplaced Sections'). Read only + * + * [Api set: OneNoteApi 1.2] + */ + isVirtual?: boolean; /** * * Gets the name of the notebook. Read-only. @@ -53057,6 +53762,20 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ id?: string; + /** + * + * True if this section is encrypted with a password. Read only + * + * [Api set: OneNoteApi 1.2] + */ + isEncrypted?: boolean; + /** + * + * True if this section is locked. Read only + * + * [Api set: OneNoteApi 1.2] + */ + isLocked?: boolean; /** * * Gets the name of the section. Read-only. @@ -53203,7 +53922,7 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - type?: string; + type?: OneNote.PageContentType | "Outline" | "Image" | "Ink" | "Other"; } /** An interface describing the data returned by calling "pageContentCollection.toJSON()". */ interface PageContentCollectionData { @@ -53318,7 +54037,7 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - type?: string; + type?: OneNote.ParagraphType | "RichText" | "Image" | "Table" | "Ink" | "Other"; } /** An interface describing the data returned by calling "paragraphCollection.toJSON()". */ interface ParagraphCollectionData { @@ -53339,14 +54058,14 @@ declare namespace OneNote { * * [Api set: OneNoteApi 1.1] */ - status?: string; + status?: OneNote.NoteTagStatus | "Unknown" | "Normal" | "Completed" | "Disabled" | "OutlookTask" | "TaskNotSyncedYet" | "TaskRemoved"; /** * * Gets the type of the NoteTag object. Read-only. * * [Api set: OneNoteApi 1.1] */ - type?: string; + type?: OneNote.NoteTagType | "Unknown" | "ToDo" | "Important" | "Question" | "Contact" | "Address" | "PhoneNumber" | "Website" | "Idea" | "Critical" | "ToDoPriority1" | "ToDoPriority2"; } /** An interface describing the data returned by calling "richText.toJSON()". */ interface RichTextData { @@ -53937,7 +54656,7 @@ declare namespace OneNote { * * The words that were recognized in this ink word, in order of likelihood. Read-only. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ wordAlternates?: boolean; } @@ -53974,7 +54693,7 @@ declare namespace OneNote { * * For EACH ITEM in the collection: The words that were recognized in this ink word, in order of likelihood. Read-only. * - * [Api set: OneNoteApi] + * [Api set: OneNoteApi 1.1] */ wordAlternates?: boolean; } @@ -54021,6 +54740,13 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ id?: boolean; + /** + * + * True if the Notebook is not created by the user (i.e. 'Misplaced Sections'). Read only + * + * [Api set: OneNoteApi 1.2] + */ + isVirtual?: boolean; /** * * Gets the name of the notebook. Read-only. @@ -54072,6 +54798,13 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ id?: boolean; + /** + * + * For EACH ITEM in the collection: True if the Notebook is not created by the user (i.e. 'Misplaced Sections'). Read only + * + * [Api set: OneNoteApi 1.2] + */ + isVirtual?: boolean; /** * * For EACH ITEM in the collection: Gets the name of the notebook. Read-only. @@ -54260,6 +54993,20 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ id?: boolean; + /** + * + * True if this section is encrypted with a password. Read only + * + * [Api set: OneNoteApi 1.2] + */ + isEncrypted?: boolean; + /** + * + * True if this section is locked. Read only + * + * [Api set: OneNoteApi 1.2] + */ + isLocked?: boolean; /** * * Gets the name of the section. Read-only. @@ -54325,6 +55072,20 @@ declare namespace OneNote { * [Api set: OneNoteApi 1.1] */ id?: boolean; + /** + * + * For EACH ITEM in the collection: True if this section is encrypted with a password. Read only + * + * [Api set: OneNoteApi 1.2] + */ + isEncrypted?: boolean; + /** + * + * For EACH ITEM in the collection: True if this section is locked. Read only + * + * [Api set: OneNoteApi 1.2] + */ + isLocked?: boolean; /** * * For EACH ITEM in the collection: Gets the name of the section. Read-only. @@ -55203,10 +55964,186 @@ declare namespace OneNote { */ shadingColor?: boolean; } + /** + * + * Represents a OneNote accessibility violation. + * + * [Api set: OneNoteApi 1.2] + */ + interface AccessibilityViolationLoadOptions { + $all?: boolean; + /** + * + * Gets the ID of the accessibility violation. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + id?: boolean; + /** + * + * Gets the location of the accessibility violation. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + location?: boolean; + /** + * + * Gets the name of the accessibility violation. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + name?: boolean; + /** + * + * Gets the type of the accessibility violation. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + type?: boolean; + } + /** + * + * Represents the collection of AccessibilityViolations + * + * [Api set: OneNoteApi 1.2] + */ + interface AccessibilityViolationCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the ID of the accessibility violation. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the location of the accessibility violation. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + location?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the name of the accessibility violation. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the type of the accessibility violation. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + type?: boolean; + } + /** + * + * A OneNote structure that stores metadata about accessibility violations for an entity. + * + * [Api set: OneNoteApi 1.2] + */ + interface AccessibilityViolationsByEntityLoadOptions { + $all?: boolean; + /** + * + * Gets the parent section section group (if any) of the entity. + * + * [Api set: OneNoteApi 1.2] + */ + parentSectionGroupOrNull?: OneNote.Interfaces.SectionGroupLoadOptions; + /** + * + * Gets the parent section (if any) of the entity. + * + * [Api set: OneNoteApi 1.2] + */ + parentSectionOrNull?: OneNote.Interfaces.SectionLoadOptions; + /** + * + * Gets the name of the entity for which this structure holds metadata. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + entityName?: boolean; + /** + * + * Gets the type of the entity for which this structure holds metadata. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + entityType?: boolean; + /** + * + * Gets the ID of the AccessibilityViolationsByEntity. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + id?: boolean; + /** + * + * Gets the count of accessibility violations for the entity. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + violationsCount?: boolean; + } + /** + * + * Represents the collection of AccessibilityViolationsByEntity + * + * [Api set: OneNoteApi 1.2] + */ + interface AccessibilityViolationsByEntityCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the parent section section group (if any) of the entity. + * + * [Api set: OneNoteApi 1.2] + */ + parentSectionGroupOrNull?: OneNote.Interfaces.SectionGroupLoadOptions; + /** + * + * For EACH ITEM in the collection: Gets the parent section (if any) of the entity. + * + * [Api set: OneNoteApi 1.2] + */ + parentSectionOrNull?: OneNote.Interfaces.SectionLoadOptions; + /** + * + * For EACH ITEM in the collection: Gets the name of the entity for which this structure holds metadata. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + entityName?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the type of the entity for which this structure holds metadata. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + entityType?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the ID of the AccessibilityViolationsByEntity. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the count of accessibility violations for the entity. Read-only. + * + * [Api set: OneNoteApi 1.2] + */ + violationsCount?: boolean; + } } } declare namespace OneNote { - class RequestContext extends OfficeExtension.ClientRequestContext { + class RequestContext extends OfficeCore.RequestContext { constructor(url?: string); readonly application: Application; } @@ -55215,24 +56152,18 @@ declare namespace OneNote { * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the OneNote application. Since the Office add-in and the OneNote application run in two different processes, the request context is required to get access to the OneNote object model from the add-in. */ function run(batch: (context: OneNote.RequestContext) => Promise): Promise; + /** + * Executes a batch script that performs actions on the OneNote object model, using the request context of a previously-created API object. + * @param object - A previously-created API object. The batch will use the same request context as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". + * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + */ + function run(object: OfficeExtension.ClientObject, batch: (context: OneNote.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the OneNote object model, using the request context of previously-created API objects. * @param object - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared request context, which means that any changes applied to these objects will be picked up by "context.sync()". * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. */ function run(objects: OfficeExtension.ClientObject[], batch: (context: OneNote.RequestContext) => Promise): Promise; - /** - * Executes a batch script that performs actions on the OneNote object model, using the request context of a previously-created API object. - * @param object - A previously-created API object. The batch will use the same request context as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". - * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @remarks - * In addition to this signature, the method also has the following signatures: - * - * `run(batch: (context: OneNote.RequestContext) => Promise): Promise;` - * - * `run(objects: OfficeExtension.ClientObject[], batch: (context: OneNote.RequestContext) => Promise): Promise;` - */ - function run(object: OfficeExtension.ClientObject, batch: (context: OneNote.RequestContext) => Promise): Promise; } @@ -55267,7 +56198,7 @@ declare namespace Visio { pageName: string; /** * - * Gets the shape object that raised the ShapeMouseEnter event. + * Gets the name of the shape object that raised the ShapeMouseEnter event. * * [Api set: 1.1] */ @@ -55289,7 +56220,7 @@ declare namespace Visio { pageName: string; /** * - * Gets the shape object that raised the ShapeMouseLeave event. + * Gets the name of the shape object that raised the ShapeMouseLeave event. * * [Api set: 1.1] */ @@ -55311,7 +56242,7 @@ declare namespace Visio { pageName: string; /** * - * Gets the success/failure of the PageLoadComplete event. + * Gets the success or failure of the PageLoadComplete event. * * [Api set: 1.1] */ @@ -55333,7 +56264,7 @@ declare namespace Visio { document: Visio.Document; /** * - * Gets the success/failure of the DataRefreshComplete event. + * Gets the success or failure of the DataRefreshComplete event. * * [Api set: 1.1] */ @@ -55355,22 +56286,44 @@ declare namespace Visio { pageName: string; /** * - * Gets the ShapeCollection object that raised the SelectionChanged event. + * Gets the array of shape names that raised the SelectionChanged event. * * [Api set: 1.1] */ - shapeNames: Array; + shapeNames: string[]; } /** * - * Provides information about the drawing that raised the DiagramLoadComplete event. + * Provides information about the success or failure of the DocumentLoadComplete event. * * [Api set: 1.1] */ interface DocumentLoadCompleteEventArgs { /** * - * Gets the success/failure of the DocumentLoadComplete event. + * Gets the success or failure of the DocumentLoadComplete event. + * + * [Api set: 1.1] + */ + success: boolean; + } + /** + * + * Provides information about the page that raised the PageRenderComplete event. + * + * [Api set: 1.1] + */ + interface PageRenderCompleteEventArgs { + /** + * + * Gets the name of the page that raised the PageLoad event. + * + * [Api set: 1.1] + */ + pageName: string; + /** + * + * Gets the success/failure of the PageRender event. * * [Api set: 1.1] */ @@ -55385,36 +56338,66 @@ declare namespace Visio { class Application extends OfficeExtension.ClientObject { /** * - * Show/Hide the application borders. + * Show or hide the iFrame application borders. * * [Api set: 1.1] */ showBorders: boolean; /** * - * Show or Hide the standard toolbars. + * Show or hide the standard toolbars. * * [Api set: 1.1] */ showToolbars: boolean; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.ApplicationUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Visio.Application): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ApplicationUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Application): void; + set(properties: Visio.Application): void; /** * - * Show or Hide a particular toolbar. + * Sets the visibility of a specific toolbar in the application. * * [Api set: 1.1] + * + * @param id The type of the Toolbar + * @param show Whether the toolbar is visibile or not. */ - showToolbar(id: string, show: boolean): void; + showToolbar(id: Visio.ToolBarType, show: boolean): void; + /** + * + * Sets the visibility of a specific toolbar in the application. + * + * [Api set: 1.1] + * + * @param id The type of the Toolbar + * @param show Whether the toolbar is visibile or not. + */ + showToolbar(id: "CommandBar" | "PageNavigationBar" | "StatusBar", show: boolean): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.Application` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.Application` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.Application` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.ApplicationLoadOptions): Visio.Application; load(option?: string | string[]): Visio.Application; @@ -55447,20 +56430,25 @@ declare namespace Visio { readonly pages: Visio.PageCollection; /** * - * Returns the DocumentView object. + * Returns the DocumentView object. Read-only. * * [Api set: 1.1] */ readonly view: Visio.DocumentView; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.DocumentUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Visio.Document): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.DocumentUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Document): void; + set(properties: Visio.Document): void; /** * * Returns the Active Page of the document. @@ -55486,6 +56474,18 @@ declare namespace Visio { startDataRefresh(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.Document` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.Document` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.Document` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.DocumentLoadOptions): Visio.Document; load(option?: string | string[]): Visio.Document; @@ -55567,22 +56567,39 @@ declare namespace Visio { disableZoom: boolean; /** * - * Disable Hyperlinks. + * Hide Diagram Boundary. * * [Api set: 1.1] */ hideDiagramBoundary: boolean; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.DocumentViewUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Visio.DocumentView): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.DocumentViewUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: DocumentView): void; + set(properties: Visio.DocumentView): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.DocumentView` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.DocumentView` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.DocumentView` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.DocumentViewLoadOptions): Visio.DocumentView; load(option?: string | string[]): Visio.DocumentView; @@ -55601,21 +56618,21 @@ declare namespace Visio { class Page extends OfficeExtension.ClientObject { /** * - * All shapes in the page. Read-only. + * All shapes in the Page, including subshapes. Read-only. * * [Api set: 1.1] */ readonly allShapes: Visio.ShapeCollection; /** * - * Returns the Comments Collection + * Returns the Comments Collection. Read-only. * * [Api set: 1.1] */ readonly comments: Visio.CommentCollection; /** * - * Shapes at root level, in the page. Read-only. + * All top-level shapes in the Page.Read-only. * * [Api set: 1.1] */ @@ -55636,7 +56653,7 @@ declare namespace Visio { readonly height: number; /** * - * Index of the Page. + * Index of the Page. Read-only. * * [Api set: 1.1] */ @@ -55662,15 +56679,20 @@ declare namespace Visio { * [Api set: 1.1] */ readonly width: number; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.PageUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Visio.Page): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PageUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Page): void; + set(properties: Visio.Page): void; /** * * Set the page as Active Page of the document. @@ -55680,6 +56702,18 @@ declare namespace Visio { activate(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.Page` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.Page` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.Page` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.PageLoadOptions): Visio.Page; load(option?: string | string[]): Visio.Page; @@ -55698,20 +56732,25 @@ declare namespace Visio { class PageView extends OfficeExtension.ClientObject { /** * - * Get/Set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. + * Get and set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. * * [Api set: 1.1] */ zoom: number; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.PageViewUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Visio.PageView): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PageViewUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: PageView): void; + set(properties: Visio.PageView): void; /** * * Pans the Visio drawing to place the specified shape in the center of the view. @@ -55762,6 +56801,18 @@ declare namespace Visio { setPosition(Position: Visio.Position): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.PageView` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.PageView` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.PageView` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.PageViewLoadOptions): Visio.PageView; load(option?: string | string[]): Visio.PageView; @@ -55779,7 +56830,7 @@ declare namespace Visio { */ class PageCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: Visio.Page[]; /** * * Gets the number of pages in the collection. @@ -55798,6 +56849,18 @@ declare namespace Visio { getItem(key: number | string): Visio.Page; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.PageCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.PageCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.PageCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.PageCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.PageCollection; load(option?: string | string[]): Visio.PageCollection; @@ -55812,7 +56875,7 @@ declare namespace Visio { */ class ShapeCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: Visio.Shape[]; /** * * Gets the number of Shapes in the collection. @@ -55831,6 +56894,18 @@ declare namespace Visio { getItem(key: number | string): Visio.Shape; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.ShapeCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.ShapeCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.ShapeCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.ShapeCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.ShapeCollection; load(option?: string | string[]): Visio.ShapeCollection; @@ -55846,7 +56921,7 @@ declare namespace Visio { class Shape extends OfficeExtension.ClientObject { /** * - * Returns the Comments Collection + * Returns the Comments Collection. Read-only. * * [Api set: 1.1] */ @@ -55867,7 +56942,7 @@ declare namespace Visio { readonly shapeDataItems: Visio.ShapeDataItemCollection; /** * - * Gets SubShape Collection. + * Gets SubShape Collection. Read-only. * * [Api set: 1.1] */ @@ -55881,14 +56956,14 @@ declare namespace Visio { readonly view: Visio.ShapeView; /** * - * Shape's Identifier. + * Shape's identifier. Read-only. * * [Api set: 1.1] */ readonly id: number; /** * - * Shape's name. + * Shape's name. Read-only. * * [Api set: 1.1] */ @@ -55902,20 +56977,25 @@ declare namespace Visio { select: boolean; /** * - * Shape's Text. + * Shape's text. Read-only. * * [Api set: 1.1] */ readonly text: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.ShapeUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Visio.Shape): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ShapeUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Shape): void; + set(properties: Visio.Shape): void; /** * * Returns the BoundingBox object that specifies bounding box of the shape. @@ -55925,6 +57005,18 @@ declare namespace Visio { getBounds(): OfficeExtension.ClientResult; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.Shape` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.Shape` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.Shape` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.ShapeLoadOptions): Visio.Shape; load(option?: string | string[]): Visio.Shape; @@ -55948,29 +57040,48 @@ declare namespace Visio { * [Api set: 1.1] */ highlight: Visio.Highlight; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.ShapeViewUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Visio.ShapeView): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ShapeViewUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: ShapeView): void; + set(properties: Visio.ShapeView): void; /** * * Adds an overlay on top of the shape. * * [Api set: 1.1] * - * @param OverlayType An Overlay Type -Text, Image. + * @param OverlayType An Overlay Type. Can be 'Text' or 'Image'. * @param Content Content of Overlay. - * @param OverlayHorizontalAlignment Horizontal Alignment of Overlay - Left, Center, Right - * @param OverlayVerticalAlignment Vertical Alignment of Overlay - Top, Middle, Bottom + * @param OverlayHorizontalAlignment Horizontal Alignment of Overlay. Can be 'Left', 'Center', or 'Right'. + * @param OverlayVerticalAlignment Vertical Alignment of Overlay. Can be 'Top', 'Middle', 'Bottom'. * @param Width Overlay Width. * @param Height Overlay Height. */ - addOverlay(OverlayType: string, Content: string, OverlayHorizontalAlignment: string, OverlayVerticalAlignment: string, Width: number, Height: number): OfficeExtension.ClientResult; + addOverlay(OverlayType: Visio.OverlayType, Content: string, OverlayHorizontalAlignment: Visio.OverlayHorizontalAlignment, OverlayVerticalAlignment: Visio.OverlayVerticalAlignment, Width: number, Height: number): OfficeExtension.ClientResult; + /** + * + * Adds an overlay on top of the shape. + * + * [Api set: 1.1] + * + * @param OverlayType An Overlay Type. Can be 'Text' or 'Image'. + * @param Content Content of Overlay. + * @param OverlayHorizontalAlignment Horizontal Alignment of Overlay. Can be 'Left', 'Center', or 'Right'. + * @param OverlayVerticalAlignment Vertical Alignment of Overlay. Can be 'Top', 'Middle', 'Bottom'. + * @param Width Overlay Width. + * @param Height Overlay Height. + */ + addOverlay(OverlayType: "Text" | "Image", Content: string, OverlayHorizontalAlignment: "Left" | "Center" | "Right", OverlayVerticalAlignment: "Top" | "Middle" | "Bottom", Width: number, Height: number): OfficeExtension.ClientResult; /** * * Removes particular overlay or all overlays on the Shape. @@ -55982,6 +57093,18 @@ declare namespace Visio { removeOverlay(OverlayId: number): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.ShapeView` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.ShapeView` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.ShapeView` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.ShapeViewLoadOptions): Visio.ShapeView; load(option?: string | string[]): Visio.ShapeView; @@ -56079,7 +57202,7 @@ declare namespace Visio { */ class ShapeDataItemCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: Visio.ShapeDataItem[]; /** * * Gets the number of Shape Data Items. @@ -56098,6 +57221,18 @@ declare namespace Visio { getItem(key: string): Visio.ShapeDataItem; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.ShapeDataItemCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.ShapeDataItemCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.ShapeDataItemCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.ShapeDataItemCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.ShapeDataItemCollection; load(option?: string | string[]): Visio.ShapeDataItemCollection; @@ -56113,34 +57248,46 @@ declare namespace Visio { class ShapeDataItem extends OfficeExtension.ClientObject { /** * - * A string that specifies the format of the shape data item. + * A string that specifies the format of the shape data item. Read-only. * * [Api set: 1.1] */ readonly format: string; /** * - * A string that specifies the formatted value of the shape data item. + * A string that specifies the formatted value of the shape data item. Read-only. * * [Api set: 1.1] */ readonly formattedValue: string; /** * - * A string that specifies the label of the shape data item. + * A string that specifies the label of the shape data item. Read-only. * * [Api set: 1.1] */ readonly label: string; /** * - * A string that specifies the value of the shape data item. + * A string that specifies the value of the shape data item. Read-only. * * [Api set: 1.1] */ readonly value: string; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.ShapeDataItem` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.ShapeDataItem` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.ShapeDataItem` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.ShapeDataItemLoadOptions): Visio.ShapeDataItem; load(option?: string | string[]): Visio.ShapeDataItem; @@ -56158,7 +57305,7 @@ declare namespace Visio { */ class HyperlinkCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: Visio.Hyperlink[]; /** * * Gets the number of hyperlinks. @@ -56177,6 +57324,18 @@ declare namespace Visio { getItem(Key: number | string): Visio.Hyperlink; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.HyperlinkCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.HyperlinkCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.HyperlinkCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.HyperlinkCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.HyperlinkCollection; load(option?: string | string[]): Visio.HyperlinkCollection; @@ -56192,34 +57351,46 @@ declare namespace Visio { class Hyperlink extends OfficeExtension.ClientObject { /** * - * Gets the address of the Hyperlink object. + * Gets the address of the Hyperlink object. Read-only. * * [Api set: 1.1] */ readonly address: string; /** * - * Gets the description of a hyperlink. + * Gets the description of a hyperlink. Read-only. * * [Api set: 1.1] */ readonly description: string; /** * - * Gets the extra info of a hyperlink. + * Gets the extra URL request information used to resolve the hyperlink's URL. Read-only. * * [Api set: 1.1] */ readonly extraInfo: string; /** * - * Gets the sub-address of the Hyperlink object. + * Gets the sub-address of the Hyperlink object. Read-only. * * [Api set: 1.1] */ readonly subAddress: string; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.Hyperlink` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.Hyperlink` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.Hyperlink` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.HyperlinkLoadOptions): Visio.Hyperlink; load(option?: string | string[]): Visio.Hyperlink; @@ -56237,10 +57408,10 @@ declare namespace Visio { */ class CommentCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ - readonly items: Array; + readonly items: Visio.Comment[]; /** * - * Gets the number of Shape Data Items. + * Gets the number of Comments. * * [Api set: 1.1] */ @@ -56256,6 +57427,18 @@ declare namespace Visio { getItem(key: string): Visio.Comment; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.CommentCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.CommentCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.CommentCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.CommentCollectionLoadOptions & Visio.Interfaces.CollectionLoadOptions): Visio.CommentCollection; load(option?: string | string[]): Visio.CommentCollection; @@ -56271,36 +57454,53 @@ declare namespace Visio { class Comment extends OfficeExtension.ClientObject { /** * - * A string that specifies the label of the shape data item. + * A string that specifies the name of the author of the comment. * * [Api set: 1.1] */ author: string; /** * - * A string that specifies the format of the shape data item. + * A string that specifies the date when the comment was created. * * [Api set: 1.1] */ date: string; /** * - * A string that specifies the value of the shape data item. + * A string that contains the comment text. * * [Api set: 1.1] */ text: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ - set(properties: Interfaces.CommentUpdateData, options?: { - /** - * Throw an error if the passed-in property list includes read-only properties (default = true). - */ - throwOnReadOnly?: boolean; - }): void; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Visio.Comment): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.CommentUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Comment): void; + set(properties: Visio.Comment): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.Comment` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.Comment` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.Comment` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Visio.Interfaces.CommentLoadOptions): Visio.Comment; load(option?: string | string[]): Visio.Comment; @@ -56319,13 +57519,25 @@ declare namespace Visio { class Selection extends OfficeExtension.ClientObject { /** * - * Gets the Shapes of the Selection + * Gets the Shapes of the Selection. Read-only. * * [Api set: 1.1] */ readonly shapes: Visio.ShapeCollection; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Visio.Selection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Visio.Selection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.Selection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: string | string[]): Visio.Selection; load(option?: { @@ -56340,25 +57552,25 @@ declare namespace Visio { * * [Api set: 1.1] */ - namespace OverlayHorizontalAlignment { + enum OverlayHorizontalAlignment { /** * * left * */ - var left: string; + left = "Left", /** * * center * */ - var center: string; + center = "Center", /** * * right * */ - var right: string; + right = "Right", } /** * @@ -56366,25 +57578,25 @@ declare namespace Visio { * * [Api set: 1.1] */ - namespace OverlayVerticalAlignment { + enum OverlayVerticalAlignment { /** * * top * */ - var top: string; + top = "Top", /** * * middle * */ - var middle: string; + middle = "Middle", /** * * bottom * */ - var bottom: string; + bottom = "Bottom", } /** * @@ -56392,19 +57604,19 @@ declare namespace Visio { * * [Api set: 1.1] */ - namespace OverlayType { + enum OverlayType { /** * * text * */ - var text: string; + text = "Text", /** * * image * */ - var image: string; + image = "Image", } /** * @@ -56412,51 +57624,60 @@ declare namespace Visio { * * [Api set: 1.1] */ - namespace ToolBarType { + enum ToolBarType { /** * * CommandBar * */ - var commandBar: string; + commandBar = "CommandBar", /** * * PageNavigationBar * */ - var pageNavigationBar: string; + pageNavigationBar = "PageNavigationBar", /** * * StatusBar * */ - var statusBar: string; + statusBar = "StatusBar", } - namespace ErrorCodes { - var accessDenied: string; - var generalException: string; - var invalidArgument: string; - var itemNotFound: string; - var notImplemented: string; - var unsupportedOperation: string; + enum ErrorCodes { + accessDenied = "AccessDenied", + generalException = "GeneralException", + invalidArgument = "InvalidArgument", + itemNotFound = "ItemNotFound", + notImplemented = "NotImplemented", + unsupportedOperation = "UnsupportedOperation", } - namespace Interfaces { + module Interfaces { + /** + * Provides ways to load properties of only a subset of members of a collection. + */ interface CollectionLoadOptions { + /** + * Specify the number of items in the queried collection to be included in the result. + */ $top?: number; + /** + * Specify the number of items in the collection that are to be skipped and not included in the result. If top is specified, the selection of result will start after skipping the specified number of items. + */ $skip?: number; } /** An interface for updating data on the Application object, for use in "application.set({ ... })". */ interface ApplicationUpdateData { /** * - * Show/Hide the application borders. + * Show or hide the iFrame application borders. * * [Api set: 1.1] */ showBorders?: boolean; /** * - * Show or Hide the standard toolbars. + * Show or hide the standard toolbars. * * [Api set: 1.1] */ @@ -56504,7 +57725,7 @@ declare namespace Visio { disableZoom?: boolean; /** * - * Disable Hyperlinks. + * Hide Diagram Boundary. * * [Api set: 1.1] */ @@ -56524,7 +57745,7 @@ declare namespace Visio { interface PageViewUpdateData { /** * - * Get/Set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. + * Get and set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. * * [Api set: 1.1] */ @@ -56581,21 +57802,21 @@ declare namespace Visio { interface CommentUpdateData { /** * - * A string that specifies the label of the shape data item. + * A string that specifies the name of the author of the comment. * * [Api set: 1.1] */ author?: string; /** * - * A string that specifies the format of the shape data item. + * A string that specifies the date when the comment was created. * * [Api set: 1.1] */ date?: string; /** * - * A string that specifies the value of the shape data item. + * A string that contains the comment text. * * [Api set: 1.1] */ @@ -56605,14 +57826,14 @@ declare namespace Visio { interface ApplicationData { /** * - * Show/Hide the application borders. + * Show or hide the iFrame application borders. * * [Api set: 1.1] */ showBorders?: boolean; /** * - * Show or Hide the standard toolbars. + * Show or hide the standard toolbars. * * [Api set: 1.1] */ @@ -56636,7 +57857,7 @@ declare namespace Visio { pages?: Visio.Interfaces.PageData[]; /** * - * Returns the DocumentView object. + * Returns the DocumentView object. Read-only. * * [Api set: 1.1] */ @@ -56667,7 +57888,7 @@ declare namespace Visio { disableZoom?: boolean; /** * - * Disable Hyperlinks. + * Hide Diagram Boundary. * * [Api set: 1.1] */ @@ -56677,21 +57898,21 @@ declare namespace Visio { interface PageData { /** * - * All shapes in the page. Read-only. + * All shapes in the Page, including subshapes. Read-only. * * [Api set: 1.1] */ allShapes?: Visio.Interfaces.ShapeData[]; /** * - * Returns the Comments Collection + * Returns the Comments Collection. Read-only. * * [Api set: 1.1] */ comments?: Visio.Interfaces.CommentData[]; /** * - * Shapes at root level, in the page. Read-only. + * All top-level shapes in the Page.Read-only. * * [Api set: 1.1] */ @@ -56712,7 +57933,7 @@ declare namespace Visio { height?: number; /** * - * Index of the Page. + * Index of the Page. Read-only. * * [Api set: 1.1] */ @@ -56743,7 +57964,7 @@ declare namespace Visio { interface PageViewData { /** * - * Get/Set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. + * Get and set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. * * [Api set: 1.1] */ @@ -56761,7 +57982,7 @@ declare namespace Visio { interface ShapeData { /** * - * Returns the Comments Collection + * Returns the Comments Collection. Read-only. * * [Api set: 1.1] */ @@ -56782,7 +58003,7 @@ declare namespace Visio { shapeDataItems?: Visio.Interfaces.ShapeDataItemData[]; /** * - * Gets SubShape Collection. + * Gets SubShape Collection. Read-only. * * [Api set: 1.1] */ @@ -56796,14 +58017,14 @@ declare namespace Visio { view?: Visio.Interfaces.ShapeViewData; /** * - * Shape's Identifier. + * Shape's identifier. Read-only. * * [Api set: 1.1] */ id?: number; /** * - * Shape's name. + * Shape's name. Read-only. * * [Api set: 1.1] */ @@ -56817,7 +58038,7 @@ declare namespace Visio { select?: boolean; /** * - * Shape's Text. + * Shape's text. Read-only. * * [Api set: 1.1] */ @@ -56841,28 +58062,28 @@ declare namespace Visio { interface ShapeDataItemData { /** * - * A string that specifies the format of the shape data item. + * A string that specifies the format of the shape data item. Read-only. * * [Api set: 1.1] */ format?: string; /** * - * A string that specifies the formatted value of the shape data item. + * A string that specifies the formatted value of the shape data item. Read-only. * * [Api set: 1.1] */ formattedValue?: string; /** * - * A string that specifies the label of the shape data item. + * A string that specifies the label of the shape data item. Read-only. * * [Api set: 1.1] */ label?: string; /** * - * A string that specifies the value of the shape data item. + * A string that specifies the value of the shape data item. Read-only. * * [Api set: 1.1] */ @@ -56876,28 +58097,28 @@ declare namespace Visio { interface HyperlinkData { /** * - * Gets the address of the Hyperlink object. + * Gets the address of the Hyperlink object. Read-only. * * [Api set: 1.1] */ address?: string; /** * - * Gets the description of a hyperlink. + * Gets the description of a hyperlink. Read-only. * * [Api set: 1.1] */ description?: string; /** * - * Gets the extra info of a hyperlink. + * Gets the extra URL request information used to resolve the hyperlink's URL. Read-only. * * [Api set: 1.1] */ extraInfo?: string; /** * - * Gets the sub-address of the Hyperlink object. + * Gets the sub-address of the Hyperlink object. Read-only. * * [Api set: 1.1] */ @@ -56911,21 +58132,21 @@ declare namespace Visio { interface CommentData { /** * - * A string that specifies the label of the shape data item. + * A string that specifies the name of the author of the comment. * * [Api set: 1.1] */ author?: string; /** * - * A string that specifies the format of the shape data item. + * A string that specifies the date when the comment was created. * * [Api set: 1.1] */ date?: string; /** * - * A string that specifies the value of the shape data item. + * A string that contains the comment text. * * [Api set: 1.1] */ @@ -56935,7 +58156,7 @@ declare namespace Visio { interface SelectionData { /** * - * Gets the Shapes of the Selection + * Gets the Shapes of the Selection. Read-only. * * [Api set: 1.1] */ @@ -56951,14 +58172,14 @@ declare namespace Visio { $all?: boolean; /** * - * Show/Hide the application borders. + * Show or hide the iFrame application borders. * * [Api set: 1.1] */ showBorders?: boolean; /** * - * Show or Hide the standard toolbars. + * Show or hide the standard toolbars. * * [Api set: 1.1] */ @@ -57018,7 +58239,7 @@ declare namespace Visio { disableZoom?: boolean; /** * - * Disable Hyperlinks. + * Hide Diagram Boundary. * * [Api set: 1.1] */ @@ -57048,7 +58269,7 @@ declare namespace Visio { height?: boolean; /** * - * Index of the Page. + * Index of the Page. Read-only. * * [Api set: 1.1] */ @@ -57085,7 +58306,7 @@ declare namespace Visio { $all?: boolean; /** * - * Get/Set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. + * Get and set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom. * * [Api set: 1.1] */ @@ -57115,7 +58336,7 @@ declare namespace Visio { height?: boolean; /** * - * For EACH ITEM in the collection: Index of the Page. + * For EACH ITEM in the collection: Index of the Page. Read-only. * * [Api set: 1.1] */ @@ -57159,14 +58380,14 @@ declare namespace Visio { view?: Visio.Interfaces.ShapeViewLoadOptions; /** * - * For EACH ITEM in the collection: Shape's Identifier. + * For EACH ITEM in the collection: Shape's identifier. Read-only. * * [Api set: 1.1] */ id?: boolean; /** * - * For EACH ITEM in the collection: Shape's name. + * For EACH ITEM in the collection: Shape's name. Read-only. * * [Api set: 1.1] */ @@ -57180,7 +58401,7 @@ declare namespace Visio { select?: boolean; /** * - * For EACH ITEM in the collection: Shape's Text. + * For EACH ITEM in the collection: Shape's text. Read-only. * * [Api set: 1.1] */ @@ -57203,14 +58424,14 @@ declare namespace Visio { view?: Visio.Interfaces.ShapeViewLoadOptions; /** * - * Shape's Identifier. + * Shape's identifier. Read-only. * * [Api set: 1.1] */ id?: boolean; /** * - * Shape's name. + * Shape's name. Read-only. * * [Api set: 1.1] */ @@ -57224,7 +58445,7 @@ declare namespace Visio { select?: boolean; /** * - * Shape's Text. + * Shape's text. Read-only. * * [Api set: 1.1] */ @@ -57256,28 +58477,28 @@ declare namespace Visio { $all?: boolean; /** * - * For EACH ITEM in the collection: A string that specifies the format of the shape data item. + * For EACH ITEM in the collection: A string that specifies the format of the shape data item. Read-only. * * [Api set: 1.1] */ format?: boolean; /** * - * For EACH ITEM in the collection: A string that specifies the formatted value of the shape data item. + * For EACH ITEM in the collection: A string that specifies the formatted value of the shape data item. Read-only. * * [Api set: 1.1] */ formattedValue?: boolean; /** * - * For EACH ITEM in the collection: A string that specifies the label of the shape data item. + * For EACH ITEM in the collection: A string that specifies the label of the shape data item. Read-only. * * [Api set: 1.1] */ label?: boolean; /** * - * For EACH ITEM in the collection: A string that specifies the value of the shape data item. + * For EACH ITEM in the collection: A string that specifies the value of the shape data item. Read-only. * * [Api set: 1.1] */ @@ -57293,28 +58514,28 @@ declare namespace Visio { $all?: boolean; /** * - * A string that specifies the format of the shape data item. + * A string that specifies the format of the shape data item. Read-only. * * [Api set: 1.1] */ format?: boolean; /** * - * A string that specifies the formatted value of the shape data item. + * A string that specifies the formatted value of the shape data item. Read-only. * * [Api set: 1.1] */ formattedValue?: boolean; /** * - * A string that specifies the label of the shape data item. + * A string that specifies the label of the shape data item. Read-only. * * [Api set: 1.1] */ label?: boolean; /** * - * A string that specifies the value of the shape data item. + * A string that specifies the value of the shape data item. Read-only. * * [Api set: 1.1] */ @@ -57330,28 +58551,28 @@ declare namespace Visio { $all?: boolean; /** * - * For EACH ITEM in the collection: Gets the address of the Hyperlink object. + * For EACH ITEM in the collection: Gets the address of the Hyperlink object. Read-only. * * [Api set: 1.1] */ address?: boolean; /** * - * For EACH ITEM in the collection: Gets the description of a hyperlink. + * For EACH ITEM in the collection: Gets the description of a hyperlink. Read-only. * * [Api set: 1.1] */ description?: boolean; /** * - * For EACH ITEM in the collection: Gets the extra info of a hyperlink. + * For EACH ITEM in the collection: Gets the extra URL request information used to resolve the hyperlink's URL. Read-only. * * [Api set: 1.1] */ extraInfo?: boolean; /** * - * For EACH ITEM in the collection: Gets the sub-address of the Hyperlink object. + * For EACH ITEM in the collection: Gets the sub-address of the Hyperlink object. Read-only. * * [Api set: 1.1] */ @@ -57367,28 +58588,28 @@ declare namespace Visio { $all?: boolean; /** * - * Gets the address of the Hyperlink object. + * Gets the address of the Hyperlink object. Read-only. * * [Api set: 1.1] */ address?: boolean; /** * - * Gets the description of a hyperlink. + * Gets the description of a hyperlink. Read-only. * * [Api set: 1.1] */ description?: boolean; /** * - * Gets the extra info of a hyperlink. + * Gets the extra URL request information used to resolve the hyperlink's URL. Read-only. * * [Api set: 1.1] */ extraInfo?: boolean; /** * - * Gets the sub-address of the Hyperlink object. + * Gets the sub-address of the Hyperlink object. Read-only. * * [Api set: 1.1] */ @@ -57404,21 +58625,21 @@ declare namespace Visio { $all?: boolean; /** * - * For EACH ITEM in the collection: A string that specifies the label of the shape data item. + * For EACH ITEM in the collection: A string that specifies the name of the author of the comment. * * [Api set: 1.1] */ author?: boolean; /** * - * For EACH ITEM in the collection: A string that specifies the format of the shape data item. + * For EACH ITEM in the collection: A string that specifies the date when the comment was created. * * [Api set: 1.1] */ date?: boolean; /** * - * For EACH ITEM in the collection: A string that specifies the value of the shape data item. + * For EACH ITEM in the collection: A string that contains the comment text. * * [Api set: 1.1] */ @@ -57434,21 +58655,21 @@ declare namespace Visio { $all?: boolean; /** * - * A string that specifies the label of the shape data item. + * A string that specifies the name of the author of the comment. * * [Api set: 1.1] */ author?: boolean; /** * - * A string that specifies the format of the shape data item. + * A string that specifies the date when the comment was created. * * [Api set: 1.1] */ date?: boolean; /** * - * A string that specifies the value of the shape data item. + * A string that contains the comment text. * * [Api set: 1.1] */ @@ -57475,30 +58696,21 @@ declare namespace Visio { * @param batch - A function that takes in an Visio.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. */ function run(object: OfficeExtension.ClientObject | OfficeExtension.EmbeddedSession, batch: (context: Visio.RequestContext) => Promise): Promise; - + /** + * Executes a batch script that performs actions on the Visio object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * @param contextObject - A previously-created Visio.RequestContext. This context will get re-used by the batch function (instead of having a new context created). This means that the batch will be able to pick up changes made to existing API objects, if those objects were derived from this same context. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Visio application. Since the Office add-in and the Visio application run in two different processes, the RequestContext is required to get access to the Visio object model from the add-in. + */ + function run(contextObject: OfficeExtension.ClientRequestContext, batch: (context: Visio.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Visio object model, using the request context of previously-created API objects. * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared request context, which means that any changes applied to these objects will be picked up by "context.sync()". * @param batch - A function that takes in a Visio.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. */ function run(objects: OfficeExtension.ClientObject[], batch: (context: Visio.RequestContext) => Promise): Promise; - /** - * Executes a batch script that performs actions on the Visio object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param contextObject - A previously-created Visio.RequestContext. This context will get re-used by the batch function (instead of having a new context created). This means that the batch will be able to pick up changes made to existing API objects, if those objects were derived from this same context. - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Visio application. Since the Office add-in and the Visio application run in two different processes, the RequestContext is required to get access to the Visio object model from the add-in. - * @remarks - * In addition to this signature, the method also has the following signatures: - * - * `run(batch: (context: Visio.RequestContext) => Promise): Promise;` - * - * `run(object: OfficeExtension.ClientObject | OfficeExtension.EmbeddedSession, batch: (context: Visio.RequestContext) => Promise): Promise;` - * - * `run(objects: OfficeExtension.ClientObject[], batch: (context: Visio.RequestContext) => Promise): Promise;` - */ - function run(contextObject: OfficeExtension.ClientRequestContext, batch: (context: Visio.RequestContext) => Promise): Promise; } //////////////////////////////////////////////////////////////// //////////////////////// End Visio APIs //////////////////////// -//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// \ No newline at end of file From 165cfcfbbff262ae5dffd854d3aeb684612668eb Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Sat, 21 Jul 2018 08:46:16 +0800 Subject: [PATCH 143/738] update weixin-app's request method (#27368) --- types/weixin-app/index.d.ts | 18 +++++++++++++++--- types/weixin-app/weixin-app-tests.ts | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/types/weixin-app/index.d.ts b/types/weixin-app/index.d.ts index 03dfb8fc8f..2f7edd8476 100644 --- a/types/weixin-app/index.d.ts +++ b/types/weixin-app/index.d.ts @@ -9,7 +9,11 @@ declare namespace wx { // #region 基本参数 interface DataResponse { /** 回调函数返回的内容 */ - data: any; + data: object | string | ArrayBuffer; + /** 开发者服务器返回的 HTTP 状态码 */ + statusCode: number; + /** 开发者服务器返回的 HTTP Response Header */ + header: object; } interface ErrMsgResponse { /** 成功:ok,错误:详细信息 */ @@ -37,7 +41,7 @@ declare namespace wx { /** 开发者服务器接口地址 */ url: string; /** 请求的参数 */ - data?: string | any; + data?: string | object | ArrayBuffer; /** 设置请求的 header , header 中不能设置 Referer */ header?: RequestHeader; /** 默认为 GET,有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT */ @@ -55,7 +59,15 @@ declare namespace wx { /** * wx.request发起的是https请求。一个微信小程序,同时只能有5个网络请求连接。 */ - function request(options: RequestOptions): void; + function request(options: RequestOptions): RequestTask; + + /** + * 返回一个 requestTask 对象,通过 requestTask,可中断请求任务。 + */ + interface RequestTask { + abort(): void; + } + interface UploadTask { /** * 监听上传进度变化 diff --git a/types/weixin-app/weixin-app-tests.ts b/types/weixin-app/weixin-app-tests.ts index 0430dd9115..39943eba61 100644 --- a/types/weixin-app/weixin-app-tests.ts +++ b/types/weixin-app/weixin-app-tests.ts @@ -291,3 +291,18 @@ downloadTask.onProgressUpdate((res) => { }); downloadTask.abort(); // 取消下载任务 + +wx.request({ + url: 'https://www.baidu.com', + method: 'GET', + success(res) { + if (res.statusCode < 300) { + console.log(res.data); + } else { + console.warn(res.statusCode, res.header); + } + }, + fail(e) { + console.error(e); + } +}).abort(); From 859b3edaa7cbf7a2b9a805d9edd31d0c485091f4 Mon Sep 17 00:00:00 2001 From: Mitchell Grice Date: Sat, 21 Jul 2018 10:46:28 +1000 Subject: [PATCH 144/738] Google.Visualization correct column index type (#27383) Changed `columnIndex` to be a number like all its neighbours --- types/google.visualization/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/google.visualization/index.d.ts b/types/google.visualization/index.d.ts index 5a4e8f0b32..6f36ff881a 100644 --- a/types/google.visualization/index.d.ts +++ b/types/google.visualization/index.d.ts @@ -88,7 +88,7 @@ declare namespace google { getColumnProperties(columnIndex: number): Properties; getColumnProperty(columnIndex: number, name: string): any; getColumnRange(columnIndex: number): { min: any; max: any }; - getColumnRole(columnIndex: string): string; + getColumnRole(columnIndex: number): string; getColumnType(columnIndex: number): string; getDistinctValues(columnIndex: number): any[]; getFilteredRows(filters: DataTableCellFilter[]): number[]; From e02291c0925773526f21322b3f650233e0c61015 Mon Sep 17 00:00:00 2001 From: S McDowall Date: Fri, 20 Jul 2018 20:46:44 -0400 Subject: [PATCH 145/738] Enhanced return type of Koa Middleware (#27203) As a Koa Middleware, koa-response-time should indicate it returns a Middleware type not "any" which, in strict TS projects causes warnings. --- types/koa-response-time/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/koa-response-time/index.d.ts b/types/koa-response-time/index.d.ts index 17c3525682..d8315353fa 100644 --- a/types/koa-response-time/index.d.ts +++ b/types/koa-response-time/index.d.ts @@ -1,8 +1,11 @@ // Type definitions for koa-response-time 2.0 // Project: https://github.com/koajs/response-time#readme // Definitions by: Thor Sedeke +// Steven McDowall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare function koa_response_time(): any; +import { Middleware } from 'koa'; + +declare function koa_response_time(): Middleware; export = koa_response_time; From a43c276f2b8acb1172681d9dc9df54580d425ffc Mon Sep 17 00:00:00 2001 From: Nikolay Alexandrov Date: Sat, 21 Jul 2018 07:47:43 +0700 Subject: [PATCH 146/738] [mock-knex] Knex could return any type of data (#27390) --- types/mock-knex/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/mock-knex/index.d.ts b/types/mock-knex/index.d.ts index 8c3f022bc7..8a77dbbb14 100644 --- a/types/mock-knex/index.d.ts +++ b/types/mock-knex/index.d.ts @@ -52,6 +52,11 @@ export interface Tracker extends EventEmitter { event: "query", callback: (query: QueryDetails, step: number) => void ): this; + + once( + event: "query", + callback: (query: QueryDetails, step: number) => void + ): this; } /** @@ -73,7 +78,7 @@ export interface QueryDetails extends Knex.Sql { * * @param values An array of mock data to be returned by database. For Bookshelf this is mostly array of objects. Knex could return any type of data. */ - response(values: any[], options?: QueryDetailsResponseOption): void; + response(values: any, options?: QueryDetailsResponseOption): void; } export interface QueryDetailsResponseOption { From 1d4e623ccb75ce7fcd554b09e59ca5cc80229c7f Mon Sep 17 00:00:00 2001 From: Adam Haglund Date: Sat, 21 Jul 2018 02:50:03 +0200 Subject: [PATCH 147/738] add options to request.auth method (#27373) --- types/superagent/index.d.ts | 4 +++- types/superagent/superagent-tests.ts | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index c07d2fff1c..ffedf346ff 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -5,6 +5,7 @@ // Pap Lőrinc // Shrey Jain // Alec Zopf +// Adam Haglund // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -118,7 +119,8 @@ declare namespace request { abort(): void; accept(type: string): this; attach(field: string, file: MultipartValueSingle, options?: string | { filename?: string; contentType?: string }): this; - auth(user: string, name: string): this; + auth(user: string, pass: string, options?: { type: 'basic' | 'auto' }): this; + auth(token: string, options: { type: 'bearer' }): this; buffer(val?: boolean): this; ca(cert: Buffer): this; cert(cert: Buffer | string): this; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 0c4b51f31e..c063c819be 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -230,13 +230,29 @@ const reqCookies: string = req.cookies; console.log(`${reqMethod} request to ${reqUrl} cookies ${reqCookies}`); -// Basic authentication +// Authentication request.get('http://tobi:learnboost@local').end(callback); + request .get('http://local') .auth('tobo', 'learnboost') .end(callback); +request + .get('http://local') + .auth('user', 'pass', { type: 'basic' }) + .end(callback); + +request + .get('http://local') + .auth('user', 'pass', {type: 'auto'}) + .end(callback); + +request + .get('http://local') + .auth('abearertoken', { type: 'bearer' }) + .end(callback); + // Following redirects request .get('/some.png') From 6aa9bbdf5c9ccc79df66c10f754e67e8e25d175d Mon Sep 17 00:00:00 2001 From: Andrew Hyndman Date: Fri, 20 Jul 2018 17:50:26 -0700 Subject: [PATCH 148/738] component should expect a function as a child (#27401) --- types/react-sticky/index.d.ts | 18 +++++++++-- types/react-sticky/react-sticky-tests.tsx | 37 ++++++++++++----------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/types/react-sticky/index.d.ts b/types/react-sticky/index.d.ts index 9dac505d85..86091531e9 100644 --- a/types/react-sticky/index.d.ts +++ b/types/react-sticky/index.d.ts @@ -1,14 +1,28 @@ // Type definitions for react-sticky 6.0 // Project: https://github.com/captivationsoftware/react-sticky -// Definitions by: Matej Lednicky , Curtis Warren +// Definitions by: Matej Lednicky , +// Curtis Warren , +// Andrew Hyndman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 import * as React from "react"; -export const StickyContainer: React.ComponentClass>; +export const StickyContainer: React.ComponentClass< + React.HTMLAttributes +>; + +export interface StickyChildArgs { + style: React.CSSProperties; + isSticky: boolean; + wasSticky: boolean; + distanceFromTop: number; + distanceFromBottom: number; + calculatedHeight: number; +} export interface StickyProps { + children: (args: StickyChildArgs) => React.ReactElement; relative?: boolean; isActive?: boolean; className?: string; diff --git a/types/react-sticky/react-sticky-tests.tsx b/types/react-sticky/react-sticky-tests.tsx index 8284add89a..085bfe786c 100644 --- a/types/react-sticky/react-sticky-tests.tsx +++ b/types/react-sticky/react-sticky-tests.tsx @@ -1,26 +1,27 @@ import { Sticky, StickyContainer } from "react-sticky"; import * as React from "react"; -const StickyAllOptions: JSX.Element = +const StickyAllOptions: JSX.Element = ( undefined}> -
+ relative + disableHardwareAcceleration + isActive={true} + className="sticky" + style={{}} + stickyClassName="sticky" + stickyStyle={{}} + topOffset={0} + bottomOffset={0} + onStickyStateChange={(isSticky: boolean): void => undefined} + > + {({ style }) =>
} - ; + +); -const StickyNoOptions: JSX.Element = +const StickyNoOptions: JSX.Element = ( - -
- - ; + {({ style }) =>
} + +); From 89ac4daab13948e7c11a3e20dbea8c5e23f14d99 Mon Sep 17 00:00:00 2001 From: Jake Richards <36425972+jakejrichards@users.noreply.github.com> Date: Fri, 20 Jul 2018 20:50:38 -0400 Subject: [PATCH 149/738] Add missing waitFor types (#27331) --- types/puppeteer/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index b9a812aaeb..4859b86fc1 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -1107,6 +1107,16 @@ export interface FrameBase extends Evalable { ...args: any[] ): Promise; + waitForRequest( + urlOrPredicate: string | ((req: Request) => boolean), + options?: { timeout?: number } + ): Promise; + + waitForResponse( + urlOrPredicate: string | ((res: Response) => boolean), + options?: { timeout?: number } + ): Promise; + waitForSelector( selector: string, options?: { visible?: boolean; hidden?: boolean; timeout?: number } From f805351bd7214f0c7de749f8da3c774b32d64bdf Mon Sep 17 00:00:00 2001 From: nakagawa424 <35394755+nakagawa424@users.noreply.github.com> Date: Sat, 21 Jul 2018 09:50:56 +0900 Subject: [PATCH 150/738] typo (#27409) --- types/cytoscape/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 77a7d20dc3..29f28d2305 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -2382,12 +2382,12 @@ declare namespace cytoscape { * Get the elements in both this collection and another specified collection. * http://js.cytoscape.org/#eles.intersection */ - intersection: CollectionSymmetricDifferenceFunc; - intersect: CollectionSymmetricDifferenceFunc; - and: CollectionSymmetricDifferenceFunc; - n: CollectionSymmetricDifferenceFunc; - '&': CollectionSymmetricDifferenceFunc; - '.': CollectionSymmetricDifferenceFunc; + intersection: CollectionBuildingIntersectionFunc; + intersect: CollectionBuildingIntersectionFunc; + and: CollectionBuildingIntersectionFunc; + n: CollectionBuildingIntersectionFunc; + '&': CollectionBuildingIntersectionFunc; + '.': CollectionBuildingIntersectionFunc; /** * Get the elements that are in the calling collection From 5d63e04d343e978e275030e057a4511d86fc34db Mon Sep 17 00:00:00 2001 From: Will Koster Date: Fri, 20 Jul 2018 19:51:22 -0500 Subject: [PATCH 151/738] Fix type of mongodb.connect (#27398) It had never been updated from 2.x. Fixes #23548. --- types/mongodb/index.d.ts | 6 +++--- types/mongodb/mongodb-tests.ts | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 2849770ece..c58f690433 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -24,9 +24,9 @@ import { ObjectID } from 'bson'; import { EventEmitter } from 'events'; import { Readable, Writable } from "stream"; -export function connect(uri: string, options?: MongoClientOptions): Promise; -export function connect(uri: string, callback: MongoCallback): void; -export function connect(uri: string, options: MongoClientOptions, callback: MongoCallback): void; +export function connect(uri: string, options?: MongoClientOptions): Promise; +export function connect(uri: string, callback: MongoCallback): void; +export function connect(uri: string, options: MongoClientOptions, callback: MongoCallback): void; export { Binary, DBRef, Decimal128, Double, Long, MaxKey, MinKey, ObjectID, ObjectId, Timestamp } from 'bson'; diff --git a/types/mongodb/mongodb-tests.ts b/types/mongodb/mongodb-tests.ts index 12403bda37..5ffaf6818f 100644 --- a/types/mongodb/mongodb-tests.ts +++ b/types/mongodb/mongodb-tests.ts @@ -2,6 +2,8 @@ import mongodb = require('mongodb'); var MongoClient = mongodb.MongoClient; +const connectionString = 'mongodb://127.0.0.1:27017/test'; + var format = require('util').format; let options: mongodb.MongoClientOptions = { authSource: ' ', @@ -30,7 +32,7 @@ let options: mongodb.MongoClientOptions = { promoteBuffers: false, useNewUrlParser: false } -MongoClient.connect('mongodb://127.0.0.1:27017/test', options, function (err: mongodb.MongoError, client: mongodb.MongoClient) { +MongoClient.connect(connectionString, options, function (err: mongodb.MongoError, client: mongodb.MongoClient) { if (err) throw err; const db = client.db('test'); var collection = db.collection('test_insert'); @@ -166,3 +168,11 @@ MongoClient.connect('mongodb://127.0.0.1:27017/test', options, function (err: mo const res: mongodb.Cursor = testCollection.find({ _id: 123 }); } }) + +let testFunc = async () => { + let testClient: mongodb.MongoClient; + testClient = await mongodb.connect(connectionString); +}; + +mongodb.connect(connectionString, (err: mongodb.MongoError, client: mongodb.MongoClient) => {}); +mongodb.connect(connectionString, options, (err: mongodb.MongoError, client: mongodb.MongoClient) => {}); From 435aec3769623e091efacb9afc01c456158ace28 Mon Sep 17 00:00:00 2001 From: nakagawa424 <35394755+nakagawa424@users.noreply.github.com> Date: Sat, 21 Jul 2018 09:51:40 +0900 Subject: [PATCH 152/738] cytoscape: fix filtering functions (#27411) * cytoscape: fix map() * add tests * cytoscape: fix filtering functions --- types/cytoscape/cytoscape-tests.ts | 4 ++++ types/cytoscape/index.d.ts | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/types/cytoscape/cytoscape-tests.ts b/types/cytoscape/cytoscape-tests.ts index 7c9f5353c9..484b682fcc 100644 --- a/types/cytoscape/cytoscape-tests.ts +++ b/types/cytoscape/cytoscape-tests.ts @@ -553,6 +553,10 @@ eles.sort((a, b) => 1).map((ele, i, eles) => [i, ele]); eles.reduce((prev, ele, i, eles) => [...prev, [ele, i]], []).concat(['finish']); const min = eles.min((ele, i, eles) => ele.id.length + i); min.ele.scratch('min', min.value).scratch('min').value; const max = eles.max((ele, i, eles) => ele.id.length + i); max.ele.scratch('max', max.value); +nodes.min(n => n.degree(false)); +nodes.max(n => n.degree(false)); +edges.max(n => n.source().id().length); +edges.max(n => n.source().id().length); // TODO: traversing (need to actively check the nodes/edges distinction) // TODO: algorithms diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 29f28d2305..dddfb10fa3 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -2442,7 +2442,7 @@ declare namespace cytoscape { * var col = cy.collection(); // new, empty collection * col.merge('#j').merge('#e'); */ - merge(eles: CollectionArgument | string): this; + merge(eles: CollectionArgument | Selector): this; /** * Perform an in-place operation on the calling collection to remove the given elements. * @param eles The elements to remove in-place or a selector representing the elements to remove . @@ -2467,7 +2467,7 @@ declare namespace cytoscape { * col.merge( cy.nodes() ); * col.unmerge('#e'); */ - unmerge(eles: CollectionArgument | string): this; + unmerge(eles: CollectionArgument | Selector): this; /** * Get a new collection containing elements that are accepted by the specified filter. @@ -2504,7 +2504,7 @@ declare namespace cytoscape { * * http://js.cytoscape.org/#eles.sort */ - sort(sort: (ele1: CollectionArgument, ele2: CollectionArgument) => number): CollectionReturnValue; + sort(sort: (ele1: TOut, ele2: TOut) => number): CollectionReturnValue; /** * Get an array containing values mapped from the collection. @@ -2527,15 +2527,15 @@ declare namespace cytoscape { * given the previous value and the current element. * prevVal The value accumulated from previous elements. * ele The current element. - * ix The index of the current element. + * i The index of the current element. * eles The collection of elements being reduced. * @param initialValue The initial value for reducing * It is used also for type inference of output, but the type can be * also stated explicitly as generic * http://js.cytoscape.org/#eles.reduce */ - reduce(fn: (prevVal: T, ele: SingularElementReturnValue, - ix: number, eles: CollectionReturnValue) => T, initialValue: T): T; + reduce(fn: (prevVal: T, ele: TOut, + i: number, eles: CollectionArgument) => T, initialValue: T): T; /** * Find a minimum value in a collection. @@ -2548,11 +2548,11 @@ declare namespace cytoscape { * * http://js.cytoscape.org/#eles.min */ - min(fn: (ele: SingularElementArgument, i: number, eles: CollectionArgument) => any, thisArg?: any): { + min(fn: (ele: TOut, i: number, eles: CollectionArgument) => T, thisArg?: any): { /** * The minimum value found. */ - value: any, + value: T, /** * The element that corresponds to the minimum value. */ @@ -2570,11 +2570,11 @@ declare namespace cytoscape { * * http://js.cytoscape.org/#eles.max */ - max(fn: (ele: SingularElementArgument, i: number, eles: CollectionArgument) => any, thisArg?: any): { + max(fn: (ele: TOut, i: number, eles: CollectionArgument) => T, thisArg?: any): { /** * The minimum value found. */ - value: any, + value: T, /** * The element that corresponds to the minimum value. */ @@ -2676,14 +2676,14 @@ declare namespace cytoscape { * @param selector An optional selector that is used to filter the resultant collection. * http://js.cytoscape.org/#edge.source */ - source(selector?: Selector): NodeCollection; + source(selector?: Selector): NodeSingular; /** * Get target node of this edge. * @param selector An optional selector that is used to filter the resultant collection. * http://js.cytoscape.org/#edge.target */ - target(selector?: Selector): NodeCollection; + target(selector?: Selector): NodeSingular; } interface EdgeCollectionTraversing { // http://js.cytoscape.org/#collection/traversing From 7212e9a24258c20a0dfa31ec054539048d58b507 Mon Sep 17 00:00:00 2001 From: Zhu Zijia Date: Sat, 21 Jul 2018 08:52:46 +0800 Subject: [PATCH 153/738] Fix incorrect exports in npmlog (#27396) --- types/npmlog/index.d.ts | 52 +++++++++++++++++------------------- types/npmlog/npmlog-tests.ts | 5 ++-- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/types/npmlog/index.d.ts b/types/npmlog/index.d.ts index 5487c76dc7..9457012e3d 100644 --- a/types/npmlog/index.d.ts +++ b/types/npmlog/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for npmlog 4.1 // Project: https://github.com/npm/npmlog#readme // Definitions by: Daniel Schmidt +// Zhu Zijia // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -32,39 +33,34 @@ export interface MessageObject { } // TODO: newStream, newGroup, setGaugeTemplate and setGaugeTemplateSet need to be added -interface npmlog { - log(level: LogLevels | string, prefix: string, message: string, ...args: any[]): void; - silly(prefix: string, message: string, ...args: any[]): void; - verbose(prefix: string, message: string, ...args: any[]): void; - info(prefix: string, message: string, ...args: any[]): void; - http(prefix: string, message: string, ...args: any[]): void; - warn(prefix: string, message: string, ...args: any[]): void; - error(prefix: string, message: string, ...args: any[]): void; +export function log(level: LogLevels | string, prefix: string, message: string, ...args: any[]): void; - level: string; - record: MessageObject[]; - maxRecordSize: number; - prefixStyle: StyleObject; - headingStyle: StyleObject; - heading: string; - stream: any; // Defaults to process.stderr +export function silly(prefix: string, message: string, ...args: any[]): void; +export function verbose(prefix: string, message: string, ...args: any[]): void; +export function info(prefix: string, message: string, ...args: any[]): void; +export function http(prefix: string, message: string, ...args: any[]): void; +export function warn(prefix: string, message: string, ...args: any[]): void; +export function error(prefix: string, message: string, ...args: any[]): void; - enableColor(): void; - disableColor(): void; +export let level: string; +export let record: MessageObject[]; +export let maxRecordSize: number; +export let prefixStyle: StyleObject; +export let headingStyle: StyleObject; +export let heading: string; +export let stream: any; // Defaults to process.stderr - enableProgress(): void; - disableProgress(): void; +export function enableColor(): void; +export function disableColor(): void; - enableUnicode(): void; - disableUnicode(): void; +export function enableProgress(): void; +export function disableProgress(): void; - pause(): void; - resume(): void; +export function enableUnicode(): void; +export function disableUnicode(): void; - addLevel(level: string, n: number, style?: StyleObject, disp?: string): void; -} +export function pause(): void; +export function resume(): void; -declare const logger: npmlog; - -export default logger; +export function addLevel(level: string, n: number, style?: StyleObject, disp?: string): void; diff --git a/types/npmlog/npmlog-tests.ts b/types/npmlog/npmlog-tests.ts index 8f90bea7ce..451b49302d 100644 --- a/types/npmlog/npmlog-tests.ts +++ b/types/npmlog/npmlog-tests.ts @@ -1,4 +1,4 @@ -import npmlog from "npmlog"; +import * as npmlog from "npmlog"; const prefix = "str"; const message = "otherStr"; @@ -12,7 +12,8 @@ npmlog.http(prefix, message); npmlog.warn(prefix, message); npmlog.error(prefix, message); -npmlog.level = "silly"; +// ES6 module does't support changing variable exported by `export let` +// npmlog.level = "silly"; npmlog.enableColor(); npmlog.disableColor(); From 08cd3c3b367e6111e5fd1b3e65433c1e8068716f Mon Sep 17 00:00:00 2001 From: Kamil Waheed Date: Sat, 21 Jul 2018 03:53:51 +0300 Subject: [PATCH 154/738] Fix incorrectly typed GatewayDest's component prop in react-gateway (#27414) * Use correct type for GatewayDestProps component * Test react-gateway GatewayDest component prop type * Add another test for react-gateway GatewayDest component prop type --- types/react-gateway/GatewayDest.d.ts | 2 +- types/react-gateway/react-gateway-tests.tsx | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/react-gateway/GatewayDest.d.ts b/types/react-gateway/GatewayDest.d.ts index 4fd7928b2f..ad45947d4c 100644 --- a/types/react-gateway/GatewayDest.d.ts +++ b/types/react-gateway/GatewayDest.d.ts @@ -4,7 +4,7 @@ declare namespace GatewayDest { interface GatewayDestProps { name: string; tagName?: string; - component?: string | React.Component; + component?: string | React.ComponentClass; } } declare class GatewayDest extends React.Component { } diff --git a/types/react-gateway/react-gateway-tests.tsx b/types/react-gateway/react-gateway-tests.tsx index bbf24dd741..6d0642f591 100644 --- a/types/react-gateway/react-gateway-tests.tsx +++ b/types/react-gateway/react-gateway-tests.tsx @@ -1,6 +1,14 @@ import * as React from 'react'; import { Gateway, GatewayProvider, GatewayDest } from 'react-gateway'; +class GatewayComponent extends React.Component { + render() { + return ( +
{this.props.children}
+ ); + } +} + class ReactGateway extends React.Component { render() { return ( @@ -17,7 +25,9 @@ class ReactGatewayProvider extends React.Component { render() { return ( - + + +
All the way down...
@@ -26,6 +36,8 @@ class ReactGatewayProvider extends React.Component { Getting close...
+ +
From 62730ac062f935743909db87a6a07932e2c15427 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Sat, 21 Jul 2018 08:54:28 +0800 Subject: [PATCH 155/738] classnames: change value of ClassDictionary to any (#27280) --- types/classnames/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/classnames/index.d.ts b/types/classnames/index.d.ts index 0c3502d4dd..84073ec109 100644 --- a/types/classnames/index.d.ts +++ b/types/classnames/index.d.ts @@ -12,7 +12,7 @@ type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | boolean; interface ClassDictionary { - [id: string]: boolean | undefined | null; + [id: string]: any; } // This is the only way I found to break circular references between ClassArray and ClassValue From f5f7c436b99d743ce7f5810bfbf7563561a95e5e Mon Sep 17 00:00:00 2001 From: Scott Trinh Date: Fri, 20 Jul 2018 20:54:56 -0400 Subject: [PATCH 156/738] knex: Allow null value for decimal precision (#27422) * Allow null value for decimal precision * Update tests * Fix weird wording in test comment --- types/knex/index.d.ts | 2 +- types/knex/knex-tests.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index c80238f259..82dbb5f235 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -433,7 +433,7 @@ declare namespace Knex { text(columnName: string, textType?: string): ColumnBuilder; string(columnName: string, length?: number): ColumnBuilder; float(columnName: string, precision?: number, scale?: number): ColumnBuilder; - decimal(columnName: string, precision?: number, scale?: number): ColumnBuilder; + decimal(columnName: string, precision?: number | null, scale?: number): ColumnBuilder; boolean(columnName: string): ColumnBuilder; date(columnName: string): ColumnBuilder; dateTime(columnName: string): ColumnBuilder; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index e409b8f5ae..89a120fac1 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -1090,3 +1090,16 @@ knex.schema knex.schema.createTable('testTable', function (table) { table.binary('binaryKey', 16).primary(); //will make table with binaryKey type BINARY(16) }); + +// allow creating decimal column that can store that can store numbers of any +// precision and scale. (Only supported for Oracle, SQLite, Postgres) +var knex = Knex({ + client: 'pg' +}); + +knex.schema + .dropTableIfExists('testTable') + .createTable('testTable', function (table) { + table.decimal('dec', null); + }) + .dropTable('testTable'); From 05d47a553b3755df02a641601ed404e795fedfd5 Mon Sep 17 00:00:00 2001 From: Lee Standen Date: Fri, 20 Jul 2018 17:55:07 -0700 Subject: [PATCH 157/738] @types/react-circular-progressbar bump version to match upstream version, as release is needed (#27420) * version bump to match upstream version * Fix version number --- types/react-circular-progressbar/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-circular-progressbar/index.d.ts b/types/react-circular-progressbar/index.d.ts index 8c8664a69f..dc6e1a1950 100644 --- a/types/react-circular-progressbar/index.d.ts +++ b/types/react-circular-progressbar/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-circular-progressbar 0.8 +// Type definitions for react-circular-progressbar 1.0 // Project: https://github.com/iqnivek/react-circular-progressbar#readme // Definitions by: Lee Standen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From d73e42043d120712ccfb8ee3dfa3f2a092d87730 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Fri, 20 Jul 2018 17:55:46 -0700 Subject: [PATCH 158/738] [JSS] Export the JSS class declaration (#27428) * Export the JSS class. * Fix tests. * Revert "Fix tests." This reverts commit 5d2acc01ab583dca20999ecc9d9d04e899066f98. --- types/jss/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/jss/index.d.ts b/types/jss/index.d.ts index 27c8d779a6..3318f9a565 100644 --- a/types/jss/index.d.ts +++ b/types/jss/index.d.ts @@ -104,13 +104,13 @@ export interface RuleOptions { className: string; } export declare class SheetsRegistry { - constructor(); - registry: ReadonlyArray; - readonly index: number; - add(sheet: StyleSheet): void; - reset(): void; - remove(sheet: StyleSheet): void; - toString(options?: ToCssOptions): string; + constructor(); + registry: ReadonlyArray; + readonly index: number; + add(sheet: StyleSheet): void; + reset(): void; + remove(sheet: StyleSheet): void; + toString(options?: ToCssOptions): string; } export type CreateStyleSheetOptions = Partial<{ media: string; @@ -121,7 +121,7 @@ export type CreateStyleSheetOptions = Partial<{ generateClassName: GenerateClassName; classNamePrefix: string; }>; -declare class JSS { +export declare class JSS { constructor(options?: Partial); createStyleSheet( styles: Partial>, From 05bf38481e34314dfa36d63948f833d051bd9c92 Mon Sep 17 00:00:00 2001 From: Adam Eisenreich Date: Sat, 21 Jul 2018 02:56:11 +0200 Subject: [PATCH 159/738] Added more component definitions to video.js (#27163) * Added more component definitions to video.js * Update getComponent This will allow to write `class MyComponent extends videojs.getComponent('Button') { }`. * addChild correctly returns given component * typo in ClickableComponent * Added ControlBar * Fixing whitespace errors Fixes ERROR: 26:49 typedef-whitespace * Update video.js-tests.ts * Update index.d.ts * Bump version to 2.1 * Fix tslint errors * fixup! Bump version to 2.1 * fixup! Fix tslint errors --- types/video.js/index.d.ts | 64 +++++++++++++++++++++++++++----- types/video.js/video.js-tests.ts | 51 +++++++++++++++---------- 2 files changed, 86 insertions(+), 29 deletions(-) diff --git a/types/video.js/index.d.ts b/types/video.js/index.d.ts index de0c2ad543..f7cf6033f0 100644 --- a/types/video.js/index.d.ts +++ b/types/video.js/index.d.ts @@ -7,20 +7,25 @@ // Gio Freitas // Grzegorz Błaszczyk // Stéphane Roucheray +// Adam Eisenreich // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 // The Video.js API allows you to interact with the video through // Javascript, whether the browser is playing the video through HTML5 // video, Flash, or any other supported playback technologies. declare function videojs(id: any, options?: videojs.PlayerOptions, ready?: () => void): videojs.Player; -export = videojs; +export default videojs; export as namespace videojs; declare namespace videojs { const getComponent: typeof Component.getComponent; const registerComponent: typeof Component.registerComponent; const getPlugin: typeof Plugin.getPlugin; + function registerPlugin(pluginName: string, pluginFn: (this: Player, ...parameters: any[]) => void): void; + function addLanguage(lang: string, data: {[key: string]: string }): void; + function mergeOptions< A, B, C, D, E, F >(option: A, option2?: B, option3?: C, option4?: D, option5?: E, option6?: F): A & B & C & D & E & F; interface PlayerOptions { techOrder?: string[]; @@ -43,6 +48,12 @@ declare namespace videojs { notSupportedMessage?: string; plugins?: any; poster?: string; + controlBar?: { + volumePanel?: { + inline?: boolean; + vertical?: boolean; + } + }; } interface Source { @@ -68,18 +79,25 @@ declare namespace videojs { class Component extends EventTarget { constructor(player: Player, options: any); - static getComponent(name: 'Player' | 'player'): Player; - static getComponent(name: 'Button' | 'button'): Button; - static getComponent(name: 'Component' | 'component' | string): Component; - static registerComponent(name: string, ComponentToRegister: Component): Component; + static getComponent(name: 'Player' | 'player'): typeof Player; + static getComponent(name: 'Button' | 'button'): typeof Button; + static getComponent(name: 'ClickableComponent' | 'clickablecomponent'): typeof ClickableComponent; + static getComponent(name: 'ModalDialog' | 'modaldialog'): typeof ModalDialog; + static getComponent(name: 'ControlBar' | 'controlbar'): typeof ControlBar; + static getComponent(name: 'Component' | 'component' | string): typeof Component; + static registerComponent(name: string, ComponentToRegister: typeof Component): typeof Component; $(selector: string, context?: string | Element): Element; $$(selector: string, context?: string | Element): NodeList; - addChild(child: string | Component, optionsopt?: any, indexopt?: number): Component; + addChild(component: string, optionsopt?: any, indexopt?: number): Component; + addChild(component: Element, optionsopt?: any, indexopt?: number): Element; + addChild(component: T, optionsopt?: any, indexopt?: number): T; addClass(classToAdd: string): void; blur(): void; + buildCSSClass(): string; cancelAnimationFrame(id: number): number; children(): Component[]; + controlText(key: string): string; clearInterval(intervalId: number): number; clearTimeout(timeoutId: number): number; contentEl(): Element; @@ -107,6 +125,7 @@ declare namespace videojs { localize(key: string, tokens?: string[], defaultValue?: string): string; name(): string; options(obj: any): any; + played(): TimeRanges; player(): Player; ready(callback: (this: this) => void): this; removeAttribute(attribute: string): void; @@ -117,27 +136,51 @@ declare namespace videojs { setInterval(fn: () => void, interval: number): number; setTimeout(fn: () => void, timeout: number): number; show(): void; - toggleClass(classToToggle: string, predicate?: string): void; + toggleClass(classToToggle: string, predicate?: boolean | ((element: Element, classToToggle: string) => boolean)): void; + trigger(eventName: string, ...parameters: any[]): void; triggerReady(): void; width(): string | number; width(num: number, skipListeners?: number): void; } - class Button extends Component { + class ControlBar extends Component {} + + class ModalDialog extends Component { + open(): void; + close(): void; + content(): Element; + } + + class ClickableComponent extends Component { controlText(textopt?: string, elopt?: Element): string; createControlTextEl(elopt: Element): Element; + handleClick(event: Event): void; + } + + class Button extends ClickableComponent { + handleClick(event: Event): void; + disable(): boolean; } class Player extends Component { + bigPlayButton: Button; + loadingSpinner: Component; + errorDisplay: ModalDialog; + controlBar: ControlBar; + autoplay(value?: boolean): string; addRemoteTextTrack(options: {}, manualCleanup?: boolean): HTMLTrackElement; buffered(): TimeRanges; bufferedPercent(): number; cancelFullScreen(): Player; controls(bool?: boolean): boolean; + currentSrc(): string; currentTime(): number; currentTime(seconds: number): Player; duration(): number; + error(): any; + /** Passing null will hide error */ + error(error: T): T; exitFullscreen(): Player; height(): number; height(num: number): void; @@ -153,11 +196,12 @@ declare namespace videojs { removeRemoteTextTrack(track: HTMLTrackElement): void; requestFullScreen(): Player; size(width: number, height: number): Player; + src(): string; src(newSource: string | Source | Source[]): Player; - volume(): number; - volume(percentAsDecimal: number): TimeRanges; + volume(percentAsDecimal?: number): number; width(): number; width(num: number): void; + usingPlugin(pluginName: string): boolean; } class Plugin { diff --git a/types/video.js/video.js-tests.ts b/types/video.js/video.js-tests.ts index 68a138f433..ae30493652 100644 --- a/types/video.js/video.js-tests.ts +++ b/types/video.js/video.js-tests.ts @@ -1,4 +1,4 @@ -import videojs = require('video.js'); +import videojs from 'video.js'; videojs("example_video_1").ready(function() { // EXAMPLE: Start playing the video. @@ -58,41 +58,54 @@ videojs("example_video_1").ready(function() { this.requestFullScreen(); testEvents(this); + + testComponents(this); + + testPlugin(this, {}); }); -function testEvents(myPlayer: videojs.Player) { +function testEvents(player: videojs.Player) { const myFunc = function(this: videojs.Player) { // Do something when the event is fired }; - myPlayer.on("error", myFunc); + player.on("error", myFunc); // Removes the specified listener only. - myPlayer.off("error", myFunc); + player.off("error", myFunc); const myFuncWithArg = function(this: videojs.Player, e: Event) { // Do something when the event is fired }; - myPlayer.on("volumechange", myFuncWithArg); + player.on("volumechange", myFuncWithArg); // Removes all listeners for the given event type. - myPlayer.off("volumechange"); + player.off("volumechange"); - myPlayer.on("loadeddata", () => { /* Some handler. */ }); + player.on("loadeddata", () => { /* Some handler. */ }); // Removes all listeners. - myPlayer.off(); + player.off(); } -function testComponents() { - let component = videojs.getComponent('Component'); - component = videojs.Component.getComponent('Component'); +function testComponents(player: videojs.Player) { + class MyWindow extends videojs.getComponent('ModalDialog') { + myFunction() { + this.player().play(); + } + } - const button = videojs.getComponent('Button'); - button.controlText('Button Text'); - const player = videojs.getComponent('Player'); - player.play(); + const myWindow = new MyWindow(player, {}); + myWindow.controlText('My text'); + myWindow.open(); + myWindow.close(); + myWindow.myFunction(); } -function testPlugin() { - let plugin = videojs.getPlugin('plugin_name'); - plugin = videojs.getPlugin('plugin_name'); +function testPlugin(player: videojs.Player, options: {}) { + if (player.usingPlugin('uloztoExample')) { return; } - plugin.dispose(); + videojs.registerPlugin('uloztoExample', function({}: typeof options) { + this.play(); + this.one('ended', () => { + // do something + }); + }); + (player as any).uloztoExample(options); } From 37c8afcfa9f428103c1e842973d12e1628c6bd15 Mon Sep 17 00:00:00 2001 From: daniel-maier Date: Sat, 21 Jul 2018 02:56:20 +0200 Subject: [PATCH 160/738] Update to vertx3-eventbus-client 3.5 (#27070) * Update index.d.ts Update to vertx3-eventbus-client 3.5 * Update index.d.ts * update to vertx3-eventbus-client 3.5 --- types/vertx3-eventbus-client/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/vertx3-eventbus-client/index.d.ts b/types/vertx3-eventbus-client/index.d.ts index 96c74a66e6..0196f94441 100644 --- a/types/vertx3-eventbus-client/index.d.ts +++ b/types/vertx3-eventbus-client/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vertx3-eventbus-client 3.4 +// Type definitions for vertx3-eventbus-client 3.5 // Project: http://vertx.io // Definitions by: Odd Eirik Nes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -18,6 +18,8 @@ declare namespace EventBus { unregisterHandler(address: string, headers: any, callback: (error: Error, message: any) => any): any; send(address: string, message: any, headers: any, callback?: (error: Error, message: any) => any): any; publish(address: string, message: any, headers?: any): any; + enableReconnect(enable: boolean): void; + enablePing(enable: boolean): void; close(): any; } } From 9fa7394da191db52fa1ea4e2ee34045f9b49d17e Mon Sep 17 00:00:00 2001 From: FUJI Goro Date: Sat, 21 Jul 2018 09:56:39 +0900 Subject: [PATCH 161/738] [@types/jquery] fix: let jQuery's insertAfter / insertBefore accept Node and JQuery (#27404) * fix: let jQuery's insertAfter / insertBefore accept JQuery as well as HTMLElement * jquery now requires typescript 2.4 * fix jQuery dts to compile on TypeScript 2.3 --- types/jquery/index.d.ts | 4 ++-- types/jquery/jquery-tests.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 4bf8e03ee7..821e7ec162 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -4327,7 +4327,7 @@ interface JQuery extends Iterable { * @see \`{@link https://api.jquery.com/insertAfter/ }\` * @since 1.0 */ - insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; /** * Insert every element in the set of matched elements before the target. * @@ -4336,7 +4336,7 @@ interface JQuery extends Iterable { * @see \`{@link https://api.jquery.com/insertBefore/ }\` * @since 1.0 */ - insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; /** * Check the current matched set of elements against a selector, element, or jQuery object and return * true if at least one of these elements matches the given arguments. diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index bee2c7c2ab..309b1e2f89 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -5681,6 +5681,12 @@ function JQuery() { // $ExpectType JQuery $('span').insertAfter($('p')); + + // $ExpectType JQuery + $('span').insertAfter(new Text('hello!')); + + // $ExpectType JQuery + $('span').insertAfter($(new Text('hello!'))); } function insertBefore() { @@ -5698,6 +5704,12 @@ function JQuery() { // $ExpectType JQuery $('span').insertBefore($('p')); + + // $ExpectType JQuery + $('span').insertBefore(new Text('hello!')); + + // $ExpectType JQuery + $('span').insertBefore($(new Text('hello!'))); } function prependTo() { From 9fa36689abc70f09ba9b3f20384c9abcbbabcab5 Mon Sep 17 00:00:00 2001 From: Willem Sonke Date: Sat, 21 Jul 2018 02:57:12 +0200 Subject: [PATCH 162/738] [snapsvg] Make handler optional for un... methods (#27252) For `unclick` the handler argument was already marked as optional. As in snapsvg's [implementation of the `un...` methods](https://github.com/adobe-webplatform/Snap.svg/blob/master/src/mouse.js#L340) there is no difference in how the various events are handled, the handler should also be optional for the other event types. I tried this with `undblclick` in particular, and it works as expected (removes all `dblclick` events). --- types/snapsvg/index.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/types/snapsvg/index.d.ts b/types/snapsvg/index.d.ts index 981252ac07..c012cc238c 100644 --- a/types/snapsvg/index.d.ts +++ b/types/snapsvg/index.d.ts @@ -203,16 +203,16 @@ declare namespace Snap { touchcancel(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element; unclick(handler?: (event: MouseEvent) => void): Snap.Element; - undblclick(handler: (event: MouseEvent) => void): Snap.Element; - unmousedown(handler: (event: MouseEvent) => void): Snap.Element; - unmousemove(handler: (event: MouseEvent) => void): Snap.Element; - unmouseout(handler: (event: MouseEvent) => void): Snap.Element; - unmouseover(handler: (event: MouseEvent) => void): Snap.Element; - unmouseup(handler: (event: MouseEvent) => void): Snap.Element; - untouchstart(handler: (event: MouseEvent) => void): Snap.Element; - untouchmove(handler: (event: MouseEvent) => void): Snap.Element; - untouchend(handler: (event: MouseEvent) => void): Snap.Element; - untouchcancel(handler: (event: MouseEvent) => void): Snap.Element; + undblclick(handler?: (event: MouseEvent) => void): Snap.Element; + unmousedown(handler?: (event: MouseEvent) => void): Snap.Element; + unmousemove(handler?: (event: MouseEvent) => void): Snap.Element; + unmouseout(handler?: (event: MouseEvent) => void): Snap.Element; + unmouseover(handler?: (event: MouseEvent) => void): Snap.Element; + unmouseup(handler?: (event: MouseEvent) => void): Snap.Element; + untouchstart(handler?: (event: MouseEvent) => void): Snap.Element; + untouchmove(handler?: (event: MouseEvent) => void): Snap.Element; + untouchend(handler?: (event: MouseEvent) => void): Snap.Element; + untouchcancel(handler?: (event: MouseEvent) => void): Snap.Element; hover(hoverInHandler: (event: MouseEvent) => void, hoverOutHandler: (event: MouseEvent) => void, thisArg?: any): Snap.Element; hover(hoverInHandler: (event: MouseEvent) => void, hoverOutHandler: (event: MouseEvent) => void, inThisArg?: any, outThisArg?: any): Snap.Element; From e1d9a3c9f4fb07546c30a16aa239dd0768ad1193 Mon Sep 17 00:00:00 2001 From: Bond Date: Sat, 21 Jul 2018 01:58:10 +0100 Subject: [PATCH 163/738] GetJob returns a promise of job or null (#27448) Says it in the jsdoc even. --- types/bull/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 009e26ef95..7b3fa3c3dc 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -476,7 +476,7 @@ declare namespace Bull { * Returns a promise that will return the job instance associated with the jobId parameter. * If the specified job cannot be located, the promise callback parameter will be set to null. */ - getJob(jobId: JobId): Promise>; + getJob(jobId: JobId): Promise | null>; /** * Returns a promise that will return an array with the waiting jobs between start and end. From fa54ed4ad31b5fa8faf8f9dcd11e23b8cb17d8b5 Mon Sep 17 00:00:00 2001 From: Alfie Johnson Date: Fri, 20 Jul 2018 18:59:15 -0600 Subject: [PATCH 164/738] I believe IDatepickerPopupConfig has everything in IDatepickerConfig, plus additional things, so it should extend IDatepickerConfig. (#27452) --- .../angular-ui-bootstrap-tests.ts | 22 +++++++++++++++++++ types/angular-ui-bootstrap/index.d.ts | 6 +++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/types/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/types/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index 9dbbf8e002..f21ee43ab3 100644 --- a/types/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/types/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -57,6 +57,28 @@ testApp.config(( /** * $datepickerPopupConfig tests */ + $datepickerPopupConfig.datepickerMode = 'month'; + $datepickerPopupConfig.formatDay = 'd'; + $datepickerPopupConfig.formatDayHeader = 'E'; + $datepickerPopupConfig.formatDayTitle = 'dd-MM-yyyy'; + $datepickerPopupConfig.formatMonth = 'M'; + $datepickerPopupConfig.formatMonthTitle = 'yy'; + $datepickerPopupConfig.formatYear = 'y'; + $datepickerPopupConfig.initDate = '1389586124979'; + $datepickerPopupConfig.maxDate = '1389586124979'; + $datepickerPopupConfig.maxMode = 'month'; + $datepickerPopupConfig.minDate = '1389586124979'; + $datepickerPopupConfig.minMode = 'month'; + $datepickerPopupConfig.shortcutPropagation = true; + $datepickerPopupConfig.showWeeks = false; + $datepickerPopupConfig.startingDay = 1; + $datepickerPopupConfig.yearRange = 10; + $datepickerPopupConfig.monthColumns = 3; + $datepickerPopupConfig.yearColumns = 9; + $datepickerPopupConfig.yearRows = 6; + $datepickerPopupConfig.ngModelOptions.allowInvalid = false; + $datepickerPopupConfig.ngModelOptions.timezone = "EST"; + $datepickerPopupConfig.ngModelOptions.updateOn = "click"; $datepickerPopupConfig.altInputFormats = ["mm/dd/YYYY", "mm-dd-YY"]; $datepickerPopupConfig.appendToBody = true; $datepickerPopupConfig.currentText = 'Select Today'; diff --git a/types/angular-ui-bootstrap/index.d.ts b/types/angular-ui-bootstrap/index.d.ts index 0c41fcc15c..db08aae252 100644 --- a/types/angular-ui-bootstrap/index.d.ts +++ b/types/angular-ui-bootstrap/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for Angular UI Bootstrap 0.13.3 // Project: https://github.com/angular-ui/bootstrap -// Definitions by: Brian Surowiec , Ryan Southgate +// Definitions by: Brian Surowiec , +// Ryan Southgate +// Alfie Johnson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -227,7 +229,7 @@ declare module 'angular' { customClass?: DatepickerCallback; } - interface IDatepickerPopupConfig { + interface IDatepickerPopupConfig extends IDatepickerConfig { /** * A list of alternate formats acceptable for manual entry. From 0575e7dbc35767f17721955c2f45f359a1b20239 Mon Sep 17 00:00:00 2001 From: Dasa Paddock Date: Fri, 20 Jul 2018 17:59:26 -0700 Subject: [PATCH 165/738] Small updates for version 4.8 (#27426) --- types/arcgis-js-api/index.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/types/arcgis-js-api/index.d.ts b/types/arcgis-js-api/index.d.ts index baf6145ff9..97eb679110 100644 --- a/types/arcgis-js-api/index.d.ts +++ b/types/arcgis-js-api/index.d.ts @@ -682,7 +682,7 @@ declare namespace __esri { export type AfterInterceptorCallback = (response: RequestResponse) => void; - export type BeforeInterceptorCallback = (params: any, requestOptions: RequestOptions) => any; + export type BeforeInterceptorCallback = (params: any) => any; export interface configRequest extends Object { @@ -731,7 +731,7 @@ declare namespace __esri { */ httpsDomains?: string[]; /** - * Allows developers to modify requests before or after they are sent. An array of interceptors that will return the first one that matches. If no urls are specified, will apply to all relevant requests. Example: + * Allows developers to modify requests before or after they are sent. The first interceptor that matches the request URL will be used. Example: * ```js * const featureLayerUrl = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0"; * @@ -909,19 +909,19 @@ declare namespace __esri { */ after?: AfterInterceptorCallback; /** - * Callback function that can make changes to the url or options before the request is sent. + * Callback function that can make changes to the URL or options before the request is sent. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor) */ before?: BeforeInterceptorCallback; /** - * Sets or adds headers into `requestOptions.headers`. + * Sets or adds headers into `requestOptions.headers`. See also: [requestOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor) */ headers?: any; /** - * Appends a query statement to the request in the Query String Parameters of the header. + * Sets or adds a query parameter into `requestOptions.query`. See also: [requestOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor) */ @@ -933,11 +933,11 @@ declare namespace __esri { */ responseData?: any; /** - * Specifies the url(s) to apply to the interceptors. If undefined, interceptors will apply to all relevant requests. + * Specifies the URL(s) to apply to the interceptors. If the value is type `String`, then it matches if the request URL starts with that string. If null or undefined, the interceptor will apply to all relevant requests. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor) */ - urls?: string | RegExp | any[]; + urls?: string | RegExp | (string | RegExp)[]; } @@ -47653,7 +47653,7 @@ declare namespace __esri { */ readonly expanded: boolean; /** - * Icon font used to style the Expand button. + * Icon font used to style the Expand button. Will automatically use the [content's](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#content) iconClass if it has one. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#expandIconClass) */ @@ -47778,7 +47778,7 @@ declare namespace __esri { */ content?: Node | string | WidgetProperties; /** - * Icon font used to style the Expand button. + * Icon font used to style the Expand button. Will automatically use the [content's](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#content) iconClass if it has one. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#expandIconClass) */ @@ -49921,7 +49921,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#open) */ - content?: string; + content?: string | HTMLElement | Widget; /** * Sets the popup's [location](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#location), which is the geometry used to position the popup. * From 9b47d926c604b0ef2a63b28d939312a922613c19 Mon Sep 17 00:00:00 2001 From: mattmm3d <36530840+mattmm3d@users.noreply.github.com> Date: Fri, 20 Jul 2018 21:00:19 -0400 Subject: [PATCH 166/738] Splice can take a number array as an argument for 2D arrays (#27239) --- types/numjs/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/numjs/index.d.ts b/types/numjs/index.d.ts index d663d9e0e8..76d1317d37 100644 --- a/types/numjs/index.d.ts +++ b/types/numjs/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for numjs 0.14 // Project: https://github.com/nicolaspanel/numjs#readme // Definitions by: taoqf +// matt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -12,7 +13,7 @@ export type NdType = BaseNdArray.DataType | BaseNdArray.Data; export interface NdArray extends BaseNdArray { ndim: number; T: NdArray; - slice(...args: number[]): NdArray; + slice(...args: Array): NdArray; /** * Return a copy of the array collapsed into one dimension using row-major order (C-style) From b7ba5e828bb0ede78b1f1f7df380f21787f5d70a Mon Sep 17 00:00:00 2001 From: geraldinelemeur <37600826+geraldinelemeur@users.noreply.github.com> Date: Fri, 20 Jul 2018 21:00:59 -0400 Subject: [PATCH 167/738] [mongodb] Cursor.next() resolves to null if no more documents. (#27402) --- types/mongodb/index.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index c58f690433..8ce8f52fa4 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -12,6 +12,7 @@ // Denys Bushulyak // Bastien Arata // Wan Bachtiar +// Geraldine Lemeur // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1286,8 +1287,8 @@ export class Cursor extends Readable { /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#min */ min(min: number): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#next */ - next(): Promise; - next(callback: MongoCallback): void; + next(): Promise; + next(callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#project */ project(value: Object): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#read */ @@ -1365,8 +1366,8 @@ export class AggregationCursor extends Readable { /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#maxTimeMS */ maxTimeMS(value: number): AggregationCursor; /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#next */ - next(): Promise; - next(callback: MongoCallback): void; + next(): Promise; + next(callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#out */ out(destination: string): AggregationCursor; /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#project */ From aee338f484683fdd3902a6cd909b040ec99661b9 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Sat, 21 Jul 2018 02:01:15 +0100 Subject: [PATCH 168/738] `node-fetch`: correct `Headers.raw` type (#27364) * `node-fetch`: add test for `Headers.raw` * `node-fetch`: `Headers.raw`: add `string[]` to index signature value type * `node-fetch`: `Headers.raw`: add `undefined` to index signature value type * `node-fetch`: enable `strictNullChecks` and fix errors * Revert "`node-fetch`: `Headers.raw`: add `undefined` to index signature value type" This reverts commit 15ad14d72c42fa1f3ba472bc15f38a88230f3a4f. * Fix expect type format * Remove string --- types/node-fetch/index.d.ts | 2 +- types/node-fetch/node-fetch-tests.ts | 8 +++++++- types/node-fetch/tsconfig.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index b203744a72..4b12734363 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -102,7 +102,7 @@ export class Headers implements Iterable<[string, string]> { get(name: string): string | null; getAll(name: string): string[]; has(name: string): boolean; - raw(): { [k: string]: string }; + raw(): { [k: string]: string[] }; set(name: string, value: string): void; // Iterator methods diff --git a/types/node-fetch/node-fetch-tests.ts b/types/node-fetch/node-fetch-tests.ts index 6f78a512cf..7561ae1b0f 100644 --- a/types/node-fetch/node-fetch-tests.ts +++ b/types/node-fetch/node-fetch-tests.ts @@ -44,7 +44,7 @@ function test_fetchUrlWithRequestObject() { const request: Request = new Request("http://www.andlabs.net/html5/uCOR.php", requestOptions); const timeout: number = request.timeout; const size: number = request.size; - const agent: Agent = request.agent; + const agent: Agent | undefined = request.agent; const protocol: string = request.protocol; handlePromise(fetch(request)); @@ -71,3 +71,9 @@ function handlePromise(promise: Promise, isArrayBuffer: boolean = fals console.log(text); }); } + +function test_headersRaw() { + const headers = new Headers(); + const myHeader = 'foo'; + headers.raw()[myHeader]; // $ExpectType string[] +} diff --git a/types/node-fetch/tsconfig.json b/types/node-fetch/tsconfig.json index 98a8d56ff1..d349bf9665 100644 --- a/types/node-fetch/tsconfig.json +++ b/types/node-fetch/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ From 86433acc82bea8e6c3b120d29b2473eaa3fa128a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sat, 21 Jul 2018 03:02:29 +0200 Subject: [PATCH 169/738] [React-native-auth0] Add language value in AuthorizeParams (#27416) * Add language value * Update test --- types/react-native-auth0/index.d.ts | 1 + types/react-native-auth0/react-native-auth0-tests.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/react-native-auth0/index.d.ts b/types/react-native-auth0/index.d.ts index b6a4e769e8..5904879859 100644 --- a/types/react-native-auth0/index.d.ts +++ b/types/react-native-auth0/index.d.ts @@ -138,6 +138,7 @@ export interface AuthorizeParams { audience?: string; scope?: string; connection?: string; + language?: string; } export interface ClearSessionParams { diff --git a/types/react-native-auth0/react-native-auth0-tests.ts b/types/react-native-auth0/react-native-auth0-tests.ts index 08f8b0bc59..f7f675bcfd 100644 --- a/types/react-native-auth0/react-native-auth0-tests.ts +++ b/types/react-native-auth0/react-native-auth0-tests.ts @@ -60,7 +60,8 @@ auth0.auth.userInfo({ auth0.webAuth.authorize({ state: "state", nonce: "nonce", - scope: "openid" + scope: "openid", + language: "en" }); auth0.webAuth.clearSession({ federated: false }); From 15d7eb53b3f1096e681b71917b3dc8245a8645bd Mon Sep 17 00:00:00 2001 From: Atrahasis Date: Sat, 21 Jul 2018 03:04:08 +0200 Subject: [PATCH 170/738] [@types/three]: Improve material type casting, implementation and doc. (#27413) --- types/three/three-core.d.ts | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 98cdcbe4e0..ec0af62b97 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -5209,10 +5209,21 @@ export class LOD extends Object3D { objects: any[]; } + +/** + * An intermediate material type that casts more precisely the possible materials assignable to a [[Line]] object. + * + * [[LineDashedMaterial]] is omitted as it extends [[LineBasicMaterial]]. + * + * // Todo: + * // - can [[Line]] take in an array of materials ? + */ +export type LineMaterialType = LineBasicMaterial | ShaderMaterial | MeshDepthMaterial; + export class Line extends Object3D { constructor( geometry?: Geometry | BufferGeometry, - material?: LineDashedMaterial | LineBasicMaterial | ShaderMaterial, + material?: LineMaterialType | LineMaterialType[], mode?: number ); @@ -5238,18 +5249,23 @@ export const LinePieces: number; export class LineSegments extends Line { constructor( geometry?: Geometry | BufferGeometry, - material?: LineDashedMaterial | LineBasicMaterial | ShaderMaterial | (LineDashedMaterial | LineBasicMaterial | ShaderMaterial)[], + material?: LineMaterialType | LineMaterialType[], mode?: number ); } -type MeshMaterial = MeshBasicMaterial | MeshLambertMaterial | MeshPhongMaterial | MeshDepthMaterial | MeshStandardMaterial | MeshPhysicalMaterial | MeshNormalMaterial | MeshFaceMaterial | ShaderMaterial; +/** + * An intermediate material type that casts more precisely the possible materials assignable to a [[Mesh]] object. + * + * `MeshToonMaterial` and [[MeshPhysicalMaterial]] are omitted as they extend [[MeshPhongMaterial]] and [[MeshStandardMaterial]] respectively. + */ +export type MeshMaterialType = MeshBasicMaterial | MeshDepthMaterial | MeshFaceMaterial | MeshLambertMaterial | MeshNormalMaterial | MeshPhongMaterial | MeshStandardMaterial | ShaderMaterial | ShadowMaterial; export class Mesh extends Object3D { - constructor(geometry?: Geometry | BufferGeometry, material?: MeshMaterial | MeshMaterial[]); + constructor(geometry?: Geometry | BufferGeometry, material?: MeshMaterialType | MeshMaterialType[]); geometry: Geometry|BufferGeometry; - material: MeshMaterial | MeshMaterial[]; + material: MeshMaterialType | MeshMaterialType[]; drawMode: TrianglesDrawModes; morphTargetInfluences?: number[]; morphTargetDictionary?: { [key: string]: number; }; @@ -5262,6 +5278,14 @@ export class Mesh extends Object3D { copy(source: this, recursive?: boolean): this; } +/** + * An intermediate material type that casts more precisely the possible materials assignable to a [[Points]] object. + * + * // Todo: + * // - can [[Points]] take in an array of materials ? + */ +export type PointsMaterialType = PointsMaterial | ShaderMaterial | MeshDepthMaterial; + /** * A class for displaying particles in the form of variable size points. For example, if using the WebGLRenderer, the particles are displayed using GL_POINTS. * @@ -5275,7 +5299,7 @@ export class Points extends Object3D { */ constructor( geometry?: Geometry | BufferGeometry, - material?: PointsMaterial | ShaderMaterial + material?: PointsMaterialType | PointsMaterialType[] ); type: "Points"; From 3eca76c410c018eaf1a5cd3b8e1a6082854fc4d3 Mon Sep 17 00:00:00 2001 From: Zhang Yi Jiang Date: Sat, 21 Jul 2018 09:07:32 +0800 Subject: [PATCH 171/738] [react-router-dom] Add generatePath reexport from react-router (#27178) --- types/react-router-dom/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-router-dom/index.d.ts b/types/react-router-dom/index.d.ts index 9870a487b3..e71192e0b2 100644 --- a/types/react-router-dom/index.d.ts +++ b/types/react-router-dom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React Router 4.2 +// Type definitions for React Router 4.3 // Project: https://github.com/ReactTraining/react-router // Definitions by: Tanguy Krotoff // Huy Nguyen @@ -11,6 +11,7 @@ import * as React from 'react'; import * as H from 'history'; export { + generatePath, Prompt, MemoryRouter, RedirectProps, From 64dc73c84c40e6fb79943b2a00d30b7b2d49579a Mon Sep 17 00:00:00 2001 From: Matt Bishop Date: Fri, 20 Jul 2018 18:07:50 -0700 Subject: [PATCH 172/738] Add missing methods withinX (#27176) --- types/chai-datetime/chai-datetime-tests.ts | 34 +++++++++++++++++----- types/chai-datetime/index.d.ts | 9 +++++- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/types/chai-datetime/chai-datetime-tests.ts b/types/chai-datetime/chai-datetime-tests.ts index 255d816b5a..f955e78e27 100644 --- a/types/chai-datetime/chai-datetime-tests.ts +++ b/types/chai-datetime/chai-datetime-tests.ts @@ -3,47 +3,65 @@ import chai = require('chai'); import chaiDateTime = require('chai-datetime'); chai.use(chaiDateTime); -var expect = chai.expect; -var assert = chai.assert; +const expect = chai.expect; +const assert = chai.assert; function test_equalTime(){ - var date: Date = new Date(2014, 1, 1); + const date: Date = new Date(2014, 1, 1); expect(date).to.equalTime(date); date.should.equalTime(date); assert.equalTime(date, date); } function test_beforeTime(){ - var date: Date = new Date(2014, 1, 1); + const date: Date = new Date(2014, 1, 1); expect(date).to.be.beforeTime(date); date.should.be.beforeTime(date); assert.beforeTime(date, date); } function test_afterTime(){ - var date: Date = new Date(2014, 1, 1); + const date: Date = new Date(2014, 1, 1); expect(date).to.be.afterTime(date); date.should.be.afterTime(date); assert.afterTime(date, date); } +function test_withinTime(){ + const date: Date = new Date(2014, 7, 1); + const fromDate: Date = new Date(2014, 1, 1); + const toDate: Date = new Date(2015, 1, 1); + expect(date).to.be.withinTime(fromDate, toDate); + date.should.be.withinTime(fromDate, toDate); + assert.withinTime(date, fromDate, toDate); +} + function test_equalDate(){ - var date: Date = new Date(2014, 1, 1); + const date: Date = new Date(2014, 1, 1); expect(date).to.equalDate(date); date.should.equalDate(date); assert.equalDate(date, date); } function test_beforeDate(){ - var date: Date = new Date(2014, 1, 1); + const date: Date = new Date(2014, 1, 1); expect(date).to.be.beforeDate(date); date.should.be.beforeDate(date); assert.beforeDate(date, date); } function test_afterDate(){ - var date: Date = new Date(2014, 1, 1); + const date: Date = new Date(2014, 1, 1); expect(date).to.be.afterDate(date); date.should.be.afterDate(date); assert.afterDate(date, date); } + +function test_withinDate(){ + const date: Date = new Date(2014, 7, 1); + const fromDate: Date = new Date(2014, 1, 1); + const toDate: Date = new Date(2015, 1, 1); + expect(date).to.be.withinDate(fromDate, toDate); + date.should.be.withinDate(fromDate, toDate); + assert.withinDate(date, fromDate, toDate); +} diff --git a/types/chai-datetime/index.d.ts b/types/chai-datetime/index.d.ts index 176d112dc0..be623a05d4 100644 --- a/types/chai-datetime/index.d.ts +++ b/types/chai-datetime/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for chai-datetime // Project: https://github.com/gaslight/chai-datetime.git -// Definitions by: Cliff Burger +// Definitions by: Cliff Burger , +// Matt Bishop // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -14,9 +15,11 @@ declare global { afterDate(date: Date): Assertion; beforeDate(date: Date): Assertion; equalDate(date: Date): Assertion; + withinDate(dateFrom: Date, dateTo: Date): Assertion; afterTime(date: Date): Assertion; beforeTime(date: Date): Assertion; equalTime(date: Date): Assertion; + withinTime(dateFrom: Date, dateTo: Date): Assertion; } interface Assert { @@ -26,12 +29,16 @@ declare global { notBeforeTime(val: Date, exp: Date, msg?: string): void; afterTime(val: Date, exp: Date, msg?: string): void; notAfterTime(val: Date, exp: Date, msg?: string): void; + withinTime(val: Date, expFrom: Date, expTo: Date, msg?: string): void; + notWithinTime(val: Date, expFrom: Date, expTo: Date, msg?: string): void; equalDate(val: Date, exp: Date, msg?: string): void; notEqualDate(val: Date, exp: Date, msg?: string): void; beforeDate(val: Date, exp: Date, msg?: string): void; notBeforeDate(val: Date, exp: Date, msg?: string): void; afterDate(val: Date, exp: Date, msg?: string): void; notAfterDate(val: Date, exp: Date, msg?: string): void; + withinDate(val: Date, expFrom: Date, expTo: Date, msg?: string): void; + notWithinDate(val: Date, expFrom: Date, expTo: Date, msg?: string): void; } } From 38006605b191cb06c3f285c081947730eda98c37 Mon Sep 17 00:00:00 2001 From: Dave Dunkin Date: Fri, 20 Jul 2018 18:08:31 -0700 Subject: [PATCH 173/738] [fabric] Remove invalid override in Group interface. (#27182) The `get` override fails to compile in TypeScript 2.9. --- types/fabric/fabric-impl.d.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index 9163569fff..dda54d9965 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -1650,11 +1650,6 @@ export class Group { * @chainable */ destroy(): Group; - /** - * Returns requested property - * @param prop Property to get - */ - get(prop: string): any; /** * Checks whether this group was moved (since `saveCoords` was called last) * @return true if an object was moved (since fabric.Group#saveCoords was called) From 83aaaffa9f33fd8c85ce767b024cf4e87e1ffb19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Sat, 21 Jul 2018 03:09:22 +0200 Subject: [PATCH 174/738] [leveldown] Fix static functions (#27174) --- types/leveldown/index.d.ts | 7 +++++-- types/leveldown/leveldown-tests.ts | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/types/leveldown/index.d.ts b/types/leveldown/index.d.ts index 51630dc602..a281478b43 100644 --- a/types/leveldown/index.d.ts +++ b/types/leveldown/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for LevelDown 1.7 // Project: https://github.com/level/leveldown // Definitions by: Thiago de Arruda +// Linus Unnebäck // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -137,9 +138,11 @@ interface LevelDown { iterator(options?: ValueAsStringIteratorOptions): ValueAsStringIterator; iterator(options?: KeyAndValueAsStringIteratorOptions): KeyAndValueAsStringIterator; iterator(options?: KeyAndValueAsBufferIteratorOptions): KeyAndValueAsBufferIterator; +} + +interface Constructor { + (location: string): LevelDown; destroy(location: string, callback: ErrCallback): void; repair(location: string, callback: ErrCallback): void; } - -type Constructor = (location: string) => LevelDown; } diff --git a/types/leveldown/leveldown-tests.ts b/types/leveldown/leveldown-tests.ts index 0aa9b3625e..7b00db1a96 100644 --- a/types/leveldown/leveldown-tests.ts +++ b/types/leveldown/leveldown-tests.ts @@ -82,5 +82,5 @@ db.approximateSize("k1", "k2", (err, size) => { db.compactRange("k1", "k2", (err) => {}); -db.destroy("/path/to/db", (err) => {}); -db.repair("/path/to/db", (err) => {}); +leveldown.destroy("/path/to/db", (err) => {}); +leveldown.repair("/path/to/db", (err) => {}); From 045b6a27c7861190326e9b180181c5eeaa8edb5e Mon Sep 17 00:00:00 2001 From: devCola <39899964+devCola@users.noreply.github.com> Date: Fri, 20 Jul 2018 18:10:27 -0700 Subject: [PATCH 175/738] [react-router-config] add switchProps to renderRoutes (#27161) --- types/react-router-config/index.d.ts | 8 ++++++-- types/react-router-config/react-router-config-tests.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/types/react-router-config/index.d.ts b/types/react-router-config/index.d.ts index 132b5cc129..d69d42b062 100644 --- a/types/react-router-config/index.d.ts +++ b/types/react-router-config/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.8 import * as React from "react"; -import { RouteComponentProps, match } from "react-router"; +import { RouteComponentProps, SwitchProps, match } from "react-router"; import { Location } from "history"; export interface RouteConfigComponentProps extends RouteComponentProps { @@ -28,4 +28,8 @@ export interface MatchedRoute { export function matchRoutes(routes: RouteConfig[], pathname: string): Array>; -export function renderRoutes(routes: RouteConfig[] | undefined, extraProps?: any): JSX.Element; +export function renderRoutes( + routes: RouteConfig[] | undefined, + extraProps?: any, + switchProps?: SwitchProps, +): JSX.Element; diff --git a/types/react-router-config/react-router-config-tests.tsx b/types/react-router-config/react-router-config-tests.tsx index d1d28f93c0..315de6d7f9 100644 --- a/types/react-router-config/react-router-config-tests.tsx +++ b/types/react-router-config/react-router-config-tests.tsx @@ -20,7 +20,7 @@ const Child = ({ route }: RouteConfigComponentProps) => (

Child

{/* child routes won't render without this */} - {renderRoutes(route && route.routes)} + {route && renderRoutes(route.routes, null, {})}
); From 87924f4e361c52810d7921b1f1769dd6b9d5b8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=BDdila?= Date: Sat, 21 Jul 2018 03:11:02 +0200 Subject: [PATCH 176/738] added optional parameters to "websockify" and exported interfaces (#27165) * added optional parameters to "websockify" and exported interfaces * Update index.d.ts removed redundant export keywords --- types/koa-websocket/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/koa-websocket/index.d.ts b/types/koa-websocket/index.d.ts index 38fb0c0994..91b50b5ace 100644 --- a/types/koa-websocket/index.d.ts +++ b/types/koa-websocket/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kudos/koa-websocket // Definitions by: Maël Lavault // Jaco Greeff +// Martin Ždila // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -36,6 +37,6 @@ declare namespace KoaWebsocket { } } -declare function websockets(app: Koa): KoaWebsocket.App; +declare function KoaWebsocket(app: Koa, wsOptions?: ws.ServerOptions, httpsOptions?: https.ServerOptions): KoaWebsocket.App; -export = websockets; +export = KoaWebsocket; From f15ad0848ade004198e8b280b8079176ee1567fa Mon Sep 17 00:00:00 2001 From: Daniel Fischer Date: Sat, 21 Jul 2018 03:11:58 +0200 Subject: [PATCH 177/738] [oauth2-server] Add error classes (#27201) * [oauth2-server] Add error classes * [oauth2-server] Add code and name to OAuthError - they seem to be set by all subclasses * [oauth2-server] Add message to OAuthError * [oauth2-server] validateScope should actually return a string, not an array * [oauth2-server] correct properties of OAuthError --- types/oauth2-server/index.d.ts | 42 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/types/oauth2-server/index.d.ts b/types/oauth2-server/index.d.ts index 6729a05e7e..6c20aab221 100644 --- a/types/oauth2-server/index.d.ts +++ b/types/oauth2-server/index.d.ts @@ -1,7 +1,8 @@ // Type definitions for Node OAuth2 Server 3.0 // Project: https://github.com/oauthjs/node-oauth2-server // Definitions by: Robbie Van Gorkom , -// Charles Irick +// Charles Irick , +// Daniel Fischer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -263,7 +264,7 @@ declare namespace OAuth2Server { * Invoked to check if the requested scope is valid for a particular client/user combination. * */ - validateScope?(user: User, client: Client, scope: string, callback?: Callback): Promise; + validateScope?(user: User, client: Client, scope: string, callback?: Callback): Promise; } interface PasswordModel extends BaseModel, RequestAuthenticationModel { @@ -283,7 +284,7 @@ declare namespace OAuth2Server { * Invoked to check if the requested scope is valid for a particular client/user combination. * */ - validateScope?(user: User, client: Client, scope: string, callback?: Callback): Promise; + validateScope?(user: User, client: Client, scope: string, callback?: Callback): Promise; } interface RefreshTokenModel extends BaseModel, RequestAuthenticationModel { @@ -317,7 +318,7 @@ declare namespace OAuth2Server { * Invoked to check if the requested scope is valid for a particular client/user combination. * */ - validateScope?(user: User, client: Client, scope: string, callback?: Callback): Promise; + validateScope?(user: User, client: Client, scope: string, callback?: Callback): Promise; } interface ExtensionModel extends BaseModel, RequestAuthenticationModel {} @@ -380,6 +381,39 @@ declare namespace OAuth2Server { user: User; [key: string]: any; } + + class OAuthError extends Error { + constructor(messageOrError: string | Error, properties?: object); + + /** + * The HTTP error code. + */ + code: number; + + /** + * The OAuth error code. + */ + name: string; + + /** + * A human-readable error message. + */ + message: string; + } + + class AccessDeniedError extends OAuthError {} + class InsufficientScopeError extends OAuthError {} + class InvalidArgumentError extends OAuthError {} + class InvalidClientError extends OAuthError {} + class InvalidGrantError extends OAuthError {} + class InvalidRequestError extends OAuthError {} + class InvalidScopeError extends OAuthError {} + class InvalidTokenError extends OAuthError {} + class ServerError extends OAuthError {} + class UnauthorizedClientError extends OAuthError {} + class UnauthorizedRequestError extends OAuthError {} + class UnsupportedGrantTypeError extends OAuthError {} + class UnsupportedResponseTypeError extends OAuthError {} } export = OAuth2Server; From 57a76824baae8bb97a3535d5e8a737ec7b9e2d7b Mon Sep 17 00:00:00 2001 From: Billy Shih Date: Fri, 20 Jul 2018 18:13:07 -0700 Subject: [PATCH 178/738] [Victory] Fix tickFormat types (#27243) --- types/victory/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index 31740217e7..d23ffea90b 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -1097,7 +1097,7 @@ declare module "victory" { * an array of display values for each tickValue. * @example d3.time.format("%Y"), (x) => x.toPrecision(2), ["first", "second", "third"] */ - tickFormat?: any[] | { (data: any): string | number }; + tickFormat?: any[] | { (tick: any, index: number, ticks: any[]): string | number }; /** * The tickValues prop explicitly specifies which tick values to draw on the axis. * @example ["apples", "bananas", "oranges"], [2, 4, 6, 8] From af73b62052acfebff756fd475e855e0cb2e9b20a Mon Sep 17 00:00:00 2001 From: Billy Shih Date: Fri, 20 Jul 2018 18:13:56 -0700 Subject: [PATCH 179/738] [Victory] Add VictoryTooltip Types (#27177) * Add VictoryTooltip Types * Add VictoryThemeDefinition --- types/victory/index.d.ts | 140 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index d23ffea90b..6f152a9fcb 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -33,6 +33,7 @@ declare module "victory" { // Many victory components accept string or number or callback which returns string or number type StringOrNumberOrCallback = string | number | { (): string | number }; + type NumberOrCallback = { (): number } | number; /** * Style interface used in components/themeing @@ -520,6 +521,145 @@ declare module "victory" { */ export const VictoryTheme: VictoryThemeInterface; + type OrientationTypes = "top" | "bottom" | "left" | "right"; + + export interface VictoryTooltipProps { + /** + * The active prop specifies whether the tooltip component should be displayed. + */ + active?: boolean; + /** + * When true, tooltip events will set the active prop on both data and label elements. + * @default false + */ + activateData?: boolean; + /** + * The angle prop specifies the angle to rotate the tooltip around its origin point. + */ + angle?: string | number; + /** + * The cornerRadius prop determines corner radius of the flyout container. This prop may be given as a positive number or a function of datum. + */ + cornerRadius?: NumberOrCallback; + /** + * Victory components can pass a datum prop to their label component. This can be used to calculate functional styles, and determine text. + */ + datum?: {}; + /** + * Victory components can pass a data prop to their label component. This can be useful in custom components that need to make use of the entire dataset. + */ + data?: any[]; + /** + * The dx prop defines a horizontal shift from the x coordinate. + */ + dx?: StringOrNumberOrCallback; + /** + * The dy prop defines a vertical shift from the y coordinate. + */ + dy?: StringOrNumberOrCallback; + /** + * The events prop attaches arbitrary event handlers to the label component. This prop should be given as an object of event names and corresponding event handlers. + * When events are provided via Victory’s event system, event handlers will be called with the event, the props of the component is attached to, and an eventKey. + * Examples: events={{onClick: (evt) => alert("x: " + evt.clientX)}} + */ + events?: {}; + /** + * The style prop applies SVG style properties to the rendered flyout container. These props will be passed to the flyoutComponent. + */ + flyoutStyle?: React.CSSProperties; + /** + * The flyoutComponent prop takes a component instance which will be used to create the flyout path for each tooltip. + * The new element created from the passed flyoutComponent will be supplied with the following properties: x, y, dx, dy, index, datum, cornerRadius, pointerLength, pointerWidth, width, height, orientation, style, and events. + * Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. + * If flyoutComponent is omitted, a default Flyout component will be created with props described above. + * Examples: flyoutComponent={}, flyoutComponent={} + * @default + */ + flyoutComponent?: React.ReactElement; + /** + * The groupComponent prop takes a component instance which will be used to create group elements for use within container elements. This prop defaults to a tag. + * @default groupComponent={} + */ + groupComponent?: React.ReactElement; + /** + * The height prop defines the height of the tooltip flyout. This prop may be given as a positive number or a function of datum. + * If this prop is not set, height will be determined based on an approximate text size calculated from the text and style props provided to VictoryTooltip. + */ + height?: NumberOrCallback; + /** + * The horizontal prop determines whether to plot the flyouts to the left / right of the (x, y) coordinate rather than top / bottom. + * This is useful when an orientation prop is not provided, and data will determine the default orientation. i.e. negative values result in a left orientation and positive values will result in a right orientation by default. + */ + horizontal?: boolean; + /** + * The index prop represents the index of the datum in the data array. + */ + index?: number | string; + /** + * The labelComponent prop takes a component instance which will be used to render each tooltip label. + * The new element created from the passed labelComponent will be supplied with the following properties: x, y, index, datum, verticalAnchor, textAnchor, style, text, and events. + * Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. + * If labelComponent is omitted, a new VictoryLabel will be created with the props described above. + * Examples: labelComponent={}, labelComponent={} + * @default + */ + labelComponent?: React.ReactElement; + /** + * The orientation prop determines which side of the (x, y) coordinate the tooltip should be rendered on. + * This prop can be given as “top”, “bottom”, “left”, “right”, or as a function of datum that returns one of these values. + * If this prop is not provided it will be determined from the sign of the datum, and the value of the horizontal prop. + */ + orientation?: OrientationTypes; + /** + * The pointerLength prop determines the length of the triangular pointer extending from the flyout. This prop may be given as a positive number or a function of datum. + */ + pointerLength?: NumberOrCallback; + /** + * The pointerWidth prop determines the width of the base of the triangular pointer extending from the flyout. This prop may be given as a positive number or a function of datum. + */ + pointerWidth?: NumberOrCallback; + /** + * When renderInPortal is true, rendered tooltips will be wrapped in VictoryPortal and rendered within the Portal element within VictoryContainer. Note: This prop should not be set to true when using a custom container element. + */ + renderInPortal?: boolean; + /** + * The style prop applies CSS properties to the rendered `` element. + */ + style?: React.CSSProperties; + /** + * The text prop defines the text VictoryTooltip will render. The text prop may be given as a string, number, or function of datum. + * When VictoryLabel is used as the labelComponent, strings may include newline characters, which VictoryLabel will split in to separate elements. + */ + text?: StringOrNumberOrCallback | string[] | number[]; + /** + * VictoryAxis uses the standard theme prop. Read about it here + * @default VictoryTheme.grayscale + */ + theme?: VictoryThemeDefinition; + /** + * The width prop defines the width of the tooltip flyout. This prop may be given as a positive number or a function of datum. If this prop is not set, width will be determined based on an approximate text size calculated from the text and style props provided to VictoryTooltip. + */ + width?: NumberOrCallback; + /** + * The x prop defines the x coordinate to use as a basis for horizontal positioning. + */ + x?: number; + /** + * The y prop defines the y coordinate to use as a basis for vertical positioning. + */ + y?: number; + } + + + /** + * VictoryTooltip renders a tooltip component with a set of default events. When VictoryTooltip is used as a label component for any Victory component that renders data, it will attach events to rendered data components that will activate the tooltip when hovered. + * VictoryTooltip renders text as well as a configurable Flyout container. + */ + export class VictoryTooltip extends React.Component< + VictoryTooltipProps, + any + > {} + /** * Animate object used in components */ From b92d9cfc1f1a9936b0ff169dce001171807b30bd Mon Sep 17 00:00:00 2001 From: Chad Auld Date: Fri, 20 Jul 2018 19:14:14 -0600 Subject: [PATCH 180/738] Renaming react-select openAfterFocus prop to openOnClick (#27241) --- types/react-select/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index fd4d543dd3..ed8326c26b 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -472,10 +472,10 @@ export interface ReactSelectProps extends React.Props Date: Fri, 20 Jul 2018 21:15:13 -0400 Subject: [PATCH 181/738] recompose: Support OuterProps on withState enhancer (#27263) * Support OuterProps on withState enhancer Without this, any outer prop types are not handed into the component. * Add tests withState with explicit outer types --- types/recompose/index.d.ts | 2 +- types/recompose/recompose-tests.tsx | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index 0c7b9089c6..0c893486c3 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -141,7 +141,7 @@ declare module 'recompose' { stateUpdaterName: TStateUpdaterName, initialState: TState | mapper ): InferableComponentEnhancerWithProps< - stateProps, + TOutter & stateProps, TOutter >; diff --git a/types/recompose/recompose-tests.tsx b/types/recompose/recompose-tests.tsx index 75d64b468d..c30f5fb8f9 100644 --- a/types/recompose/recompose-tests.tsx +++ b/types/recompose/recompose-tests.tsx @@ -256,6 +256,15 @@ function testWithState() { const rendered2 = ( ); + + // We can also actually provide the generic necessary + const enhancer3 = withState("count", "setCount", 1); + const Enhanced3 = enhancer3(props => { + return
{props.title}
; + }); + const rendered3 = ( + + ); } function testWithStateHandlers() { From bfe8783484aed4f11017bdd3b97ebabe26349c46 Mon Sep 17 00:00:00 2001 From: Matthieu Dartiguenave Date: Sat, 21 Jul 2018 10:20:00 +0900 Subject: [PATCH 182/738] Update java to 0.9.1 (#27273) --- types/java/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/java/index.d.ts b/types/java/index.d.ts index cf770a8807..374224b832 100644 --- a/types/java/index.d.ts +++ b/types/java/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for java 0.7.2 +// Type definitions for java 0.9.1 // Project: https://github.com/joeferner/node-java -// Definitions by: Jim Lloyd , Kentaro Teramoto +// Definitions by: Jim Lloyd , Kentaro Teramoto , Matthieu Dartiguenave // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -39,8 +39,8 @@ declare namespace NodeJavaCore { asyncOptions: AsyncOptions; nativeBindingLocation: string; - callMethod(instance: any, className: string, methodName: string, args: any[], callback: Callback): void; - callMethodSync(instance: any, className: string, methodName: string, ...args: any[]): any; + callMethod(instance: any, methodName: string, args: any[], callback: Callback): void; + callMethodSync(instance: any, methodName: string, ...args: any[]): any; callStaticMethod(className: string, methodName: string, ...args: Array>): void; callStaticMethodSync(className: string, methodName: string, ...args: any[]): any; getStaticFieldValue(className: string, fieldName: string): any; From 355dbd50e89f9ecd1ae0da4e240e603c824985aa Mon Sep 17 00:00:00 2001 From: ondratra Date: Sat, 21 Jul 2018 03:20:55 +0200 Subject: [PATCH 183/738] mongoose: countDocuments() definitions added (#27283) --- types/mongoose/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 4a327e60f2..9d57b231a3 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -8,6 +8,7 @@ // Ethan Resnick // vologa // jussikinnula +// ondratra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1600,6 +1601,13 @@ declare module "mongoose" { count(callback?: (err: any, count: number) => void): Query; count(criteria: any, callback?: (err: any, count: number) => void): Query; + /** + * Counts number of matching documents in a database collection. + * @param criteria mongodb selector + */ + countDocuments(callback?: (err: any, count: number) => void): Query; + countDocuments(criteria: any, callback?: (err: any, count: number) => void): Query; + /** * Returns a wrapper around a mongodb driver cursor. A QueryCursor exposes a * Streams3-compatible interface, as well as a .next() function. From ec4917b2045d0b5ed45388ec025bf011609f9313 Mon Sep 17 00:00:00 2001 From: Suby Raman Date: Fri, 20 Jul 2018 21:22:09 -0400 Subject: [PATCH 184/738] webappsec-credential-management: tighten webauthn type options/naming (#27281) * tighten web authentication enum options as per the most current spec * (rearrange UV type) * pass linter. --- .../index.d.ts | 45 ++++++++++++++----- .../webappsec-credential-management-tests.ts | 15 ++++++- 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/types/webappsec-credential-management/index.d.ts b/types/webappsec-credential-management/index.d.ts index 2859e02d8a..9ab3292c3b 100644 --- a/types/webappsec-credential-management/index.d.ts +++ b/types/webappsec-credential-management/index.d.ts @@ -341,7 +341,7 @@ interface CredentialCreationOptions { /** * @see {@link https://w3c.github.io/webauthn/#dictionary-makecredentialoptions} */ - publicKey?: MakePublicKeyCredentialOptions; + publicKey?: PublicKeyCredentialCreationOptions; } /** @@ -364,6 +364,16 @@ interface FederatedCredentialRequestOptions { // Type definitions for webauthn // Spec: https://w3c.github.io/webauthn/ +/** + * @see {@link https://w3c.github.io/webauthn/#enumdef-publickeycredentialtype} + */ +type PublicKeyCredentialType = "public-key"; + +/** + * @see {@link https://w3c.github.io/webauthn/#enumdef-userverificationrequirement} + */ +type UserVerificationRequirement = "required" | "preferred" | "discouraged"; + /** * @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptions} */ @@ -372,7 +382,7 @@ interface PublicKeyCredentialRequestOptions { timeout: number; rpId: string; allowCredentials: PublicKeyCredentialDescriptor[]; - userVerification?: 'required' | 'preferred' | 'discouraged'; + userVerification?: UserVerificationRequirement; extensions?: any; } @@ -397,32 +407,47 @@ interface PublicKeyCredentialUserEntity { * @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialparameters} */ interface PublicKeyCredentialParameters { - type: 'public-key'; + type: PublicKeyCredentialType; alg: number; } +/** + * @see {@link https://w3c.github.io/webauthn/#transport} + */ +type AuthenticatorTransport = "usb" | "nfc" | "ble" | "internal"; + /** * @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptor} */ interface PublicKeyCredentialDescriptor { - type: 'public-key'; + type: PublicKeyCredentialType; id: BufferSource; - transports?: string[]; + transports?: AuthenticatorTransport[]; } +/** + * @see {@link https://w3c.github.io/webauthn/#attachment} + */ +type AuthenticatorAttachment = "platform" | "cross-platform"; + /** * @see {@link https://w3c.github.io/webauthn/#dictdef-authenticatorselectioncriteria} */ interface AuthenticatorSelectionCriteria { - authenticatorAttachment?: string; + authenticatorAttachment?: AuthenticatorAttachment; requireResidentKey?: boolean; - requireUserVerification?: string; + requireUserVerification?: UserVerificationRequirement; } +/** + * @see {@link https://w3c.github.io/webauthn/#attestation-convey} + */ +type AttestationConveyancePreference = "none" | "indirect" | "direct"; + /** * @see {@link https://w3c.github.io/webauthn/#dictdef-makepublickeycredentialoptions} */ -interface MakePublicKeyCredentialOptions { +interface PublicKeyCredentialCreationOptions { rp: PublicKeyCredentialRpEntity; user: PublicKeyCredentialUserEntity; @@ -432,7 +457,7 @@ interface MakePublicKeyCredentialOptions { timeout?: number; excludeCredentials?: PublicKeyCredentialDescriptor[]; authenticatorSelection?: AuthenticatorSelectionCriteria; - attestation?: 'none' | 'indirect' | 'direct'; + attestation?: AttestationConveyancePreference; extensions?: any; } @@ -463,7 +488,7 @@ interface AuthenticatorAssertionResponse extends AuthenticatorResponse { * @see {@link https://w3c.github.io/webauthn/#publickeycredential} */ interface PublicKeyCredential extends CredentialData { - readonly type: 'public-key'; + readonly type: PublicKeyCredentialType; readonly rawId: ArrayBuffer; readonly response: AuthenticatorAttestationResponse|AuthenticatorAssertionResponse; } diff --git a/types/webappsec-credential-management/webappsec-credential-management-tests.ts b/types/webappsec-credential-management/webappsec-credential-management-tests.ts index 58503208b3..2afa9f8785 100644 --- a/types/webappsec-credential-management/webappsec-credential-management-tests.ts +++ b/types/webappsec-credential-management/webappsec-credential-management-tests.ts @@ -295,8 +295,20 @@ function webauthnRegister() { pubKeyCredParams: [ {type: 'public-key', alg: -7}, ], + excludeCredentials: [ + { + id: (new Uint8Array(1)).buffer, + type: 'public-key', + transports: ['ble', 'internal'] + } + ], timeout: 5000, - authenticatorSelection: {}, + attestation: "direct", + authenticatorSelection: { + requireUserVerification: "preferred", + requireResidentKey: false, + authenticatorAttachment: "platform" + }, } }); @@ -324,6 +336,7 @@ function webauthnAuthenticate() { allowCredentials: [{ type: "public-key", id: credentialID, + transports: ['internal', 'ble', 'nfc', 'usb'] }], }}); From ffc83511271dfdb1646e22e69be3b243cd5b8e26 Mon Sep 17 00:00:00 2001 From: Ferdy Budhidharma Date: Sat, 21 Jul 2018 07:41:15 -0500 Subject: [PATCH 185/738] [prop-types] use conditional types for better prop type inference (#27378) * feat(prop-types): use conditional types for better prop type inference * fix(tests): fix publish tests * fix(prop-types): add custom prop validator, and switch requireables * fix(test): revert ReactFragment change * fix(prop-types): namespace imports from react like a good boy * CR changes * actually remove param from validator * remove anyvalidationmap * everyday i'm test...ering * SEMICOLONS WHY * retain null in undefaultize --- types/material-ui-pagination/index.d.ts | 2 +- types/material-ui/index.d.ts | 2 +- types/ngreact/index.d.ts | 2 +- types/prop-types/index.d.ts | 59 ++++--- types/prop-types/prop-types-tests.ts | 200 ++++++++++++++++++++-- types/react-foundation/index.d.ts | 2 +- types/react-is-deprecated/index.d.ts | 2 +- types/react-leaflet/index.d.ts | 2 +- types/react-props-decorators/index.d.ts | 2 +- types/react-sortable-tree/index.d.ts | 2 +- types/react-virtualized-select/index.d.ts | 2 +- types/react-virtualized/index.d.ts | 2 +- types/react/test/index.ts | 106 +----------- types/redux-form/index.d.ts | 2 +- types/redux-form/v4/index.d.ts | 8 +- 15 files changed, 249 insertions(+), 146 deletions(-) diff --git a/types/material-ui-pagination/index.d.ts b/types/material-ui-pagination/index.d.ts index 3e76401f43..1b91e0db3d 100644 --- a/types/material-ui-pagination/index.d.ts +++ b/types/material-ui-pagination/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/lo-tp/material-ui-pagination // Definitions by: m0a // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 import * as React from 'react'; export interface PaginationProps { total: number; diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 649a058156..285d949d70 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -14,7 +14,7 @@ // Sam Walsh // Tim de Koning // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 /// /// diff --git a/types/ngreact/index.d.ts b/types/ngreact/index.d.ts index 6db92506ce..1f4a31b6be 100644 --- a/types/ngreact/index.d.ts +++ b/types/ngreact/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ngReact/ngReact // Definitions by: Vicky Lai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 /// /// diff --git a/types/prop-types/index.d.ts b/types/prop-types/index.d.ts index 67146e6cc7..33ff7ae783 100644 --- a/types/prop-types/index.d.ts +++ b/types/prop-types/index.d.ts @@ -1,33 +1,52 @@ // Type definitions for prop-types 15.5 // Project: https://github.com/reactjs/prop-types // Definitions by: DovydasNavickas +// Ferdy Budhidharma // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.8 -export type Validator = (object: T, key: string, componentName: string, ...rest: any[]) => Error | null; +import { ReactNode, ReactElement } from 'react'; -export interface Requireable extends Validator { - isRequired: Validator; +export const nominalTypeHack: unique symbol; + +export type IsOptional = undefined | null extends T ? true : undefined extends T ? true : null extends T ? true : false; + +export type RequiredKeys = { [K in keyof V]: V[K] extends Validator ? IsOptional extends true ? never : K : never }[keyof V]; +export type OptionalKeys = Exclude>; +export type InferPropsInner = { [K in keyof V]: InferType; }; + +export interface Validator { + (props: object, propName: string, componentName: string, location: string, propFullName: string): Error | null; + [nominalTypeHack]?: T; } -export type ValidationMap = {[K in keyof T]?: Validator }; +export interface Requireable extends Validator { + isRequired: Validator>; +} + +export type ValidationMap = { [K in keyof T]-?: Validator }; + +export type InferType = V extends Validator ? T : any; +export type InferProps = + & InferPropsInner>> + & Partial>>>; export const any: Requireable; -export const array: Requireable; -export const bool: Requireable; -export const func: Requireable; -export const number: Requireable; -export const object: Requireable; -export const string: Requireable; -export const node: Requireable; -export const element: Requireable; -export const symbol: Requireable; -export function instanceOf(expectedClass: {}): Requireable; -export function oneOf(types: any[]): Requireable; -export function oneOfType(types: Array>): Requireable; -export function arrayOf(type: Validator): Requireable; -export function objectOf(type: Validator): Requireable; -export function shape(type: ValidationMap): Requireable; +export const array: Requireable; +export const bool: Requireable; +export const func: Requireable<(...args: any[]) => any>; +export const number: Requireable; +export const object: Requireable; +export const string: Requireable; +export const node: Requireable; +export const element: Requireable>; +export const symbol: Requireable; +export function instanceOf(expectedClass: new (...args: any[]) => T): Requireable; +export function oneOf(types: T[]): Requireable; +export function oneOfType>(types: T[]): Requireable>>; +export function arrayOf(type: Validator): Requireable; +export function objectOf(type: Validator): Requireable<{ [K in keyof any]: T; }>; +export function shape

>(type: P): Requireable>; /** * Assert that the values match with the type specs. diff --git a/types/prop-types/prop-types-tests.ts b/types/prop-types/prop-types-tests.ts index 4d5a939b6e..a9bde3af00 100644 --- a/types/prop-types/prop-types-tests.ts +++ b/types/prop-types/prop-types-tests.ts @@ -1,29 +1,207 @@ +import { ReactElement, ReactNode } from "react"; import * as PropTypes from "prop-types"; +declare const uniqueType: unique symbol; + +class TestClass { } + interface Props { - any: any; + any?: any; array: string[]; bool: boolean; - func: any; - string: string; + element: ReactElement; + func(foo: string): void; + node?: ReactNode; + requiredNode: NonNullable; number: number; + object: object; + string: string; symbol: symbol; - object: {}; - node: any; - element: any; + instanceOf: TestClass; + oneOf: 'a' | 'b' | 'c'; + oneOfType: string | boolean | { + foo?: string; + bar: number; + }; + numberOrFalse: false | number; + nodeOrRenderFn?: ReactNode | (() => ReactNode); + arrayOf: boolean[]; + objectOf: { [K: string]: number }; + shape: { + foo: string; + bar?: boolean; + baz?: any + }; + optionalNumber?: number | null; + customProp?: typeof uniqueType; } -const propTypes: PropTypes.ValidationMap = { - any: PropTypes.any.isRequired, +const innerProps = { + foo: PropTypes.string.isRequired, + bar: PropTypes.bool, + baz: PropTypes.any +}; + +const arrayOfTypes = [PropTypes.string, PropTypes.bool, PropTypes.shape({ + foo: PropTypes.string, + bar: PropTypes.number.isRequired +})]; +type PropTypesMap = PropTypes.ValidationMap; + +// TS checking +const propTypes: PropTypesMap = { + any: PropTypes.any, array: PropTypes.array.isRequired, bool: PropTypes.bool.isRequired, + element: PropTypes.element.isRequired, func: PropTypes.func.isRequired, + node: PropTypes.node, + requiredNode: PropTypes.node.isRequired, number: PropTypes.number.isRequired, object: PropTypes.object.isRequired, string: PropTypes.string.isRequired, symbol: PropTypes.symbol.isRequired, - node: PropTypes.node.isRequired, - element: PropTypes.element.isRequired + instanceOf: PropTypes.instanceOf(TestClass).isRequired, + oneOf: PropTypes.oneOf<'a' | 'b' | 'c'>(['a', 'b', 'c']).isRequired, + oneOfType: PropTypes.oneOfType(arrayOfTypes).isRequired, + numberOrFalse: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.number]).isRequired, + // The generic function type (() => any) is assignable to ReactNode because ReactNode extends the empty object type {} + // Which widens the array literal of validators to just Array any>> + // It's too risky to change ReactNode to exclude {} even though it's invalid, as it's required for children-as-function props to work + // So we assert the explicit tuple type + nodeOrRenderFn: PropTypes.oneOfType([PropTypes.node, PropTypes.func] as [PropTypes.Requireable, PropTypes.Requireable<() => any>]), + arrayOf: PropTypes.arrayOf(PropTypes.bool.isRequired).isRequired, + objectOf: PropTypes.objectOf(PropTypes.number.isRequired).isRequired, + shape: PropTypes.shape(innerProps).isRequired, + optionalNumber: PropTypes.number, + customProp: (() => null) as PropTypes.Validator }; -PropTypes.checkPropTypes({xs: PropTypes.array}, {xs: []}, 'location', 'componentName'); +// JS checking +const propTypesWithoutAnnotation = { + any: PropTypes.any, + array: PropTypes.array.isRequired, + bool: PropTypes.bool.isRequired, + element: PropTypes.element.isRequired, + func: PropTypes.func.isRequired, + node: PropTypes.node, + requiredNode: PropTypes.node.isRequired, + number: PropTypes.number.isRequired, + object: PropTypes.object.isRequired, + string: PropTypes.string.isRequired, + symbol: PropTypes.symbol.isRequired, + instanceOf: PropTypes.instanceOf(TestClass).isRequired, + // required generic specification because of array type widening + oneOf: PropTypes.oneOf<'a' | 'b' | 'c'>(['a', 'b', 'c']).isRequired, + oneOfType: PropTypes.oneOfType(arrayOfTypes).isRequired, + numberOrFalse: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.number]).isRequired, + nodeOrRenderFn: PropTypes.oneOfType([PropTypes.node, PropTypes.func] as [PropTypes.Requireable, PropTypes.Requireable<() => any>]), + arrayOf: PropTypes.arrayOf(PropTypes.bool.isRequired).isRequired, + objectOf: PropTypes.objectOf(PropTypes.number.isRequired).isRequired, + shape: PropTypes.shape(innerProps).isRequired, + optionalNumber: PropTypes.number, + customProp: (() => null) as PropTypes.Validator +}; + +const partialPropTypes = { + number: PropTypes.number.isRequired, + object: PropTypes.object.isRequired, + string: PropTypes.string.isRequired, + symbol: PropTypes.symbol.isRequired, +}; + +const outerPropTypes = { + props: PropTypes.shape(propTypes).isRequired +}; + +const outerPropTypesWithoutAnnotation = { + props: PropTypes.shape(propTypesWithoutAnnotation).isRequired +}; + +type ExtractedArrayProps = PropTypes.InferType<(typeof arrayOfTypes)[number]>; + +type ExtractedInnerProps = PropTypes.InferProps; + +type ExtractedProps = PropTypes.InferProps; +type ExtractedPropsFromOuterProps = PropTypes.InferProps['props']; +type ExtractedPartialProps = PropTypes.InferProps; + +type ExtractedPropsWithoutAnnotation = PropTypes.InferProps; +type ExtractedPropsFromOuterPropsWithoutAnnotation = PropTypes.InferProps['props']; + +// $ExpectType: true +type ExtractPropsMatch = ExtractedProps extends ExtractedPropsWithoutAnnotation ? true : false; +// $ExpectType: true +type ExtractPropsMatch2 = ExtractedPropsWithoutAnnotation extends ExtractedProps ? true : false; +// $ExpectType: true +type ExtractPropsMatch3 = ExtractedProps extends Props ? true : false; +// $ExpectType: true +type ExtractPropsMatch4 = Props extends ExtractedPropsWithoutAnnotation ? true : false; +// $ExpectType: true +type ExtractFromOuterPropsMatch = ExtractedPropsFromOuterProps extends ExtractedPropsFromOuterPropsWithoutAnnotation ? true : false; +// $ExpectType: true +type ExtractFromOuterPropsMatch2 = ExtractedPropsFromOuterPropsWithoutAnnotation extends ExtractedPropsFromOuterProps ? true : false; +// $ExpectType: true +type ExtractFromOuterPropsMatch3 = ExtractedPropsFromOuterProps extends Props ? true : false; +// $ExpectType: true +type ExtractFromOuterPropsMatch4 = Props extends ExtractedPropsFromOuterPropsWithoutAnnotation ? true : false; + +// $ExpectType: false +type ExtractPropsMismatch = ExtractedPartialProps extends Props ? true : false; + +// $ExpectType: {} +type UnmatchedPropKeys = Pick>; +// $ExpectType: {} +type UnmatchedPropKeys2 = Pick>; + +PropTypes.checkPropTypes({ xs: PropTypes.array }, { xs: [] }, 'location', 'componentName'); + +// This would be the type that JSX sees +type Defaultize = + & Pick> + & Partial>> + & Partial>>; + +// This would be the type inside the component +type Undefaultize = + & Pick> + & { [K in Extract]-?: Exclude; } + & Required>>; + +const componentPropTypes = { + fi: PropTypes.func.isRequired, + foo: PropTypes.string, + bar: PropTypes.number.isRequired, + baz: PropTypes.bool, + bat: PropTypes.node +}; + +const componentDefaultProps = { + fi: () => null, + baz: false, + bat: ['This', 'is', 'a', 'string'] +}; + +type DefaultizedProps = Defaultize, typeof componentDefaultProps>; +type UndefaultizedProps = Undefaultize, typeof componentDefaultProps>; + +// $ExpectType: true +type DefaultizedPropsTest = { + fi?: (...args: any[]) => any; + foo?: string | null; + bar: number; + baz?: boolean | null; + bat?: ReactNode; +} extends DefaultizedProps ? true : false; +// $ExpectType: true +type UndefaultizedPropsTest = { + fi: (...args: any[]) => any; + foo?: string | null; + bar: number; + baz: boolean; + bat: Exclude; +} extends UndefaultizedProps ? true : false; diff --git a/types/react-foundation/index.d.ts b/types/react-foundation/index.d.ts index 9c88ff2f7e..51433b1fd9 100644 --- a/types/react-foundation/index.d.ts +++ b/types/react-foundation/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/digiaonline/react-foundation // Definitions by: Daniel Earwicker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 export { Accordion, AccordionItem, AccordionTitle, AccordionContent } from './components/accordion'; export { Badge } from './components/badge'; diff --git a/types/react-is-deprecated/index.d.ts b/types/react-is-deprecated/index.d.ts index 791cb97862..d5d3927177 100644 --- a/types/react-is-deprecated/index.d.ts +++ b/types/react-is-deprecated/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Aweary/react-is-deprecated // Definitions by: Sean Kelley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 declare module 'react-is-deprecated' { import { Validator, Requireable, ValidationMap, ReactPropTypes } from 'react'; diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index 48a98bfbca..c362a1f23c 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/PaulLeCam/react-leaflet // Definitions by: Dave Leaver , David Schneider , Yui T. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 import * as Leaflet from 'leaflet'; import * as React from 'react'; diff --git a/types/react-props-decorators/index.d.ts b/types/react-props-decorators/index.d.ts index 8aa59e5194..5396fa81ca 100644 --- a/types/react-props-decorators/index.d.ts +++ b/types/react-props-decorators/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/popkirby/react-props-decorators // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 /// diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index 498fd48800..0415db0414 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -4,7 +4,7 @@ // Jovica Zoric // Kevin Perrine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 import * as React from 'react'; import { ListProps, Index } from 'react-virtualized'; diff --git a/types/react-virtualized-select/index.d.ts b/types/react-virtualized-select/index.d.ts index 83c062eab7..402b027785 100644 --- a/types/react-virtualized-select/index.d.ts +++ b/types/react-virtualized-select/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/bvaughn/react-virtualized-select // Definitions by: Sean Kelley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 import * as React from "react"; import { ReactSelectProps, ReactAsyncSelectProps, ReactCreatableSelectProps, LoadOptionsHandler, OptionValues } from "react-select"; diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index 2714e9a93c..b7c557d875 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -8,7 +8,7 @@ // Steve Zhang // Maciej Goszczycki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 export { ArrowKeyStepper, diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 3b7e5193fd..227ba5721d 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -11,7 +11,6 @@ import * as TestUtils from "react-addons-test-utils"; import TransitionGroup = require("react-addons-transition-group"); import update = require("react-addons-update"); import createReactClass = require("create-react-class"); -import * as PropTypes from "prop-types"; import * as DOM from "react-dom-factories"; interface Props extends React.Attributes { @@ -91,10 +90,10 @@ declare const container: Element; }; // Even if state is not set, this is allowed by React - this.setState({inputValue: 'hello'}); + this.setState({ inputValue: 'hello' }); this.setState((prevState, props) => { // $ExpectError - props = {foo: 'nope'}; + props = { foo: 'nope' }; // $ExpectError props.foo = 'nope'; @@ -118,15 +117,15 @@ declare const container: Element; class ModernComponent extends React.Component implements MyComponent, React.ChildContextProvider { static propTypes: React.ValidationMap = { - foo: PropTypes.number + foo: (() => null) as React.Validator }; static contextTypes: React.ValidationMap = { - someValue: PropTypes.string + someValue: (() => null) as React.Validator }; static childContextTypes: React.ValidationMap = { - someOtherValue: PropTypes.string + someOtherValue: (() => null) as React.Validator }; context: Context; @@ -180,7 +179,7 @@ class ModernComponent extends React.Component class ModernComponentArrayRender extends React.Component { render() { return [DOM.h1({ key: "1" }, "1"), - DOM.h1({ key: "2" }, "2")]; + DOM.h1({ key: "2" }, "2")]; } } @@ -436,99 +435,6 @@ DOM.svg({ }) ); -// -// PropTypes -// -------------------------------------------------------------------------- - -const PropTypesSpecification: React.ComponentSpec = { - propTypes: { - optionalArray: PropTypes.array, - optionalBool: PropTypes.bool, - optionalFunc: PropTypes.func, - optionalNumber: PropTypes.number, - optionalObject: PropTypes.object, - optionalString: PropTypes.string, - optionalNode: PropTypes.node, - optionalElement: PropTypes.element, - optionalMessage: PropTypes.instanceOf(Date), - optionalEnum: PropTypes.oneOf(["News", "Photos"]), - optionalUnion: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number, - PropTypes.instanceOf(Date) - ]), - optionalArrayOf: PropTypes.arrayOf(PropTypes.number), - optionalObjectOf: PropTypes.objectOf(PropTypes.number), - optionalObjectWithShape: PropTypes.shape({ - color: PropTypes.string, - fontSize: PropTypes.number - }), - requiredFunc: PropTypes.func.isRequired, - requiredAny: PropTypes.any.isRequired, - customProp(props: any, propName: string, componentName: string): Error | null { - if (!/matchme/.test(props[propName])) { - return new Error("Validation failed!"); - } - return null; - }, - // https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes - percentage: (object: any, key: string, componentName: string, ...rest: any[]): Error | null => { - const error = PropTypes.number(object, key, componentName, ...rest); - if (error) { - return error; - } - if (object[key] < 0 || object[key] > 100) { - return new Error(`prop ${key} must be between 0 and 100`); - } - return null; - } - }, - render: (): React.ReactElement | null => { - return null; - } -}; - -// -// ContextTypes -// -------------------------------------------------------------------------- - -const ContextTypesSpecification: React.ComponentSpec = { - contextTypes: { - optionalArray: PropTypes.array, - optionalBool: PropTypes.bool, - optionalFunc: PropTypes.func, - optionalNumber: PropTypes.number, - optionalObject: PropTypes.object, - optionalString: PropTypes.string, - optionalNode: PropTypes.node, - optionalElement: PropTypes.element, - optionalMessage: PropTypes.instanceOf(Date), - optionalEnum: PropTypes.oneOf(["News", "Photos"]), - optionalUnion: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number, - PropTypes.instanceOf(Date) - ]), - optionalArrayOf: PropTypes.arrayOf(PropTypes.number), - optionalObjectOf: PropTypes.objectOf(PropTypes.number), - optionalObjectWithShape: PropTypes.shape({ - color: PropTypes.string, - fontSize: PropTypes.number - }), - requiredFunc: PropTypes.func.isRequired, - requiredAny: PropTypes.any.isRequired, - customProp(props: any, propName: string, componentName: string): Error | null { - if (!/matchme/.test(props[propName])) { - return new Error("Validation failed!"); - } - return null; - } - }, - render: (): null => { - return null; - } -}; - // // React.Children // -------------------------------------------------------------------------- diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index 5ff24c90a0..989d9222d0 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -10,7 +10,7 @@ // Tim de Koning // Maddi Joyce // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 import { ComponentClass, StatelessComponent, diff --git a/types/redux-form/v4/index.d.ts b/types/redux-form/v4/index.d.ts index 3ecd2d87cc..4e21aee1fa 100644 --- a/types/redux-form/v4/index.d.ts +++ b/types/redux-form/v4/index.d.ts @@ -2,12 +2,12 @@ // Project: https://github.com/erikras/redux-form // Definitions by: Daniel Lytkin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 import * as React from 'react'; import { Dispatch, ActionCreator, Reducer } from 'redux'; -export const actionTypes: {[actionName: string]: string}; +export const actionTypes: { [actionName: string]: string }; export type FieldValue = any; @@ -464,7 +464,7 @@ export declare const reducer: { [formName: string]: { [fieldName: string]: Normalizer } - }): Reducer; + }): Reducer; /** * Returns a form reducer that will also pass each action through @@ -473,5 +473,5 @@ export declare const reducer: { * passed to each reducer will only be the slice that pertains to that * form. */ - plugin(reducers: { [formName: string]: Reducer }): Reducer; + plugin(reducers: { [formName: string]: Reducer }): Reducer; }; From 4545f71dc406e1bf283bfd378c063e77c4947103 Mon Sep 17 00:00:00 2001 From: BehindTheMath <9314934+BehindTheMath@users.noreply.github.com> Date: Mon, 23 Jul 2018 01:13:58 -0400 Subject: [PATCH 186/738] [papaparse] Fix missing namespace for an external interface (#27353) The un-namespaced ReadableStream is defined in lib.dom.d.ts. The ReadableStream referenced here should be the one defined in @types/node. --- types/papaparse/index.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/papaparse/index.d.ts b/types/papaparse/index.d.ts index 4c83399955..bbd75e9e61 100644 --- a/types/papaparse/index.d.ts +++ b/types/papaparse/index.d.ts @@ -5,9 +5,12 @@ // João Loff // John Reilly // Alberto Restifo +// Behind The Math // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 +import "node"; + export as namespace Papa; /** @@ -17,9 +20,9 @@ export function parse(csvString: string, config?: ParseConfig): ParseResult; export function parse(file: File, config?: ParseConfig): ParseResult; -export function parse(stream: ReadableStream, config?: ParseConfig): ParseResult; +export function parse(stream: NodeJS.ReadableStream, config?: ParseConfig): ParseResult; -export function parse(stream: typeof NODE_STREAM_INPUT, config?: ParseConfig): ReadableStream; +export function parse(stream: typeof NODE_STREAM_INPUT, config?: ParseConfig): NodeJS.ReadableStream; /** * Unparses javascript data objects and returns a csv string From 420fde9ad1ac3557295612d6a6fc344899365418 Mon Sep 17 00:00:00 2001 From: geta6 Date: Tue, 24 Jul 2018 00:08:40 +0900 Subject: [PATCH 187/738] Fix incorrectly typed MultiCompiler.compilers in webpack (#27494) --- types/webpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 5831d996dd..5508d10491 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -1073,7 +1073,7 @@ declare namespace webpack { } abstract class MultiCompiler extends Tapable implements ICompiler { - compilers: ICompiler[]; + compilers: Compiler[]; run(handler: MultiCompiler.Handler): void; watch(watchOptions: MultiCompiler.WatchOptions, handler: MultiCompiler.Handler): MultiWatching; } From ba10e7228550faa86346279b3d7b005b32e32531 Mon Sep 17 00:00:00 2001 From: Adam Haglund Date: Mon, 23 Jul 2018 17:26:53 +0200 Subject: [PATCH 188/738] react-dnd*: Remove and Fix Types (#27466) * fix types for react-dnd-multi-backend * remove react-dnd and react-dnd-html5-backend typings * remove typings for react-dnd-test-backend * update types for react-dnd-touch-backend * fix tests for react-dnd-multi-backend * add to contributors --- notNeededPackages.json | 18 + types/react-dnd-html5-backend/index.d.ts | 15 - .../react-dnd-html5-backend-tests.ts | 286 --------------- types/react-dnd-html5-backend/tsconfig.json | 24 -- types/react-dnd-html5-backend/tslint.json | 7 - types/react-dnd-multi-backend/index.d.ts | 7 +- types/react-dnd-multi-backend/package.json | 6 + .../react-dnd-multi-backend-tests.tsx | 24 +- types/react-dnd-test-backend/index.d.ts | 15 - .../react-dnd-test-backend-tests.tsx | 17 - types/react-dnd-test-backend/tsconfig.json | 25 -- types/react-dnd-test-backend/tslint.json | 3 - types/react-dnd-touch-backend/index.d.ts | 8 +- types/react-dnd-touch-backend/package.json | 6 + .../react-dnd-touch-backend-tests.ts | 28 +- types/react-dnd/index.d.ts | 189 ---------- types/react-dnd/react-dnd-tests.tsx | 325 ------------------ types/react-dnd/tsconfig.json | 25 -- types/react-dnd/tslint.json | 79 ----- 19 files changed, 60 insertions(+), 1047 deletions(-) delete mode 100644 types/react-dnd-html5-backend/index.d.ts delete mode 100644 types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts delete mode 100644 types/react-dnd-html5-backend/tsconfig.json delete mode 100644 types/react-dnd-html5-backend/tslint.json create mode 100644 types/react-dnd-multi-backend/package.json delete mode 100644 types/react-dnd-test-backend/index.d.ts delete mode 100644 types/react-dnd-test-backend/react-dnd-test-backend-tests.tsx delete mode 100644 types/react-dnd-test-backend/tsconfig.json delete mode 100644 types/react-dnd-test-backend/tslint.json create mode 100644 types/react-dnd-touch-backend/package.json delete mode 100644 types/react-dnd/index.d.ts delete mode 100644 types/react-dnd/react-dnd-tests.tsx delete mode 100644 types/react-dnd/tsconfig.json delete mode 100644 types/react-dnd/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index b3ac153770..db3cd3f68e 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1140,6 +1140,24 @@ "sourceRepoURL": "https://github.com/gpbl/react-day-picker", "asOfVersion": "5.3.0" }, + { + "libraryName": "react-dnd", + "typingsPackageName": "react-dnd", + "sourceRepoURL": "https://github.com/react-dnd/react-dnd", + "asOfVersion": "3.0.2" + }, + { + "libraryName": "react-dnd-html5-backend", + "typingsPackageName": "react-dnd-html5-backend", + "sourceRepoURL": "https://github.com/react-dnd/react-dnd", + "asOfVersion": "3.0.2" + }, + { + "libraryName": "react-dnd-test-backend", + "typingsPackageName": "react-dnd-test-backend", + "sourceRepoURL": "https://github.com/react-dnd/react-dnd", + "asOfVersion": "3.0.2" + }, { "libraryName": "react-flip-move", "typingsPackageName": "react-flip-move", diff --git a/types/react-dnd-html5-backend/index.d.ts b/types/react-dnd-html5-backend/index.d.ts deleted file mode 100644 index 1cf8f78335..0000000000 --- a/types/react-dnd-html5-backend/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Type definitions for React DnD Html5 Backend 2.1 -// Project: https://github.com/gaearon/react-dnd -// Definitions by: Pedro Pereira -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 - -import * as ReactDnd from "react-dnd"; - -export namespace NativeTypes { - const FILE: string; - const URL: string; - const TEXT: string; -} -export function getEmptyImage(): any; // Image -export default class HTML5Backend implements ReactDnd.Backend {} diff --git a/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts b/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts deleted file mode 100644 index 71a0d06039..0000000000 --- a/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts +++ /dev/null @@ -1,286 +0,0 @@ -// Test adapted from the ReactDnD chess game tutorial: -// http://gaearon.github.io/react-dnd/docs-tutorial.html - -import * as React from "react"; -import * as DOM from "react-dom-factories"; -import * as ReactDnd from "react-dnd"; - -const r = DOM; - -import DragSource = ReactDnd.DragSource; -import DropTarget = ReactDnd.DropTarget; -import DragLayer = ReactDnd.DragLayer; -import DragDropContext = ReactDnd.DragDropContext; -import HTML5Backend, { getEmptyImage } from 'react-dnd-html5-backend'; -// Game Component -// ---------------------------------------------------------------------- - -namespace Game { - let knightPosition = [0, 0]; - let observer: any = null; - - function emitChange() { - observer(knightPosition); - } - - export function observe(o: any) { - if (observer) { - throw new Error("Multiple observers not implemented."); - } - - observer = o; - emitChange(); - } - - export function moveKnight(toX: number, toY: number) { - knightPosition = [toX, toY]; - emitChange(); - } - - export function canMoveKnight(toX: number, toY: number) { - const x = knightPosition[0]; - const y = knightPosition[1]; - const dx = toX - x; - const dy = toY - y; - - return (Math.abs(dx) === 2 && Math.abs(dy) === 1) || - (Math.abs(dx) === 1 && Math.abs(dy) === 2); - } -} - -const ItemTypes = { - KNIGHT: "knight" -}; - -// Knight Component -// ---------------------------------------------------------------------- - -namespace Knight { - interface KnightP extends React.Props { - connectDragSource: ReactDnd.ConnectDragSource; - connectDragPreview: ReactDnd.ConnectDragPreview; - isDragging: boolean; - } - - const knightSource: ReactDnd.DragSourceSpec = { - beginDrag: (props) => { - return {}; - } - }; - - function knightCollect(connect: ReactDnd.DragSourceConnector, monitor: ReactDnd.DragSourceMonitor) { - return { - connectDragSource: connect.dragSource(), - connectDragPreview: connect.dragPreview(), - isDragging: monitor.isDragging() - }; - } - - export class Knight extends React.Component { - static defaultProps: KnightP; - - static create = React.createFactory(Knight); - - componentDidMount() { - const img = getEmptyImage(); - img.onload = () => this.props.connectDragPreview(img); - } - - render() { - return this.props.connectDragSource( - r.div({ - style: { - opacity: this.props.isDragging ? 0.5 : 1, - fontSize: 25, - fontWeight: 'bold', - cursor: 'move' - } - }, "♘") - ); - } - } - - export const DndKnight = DragSource(ItemTypes.KNIGHT, knightSource, knightCollect)(Knight); - export const create = React.createFactory(DndKnight); -} - -// Square Component -// ---------------------------------------------------------------------- - -namespace Square { - interface SquareP extends React.Props { - black: boolean; - } - - export class Square extends React.Component { - render() { - const fill = this.props.black ? 'black' : 'white'; - return r.div({ - style: { - backgroundColor: fill - } - }); - } - } - - export const create = React.createFactory(Square); -} - -// BoardSquare Component -// ---------------------------------------------------------------------- - -namespace BoardSquare { - interface BoardSquareP extends React.Props { - x: number; - y: number; - connectDropTarget?: ReactDnd.ConnectDropTarget; - isOver?: boolean; - canDrop?: boolean; - } - - const boardSquareTarget: ReactDnd.DropTargetSpec = { - canDrop: (props) => Game.canMoveKnight(props.x, props.y), - drop: (props) => Game.moveKnight(props.x, props.y) - }; - - function boardSquareCollect(connect: ReactDnd.DropTargetConnector, monitor: ReactDnd.DropTargetMonitor) { - return { - connectDropTarget: connect.dropTarget(), - isOver: monitor.isOver(), - canDrop: monitor.canDrop() - }; - } - - export class BoardSquare extends React.Component { - static defaultProps: BoardSquareP; - - private readonly _renderOverlay = (color: string) => { - return r.div({ - style: { - position: 'absolute', - top: 0, - left: 0, - height: '100%', - width: '100%', - zIndex: 1, - opacity: 0.5, - backgroundColor: color - } - }); - } - - render() { - const black = (this.props.x + this.props.y) % 2 === 1; - const isOver = this.props.isOver; - const canDrop = this.props.canDrop; - - return this.props.connectDropTarget( - r.div({ - style: { - position: 'relative', - width: '100%', - height: '100%' - }, - children: [ - Square.create({ black }), - isOver && !canDrop ? this._renderOverlay('red') : null, - !isOver && canDrop ? this._renderOverlay('yellow') : null, - isOver && canDrop ? this._renderOverlay('green') : null - ] - }) - ); - } - } - - export const DndBoardSquare = DropTarget(ItemTypes.KNIGHT, boardSquareTarget, boardSquareCollect)(BoardSquare); - export const create = React.createFactory(DndBoardSquare); -} - -// Custom Drag Layer Component -// ---------------------------------------------------------------------- -namespace CustomDragLayer { - interface CustomDragLayerP extends React.Props { - isDragging?: boolean; - item?: {}; - } - - function dragLayerCollect(monitor: ReactDnd.DragLayerMonitor) { - return { - isDragging: monitor.isDragging(), - item: monitor.getItem(), - }; - } - - export class CustomDragLayer extends React.Component { - render() { - return r.div(null, this.props.isDragging ? this.props.item : null); - } - } - - export const dragLayer = DragLayer(dragLayerCollect)(CustomDragLayer); - - export const create = React.createFactory(dragLayer); -} - -// Board Component -// ---------------------------------------------------------------------- - -namespace Board { - interface BoardP extends React.Props { - knightPosition: number[]; - } - - export class Board extends React.Component { - private readonly _renderPiece = (x: number, y: number) => { - const knightX = this.props.knightPosition[0]; - const knightY = this.props.knightPosition[1]; - return x === knightX && y === knightY ? - Knight.create() : - null; - } - - private readonly _renderSquare = (i: number) => { - const x = i % 8; - const y = Math.floor(i / 8); - - return r.div({ - key: i, - style: { - width: '12.5%', - height: '12.5%' - } - }, BoardSquare.create({ x, y }, this._renderPiece(x, y))); - } - - render() { - const squares: Array> = []; - for (let i = 0; i < 64; i++) { - squares.push(this._renderSquare(i)); - } - - return r.div({ - children: [ - CustomDragLayer.create(), - r.div({ - style: { - width: '100%', - height: '100%', - display: 'flex', - flexWrap: 'wrap' - }, - children: squares - }) - ] - }); - } - } - - export const createWithHTMLBackend = React.createFactory(DragDropContext(HTML5Backend)(Board)); -} - -// Render the Board Component -// ---------------------------------------------------------------------- - -Board.createWithHTMLBackend({ - knightPosition: [0, 0] -}); diff --git a/types/react-dnd-html5-backend/tsconfig.json b/types/react-dnd-html5-backend/tsconfig.json deleted file mode 100644 index dca11ac9e1..0000000000 --- a/types/react-dnd-html5-backend/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-dnd-html5-backend-tests.ts" - ] -} \ No newline at end of file diff --git a/types/react-dnd-html5-backend/tslint.json b/types/react-dnd-html5-backend/tslint.json deleted file mode 100644 index bf6102640b..0000000000 --- a/types/react-dnd-html5-backend/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-namespace": false - } -} diff --git a/types/react-dnd-multi-backend/index.d.ts b/types/react-dnd-multi-backend/index.d.ts index 7e8b3ff209..10e6662bdd 100644 --- a/types/react-dnd-multi-backend/index.d.ts +++ b/types/react-dnd-multi-backend/index.d.ts @@ -1,11 +1,12 @@ // Type definitions for react-dnd-multi-backend 3.0 // Project: https://github.com/LouisBrunner/react-dnd-multi-backend // Definitions by: Janeene Beeforth +// Adam Haglund // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 import { CSSProperties, PureComponent } from "react"; -import { Backend } from "react-dnd"; +import { BackendFactory } from "dnd-core"; /** * Callback function type definition for checking whether an event represents a transition between @@ -50,7 +51,7 @@ export interface BackendDeclaration { /** * Backend - e.g. the one provided by react-dnd-html5-backend. */ - backend: Backend; + backend: BackendFactory; /** * Flag to indicate that this backend needs to have a custom preview generated. This is mainly * used for backends such as the react-dnd-touch-backend, where there is no default preview @@ -112,4 +113,4 @@ export const HTML5DragTransition: Transition; * @param backends The list of backends in descending order of preference to use for drag and drop. * @returns A backend definition compatible with react-dnd. */ -export default function(backends: Backends): Backend; +export default function(backends: Backends): BackendFactory; diff --git a/types/react-dnd-multi-backend/package.json b/types/react-dnd-multi-backend/package.json new file mode 100644 index 0000000000..7f98b8bee8 --- /dev/null +++ b/types/react-dnd-multi-backend/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "dnd-core": "^4.0.5" + } +} diff --git a/types/react-dnd-multi-backend/react-dnd-multi-backend-tests.tsx b/types/react-dnd-multi-backend/react-dnd-multi-backend-tests.tsx index cbe6136585..d54e24ace2 100644 --- a/types/react-dnd-multi-backend/react-dnd-multi-backend-tests.tsx +++ b/types/react-dnd-multi-backend/react-dnd-multi-backend-tests.tsx @@ -1,26 +1,21 @@ -// Examples based on documentation at https://github.com/LouisBrunner/react-dnd-multi-backend - import * as React from 'react'; -import * as ReactDnd from 'react-dnd'; -import MultiBackend, { Backends, createTransition, Preview, TouchTransition, HTML5DragTransition } from 'react-dnd-multi-backend'; -import HTML5toTouch from 'react-dnd-multi-backend/lib/HTML5toTouch'; -import HTML5Backend from 'react-dnd-html5-backend'; +import { createDragDropManager } from 'dnd-core'; +import MultiBackend, { createTransition, TouchTransition, Backends, Preview } from 'react-dnd-multi-backend'; +import HTML5ToTouch from 'react-dnd-multi-backend/lib/HTML5toTouch'; import TouchBackend from 'react-dnd-touch-backend'; -const component = () => null; +const context = {}; /** * Most common use case - using the default HTML5 with Touch as a fallback. */ -const multiDndComponent = ReactDnd.DragDropContext(MultiBackend(HTML5toTouch))(component); +const multiDndComponent = createDragDropManager(MultiBackend(HTML5ToTouch), context); /** * Creating a custom list of backends, including creating a touch transition. */ const CustomBackends: Backends = { - backends: [{ - backend: HTML5Backend - }, + backends: [ { backend: TouchBackend({ enableMouseEvents: false }), preview: true, @@ -28,17 +23,12 @@ const CustomBackends: Backends = { return event.touches != null; }) }, - { - backend: HTML5Backend, - transition: HTML5DragTransition, - preview: true - }, { backend: TouchBackend({}), transition: TouchTransition }] }; -const multiCustomBackendsComponent = ReactDnd.DragDropContext(MultiBackend(CustomBackends))(component); +const multiCustomBackendsComponent = createDragDropManager(MultiBackend(CustomBackends), context); /** * Testing the Preview component. diff --git a/types/react-dnd-test-backend/index.d.ts b/types/react-dnd-test-backend/index.d.ts deleted file mode 100644 index 07f13607dd..0000000000 --- a/types/react-dnd-test-backend/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Type definitions for react-dnd-test-backend 2.5 -// Project: https://github.com/react-dnd/react-dnd#readme -// Definitions by: Gustavo Henke -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 - -import * as ReactDnd from "react-dnd"; - -export default class TestBackend implements ReactDnd.Backend { - simulateBeginDrag(sourceIds: ReactDnd.Identifier[], options?: {}): void; - simulatePublishDragSource(): void; - simulateHover(targetIds: ReactDnd.Identifier[], options?: {}): void; - simulateDrop(): void; - simulateEndDrag(): void; -} diff --git a/types/react-dnd-test-backend/react-dnd-test-backend-tests.tsx b/types/react-dnd-test-backend/react-dnd-test-backend-tests.tsx deleted file mode 100644 index aed3117e06..0000000000 --- a/types/react-dnd-test-backend/react-dnd-test-backend-tests.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import * as React from "react"; -import { ContextComponent, ContextComponentClass, DragDropContext } from "react-dnd"; -import TestBackend from "react-dnd-test-backend"; - -const Component = DragDropContext(TestBackend)(() =>

); -) => { - const backend = instance.getManager().getBackend() as TestBackend; - backend.simulateBeginDrag(["1"]); - backend.simulateBeginDrag(["1"], { foo: "bar" }); - - backend.simulateHover(["2"]); - backend.simulateHover(["2"], { foo: "bar" }); - - backend.simulateDrop(); - backend.simulateEndDrag(); - backend.simulatePublishDragSource(); -}}/>; diff --git a/types/react-dnd-test-backend/tsconfig.json b/types/react-dnd-test-backend/tsconfig.json deleted file mode 100644 index b83ff74de3..0000000000 --- a/types/react-dnd-test-backend/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "jsx": "react", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-dnd-test-backend-tests.tsx" - ] -} \ No newline at end of file diff --git a/types/react-dnd-test-backend/tslint.json b/types/react-dnd-test-backend/tslint.json deleted file mode 100644 index f93cf8562a..0000000000 --- a/types/react-dnd-test-backend/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} diff --git a/types/react-dnd-touch-backend/index.d.ts b/types/react-dnd-touch-backend/index.d.ts index 86ba0d1d10..9560f48883 100644 --- a/types/react-dnd-touch-backend/index.d.ts +++ b/types/react-dnd-touch-backend/index.d.ts @@ -1,12 +1,14 @@ // Type definitions for react-dnd-touch-backend 0.4 // Project: https://github.com/yahoo/react-dnd-touch-backend#readme -// Definitions by: Daniel Król , Janeene Beeforth +// Definitions by: Daniel Król , +// Janeene Beeforth +// Adam Haglund // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import * as ReactDnd from "react-dnd"; +import { BackendFactory } from 'dnd-core'; -export default function createTouchBackend(options: TouchBackendOptions): ReactDnd.Backend; +export default function createTouchBackend(option?: TouchBackendOptions): BackendFactory; export interface TouchBackendOptions { /** diff --git a/types/react-dnd-touch-backend/package.json b/types/react-dnd-touch-backend/package.json new file mode 100644 index 0000000000..7f98b8bee8 --- /dev/null +++ b/types/react-dnd-touch-backend/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "dnd-core": "^4.0.5" + } +} diff --git a/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts b/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts index dbf807a6a8..77da6f241f 100644 --- a/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts +++ b/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts @@ -1,17 +1,17 @@ -import * as ReactDnd from "react-dnd"; +import { createDragDropManager } from "dnd-core"; import TouchBackend from "react-dnd-touch-backend"; -const component = () => null; +const context = {}; -const dndComponent = ReactDnd.DragDropContext(TouchBackend)(component); -const dndComponentMouseEvents = ReactDnd.DragDropContext(TouchBackend({enableMouseEvents: true}))(component); -const dndComponentDelayTouchStart = ReactDnd.DragDropContext(TouchBackend({delayTouchStart: 200}))(component); -const dndComponentDelayMouseStart = ReactDnd.DragDropContext(TouchBackend({enableMouseEvents: true, delayMouseStart: 100})); -const dndComponentKeyboardEvents = ReactDnd.DragDropContext(TouchBackend({enableKeyboardEvents: true})); -const dndComponentOldDelay = ReactDnd.DragDropContext(TouchBackend({delay: 300})); -const dndComponentAllCurrentEvents = ReactDnd.DragDropContext(TouchBackend( - {enableKeyboardEvents: true, enableMouseEvents: true, delayMouseStart: 100, delayTouchStart: 200})); -const dndComponentWithScrollAngleRanges = ReactDnd.DragDropContext(TouchBackend( - { scrollAngleRanges: [{ start: 0, end: 0 }, { start: 0 }, { end: 0 }] })); -const dndComponentWithTouchSlop = ReactDnd.DragDropContext(TouchBackend({ touchSlop: 0 })); -const dndComponentWithIgnoreContextMenu = ReactDnd.DragDropContext(TouchBackend({ ignoreContextMenu: true })); +const dndComponent = createDragDropManager(TouchBackend(), context); +const dndComponentMouseEvents = createDragDropManager(TouchBackend({enableMouseEvents: true}), context); +const dndComponentDelayTouchStart = createDragDropManager(TouchBackend({delayTouchStart: 200}), context); +const dndComponentDelayMouseStart = createDragDropManager(TouchBackend({enableMouseEvents: true, delayMouseStart: 100}), context); +const dndComponentKeyboardEvents = createDragDropManager(TouchBackend({enableKeyboardEvents: true}), context); +const dndComponentOldDelay = createDragDropManager(TouchBackend({delay: 300}), context); +const dndComponentAllCurrentEvents = createDragDropManager(TouchBackend( + {enableKeyboardEvents: true, enableMouseEvents: true, delayMouseStart: 100, delayTouchStart: 200}), context); +const dndComponentWithScrollAngleRanges = createDragDropManager(TouchBackend( + { scrollAngleRanges: [{ start: 0, end: 0 }, { start: 0 }, { end: 0 }] }), context); +const dndComponentWithTouchSlop = createDragDropManager(TouchBackend({ touchSlop: 0 }), context); +const dndComponentWithIgnoreContextMenu = createDragDropManager(TouchBackend({ ignoreContextMenu: true }), context); diff --git a/types/react-dnd/index.d.ts b/types/react-dnd/index.d.ts deleted file mode 100644 index 6625903ad1..0000000000 --- a/types/react-dnd/index.d.ts +++ /dev/null @@ -1,189 +0,0 @@ -// Type definitions for React DnD v2.0.2 -// Project: https://github.com/gaearon/react-dnd -// Definitions by: Asana -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 - -/// - -declare module __ReactDnd { - // Decorated React Components - // ---------------------------------------------------------------------- - - class ContextComponent extends React.Component { - getDecoratedComponentInstance(): React.Component; - // Note: getManager is not yet documented on the React DnD docs. - getManager(): any; - } - - class DndComponent extends React.Component { - getDecoratedComponentInstance(): React.Component; - getHandlerId(): Identifier; - } - - interface ContextComponentClass

extends React.ComponentClass

{ - new(props?: P, context?: any): ContextComponent; - DecoratedComponent: React.ComponentClass

; - } - - interface DndComponentClass

extends React.ComponentClass

{ - new(props?: P, context?: any): DndComponent; - DecoratedComponent: React.ComponentClass

; - } - - // Top-level API - // ---------------------------------------------------------------------- - - export function DragSource

( - type: Identifier | ((props: P) => Identifier), - spec: DragSourceSpec

, - collect: DragSourceCollector, - options?: DndOptions

- ): (componentClass: React.ComponentClass

| React.StatelessComponent

) => DndComponentClass

; - - export function DropTarget

( - types: Identifier | Identifier[] | ((props: P) => Identifier | Identifier[]), - spec: DropTargetSpec

, - collect: DropTargetCollector, - options?: DndOptions

- ): (componentClass: React.ComponentClass

| React.StatelessComponent

) => DndComponentClass

; - - export function DragDropContext

( - backend: Backend - ):

(componentClass: React.ComponentClass

| React.StatelessComponent

) => ContextComponentClass

; - - interface DragDropContextProviderProps { - backend: Backend, - window?: Window, - } - - export class DragDropContextProvider extends React.Component { - } - - export function DragLayer

( - collect: DragLayerCollector, - options?: DndOptions

- ): (componentClass: React.ComponentClass

| React.StatelessComponent

) => DndComponentClass

; - - type DragSourceCollector = (connect: DragSourceConnector, monitor: DragSourceMonitor) => Object; - type DropTargetCollector = (connect: DropTargetConnector, monitor: DropTargetMonitor) => Object; - type DragLayerCollector = (monitor: DragLayerMonitor) => Object; - - // Shared - // ---------------------------------------------------------------------- - - // The React DnD docs say that this can also be the ES6 Symbol. - type Identifier = string; - - interface ClientOffset { - x: number; - y: number; - } - - interface DndOptions

{ - arePropsEqual?(props: P, otherProps: P): boolean; - } - - // DragSource - // ---------------------------------------------------------------------- - - interface DragSourceSpec

{ - beginDrag(props: P, monitor?: DragSourceMonitor, component?: React.Component

): Object; - endDrag?(props: P, monitor?: DragSourceMonitor, component?: React.Component

): void; - canDrag?(props: P, monitor?: DragSourceMonitor): boolean; - isDragging?(props: P, monitor?: DragSourceMonitor): boolean; - } - - class DragSourceMonitor { - canDrag(): boolean; - isDragging(): boolean; - getItemType(): Identifier; - getItem(): Object; - getDropResult(): Object; - didDrop(): boolean; - getInitialClientOffset(): ClientOffset; - getInitialSourceClientOffset(): ClientOffset; - getClientOffset(): ClientOffset; - getDifferenceFromInitialOffset(): ClientOffset; - getSourceClientOffset(): ClientOffset; - } - - class DragSourceConnector { - dragSource(): ConnectDragSource; - dragPreview(): ConnectDragPreview; - } - - interface DragElementWrapper { -

(elementOrNode: React.ReactElement

, options?: O): React.ReactElement

; - } - - interface DragSourceOptions { - dropEffect?: string; - } - - interface DragPreviewOptions { - captureDraggingState?: boolean; - anchorX?: number; - anchorY?: number; - offsetX?: number; - offsetY?: number; - } - - type ConnectDragSource = DragElementWrapper; - type ConnectDragPreview = DragElementWrapper; - - /// DropTarget - // ---------------------------------------------------------------------- - - interface DropTargetSpec

{ - drop?(props: P, monitor?: DropTargetMonitor, component?: React.Component

): Object|void; - hover?(props: P, monitor?: DropTargetMonitor, component?: React.Component

): void; - canDrop?(props: P, monitor?: DropTargetMonitor): boolean; - } - - class DropTargetMonitor { - canDrop(): boolean; - isOver(options?: { shallow: boolean }): boolean; - getItemType(): Identifier; - getItem(): Object; - getDropResult(): Object; - didDrop(): boolean; - getInitialClientOffset(): ClientOffset; - getInitialSourceClientOffset(): ClientOffset; - getClientOffset(): ClientOffset; - getDifferenceFromInitialOffset(): ClientOffset; - getSourceClientOffset(): ClientOffset; - } - - class DropTargetConnector { - dropTarget(): ConnectDropTarget; - } - - type ConnectDropTarget =

(elementOrNode: React.ReactElement

) => React.ReactElement

; - - /// DragLayerMonitor - // ---------------------------------------------------------------------- - - class DragLayerMonitor { - isDragging(): boolean; - getItemType(): Identifier; - getItem(): Object; - getInitialClientOffset(): ClientOffset; - getInitialSourceClientOffset(): ClientOffset; - getClientOffset(): ClientOffset; - getDifferenceFromInitialOffset(): ClientOffset; - getSourceClientOffset(): ClientOffset; - } - - /// Backend - /// --------------------------------------------------------------------- - - // TODO: Fill in the Backend interface. - // The React DnD docs do not cover this, and this is only needed for - // creating custom backends (i.e. not using the built-in HTML5Backend). - interface Backend {} -} - -declare module "react-dnd" { - export = __ReactDnd; -} diff --git a/types/react-dnd/react-dnd-tests.tsx b/types/react-dnd/react-dnd-tests.tsx deleted file mode 100644 index 3016a3f523..0000000000 --- a/types/react-dnd/react-dnd-tests.tsx +++ /dev/null @@ -1,325 +0,0 @@ -// Test adapted from the ReactDnD chess game tutorial: -// http://gaearon.github.io/react-dnd/docs-tutorial.html - -import * as React from "react"; -import * as DOM from "react-dom-factories"; -import * as ReactDnd from "react-dnd"; - -var r = DOM; - -import DragSource = ReactDnd.DragSource; -import DropTarget = ReactDnd.DropTarget; -import DragLayer = ReactDnd.DragLayer; -import DragDropContext = ReactDnd.DragDropContext; -import DragDropContextProvider = ReactDnd.DragDropContextProvider; -import HTML5Backend, { getEmptyImage, NativeTypes } from "react-dnd-html5-backend"; -declare class TestBackend { - setup(): void; - teardown(): void; - connectDragSource(): void; - connectDropTarget(): void; - simulateBeginDrag(sourceIds: __ReactDnd.Identifier[], options?: {}): void; - simulatePublishDragSource(): void; - simulateHover(targetIds: __ReactDnd.Identifier[], options?: {}): void; - simulateDrop(): void; - simulateEndDrag(): void; -} - -// Game Component -// ---------------------------------------------------------------------- - -namespace Game { - var knightPosition = [0, 0]; - var observer: any = null; - - function emitChange() { - observer(knightPosition); - } - - export function observe(o: any) { - if (observer) { - throw new Error("Multiple observers not implemented."); - } - - observer = o; - emitChange(); - } - - export function moveKnight(toX: number, toY: number) { - knightPosition = [toX, toY]; - emitChange(); - } - - export function canMoveKnight(toX: number, toY: number) { - const x = knightPosition[0]; - const y = knightPosition[1]; - const dx = toX - x; - const dy = toY - y; - - return (Math.abs(dx) === 2 && Math.abs(dy) === 1) || - (Math.abs(dx) === 1 && Math.abs(dy) === 2); - } -} - -var ItemTypes = { - KNIGHT: "knight" -}; - -// Knight Component -// ---------------------------------------------------------------------- - -namespace Knight { - interface KnightP extends React.Props { - connectDragSource: ReactDnd.ConnectDragSource; - connectDragPreview: ReactDnd.ConnectDragPreview; - isDragging: boolean; - } - - var knightSource: ReactDnd.DragSourceSpec = { - beginDrag: (props) => { - return {}; - } - }; - - function knightCollect(connect: ReactDnd.DragSourceConnector, monitor: ReactDnd.DragSourceMonitor) { - return { - connectDragSource: connect.dragSource(), - connectDragPreview: connect.dragPreview(), - isDragging: monitor.isDragging() - }; - } - - export class Knight extends React.Component { - static defaultProps: KnightP; - - static create = React.createFactory(Knight); - - componentDidMount() { - var img = getEmptyImage(); - img.onload = () => this.props.connectDragPreview(img); - } - - render() { - return this.props.connectDragSource( - r.div({ - style: { - opacity: this.props.isDragging ? 0.5 : 1, - fontSize: 25, - fontWeight: 'bold', - cursor: 'move' - } - }, "♘") - ); - } - } - - export var DndKnight = DragSource(ItemTypes.KNIGHT, knightSource, knightCollect)(Knight); - export var create = React.createFactory(DndKnight); -} - -// Square Component -// ---------------------------------------------------------------------- - -namespace Square { - interface SquareP extends React.Props { - black: boolean; - } - - export class Square extends React.Component { - render() { - var fill = this.props.black ? 'black' : 'white'; - return r.div({ - style: { - backgroundColor: fill - } - }) - } - } - - export var create = React.createFactory(Square); -} - -// BoardSquare Component -// ---------------------------------------------------------------------- - -namespace BoardSquare { - interface BoardSquareP extends React.Props { - x: number; - y: number; - connectDropTarget?: ReactDnd.ConnectDropTarget; - isOver?: boolean; - canDrop?: boolean; - } - - var boardSquareTarget: ReactDnd.DropTargetSpec = { - canDrop: (props) => Game.canMoveKnight(props.x, props.y), - drop: (props) => Game.moveKnight(props.x, props.y) - }; - - function boardSquareCollect(connect: ReactDnd.DropTargetConnector, monitor: ReactDnd.DropTargetMonitor) { - return { - connectDropTarget: connect.dropTarget(), - isOver: monitor.isOver(), - canDrop: monitor.canDrop() - }; - } - - export class BoardSquare extends React.Component { - static defaultProps: BoardSquareP; - - private readonly _renderOverlay = (color: string) => { - return r.div({ - style: { - position: 'absolute', - top: 0, - left: 0, - height: '100%', - width: '100%', - zIndex: 1, - opacity: 0.5, - backgroundColor: color - } - }); - }; - - render() { - var black = (this.props.x + this.props.y) % 2 === 1; - var isOver = this.props.isOver; - var canDrop = this.props.canDrop; - - return this.props.connectDropTarget( - r.div({ - style: { - position: 'relative', - width: '100%', - height: '100%' - }, - children: [ - Square.create({ - black: black - }), - isOver && !canDrop ? this._renderOverlay('red') : null, - !isOver && canDrop ? this._renderOverlay('yellow') : null, - isOver && canDrop ? this._renderOverlay('green') : null - ] - }) - ); - } - } - - export var DndBoardSquare = DropTarget(ItemTypes.KNIGHT, boardSquareTarget, boardSquareCollect)(BoardSquare); - export var fileDropTarget = DropTarget(NativeTypes.FILE, boardSquareTarget, boardSquareCollect)(BoardSquare); - export var create = React.createFactory(DndBoardSquare); -} - -// Custom Drag Layer Component -// ---------------------------------------------------------------------- -namespace CustomDragLayer { - interface CustomDragLayerP extends React.Props { - isDragging?: boolean; - item?: Object; - } - - function dragLayerCollect(monitor: ReactDnd.DragLayerMonitor) { - return { - isDragging: monitor.isDragging(), - item: monitor.getItem(), - }; - } - - export class CustomDragLayer extends React.Component { - render() { - return r.div(null, this.props.isDragging ? this.props.item : null); - } - } - - export var dragLayer = DragLayer(dragLayerCollect)(CustomDragLayer); - - export var create = React.createFactory(dragLayer); -} - -// Board Component -// ---------------------------------------------------------------------- - -namespace Board { - interface BoardP extends React.Props { - knightPosition: number[]; - } - - export class Board extends React.Component { - private readonly _renderPiece = (x: number, y: number) => { - var knightX = this.props.knightPosition[0]; - var knightY = this.props.knightPosition[1]; - return x === knightX && y === knightY ? - Knight.create() : - null; - }; - - private readonly _renderSquare = (i: number) => { - var x = i % 8; - var y = Math.floor(i / 8); - - return r.div({ - key: i, - style: { - width: '12.5%', - height: '12.5%' - } - }, BoardSquare.create({ - x: x, - y: y - }, this._renderPiece(x, y))); - }; - - render() { - var squares: React.ReactHTMLElement[] = []; - for (let i = 0; i < 64; i++) { - squares.push(this._renderSquare(i)); - } - - return r.div({ - children: [ - CustomDragLayer.create(), - r.div({ - style: { - width: '100%', - height: '100%', - display: 'flex', - flexWrap: 'wrap' - }, - children: squares - }) - ] - }); - } - } - - export var createWithHTMLBackend = React.createFactory(DragDropContext(HTML5Backend)(Board)); - export var createWithTestBackend = React.createFactory(DragDropContext(TestBackend)(Board)); -} - -// Render the Board Component -// ---------------------------------------------------------------------- - -Board.createWithHTMLBackend({ - knightPosition: [0, 0] -}); - - -Board.createWithTestBackend({ - knightPosition: [0, 0] -}); - - -// DragAndDropContextProvider -// ---------------------------------------------------------------------- - -export default class YourApp { - render() { - return ( - - /* ... */ - - ); - }; -} diff --git a/types/react-dnd/tsconfig.json b/types/react-dnd/tsconfig.json deleted file mode 100644 index 0f441c38f4..0000000000 --- a/types/react-dnd/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "jsx": "react", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-dnd-tests.tsx" - ] -} \ No newline at end of file diff --git a/types/react-dnd/tslint.json b/types/react-dnd/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/react-dnd/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 6798d64a19f0e07dd5f6475c8cd0aa9b2cffc146 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Mon, 23 Jul 2018 17:27:25 +0200 Subject: [PATCH 189/738] fix: add missing syntax type (#27471) --- types/stylelint/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/stylelint/index.d.ts b/types/stylelint/index.d.ts index 1606d1805c..67316843a9 100644 --- a/types/stylelint/index.d.ts +++ b/types/stylelint/index.d.ts @@ -5,7 +5,7 @@ export type FormatterType = "json" | "string" | "verbose"; -export type SyntaxType = "scss" | "less" | "sugarss"; +export type SyntaxType = "scss" | "sass" | "less" | "sugarss"; export interface LinterOptions { code?: string; From 3efa86f7a2b9538701c28e9e068ff8e913a87eed Mon Sep 17 00:00:00 2001 From: Simon Werner Date: Tue, 24 Jul 2018 03:28:08 +1200 Subject: [PATCH 190/738] Fix issue with stampit when using TS to check JavaScript (#27478) * Fix issue with stampit when using TS to check JavaScript **Caveat: This has not been tested within a TypeScript library.*** My knowledge of TypeScript is limited, so this has not been tested. hence, I suggest @lummish and/or @koresar review this PR. ## What it's fixing Currently I get the following error with the vanilla stampit example below, it applies to the `const Fighter = stampit(Character(...` line and TypeScript highlights the problem across the whole function: ```sh Expected 0-1 arguments, but got 2 ``` Example taken from main stampit example. ```JavaScript import stampit from 'stampit'; const Character = stampit({ props: { name: null, health: 100, }, init({ name = this.name }) { this.name = name; }, }); const Fighter = stampit(Character, { props: { stamina: 100, }, init({ stamina = this.stamina }) { this.stamina = stamina; }, methods: { fight() { console.log(`${this.name} takes a mighty swing!`); this.stamina--; }, }, }); ``` * Make stampit() more generic As discussed with @koresar. --- types/stampit/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/stampit/index.d.ts b/types/stampit/index.d.ts index 87d96e4f4b..08fcfb061b 100644 --- a/types/stampit/index.d.ts +++ b/types/stampit/index.d.ts @@ -133,13 +133,16 @@ interface Options { composers?: Composer[]; } +/** Stampit Composable for main stampit() function */ +type StampitComposable = stampit.Stamp | Descriptor | Options; + /** * Return a factory (aka Stamp) function that will produce new objects using the * prototypes that are passed in or composed. * @param options Stampit options object containing refs, methods, * init, props, statics, configurations, and property descriptors. */ -declare function stampit(options?: Options): stampit.Stamp; +declare function stampit(...composables: StampitComposable[]): stampit.Stamp; declare namespace stampit { /** From 293adc3195e7bb4d14b712c026ab97d42ba947da Mon Sep 17 00:00:00 2001 From: Bond Date: Mon, 23 Jul 2018 16:28:38 +0100 Subject: [PATCH 191/738] Add functions to take and release locks. (#27491) Add functions to take and release locks. https://github.com/OptimalBits/bull/blob/742a86e0af0e7d829e7d9cea55b74e7f7e850938/lib/job.js#L153-L180 --- types/bull/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 7b3fa3c3dc..8486e03f59 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -7,6 +7,7 @@ // Gabriel Terwesten // Oleg Repin // David Koblas +// Bond Akinmade // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -142,6 +143,21 @@ declare namespace Bull { * Promotes a job that is currently "delayed" to the "waiting" state and executed as soon as possible. */ promote(): Promise; + + /** + * The lock id of the job + */ + lockKey(): string; + + /** + * Releases the lock on the job. Only locks owned by the queue instance can be released. + */ + releaseLock(): Promise; + + /** + * Takes a lock for this job so that no other queue worker can process it at the same time. + */ + takeLock(): Promise; } type JobStatus = 'completed' | 'waiting' | 'active' | 'delayed' | 'failed'; From 1cbfb298e6198d0fb4cebd58d0eb30597180dd40 Mon Sep 17 00:00:00 2001 From: Jimmy Grand Date: Mon, 23 Jul 2018 17:29:09 +0200 Subject: [PATCH 192/738] mongoose: countDocuments and estimatedDocumentCount definitions added (#27486) --- types/mongoose/index.d.ts | 65 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 9d57b231a3..6933a916f2 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -9,6 +9,7 @@ // vologa // jussikinnula // ondratra +// alfirin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -378,7 +379,7 @@ declare module "mongoose" { /** Passed directly through to tls.createSecureContext. See https://nodejs.org/dist/latest-v9.x/docs/api/tls.html#tls_tls_createsecurecontext_options for more info. */ ciphers?: string; ecdhCurve?: string; - + /** Flag for using new URL string parser instead of current (deprecated) one */ useNewUrlParser?: boolean; @@ -1602,12 +1603,40 @@ declare module "mongoose" { count(criteria: any, callback?: (err: any, count: number) => void): Query; /** - * Counts number of matching documents in a database collection. - * @param criteria mongodb selector - */ + * Specifies this query as a `countDocuments()` query. Behaves like `count()`, + * except it always does a full collection scan when passed an empty filter `{}`. + * + * There are also minor differences in how `countDocuments()` handles + * [`$where` and a couple geospatial operators](http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#countDocuments). + * versus `count()`. + * + * Passing a `callback` executes the query. + * + * This function triggers the following middleware. + * + * - `countDocuments()` + * + * + * @param {Object} [criteria] mongodb selector + * @param {Function} [callback] optional params are (error, count) + * @return {Query} this + */ countDocuments(callback?: (err: any, count: number) => void): Query; countDocuments(criteria: any, callback?: (err: any, count: number) => void): Query; + /** + * Estimates the number of documents in the MongoDB collection. Faster than + * using `countDocuments()` for large collections because + * `estimatedDocumentCount()` uses collection metadata rather than scanning + * the entire collection. + * + * @param {Object} [options] passed transparently to the [MongoDB driver](http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#estimatedDocumentCount) + * @param {Function} [callback] optional params are (error, count) + * @return {Query} this + */ + estimatedDocumentCount(callback?: (err: any, count: number) => void): Query; + estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query; + /** * Returns a wrapper around a mongodb driver cursor. A QueryCursor exposes a * Streams3-compatible interface, as well as a .next() function. @@ -2589,6 +2618,34 @@ declare module "mongoose" { /** Counts number of matching documents in a database collection. */ count(conditions: any, callback?: (err: any, count: number) => void): Query; + /** + * Counts number of documents matching `criteria` in a database collection. + * + * If you want to count all documents in a large collection, + * use the `estimatedDocumentCount()` instead. + * If you call `countDocuments({})`, MongoDB will always execute + * a full collection scan and **not** use any indexes. + * + * @param {Object} filter + * @param {Function} [callback] + * @return {Query} + */ + countDocuments(callback?: (err: any, count: number) => void): Query; + countDocuments(criteria: any, callback?: (err: any, count: number) => void): Query; + + /** + * Estimates the number of documents in the MongoDB collection. Faster than + * using `countDocuments()` for large collections because + * `estimatedDocumentCount()` uses collection metadata rather than scanning + * the entire collection. + * + * @param {Object} [options] + * @param {Function} [callback] + * @return {Query} + */ + estimatedDocumentCount(callback?: (err: any, count: number) => void): Query; + estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query; + /** * Shortcut for saving one or more documents to the database. MyModel.create(docs) * does new MyModel(doc).save() for every doc in docs. From fbe2d02cb2e5cfdfcb36033e692af0d16eeb7b9d Mon Sep 17 00:00:00 2001 From: Mike North Date: Mon, 23 Jul 2018 08:29:33 -0700 Subject: [PATCH 193/738] [ember] Ember.Container#factoryFor (#27483) --- types/ember/index.d.ts | 4 ++++ types/ember/test/application-instance.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index a15987ae83..885eaafbbd 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -311,6 +311,10 @@ declare module 'ember' { * Given a fullName return a corresponding instance. */ lookup(fullName: string, options?: {}): any; + /** + * Given a fullName return a corresponding factory. + */ + factoryFor(fullName: string, options?: {}): any; } const _ContainerProxyMixin: Mixin<_ContainerProxyMixin>; diff --git a/types/ember/test/application-instance.ts b/types/ember/test/application-instance.ts index dfda446463..5b973b37c4 100644 --- a/types/ember/test/application-instance.ts +++ b/types/ember/test/application-instance.ts @@ -15,3 +15,6 @@ appInstance.register('some:injection', class Foo {}, { singleton: false, instantiate: true, }); + +appInstance.factoryFor('router:main'); +appInstance.lookup('route:basic'); From 23735e51b7cd23e2c672b1c804ce980fb640c056 Mon Sep 17 00:00:00 2001 From: Errietta Kostala Date: Mon, 23 Jul 2018 16:29:54 +0100 Subject: [PATCH 194/738] jsoneditor: Add 'schemaRefs' option (#27474) * Add 'schemaRefs' option * reference new version * fix comment --- types/jsoneditor/index.d.ts | 4 +++- types/jsoneditor/jsoneditor-tests.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/jsoneditor/index.d.ts b/types/jsoneditor/index.d.ts index 175c295df6..f095cb8434 100644 --- a/types/jsoneditor/index.d.ts +++ b/types/jsoneditor/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for jsoneditor v5.5.7 +// Type definitions for jsoneditor v5.19.0 // Project: https://github.com/josdejong/jsoneditor // Definitions by: Alejandro Sánchez +// Errietta Kostala // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -28,6 +29,7 @@ declare module 'jsoneditor' { modes?: Array; name?: string; schema?: Object; + schemaRefs?: Object; search?: boolean; indentation?: number; theme?: string; diff --git a/types/jsoneditor/jsoneditor-tests.ts b/types/jsoneditor/jsoneditor-tests.ts index cc659cfe04..d905e6ba76 100644 --- a/types/jsoneditor/jsoneditor-tests.ts +++ b/types/jsoneditor/jsoneditor-tests.ts @@ -17,6 +17,7 @@ options = { modes: ['tree', 'view', 'form', 'code', 'text'], name: 'foo', schema: {}, + schemaRefs: { "otherSchema": {}}, search: false, indentation: 2, theme: 'default' From d57015fa9fb49cdf06ab4b0c7cfb0439e73ef819 Mon Sep 17 00:00:00 2001 From: mail6543210 Date: Mon, 23 Jul 2018 23:30:19 +0800 Subject: [PATCH 195/738] Add missing/undocumented functions (#27464) Those functions and properties are not documented. --- types/traverse/index.d.ts | 20 ++++++++++++++++++++ types/traverse/traverse-tests.ts | 14 ++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/types/traverse/index.d.ts b/types/traverse/index.d.ts index dc78978da5..c81094be98 100644 --- a/types/traverse/index.d.ts +++ b/types/traverse/index.d.ts @@ -121,6 +121,11 @@ declare namespace traverse { */ parent: TraverseContext | undefined; + /** + * The contexts of the node's parents. + */ + parents: TraverseContext[]; + /** * The name of the key of the present node in its parent. * This is `undefined` for the root node. @@ -172,6 +177,11 @@ declare namespace traverse { */ delete(stopHere?: boolean): void; + /** + * Object keys of the node. + */ + keys: string[] | null; + /** * Call this function before all of the children are traversed. * You can assign into `this.keys` here to traverse in a custom order. @@ -192,6 +202,16 @@ declare namespace traverse { * Call this function after each of the children are traversed. */ post(callback: (this: TraverseContext, child: any) => void): void; + + /** + * Stops traversal entirely. + */ + stop(): void; + + /** + * Prevents traversing descendents of the current node. + */ + block(): void; } } diff --git a/types/traverse/traverse-tests.ts b/types/traverse/traverse-tests.ts index f31ec97e3f..c96cdf813d 100644 --- a/types/traverse/traverse-tests.ts +++ b/types/traverse/traverse-tests.ts @@ -62,3 +62,17 @@ function testPaths(){ }) }) } + +function testPropsAndFuncs(){ + var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; + + traverse(obj).forEach(function (x) { + console.log(this.keys); + console.log(this.parents); + + if (this.level == 2) this.block(); + if (this.level > 10) this.stop(); + }); + + console.dir(obj); +} From 2960264e360bc45a1f142fb7aaf57e6f8a4ef4a1 Mon Sep 17 00:00:00 2001 From: Mikhail Kafanov Date: Mon, 23 Jul 2018 21:31:02 +0600 Subject: [PATCH 196/738] Parse: updated `TriggerRequest` interface, added missing `afterFind` trigger, fixed `beforeFind` signature (#27462) * Added missing property to AfterSaveRequest * Update index.d.ts - TriggerRequest interface matches one from official Parse API docs - added missing afterFind hook and related AfterFindRequest/AfterFindResponse interfaces - fixed beforeFind hook signature --- types/parse/index.d.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 908281f84d..80bd1d7c46 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -922,17 +922,19 @@ declare namespace Parse { installationId?: String; master?: boolean; user?: User; + ip: string; + headers: any; + triggerName: string; + log: any; object: Object; + original?: Parse.Object; } - interface AfterSaveRequest extends TriggerRequest { } interface AfterDeleteRequest extends TriggerRequest { } interface BeforeDeleteRequest extends TriggerRequest { } interface BeforeDeleteResponse extends FunctionResponse { } - interface BeforeSaveRequest extends TriggerRequest { - original?: Parse.Object; - } + interface BeforeSaveRequest extends TriggerRequest { } interface BeforeSaveResponse extends FunctionResponse { success: () => void; } @@ -953,11 +955,20 @@ declare namespace Parse { readPreference?: ReadPreferenceOption } + interface AfterFindRequest extends TriggerRequest { + objects: Object[] + } + + interface AfterFindResponse extends FunctionResponse { + success: (objects: Object[]) => void; + } + function afterDelete(arg1: any, func?: (request: AfterDeleteRequest) => void): void; function afterSave(arg1: any, func?: (request: AfterSaveRequest) => void): void; function beforeDelete(arg1: any, func?: (request: BeforeDeleteRequest, response: BeforeDeleteResponse) => void): void; function beforeSave(arg1: any, func?: (request: BeforeSaveRequest, response: BeforeSaveResponse) => void): void; - function beforeFind(arg1: any, func?: (request: BeforeFindRequest, response: BeforeFindRequest) => void): void; + function beforeFind(arg1: any, func?: (request: BeforeFindRequest) => void): void; + function afterFind(arg1: any, func?: (request: AfterFindRequest, response: AfterFindResponse) => void): void; function define(name: string, func?: (request: FunctionRequest, response: FunctionResponse) => void): void; function httpRequest(options: HTTPOptions): Promise; function job(name: string, func?: (request: JobRequest, status: JobStatus) => void): HttpResponse; From 67b046cb8683d84b222e267e0f0c04d191dc3fcc Mon Sep 17 00:00:00 2001 From: Sergey Kuznetsov Date: Mon, 23 Jul 2018 18:31:25 +0300 Subject: [PATCH 197/738] Make chrome.tabs.highlight callback as an optional (#27453) --- types/chrome/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 0bfec6bfd8..856a1ebc8f 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -6564,7 +6564,7 @@ declare namespace chrome.tabs { * @param callback Optional. * Parameter window: Contains details about the window whose tabs were highlighted. */ - export function highlight(highlightInfo: HighlightInfo, callback: (window: chrome.windows.Window) => void): void; + export function highlight(highlightInfo: HighlightInfo, callback?: (window: chrome.windows.Window) => void): void; /** * Gets all tabs that have the specified properties, or all tabs if no properties are specified. * @since Chrome 16. From 73c1a6ca6061cd8eddf2b3100705ca0704b27051 Mon Sep 17 00:00:00 2001 From: Hank Fanchiu Date: Mon, 23 Jul 2018 08:34:52 -0700 Subject: [PATCH 198/738] Fix "compoment" typo in index.d.ts (#27454) --- types/react/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 332d3ac640..be56f112f0 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -387,7 +387,7 @@ declare namespace React { // methods are present. interface ComponentLifecycle extends NewLifecycle, DeprecatedLifecycle { /** - * Called immediately after a compoment is mounted. Setting state here will trigger re-rendering. + * Called immediately after a component is mounted. Setting state here will trigger re-rendering. */ componentDidMount?(): void; /** From 749ebd987f186d55692ba866f408f67e50fddd56 Mon Sep 17 00:00:00 2001 From: Jon Freedman Date: Mon, 23 Jul 2018 16:41:13 +0100 Subject: [PATCH 199/738] React plotly.js (#27461) * typing as per https://github.com/plotly/react-plotly.js/issues/80 * fix travis build (thanks intellij...) * bring typescript version inline with react --- types/react-plotly.js/index.d.ts | 104 ++++++++++++++++++ .../react-plotly.js/react-plotly.js-tests.tsx | 24 ++++ types/react-plotly.js/tsconfig.json | 25 +++++ types/react-plotly.js/tslint.json | 6 + 4 files changed, 159 insertions(+) create mode 100644 types/react-plotly.js/index.d.ts create mode 100644 types/react-plotly.js/react-plotly.js-tests.tsx create mode 100644 types/react-plotly.js/tsconfig.json create mode 100644 types/react-plotly.js/tslint.json diff --git a/types/react-plotly.js/index.d.ts b/types/react-plotly.js/index.d.ts new file mode 100644 index 0000000000..ac24016496 --- /dev/null +++ b/types/react-plotly.js/index.d.ts @@ -0,0 +1,104 @@ +// Type definitions for react-plotly.js 2.2 +// Project: https://github.com/plotly/react-plotly.js#readme +// Definitions by: Jon Freedman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as Plotly from 'plotly.js'; +import * as React from 'react'; + +export interface Frame { + name: string; + data: [{ x: Plotly.Datum, y: Plotly.Datum }]; + group: 'lower' | 'upper'; +} + +export interface Figure { + data: Plotly.Data[]; + layout: Partial; +} + +export interface PlotParams { + data: Plotly.Data[]; + layout: Partial; + frames?: Frame[]; + config?: Partial; + /** + * When provided, causes the plot to update only when the revision is incremented. + */ + revision?: number; + /** + * Callback executed after plot is initialized. + * @param figure Object with three keys corresponding to input props: data, layout and frames. + * @param graphDiv Reference to the DOM node into which the figure was rendered. + */ + onInitialized?: (figure: Readonly

, graphDiv: Readonly) => void; + /** + * Callback executed when when a plot is updated due to new data or layout, or when user interacts with a plot. + * @param figure Object with three keys corresponding to input props: data, layout and frames. + * @param graphDiv Reference to the DOM node into which the figure was rendered. + */ + onUpdate?: (figure: Readonly
, graphDiv: Readonly) => void; + /** + * Callback executed when component unmounts, before Plotly.purge strips the graphDiv of all private attributes. + * @param figure Object with three keys corresponding to input props: data, layout and frames. + * @param graphDiv Reference to the DOM node into which the figure was rendered. + */ + onPurge?: (figure: Readonly
, graphDiv: Readonly) => void; + /** + * Callback executed when a plotly.js API method rejects + * @param err Error + */ + onError?: (err: Readonly) => void; + /** + * id assigned to the
into which the plot is rendered. + */ + divId?: string; + /** + * applied to the
into which the plot is rendered + */ + className?: string; + /** + * used to style the
into which the plot is rendered + */ + style?: React.CSSProperties; + /** + * Assign the graph div to window.gd for debugging + */ + debug?: boolean; + /** + * When true, adds a call to Plotly.Plot.resize() as a window.resize event handler + */ + useResizeHandler?: boolean; + + onAfterExport?: () => void; + onAfterPlot?: () => void; + onAnimated?: () => void; + onAnimatingFrame?: (event: Readonly) => void; + onAnimationInterrupted?: () => void; + onAutoSize?: () => void; + onBeforeExport?: () => void; + onButtonClicked?: (event: Readonly) => void; + onClick?: (event: Readonly) => void; + onClickAnnotation?: (event: Readonly) => void; + onDeselect?: () => void; + onDoubleClick?: () => void; + onFramework?: () => void; + onHover?: (event: Readonly) => void; + onLegendClick?: (event: Readonly) => boolean; + onLegendDoubleClick?: (event: Readonly) => boolean; + onRelayout?: (event: Readonly) => void; + onRestyle?: (event: Readonly) => void; + onRedraw?: () => void; + onSelected?: (event: Readonly) => void; + onSelecting?: (event: Readonly) => void; + onSliderChange?: (event: Readonly) => void; + onSliderEnd?: (event: Readonly) => void; + onSliderStart?: (event: Readonly) => void; + onTransitioning?: () => void; + onTransitionInterrupted?: () => void; + onUnhover?: (event: Readonly) => void; +} + +export default class Plot extends React.PureComponent { +} diff --git a/types/react-plotly.js/react-plotly.js-tests.tsx b/types/react-plotly.js/react-plotly.js-tests.tsx new file mode 100644 index 0000000000..2ca0b7026d --- /dev/null +++ b/types/react-plotly.js/react-plotly.js-tests.tsx @@ -0,0 +1,24 @@ +import * as React from 'react'; +import Plot from 'react-plotly.js'; + +/** + * based on https://plot.ly/javascript/react/#quick-start + */ +export class SimpleChartComponent extends React.PureComponent { + render() { + return( + + ); + } +} diff --git a/types/react-plotly.js/tsconfig.json b/types/react-plotly.js/tsconfig.json new file mode 100644 index 0000000000..e0ec629a4c --- /dev/null +++ b/types/react-plotly.js/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-plotly.js-tests.tsx" + ] +} diff --git a/types/react-plotly.js/tslint.json b/types/react-plotly.js/tslint.json new file mode 100644 index 0000000000..6db713aff9 --- /dev/null +++ b/types/react-plotly.js/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "indent": [true, "spaces", 4] + } +} From 5090fabde6a10aaabedd08c0b73ee2e947da1db2 Mon Sep 17 00:00:00 2001 From: Florian Keller Date: Mon, 23 Jul 2018 17:44:28 +0200 Subject: [PATCH 200/738] Add types for libsodium-wrappers (#27447) --- types/libsodium-wrappers/index.d.ts | 1086 +++++++++++++++++ .../libsodium-wrappers-tests.ts | 22 + types/libsodium-wrappers/tsconfig.json | 23 + types/libsodium-wrappers/tslint.json | 1 + 4 files changed, 1132 insertions(+) create mode 100644 types/libsodium-wrappers/index.d.ts create mode 100644 types/libsodium-wrappers/libsodium-wrappers-tests.ts create mode 100644 types/libsodium-wrappers/tsconfig.json create mode 100644 types/libsodium-wrappers/tslint.json diff --git a/types/libsodium-wrappers/index.d.ts b/types/libsodium-wrappers/index.d.ts new file mode 100644 index 0000000000..e9213da782 --- /dev/null +++ b/types/libsodium-wrappers/index.d.ts @@ -0,0 +1,1086 @@ +// Type definitions for libsodium-wrappers 0.7 +// Project: https://github.com/jedisct1/libsodium.js +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export type Uint8ArrayOutputFormat = 'uint8array'; + +export type StringOutputFormat = 'text' | 'hex' | 'base64'; + +export type KeyType = 'curve25519' | 'ed25519' | 'x25519'; + +export enum base64_variants { + ORIGINAL, + ORIGINAL_NO_PADDING, + URLSAFE, + URLSAFE_NO_PADDING, +} + +export interface CryptoBox { + ciphertext: Uint8Array; + mac: Uint8Array; +} + +export interface StringCryptoBox { + ciphertext: string; + mac: string; +} + +export interface CryptoKX { + sharedRx: Uint8Array; + sharedTx: Uint8Array; +} + +export interface StringCryptoKX { + sharedRx: string; + sharedTx: string; +} + +export interface KeyPair { + keyType: KeyType; + privateKey: Uint8Array; + publicKey: Uint8Array; +} + +export interface StringKeyPair { + keyType: KeyType; + privateKey: string; + publicKey: string; +} + +export interface SecretBox { + cipher: Uint8Array; + mac: Uint8Array; +} + +export interface StringSecretBox { + cipher: string; + mac: string; +} + +export interface generichash_state_address { + name: string; +} + +export interface onetimeauth_state_address { + name: string; +} + +export interface state_address { + name: string; +} + +export interface secretstream_xchacha20poly1305_state_address { + name: string; +} + +export interface sign_state_address { + name: string; +} + +export const SODIUM_LIBRARY_VERSION_MAJOR: number; + +export const SODIUM_LIBRARY_VERSION_MINOR: number; + +export const SODIUM_VERSION_STRING: string; + +export const crypto_aead_chacha20poly1305_ABYTES: number; + +export const crypto_aead_chacha20poly1305_KEYBYTES: number; + +export const crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX: number; + +export const crypto_aead_chacha20poly1305_NPUBBYTES: number; + +export const crypto_aead_chacha20poly1305_NSECBYTES: number; + +export const crypto_aead_chacha20poly1305_ietf_ABYTES: number; + +export const crypto_aead_chacha20poly1305_ietf_KEYBYTES: number; + +export const crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX: number; + +export const crypto_aead_chacha20poly1305_ietf_NPUBBYTES: number; + +export const crypto_aead_chacha20poly1305_ietf_NSECBYTES: number; + +export const crypto_aead_xchacha20poly1305_ietf_ABYTES: number; + +export const crypto_aead_xchacha20poly1305_ietf_KEYBYTES: number; + +export const crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX: number; + +export const crypto_aead_xchacha20poly1305_ietf_NPUBBYTES: number; + +export const crypto_aead_xchacha20poly1305_ietf_NSECBYTES: number; + +export const crypto_auth_BYTES: number; + +export const crypto_auth_KEYBYTES: number; + +export const crypto_box_BEFORENMBYTES: number; + +export const crypto_box_MACBYTES: number; + +export const crypto_box_MESSAGEBYTES_MAX: number; + +export const crypto_box_NONCEBYTES: number; + +export const crypto_box_PUBLICKEYBYTES: number; + +export const crypto_box_SEALBYTES: number; + +export const crypto_box_SECRETKEYBYTES: number; + +export const crypto_box_SEEDBYTES: number; + +export const crypto_core_hchacha20_CONSTBYTES: number; + +export const crypto_core_hchacha20_INPUTBYTES: number; + +export const crypto_core_hchacha20_KEYBYTES: number; + +export const crypto_core_hchacha20_OUTPUTBYTES: number; + +export const crypto_generichash_BYTES: number; + +export const crypto_generichash_BYTES_MAX: number; + +export const crypto_generichash_BYTES_MIN: number; + +export const crypto_generichash_KEYBYTES: number; + +export const crypto_generichash_KEYBYTES_MAX: number; + +export const crypto_generichash_KEYBYTES_MIN: number; + +export const crypto_hash_BYTES: number; + +export const crypto_kdf_BYTES_MAX: number; + +export const crypto_kdf_BYTES_MIN: number; + +export const crypto_kdf_CONTEXTBYTES: number; + +export const crypto_kdf_KEYBYTES: number; + +export const crypto_kx_PUBLICKEYBYTES: number; + +export const crypto_kx_SECRETKEYBYTES: number; + +export const crypto_kx_SEEDBYTES: number; + +export const crypto_kx_SESSIONKEYBYTES: number; + +export const crypto_pwhash_ALG_ARGON2I13: number; + +export const crypto_pwhash_ALG_ARGON2ID13: number; + +export const crypto_pwhash_ALG_DEFAULT: number; + +export const crypto_pwhash_BYTES_MAX: number; + +export const crypto_pwhash_BYTES_MIN: number; + +export const crypto_pwhash_MEMLIMIT_INTERACTIVE: number; + +export const crypto_pwhash_MEMLIMIT_MAX: number; + +export const crypto_pwhash_MEMLIMIT_MIN: number; + +export const crypto_pwhash_MEMLIMIT_MODERATE: number; + +export const crypto_pwhash_MEMLIMIT_SENSITIVE: number; + +export const crypto_pwhash_OPSLIMIT_INTERACTIVE: number; + +export const crypto_pwhash_OPSLIMIT_MAX: number; + +export const crypto_pwhash_OPSLIMIT_MIN: number; + +export const crypto_pwhash_OPSLIMIT_MODERATE: number; + +export const crypto_pwhash_OPSLIMIT_SENSITIVE: number; + +export const crypto_pwhash_PASSWD_MAX: number; + +export const crypto_pwhash_PASSWD_MIN: number; + +export const crypto_pwhash_SALTBYTES: number; + +export const crypto_pwhash_STRBYTES: number; + +export const crypto_pwhash_STRPREFIX: string; + +export const crypto_pwhash_STR_VERIFY: number; + +export const crypto_scalarmult_BYTES: number; + +export const crypto_scalarmult_SCALARBYTES: number; + +export const crypto_secretbox_KEYBYTES: number; + +export const crypto_secretbox_MACBYTES: number; + +export const crypto_secretbox_MESSAGEBYTES_MAX: number; + +export const crypto_secretbox_NONCEBYTES: number; + +export const crypto_secretstream_xchacha20poly1305_ABYTES: number; + +export const crypto_secretstream_xchacha20poly1305_HEADERBYTES: number; + +export const crypto_secretstream_xchacha20poly1305_KEYBYTES: number; + +export const crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX: number; + +export const crypto_secretstream_xchacha20poly1305_MESSAGESBYTES_MAX: number; + +export const crypto_secretstream_xchacha20poly1305_NPUBBYTES: number; + +export const crypto_secretstream_xchacha20poly1305_TAG_FINAL: number; + +export const crypto_secretstream_xchacha20poly1305_TAG_MESSAGE: number; + +export const crypto_secretstream_xchacha20poly1305_TAG_PUSH: number; + +export const crypto_secretstream_xchacha20poly1305_TAG_REKEY: number; + +export const crypto_shorthash_BYTES: number; + +export const crypto_shorthash_KEYBYTES: number; + +export const crypto_sign_BYTES: number; + +export const crypto_sign_MESSAGEBYTES_MAX: number; + +export const crypto_sign_PUBLICKEYBYTES: number; + +export const crypto_sign_SECRETKEYBYTES: number; + +export const crypto_sign_SEEDBYTES: number; + +export const crypto_stream_MESSAGEBYTES_MAX: number; + +export const crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX: number; + +export const crypto_stream_xchacha20_MESSAGEBYTES_MAX: number; + +export const randombytes_SEEDBYTES: number; + +export const ready: Promise; + +export function add(a: Uint8Array, b: Uint8Array): void; + +export function compare(b1: Uint8Array, b2: Uint8Array): number; + +export function crypto_aead_chacha20poly1305_decrypt( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_aead_chacha20poly1305_decrypt( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_aead_chacha20poly1305_decrypt_detached( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + mac?: Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_aead_chacha20poly1305_decrypt_detached( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + mac?: Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_aead_chacha20poly1305_encrypt( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_aead_chacha20poly1305_encrypt( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_aead_chacha20poly1305_encrypt_detached( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): CryptoBox; + +export function crypto_aead_chacha20poly1305_encrypt_detached( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): StringCryptoBox; + +export function crypto_aead_chacha20poly1305_ietf_decrypt( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_aead_chacha20poly1305_ietf_decrypt( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_aead_chacha20poly1305_ietf_decrypt_detached( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + mac?: Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_aead_chacha20poly1305_ietf_decrypt_detached( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + mac?: Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_aead_chacha20poly1305_ietf_encrypt( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_aead_chacha20poly1305_ietf_encrypt( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_aead_chacha20poly1305_ietf_encrypt_detached( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): CryptoBox; + +export function crypto_aead_chacha20poly1305_ietf_encrypt_detached( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): StringCryptoBox; + +export function crypto_aead_chacha20poly1305_ietf_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_aead_chacha20poly1305_ietf_keygen(outputFormat?: StringOutputFormat | null): string; + +export function crypto_aead_chacha20poly1305_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_aead_chacha20poly1305_keygen(outputFormat?: StringOutputFormat | null): string; + +export function crypto_aead_xchacha20poly1305_ietf_decrypt( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_aead_xchacha20poly1305_ietf_decrypt( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_aead_xchacha20poly1305_ietf_decrypt_detached( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + mac?: Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_aead_xchacha20poly1305_ietf_decrypt_detached( + secret_nonce?: string | Uint8Array | null, + ciphertext?: string | Uint8Array, + mac?: Uint8Array, + additional_data?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_aead_xchacha20poly1305_ietf_encrypt( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_aead_xchacha20poly1305_ietf_encrypt( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_aead_xchacha20poly1305_ietf_encrypt_detached( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): CryptoBox; + +export function crypto_aead_xchacha20poly1305_ietf_encrypt_detached( + message?: string | Uint8Array, + additional_data?: string | Uint8Array | null, + secret_nonce?: string | Uint8Array | null, + public_nonce?: Uint8Array, + key?: Uint8Array, + outputFormat?: StringOutputFormat | null, +): StringCryptoBox; + +export function crypto_aead_xchacha20poly1305_ietf_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_aead_xchacha20poly1305_ietf_keygen(outputFormat?: StringOutputFormat | null): string; + +export function crypto_auth( + message: string | Uint8Array, + key: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_auth( + message: string | Uint8Array, + key: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_auth_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_auth_keygen(outputFormat?: StringOutputFormat | null): string; + +export function crypto_auth_verify(tag: Uint8Array, message: string | Uint8Array, key: Uint8Array): boolean; + +export function crypto_box_beforenm( + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_box_beforenm( + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_box_detached( + message: string | Uint8Array, + nonce: Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): CryptoBox; + +export function crypto_box_detached( + message: string | Uint8Array, + nonce: Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): StringCryptoBox; + +export function crypto_box_easy( + message: string | Uint8Array, + nonce: Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_box_easy( + message: string | Uint8Array, + nonce: Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_box_easy_afternm( + message: string | Uint8Array, + nonce: Uint8Array, + sharedKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_box_easy_afternm( + message: string | Uint8Array, + nonce: Uint8Array, + sharedKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_box_keypair(outputFormat?: Uint8ArrayOutputFormat | null): KeyPair; + +export function crypto_box_keypair(outputFormat?: StringOutputFormat | null): StringKeyPair; + +export function crypto_box_open_detached( + ciphertext: string | Uint8Array, + mac: Uint8Array, + nonce: Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_box_open_detached( + ciphertext: string | Uint8Array, + mac: Uint8Array, + nonce: Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_box_open_easy( + ciphertext: string | Uint8Array, + nonce: Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_box_open_easy( + ciphertext: string | Uint8Array, + nonce: Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_box_open_easy_afternm( + ciphertext: string | Uint8Array, + nonce: Uint8Array, + sharedKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_box_open_easy_afternm( + ciphertext: string | Uint8Array, + nonce: Uint8Array, + sharedKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_box_seal( + message: string | Uint8Array, + publicKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_box_seal( + message: string | Uint8Array, + publicKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_box_seal_open( + ciphertext: string | Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_box_seal_open( + ciphertext: string | Uint8Array, + publicKey: Uint8Array, + privateKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_box_seed_keypair(seed: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): KeyPair; + +export function crypto_box_seed_keypair(seed: Uint8Array, outputFormat?: StringOutputFormat | null): StringKeyPair; + +export function crypto_generichash( + hash_length?: number, + message?: string | Uint8Array, + key?: string | Uint8Array | null, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_generichash( + hash_length?: number, + message?: string | Uint8Array, + key?: string | Uint8Array | null, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_generichash_final( + state_address: generichash_state_address, + hash_length: number, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_generichash_final( + state_address: generichash_state_address, + hash_length: number, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_generichash_init(key?: string | Uint8Array | null, hash_length?: number): state_address; + +export function crypto_generichash_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_generichash_keygen(outputFormat?: StringOutputFormat | null): string; + +export function crypto_generichash_update( + state_address: generichash_state_address, + message_chunk: string | Uint8Array, +): void; + +export function crypto_hash(message: string | Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_hash(message: string | Uint8Array, outputFormat?: StringOutputFormat | null): string; + +export function crypto_kdf_derive_from_key( + subkey_len: number, + subkey_id: number, + ctx: string, + key: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_kdf_derive_from_key( + subkey_len: number, + subkey_id: number, + ctx: string, + key: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_kdf_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_kdf_keygen(outputFormat?: StringOutputFormat | null): string; + +export function crypto_kx_client_session_keys( + clientPublicKey: Uint8Array, + clientSecretKey: Uint8Array, + serverPublicKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): CryptoKX; + +export function crypto_kx_client_session_keys( + clientPublicKey: Uint8Array, + clientSecretKey: Uint8Array, + serverPublicKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): StringCryptoKX; + +export function crypto_kx_keypair(outputFormat?: Uint8ArrayOutputFormat | null): KeyPair; + +export function crypto_kx_keypair(outputFormat?: StringOutputFormat | null): StringKeyPair; + +export function crypto_kx_seed_keypair(seed: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): KeyPair; + +export function crypto_kx_seed_keypair(seed: Uint8Array, outputFormat?: StringOutputFormat | null): StringKeyPair; + +export function crypto_kx_server_session_keys( + serverPublicKey: Uint8Array, + serverSecretKey: Uint8Array, + clientPublicKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): CryptoKX; + +export function crypto_kx_server_session_keys( + serverPublicKey: Uint8Array, + serverSecretKey: Uint8Array, + clientPublicKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): StringCryptoKX; + +export function crypto_pwhash( + keyLength: number, + password: string | Uint8Array, + salt: Uint8Array, + opsLimit: number, + memLimit: number, + algorithm: number, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_pwhash( + keyLength: number, + password: string | Uint8Array, + salt: Uint8Array, + opsLimit: number, + memLimit: number, + algorithm: number, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_pwhash_str(password: string | Uint8Array, opsLimit: number, memLimit: number): string; + +export function crypto_pwhash_str_verify(hashed_password: string, password: string | Uint8Array): boolean; + +export function crypto_scalarmult( + privateKey: Uint8Array, + publicKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_scalarmult( + privateKey: Uint8Array, + publicKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_scalarmult_base( + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_scalarmult_base(privateKey: Uint8Array, outputFormat?: StringOutputFormat | null): string; + +export function crypto_secretbox_detached( + message: string | Uint8Array, + nonce: Uint8Array, + key: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): SecretBox; + +export function crypto_secretbox_detached( + message: string | Uint8Array, + nonce: Uint8Array, + key: Uint8Array, + outputFormat?: StringOutputFormat | null, +): StringSecretBox; + +export function crypto_secretbox_easy( + message: string | Uint8Array, + nonce: Uint8Array, + key: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_secretbox_easy( + message: string | Uint8Array, + nonce: Uint8Array, + key: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_secretbox_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_secretbox_keygen(outputFormat?: StringOutputFormat | null): string; + +export function crypto_secretbox_open_detached( + ciphertext: string | Uint8Array, + mac: Uint8Array, + nonce: Uint8Array, + key: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_secretbox_open_detached( + ciphertext: string | Uint8Array, + mac: Uint8Array, + nonce: Uint8Array, + key: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_secretbox_open_easy( + ciphertext: string | Uint8Array, + nonce: Uint8Array, + key: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_secretbox_open_easy( + ciphertext: string | Uint8Array, + nonce: Uint8Array, + key: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_secretstream_xchacha20poly1305_init_pull(header: Uint8Array, key: Uint8Array): state_address; + +export function crypto_secretstream_xchacha20poly1305_init_push( + key: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): { state: state_address; header: Uint8Array }; + +export function crypto_secretstream_xchacha20poly1305_init_push( + key: Uint8Array, + outputFormat?: StringOutputFormat | null, +): { state: state_address; header: string }; + +export function crypto_secretstream_xchacha20poly1305_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_secretstream_xchacha20poly1305_keygen(outputFormat?: StringOutputFormat | null): string; + +export function crypto_secretstream_xchacha20poly1305_pull( + state_address?: secretstream_xchacha20poly1305_state_address, + cipher?: string | Uint8Array, + ad?: string | Uint8Array | null, + outputFormat?: Uint8ArrayOutputFormat | null, +): { message: Uint8Array; tag: Uint8Array }; + +export function crypto_secretstream_xchacha20poly1305_pull( + state_address?: secretstream_xchacha20poly1305_state_address, + cipher?: string | Uint8Array, + ad?: string | Uint8Array | null, + outputFormat?: StringOutputFormat | null, +): { message: string; tag: Uint8Array }; + +export function crypto_secretstream_xchacha20poly1305_push( + state_address?: secretstream_xchacha20poly1305_state_address, + message_chunk?: string | Uint8Array, + ad?: string | Uint8Array | null, + tag?: number, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_secretstream_xchacha20poly1305_push( + state_address?: secretstream_xchacha20poly1305_state_address, + message_chunk?: string | Uint8Array, + ad?: string | Uint8Array | null, + tag?: number, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_secretstream_xchacha20poly1305_rekey( + state_address: secretstream_xchacha20poly1305_state_address, +): true; + +export function crypto_shorthash( + message: string | Uint8Array, + key: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_shorthash( + message: string | Uint8Array, + key: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_shorthash_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_shorthash_keygen(outputFormat?: StringOutputFormat | null): string; + +export function crypto_sign( + message: string | Uint8Array, + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_sign( + message: string | Uint8Array, + privateKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_sign_detached( + message: string | Uint8Array, + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_sign_detached( + message: string | Uint8Array, + privateKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_sign_ed25519_pk_to_curve25519( + edPk: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_sign_ed25519_pk_to_curve25519( + edPk: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_sign_ed25519_sk_to_curve25519( + edSk: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_sign_ed25519_sk_to_curve25519( + edSk: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_sign_final_create( + state_address: sign_state_address, + privateKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_sign_final_create( + state_address: sign_state_address, + privateKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_sign_final_verify( + state_address: sign_state_address, + signature: Uint8Array, + publicKey: Uint8Array, +): boolean; + +export function crypto_sign_init(): state_address; + +export function crypto_sign_keypair(outputFormat?: Uint8ArrayOutputFormat | null): KeyPair; + +export function crypto_sign_keypair(outputFormat?: StringOutputFormat | null): StringKeyPair; + +export function crypto_sign_open( + signedMessage: string | Uint8Array, + publicKey: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function crypto_sign_open( + signedMessage: string | Uint8Array, + publicKey: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function crypto_sign_seed_keypair(seed: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): KeyPair; + +export function crypto_sign_seed_keypair(seed: Uint8Array, outputFormat?: StringOutputFormat | null): StringKeyPair; + +export function crypto_sign_update(state_address: sign_state_address, message_chunk: string | Uint8Array): void; + +export function crypto_sign_verify_detached( + signature: Uint8Array, + message: string | Uint8Array, + publicKey: Uint8Array, +): boolean; + +export function crypto_stream_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function crypto_stream_keygen(outputFormat?: StringOutputFormat | null): string; + +export function from_base64(input: string, variant: base64_variants): Uint8Array; + +export function from_hex(input: string): Uint8Array; + +export function from_string(str: string): Uint8Array; + +export function increment(bytes: Uint8Array): void; + +export function is_zero(bytes: Uint8Array): boolean; + +export function memcmp(b1: Uint8Array, b2: Uint8Array): boolean; + +export function memzero(bytes: Uint8Array): void; + +export function pad(buf: Uint8Array, blocksize: number): Uint8Array; + +export function randombytes_buf(length: number, outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array; + +export function randombytes_buf(length: number, outputFormat?: StringOutputFormat | null): string; + +export function randombytes_buf_deterministic( + length: number, + seed: Uint8Array, + outputFormat?: Uint8ArrayOutputFormat | null, +): Uint8Array; + +export function randombytes_buf_deterministic( + length: number, + seed: Uint8Array, + outputFormat?: StringOutputFormat | null, +): string; + +export function randombytes_close(): void; + +export function randombytes_random(): number; + +export function randombytes_set_implementation(implementation: Uint8Array): void; + +export function randombytes_stir(): void; + +export function randombytes_uniform(upper_bound: number): number; + +export function sodium_version_string(): string; + +export function symbols(): string[]; + +export function to_base64(input: string | Uint8Array, variant: base64_variants): string; + +export function to_hex(input: string | Uint8Array): string; + +export function to_string(bytes: Uint8Array): string; + +export function unpad(buf: Uint8Array, blocksize: number): Uint8Array; diff --git a/types/libsodium-wrappers/libsodium-wrappers-tests.ts b/types/libsodium-wrappers/libsodium-wrappers-tests.ts new file mode 100644 index 0000000000..302421a96d --- /dev/null +++ b/types/libsodium-wrappers/libsodium-wrappers-tests.ts @@ -0,0 +1,22 @@ +import * as _sodium from 'libsodium-wrappers'; + +_sodium.ready.then(() => { + const sodium = _sodium; + + const key = sodium.crypto_secretstream_xchacha20poly1305_keygen(); + + const res = sodium.crypto_secretstream_xchacha20poly1305_init_push(key); + const [state_out, header] = [res.state, res.header]; + const c1 = sodium.crypto_secretstream_xchacha20poly1305_push(state_out, + sodium.from_string('message 1'), null, + sodium.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE); + const c2 = sodium.crypto_secretstream_xchacha20poly1305_push(state_out, + sodium.from_string('message 2'), null, + sodium.crypto_secretstream_xchacha20poly1305_TAG_FINAL); + + const state_in = sodium.crypto_secretstream_xchacha20poly1305_init_pull(header, key); + const r1 = sodium.crypto_secretstream_xchacha20poly1305_pull(state_in, c1); + const [m1, tag1] = [sodium.to_string(r1.message), r1.tag]; + const r2 = sodium.crypto_secretstream_xchacha20poly1305_pull(state_in, c2); + const [m2, tag2] = [sodium.to_string(r2.message), r2.tag]; +}); diff --git a/types/libsodium-wrappers/tsconfig.json b/types/libsodium-wrappers/tsconfig.json new file mode 100644 index 0000000000..f366b5643e --- /dev/null +++ b/types/libsodium-wrappers/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "libsodium-wrappers-tests.ts" + ] +} diff --git a/types/libsodium-wrappers/tslint.json b/types/libsodium-wrappers/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/libsodium-wrappers/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a0d6a3652737d2c384d0c8f290522f681e785efe Mon Sep 17 00:00:00 2001 From: Sahbi Sahloul Date: Mon, 23 Jul 2018 17:46:34 +0200 Subject: [PATCH 201/738] Gapi - Use 'any | boolean' for error result as in the official documentation (#27446) * Use any instead as specified in the official documentation Link https://developers.google.com/api-client-library/javascript/features/promises#using-promises * Use boolean if not JSON-parseable --- types/gapi/index.d.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/types/gapi/index.d.ts b/types/gapi/index.d.ts index 38bf7f07b4..7ab0dfd1e6 100644 --- a/types/gapi/index.d.ts +++ b/types/gapi/index.d.ts @@ -247,11 +247,7 @@ declare namespace gapi.client { } interface HttpRequestRejected { - result: { - error: { - message: string; - } - }; + result: any | boolean; body: string; headers?: any[]; status?: number; From af3a897849cf40527cf109c61a3b66646b1a0e09 Mon Sep 17 00:00:00 2001 From: Florian Keller Date: Mon, 23 Jul 2018 17:46:54 +0200 Subject: [PATCH 202/738] Add types for bro-fs (#27445) --- types/bro-fs/bro-fs-tests.ts | 7 ++++++ types/bro-fs/index.d.ts | 47 ++++++++++++++++++++++++++++++++++++ types/bro-fs/tsconfig.json | 24 ++++++++++++++++++ types/bro-fs/tslint.json | 1 + 4 files changed, 79 insertions(+) create mode 100644 types/bro-fs/bro-fs-tests.ts create mode 100644 types/bro-fs/index.d.ts create mode 100644 types/bro-fs/tsconfig.json create mode 100644 types/bro-fs/tslint.json diff --git a/types/bro-fs/bro-fs-tests.ts b/types/bro-fs/bro-fs-tests.ts new file mode 100644 index 0000000000..c6290aa370 --- /dev/null +++ b/types/bro-fs/bro-fs-tests.ts @@ -0,0 +1,7 @@ +import * as fs from 'bro-fs'; + +fs.init({type: window.TEMPORARY, bytes: 5 * 1024 * 1024}) + .then(() => fs.mkdir('dir')) + .then(() => fs.writeFile('dir/file.txt', 'hello world')) + .then(() => fs.readFile('dir/file.txt')) + .then(content => console.log(content)); // => "hello world" diff --git a/types/bro-fs/index.d.ts b/types/bro-fs/index.d.ts new file mode 100644 index 0000000000..2f1cad2f41 --- /dev/null +++ b/types/bro-fs/index.d.ts @@ -0,0 +1,47 @@ +// Type definitions for bro-fs 0.4 +// Project: https://github.com/vitalets/bro-fs#readme +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export type readType = 'Text' | 'ArrayBuffer' | 'BinaryString' | 'DataURL'; + +export interface Options { + bytes?: number; + requestQuota?: boolean; + type?: number; +} + +export interface StatObject { + fullPath: string; + isDirectory: boolean; + isFile: boolean; + modificationTime: Date; + name: string; + size: number; +} + +export interface UsageObject { + grantedBytes: number; + usedBytes: number; +} + +export function appendFile(path: string | FileEntry, data: string | Blob | File | ArrayBuffer): Promise; +export function clear(): Promise; +export function copy(oldPath: string | FileEntry, newPath: string, options?: {create?: boolean}): Promise; +export function exists(path: string): Promise; +export function getEntry(path: FileEntry): Promise; +export function getRoot(): Promise; +export function getUrl(path: string | FileEntry): Promise; +export function init(options: Options): Promise; +export function isSupported(): boolean; +export function mkdir(path: string): Promise; +export function readdir(path: string | DirectoryEntry, options?: {deep?: boolean}): Promise; +export function readFile(path: string | FileEntry, options?: {type?: readType}): Promise; +export function rename(oldPath: string | FileEntry, newPath: string, options?: {create?: boolean}): Promise; +export function rmdir(path: string | DirectoryEntry): Promise; +export function stat(path: string | FileEntry): Promise; +export function unlink(path: string | FileEntry): Promise; +export function usage(): Promise; +export function writeFile(path: string, data: string | Blob | File | ArrayBuffer): Promise; diff --git a/types/bro-fs/tsconfig.json b/types/bro-fs/tsconfig.json new file mode 100644 index 0000000000..d8a019ec81 --- /dev/null +++ b/types/bro-fs/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bro-fs-tests.ts" + ] +} diff --git a/types/bro-fs/tslint.json b/types/bro-fs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/bro-fs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b3eaeded0aafeb156dcb97216ba7df8fad95d79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= Date: Mon, 23 Jul 2018 17:47:36 +0200 Subject: [PATCH 203/738] [redux-form/v4] Fix build by adding package.json (#27212) --- types/redux-form/v4/package.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 types/redux-form/v4/package.json diff --git a/types/redux-form/v4/package.json b/types/redux-form/v4/package.json new file mode 100644 index 0000000000..6d68bf2f9b --- /dev/null +++ b/types/redux-form/v4/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "redux": "^3.6.0" + } +} From 92f7e2f8d1d434aa5022974766b7f0e2e62b70c1 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Mon, 23 Jul 2018 18:48:39 +0300 Subject: [PATCH 204/738] Add types for react-aria-modal (#27228) * Add types for react-aria-modal * Bumpy min TS version * Trigger CI * Trigger CI --- types/react-aria-modal/index.d.ts | 170 ++++++++++++++++++ .../react-aria-modal-tests.tsx | 14 ++ types/react-aria-modal/tsconfig.json | 17 ++ types/react-aria-modal/tslint.json | 1 + 4 files changed, 202 insertions(+) create mode 100644 types/react-aria-modal/index.d.ts create mode 100644 types/react-aria-modal/react-aria-modal-tests.tsx create mode 100644 types/react-aria-modal/tsconfig.json create mode 100644 types/react-aria-modal/tslint.json diff --git a/types/react-aria-modal/index.d.ts b/types/react-aria-modal/index.d.ts new file mode 100644 index 0000000000..83ca6d3a34 --- /dev/null +++ b/types/react-aria-modal/index.d.ts @@ -0,0 +1,170 @@ +// Type definitions for react-aria-modal 2.12 +// Project: https://github.com/davidtheclark/react-aria-modal#readme +// Definitions by: forabi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import React = require('react'); + +export interface AriaModalProps { + /** + * If true, the modal will receive a role of alertdialog, + * instead of its default dialog. + */ + alert?: boolean; + + /** + * By default, the modal is active when mounted, deactivated when unmounted. + * However, you can also control its active/inactive state by changing + * its mounted property instead. + */ + mounted?: boolean; + + /** + * Provide your main application node here (which the modal should + * render outside of), and when the modal is open this application + * node will receive the attribute `aria-hidden="true"`. + * This can help screen readers understand what's going on. + */ + applicationNode?: Node | Element; + + /** + * Same as `applicationNode`, but a function that returns the node + * instead of the node itself. This can be useful or necessary in + * a variety of situations, one of which is server-side React + * rendering. The function will not be called until after the + * component mounts, so it is safe to use browser globals + * and refer to DOM nodes within it (e.g. `document.getElementById(..)`), + * without ruining your server-side rendering. + */ + getApplicationNode?(): Node | Element; + + /** + * By default, styles are applied inline to the dialog and underlay + * portions of the component. However, you can disable all inline + * styles by setting `includeDefaultStyles` to false. If set, you + * must specify all styles externally, including positioning. + * This is helpful if your project uses external CSS assets. + * + * _Note_: underlayStyle and dialogStyle can still be set inline, + * but these will be the only styles applied. + */ + includeDefaultStyles?: boolean; + + /** + * Apply a class to the dialog in order to custom-style it. + * + * Be aware that, _by default_, this module does apply various + * inline styles to the dialog element in order position it. + * To disable _all inline styles_, see `includeDefaultStyles`. + */ + dialogClass?: string; + + /** + * Choose your own id attribute for the dialog element. + * + * Default: `react-aria-modal-dialog`. + */ + dialogId?: string; + + /** + * Customize properties of the style prop that is passed to the dialog. + */ + dialogStyle?: React.CSSProperties; + + /** + * By default, when the modal activates its first focusable child will + * receive focus. However, if `focusDialog` is true, the dialog itself + * will receive initial focus — and that focus will be hidden. + * (This is essentially what Bootstrap does with their modal.) + */ + focusDialog?: boolean; + + /** + * By default, when the modal activates its first focusable child will + * receive focus. If, instead, you want to identify a specific element + * that should receive initial focus, pass a selector string to this + * prop. (That selector is passed to `document.querySelector()` to find + * the DOM node.) + */ + initialFocus?: string; + + /** + * A string to use as the modal's accessible title. This value is passed + * to the modal's `aria-label` attribute. You must use either `titleId` or + * `titleText`, but not both. + */ + titleText?: string; + + /** + * The `id` of the element that should be used as the modal's accessible + * title. This value is passed to the modal's `aria-labelledby` attribute. + * You must use either `titleId` or `titleText`, but not both. + */ + titleId?: string; + + /** + * Customize properties of the `style` prop that is passed to the underlay. + * The best way to add some vertical displacement to the dialog is to add + * top & bottom padding to the underlay. + * This is illustrated in the demo examples. + */ + underlayStyle?: React.CSSProperties; + + /** + * Apply a class to the underlay in order to custom-style it. + * This module does apply various inline styles, though, so be aware that + * overriding some styles might be difficult. If, for example, you want + * to change the underlay's color, you should probably use the + * `underlayColor` prop instead of a class. + * If you would rather control all CSS, see `includeDefaultStyles`. + */ + underlayClass?: string; + + /** + * By default, a click on the underlay will exit the modal. + * Pass `false`, and clicking on the underlay will do nothing. + */ + underlayClickExits?: boolean; + + /** + * By default, the Escape key exits the modal. Pass `false`, and it won't. + */ + escapeExits?: boolean; + + /** + * If you want to change the underlay's color, you can + * do that with this prop. If `false`, no background color will be + * applied with inline styles. Presumably you will apply then + * yourself via an `underlayClass`. + * + * Default: rgba(0,0,0,0.5) + */ + underlayColor?: string; + + /** + * If `true`, the modal's contents will be vertically (as well as horizontally) centered. + */ + verticallyCenter?: boolean; + + /** + * This function is called in the modal's `componentDidMount()` lifecycle method. + * You can use it to do whatever diverse and sundry things you feel like + * doing after the modal activates. + */ + onEnter?(): any; + + /** + * This function needs to handles the state change of exiting (or deactivating) the modal. + * Maybe it's just a wrapper around `setState()`; or maybe you use some more involved + * Flux-inspired state management — whatever the case, this module leaves the state + * management up to you instead of making assumptions. + * That also makes it easier to create your own "close modal" buttons; because you + * have the function that closes the modal right there, written by you, at your disposal. + */ + onExit(): any; +} + +export default class AriaModal extends React.PureComponent { + static renderTo(node: HTMLElement | string): void; +} diff --git a/types/react-aria-modal/react-aria-modal-tests.tsx b/types/react-aria-modal/react-aria-modal-tests.tsx new file mode 100644 index 0000000000..c8c9de62d4 --- /dev/null +++ b/types/react-aria-modal/react-aria-modal-tests.tsx @@ -0,0 +1,14 @@ +import AriaModal from 'react-aria-modal'; +import * as React from 'react'; +import { render } from 'react-dom'; + +declare const appContainer: HTMLElement; + +const onExit = () => {}; + +render( + + Hello world + , + appContainer +); diff --git a/types/react-aria-modal/tsconfig.json b/types/react-aria-modal/tsconfig.json new file mode 100644 index 0000000000..2dad722b56 --- /dev/null +++ b/types/react-aria-modal/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true, + "jsx": "react" + }, + "files": ["index.d.ts", "react-aria-modal-tests.tsx"] +} diff --git a/types/react-aria-modal/tslint.json b/types/react-aria-modal/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-aria-modal/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 04a282b63ffe86eb936f616ed29e9c86a5ec830e Mon Sep 17 00:00:00 2001 From: Joseph Carroll Date: Mon, 23 Jul 2018 11:53:59 -0400 Subject: [PATCH 205/738] Add registry-auth-token (#27285) * Add registry-auth-token * Fix: type definitions header * Fix: Change Typescript version: 2.8 * Fix: Clean-up test cases --- types/registry-auth-token/index.d.ts | 70 +++++++++++++++++++ .../registry-auth-token-tests.ts | 15 ++++ types/registry-auth-token/tsconfig.json | 23 ++++++ types/registry-auth-token/tslint.json | 3 + 4 files changed, 111 insertions(+) create mode 100644 types/registry-auth-token/index.d.ts create mode 100644 types/registry-auth-token/registry-auth-token-tests.ts create mode 100644 types/registry-auth-token/tsconfig.json create mode 100644 types/registry-auth-token/tslint.json diff --git a/types/registry-auth-token/index.d.ts b/types/registry-auth-token/index.d.ts new file mode 100644 index 0000000000..cac80c5208 --- /dev/null +++ b/types/registry-auth-token/index.d.ts @@ -0,0 +1,70 @@ +// Type definitions for Registry Auth Token 3.3 +// Project: https://github.com/rexxars/registry-auth-token +// Definitions by: Maurice de Beijer +// James Liang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/** + * Simple namespace describing the inputs and outputs for `registry-auth-token` + */ +declare namespace auth { + /** + * The options for passing into `registry-auth-token` + */ + interface AuthOptions { + /** + * Wether or not url's path parts are recursively trimmed from the registry + * url when searching for tokens + */ + recursive?: boolean; + /** + * An npmrc configuration object used when searching for tokens. If no object is provided, + * the `.npmrc` file at the base of the project is used. + */ + npmrc?: { + /** + * A registry url used for matching + */ + registry?: string; + /** + * Registry url's with token information + */ + [registryUrls: string]: string; + }; + } + /** + * The generated authentication information + */ + interface NpmCredentials { + /** + * The token representing the users credentials + */ + token: string; + /** + * The type of token + */ + type: 'Basic'|'Bearer'; + /** + * The username used in `Basic` + */ + username?: string; + /** + * The password used in `Basic` + */ + password?: string; + } +} + +/** + * + * @param registryUrl - Either the registry url used + * for matching or a configuration object describing the contents of the .npmrc file + * @param [options] - a configuration object describing the + * contents of the .npmrc file. If an `npmrc` config object was passed in as the + * first parameter, this parameter is ignored. + * @returns The `NpmCredentials` object or undefined if no match found. + */ +declare function auth(registryUrl: string | auth.AuthOptions, options?: auth.AuthOptions): auth.NpmCredentials; + +export = auth; diff --git a/types/registry-auth-token/registry-auth-token-tests.ts b/types/registry-auth-token/registry-auth-token-tests.ts new file mode 100644 index 0000000000..0c50ea20a4 --- /dev/null +++ b/types/registry-auth-token/registry-auth-token-tests.ts @@ -0,0 +1,15 @@ +import * as authToken from 'registry-auth-token'; + +// $ExpectType NpmCredentials +authToken('url'); +// $ExpectType NpmCredentials +authToken({ recursive: true }); +// $ExpectType NpmCredentials +authToken({ npmrc: { url: 'value' } }); +// $ExpectType NpmCredentials +authToken({ npmrc: { registry: 'url' } }); +// $ExpectType NpmCredentials +authToken('url', { npmrc: { url: 'value' } }); + +// $ExpectError +authToken(); diff --git a/types/registry-auth-token/tsconfig.json b/types/registry-auth-token/tsconfig.json new file mode 100644 index 0000000000..6ce9facf15 --- /dev/null +++ b/types/registry-auth-token/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "registry-auth-token-tests.ts" + ] +} diff --git a/types/registry-auth-token/tslint.json b/types/registry-auth-token/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/registry-auth-token/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From ff8d26ef8ec18c56cb35fe71219308d4337947de Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Mon, 23 Jul 2018 16:57:00 +0100 Subject: [PATCH 206/738] Add type definitions for parallel-transform. (#27312) --- types/parallel-transform/index.d.ts | 27 +++++++++++++++++++ .../parallel-transform-tests.ts | 19 +++++++++++++ types/parallel-transform/tsconfig.json | 23 ++++++++++++++++ types/parallel-transform/tslint.json | 1 + 4 files changed, 70 insertions(+) create mode 100644 types/parallel-transform/index.d.ts create mode 100644 types/parallel-transform/parallel-transform-tests.ts create mode 100644 types/parallel-transform/tsconfig.json create mode 100644 types/parallel-transform/tslint.json diff --git a/types/parallel-transform/index.d.ts b/types/parallel-transform/index.d.ts new file mode 100644 index 0000000000..da7c64fb1c --- /dev/null +++ b/types/parallel-transform/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for parallel-transform 1.1 +// Project: https://github.com/mafintosh/parallel-transform +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Transform, TransformOptions, TransformCallback } from "stream"; + +type OnTransform = (chunk: any, callback: TransformCallback) => void; + +declare namespace ParallelTransform { + interface Options extends TransformOptions { + ordered?: boolean; + } +} + +declare const ParallelTransform: { + (maxParallel: number, opts: ParallelTransform.Options | undefined | null, ontransform: OnTransform): Transform; + (opts: ParallelTransform.Options | number | undefined | null, ontransform: OnTransform): Transform; + (ontransform: OnTransform): Transform; + new(maxParallel: number, opts: ParallelTransform.Options | undefined | null, ontransform: OnTransform): Transform; + new(opts: ParallelTransform.Options | number | undefined | null, ontransform: OnTransform): Transform; + new(ontransform: OnTransform): Transform; +}; + +export = ParallelTransform; diff --git a/types/parallel-transform/parallel-transform-tests.ts b/types/parallel-transform/parallel-transform-tests.ts new file mode 100644 index 0000000000..227cccd53b --- /dev/null +++ b/types/parallel-transform/parallel-transform-tests.ts @@ -0,0 +1,19 @@ +import transform = require("parallel-transform"); + +let stream = transform(10, (data, callback) => { + setTimeout(() => callback(undefined, data), Math.random() * 1000); +}); + +stream.write("1"); +stream.write("2"); +stream.write("3"); +stream.write("4"); +stream.end(); + +stream.on("data", data => console.log(data.toString())); +stream.on("end", () => "end of stream"); + +stream = transform(10, { objectMode: false }, + (data, callback) => callback(undefined, data)); + +stream = transform({ ordered: false }, (data, callback) => callback(new Error("fail"), null)); diff --git a/types/parallel-transform/tsconfig.json b/types/parallel-transform/tsconfig.json new file mode 100644 index 0000000000..524fa6e5aa --- /dev/null +++ b/types/parallel-transform/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "parallel-transform-tests.ts" + ] +} diff --git a/types/parallel-transform/tslint.json b/types/parallel-transform/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parallel-transform/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 710912817e826d0f3c5bacba6ad5b2aeaa6c1511 Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Mon, 23 Jul 2018 16:58:07 +0100 Subject: [PATCH 207/738] Add type definitions for flush-write-stream. (#27308) --- .../flush-write-stream-tests.ts | 18 +++++++++++++++ types/flush-write-stream/index.d.ts | 23 +++++++++++++++++++ types/flush-write-stream/tsconfig.json | 23 +++++++++++++++++++ types/flush-write-stream/tslint.json | 1 + 4 files changed, 65 insertions(+) create mode 100644 types/flush-write-stream/flush-write-stream-tests.ts create mode 100644 types/flush-write-stream/index.d.ts create mode 100644 types/flush-write-stream/tsconfig.json create mode 100644 types/flush-write-stream/tslint.json diff --git a/types/flush-write-stream/flush-write-stream-tests.ts b/types/flush-write-stream/flush-write-stream-tests.ts new file mode 100644 index 0000000000..3f308d2f88 --- /dev/null +++ b/types/flush-write-stream/flush-write-stream-tests.ts @@ -0,0 +1,18 @@ +import writer = require("flush-write-stream"); + +const stream = writer(write, flush); + +stream.on("finish", () => console.log("finished")); + +stream.write("hello"); +stream.write("world"); +stream.end(); + +function write(data: any, encoding: string, callback: (error?: Error) => void): void { + console.log("Writing", data.toString()); + callback(); +} + +function flush(callback: (error?: Error) => void): void { + setTimeout(callback, 1000); +} diff --git a/types/flush-write-stream/index.d.ts b/types/flush-write-stream/index.d.ts new file mode 100644 index 0000000000..3faae23da2 --- /dev/null +++ b/types/flush-write-stream/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for flush-write-stream 1.0 +// Project: https://github.com/mafintosh/flush-write-stream +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Writable, WritableOptions } from "stream"; + +type Callback = (error?: Error) => void; +type Write = (chunk: any, encoding: string, callback: Callback) => void; +type Flush = (callback: Callback) => void; + +declare const WriteStream: { + (opts: WritableOptions, write: Write, flush?: Flush): Writable; + (write: Write, flush?: Flush): Writable; + new(opts: WritableOptions, write: Write, flush?: Flush): Writable; + new(write: Write, flush?: Flush): Writable; + obj(opts: WritableOptions, write: Write, flush?: Flush): Writable; + obj(write: Write, flush?: Flush): Writable; +}; + +export = WriteStream; diff --git a/types/flush-write-stream/tsconfig.json b/types/flush-write-stream/tsconfig.json new file mode 100644 index 0000000000..95d5eca832 --- /dev/null +++ b/types/flush-write-stream/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "flush-write-stream-tests.ts" + ] +} diff --git a/types/flush-write-stream/tslint.json b/types/flush-write-stream/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/flush-write-stream/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 661a25ec4c7dab41bd7a372b6646e904cbc62aaf Mon Sep 17 00:00:00 2001 From: Vitor Luiz Cavalcanti Date: Mon, 23 Jul 2018 12:58:47 -0300 Subject: [PATCH 208/738] Create type definition for object-keys module (#27307) --- types/object-keys/index.d.ts | 13 +++++++++++++ types/object-keys/object-keys-tests.ts | 17 +++++++++++++++++ types/object-keys/tsconfig.json | 23 +++++++++++++++++++++++ types/object-keys/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 types/object-keys/index.d.ts create mode 100644 types/object-keys/object-keys-tests.ts create mode 100644 types/object-keys/tsconfig.json create mode 100644 types/object-keys/tslint.json diff --git a/types/object-keys/index.d.ts b/types/object-keys/index.d.ts new file mode 100644 index 0000000000..fa277d74fe --- /dev/null +++ b/types/object-keys/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for object-keys 1.0 +// Project: https://github.com/ljharb/object-keys#readme +// Definitions by: Vitor Luiz Cavalcanti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare function objectKeys(object: object): string[]; + +declare namespace objectKeys { + function shim(): typeof objectKeys; +} + +export = objectKeys; diff --git a/types/object-keys/object-keys-tests.ts b/types/object-keys/object-keys-tests.ts new file mode 100644 index 0000000000..29920c0d08 --- /dev/null +++ b/types/object-keys/object-keys-tests.ts @@ -0,0 +1,17 @@ +import keys = require('object-keys'); + +keys({ A: 1, B: 2, C: 3 }); +// => string[] + +keys.shim(); +// typeof keys + +keys([ 0, 1, 2, 3 ]); +// => string[] + +keys(() => 0); +// => string[] + +function testArguments() { + keys(arguments); +} diff --git a/types/object-keys/tsconfig.json b/types/object-keys/tsconfig.json new file mode 100644 index 0000000000..3ab9e5dab9 --- /dev/null +++ b/types/object-keys/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "object-keys-tests.ts" + ] +} diff --git a/types/object-keys/tslint.json b/types/object-keys/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/object-keys/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 664a91a98f140151ab799a7bec72b6378fef75db Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Mon, 23 Jul 2018 16:59:16 +0100 Subject: [PATCH 209/738] Add type definitions for stream-each. (#27306) --- types/stream-each/index.d.ts | 12 ++++++++++++ types/stream-each/stream-each-tests.ts | 16 ++++++++++++++++ types/stream-each/tsconfig.json | 23 +++++++++++++++++++++++ types/stream-each/tslint.json | 1 + 4 files changed, 52 insertions(+) create mode 100644 types/stream-each/index.d.ts create mode 100644 types/stream-each/stream-each-tests.ts create mode 100644 types/stream-each/tsconfig.json create mode 100644 types/stream-each/tslint.json diff --git a/types/stream-each/index.d.ts b/types/stream-each/index.d.ts new file mode 100644 index 0000000000..52f00e6345 --- /dev/null +++ b/types/stream-each/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for stream-each 1.2 +// Project: https://github.com/mafintosh/stream-each +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare function each(stream: NodeJS.ReadableStream, + iterator: (data: Buffer | string, next: (error?: Error) => void) => void, + cb: (error?: Error) => void): void; + +export = each; diff --git a/types/stream-each/stream-each-tests.ts b/types/stream-each/stream-each-tests.ts new file mode 100644 index 0000000000..47684c1dc9 --- /dev/null +++ b/types/stream-each/stream-each-tests.ts @@ -0,0 +1,16 @@ +import each = require("stream-each"); +import { createReadStream } from "fs"; + +const stream = createReadStream(__filename); + +each(stream, + (data, next) => { + if (typeof data === "string") { + console.log(data); + next(); + } else { + const buffer: Buffer = data; + next(new Error("Buffer")); + } + }, + error => console.error(error)); diff --git a/types/stream-each/tsconfig.json b/types/stream-each/tsconfig.json new file mode 100644 index 0000000000..5a58f5031f --- /dev/null +++ b/types/stream-each/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "stream-each-tests.ts" + ] +} diff --git a/types/stream-each/tslint.json b/types/stream-each/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/stream-each/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4461b3198afe98760253b5da533975e4c756fcea Mon Sep 17 00:00:00 2001 From: Olegs Jeremejevs Date: Mon, 23 Jul 2018 20:02:13 +0300 Subject: [PATCH 210/738] minimal-bit-array: Initial commit (#27501) --- types/minimal-bit-array/index.d.ts | 26 +++++++++++++++++++ .../minimal-bit-array-tests.ts | 9 +++++++ types/minimal-bit-array/tsconfig.json | 23 ++++++++++++++++ types/minimal-bit-array/tslint.json | 1 + 4 files changed, 59 insertions(+) create mode 100644 types/minimal-bit-array/index.d.ts create mode 100644 types/minimal-bit-array/minimal-bit-array-tests.ts create mode 100644 types/minimal-bit-array/tsconfig.json create mode 100644 types/minimal-bit-array/tslint.json diff --git a/types/minimal-bit-array/index.d.ts b/types/minimal-bit-array/index.d.ts new file mode 100644 index 0000000000..f5172fbd47 --- /dev/null +++ b/types/minimal-bit-array/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for minimal-bit-array 1.0 +// Project: https://github.com/mikolalysenko/minimal-bit-array +// Definitions by: Olegs Jeremejevs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace BitArray { + interface BitArrayJSON { + bits: number[]; + length: number; + } +} + +declare class BitArray { + static fromJSON(bitArrayJSON: BitArray.BitArrayJSON): BitArray; + + length: number; + bits: Uint32Array; + + constructor(length: number); + + get(index: number): boolean; + set(index: number, value: any): boolean; + toJSON(): BitArray.BitArrayJSON; +} + +export = BitArray; diff --git a/types/minimal-bit-array/minimal-bit-array-tests.ts b/types/minimal-bit-array/minimal-bit-array-tests.ts new file mode 100644 index 0000000000..135b2908f2 --- /dev/null +++ b/types/minimal-bit-array/minimal-bit-array-tests.ts @@ -0,0 +1,9 @@ +import * as BitArray from "minimal-bit-array"; + +new BitArray('abc'); // $ExpectError +const bitArray: BitArray = new BitArray(123); +bitArray.get(12); // $ExpectType boolean +bitArray.set(34, true); // $ExpectType boolean +bitArray.set(34, 'someTruthyValue'); +const json: BitArray.BitArrayJSON = bitArray.toJSON(); +const bitArrayClone: BitArray = BitArray.fromJSON(json); diff --git a/types/minimal-bit-array/tsconfig.json b/types/minimal-bit-array/tsconfig.json new file mode 100644 index 0000000000..6858a768bd --- /dev/null +++ b/types/minimal-bit-array/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "minimal-bit-array-tests.ts" + ] +} diff --git a/types/minimal-bit-array/tslint.json b/types/minimal-bit-array/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/minimal-bit-array/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c931d79d0669a3e0e430b83bce533e2638264255 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 23 Jul 2018 20:08:16 +0300 Subject: [PATCH 211/738] Update url-parse typings to 1.4 (#26947) --- types/url-parse/index.d.ts | 90 +++++++++++++++--------------- types/url-parse/url-parse-tests.ts | 29 +++++----- 2 files changed, 61 insertions(+), 58 deletions(-) diff --git a/types/url-parse/index.d.ts b/types/url-parse/index.d.ts index 6aed768de9..2f7a49c7af 100644 --- a/types/url-parse/index.d.ts +++ b/types/url-parse/index.d.ts @@ -1,55 +1,57 @@ -// Type definitions for url-parse 1.1 +// Type definitions for url-parse 1.4 // Project: https://github.com/unshiftio/url-parse -// Definitions by: Pavlo Chernenko -// Hari Sivaramakrishnan +// Definitions by: Pavlo Chernenko , Hari Sivaramakrishnan , Dmitry Dushkin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import URLSearchParams = require("url-search-params"); +type URLPart = 'auth' + | 'hash' + | 'host' + | 'hostname' + | 'href' + | 'origin' + | 'password' + | 'pathname' + | 'port' + | 'protocol' + | 'query' + | 'slashes' + | 'username'; -type UrlQueryParamsParser = (url: string) => string; +type QueryParser = (query: string) => object; -declare namespace parse { - interface URL { - readonly auth: string; - readonly hash: string; - readonly host: string; - readonly hostname: string; - readonly href: string; - readonly origin: string; - readonly password: string; - readonly pathname: string; - readonly port: string; - readonly protocol: string; - query: { [key: string]: string | undefined }; - readonly search: string; - set(property: string, value: string | object | number | undefined): URL; - readonly slashes: boolean; - readonly username: string; - readonly searchParams: URLSearchParams; - toString(): string; - } +declare class URLParse { + readonly auth: string; + readonly hash: string; + readonly host: string; + readonly hostname: string; + readonly href: string; + readonly origin: string; + readonly password: string; + readonly pathname: string; + readonly port: string; + readonly protocol: string; + readonly query: { [key: string]: string | undefined }; + readonly slashes: boolean; + readonly username: string; + set(part: URLPart, value: string | object | number | undefined, fn?: boolean | QueryParser): URLParse; + toString(): string; } -type ParseFunctionNodeType = (url: string, parseQueryString?: boolean, slashesDenoteHost?: boolean) => parse.URL; -type ParseFunctionType = (url: string, baseURL?: object | string, parser?: boolean | UrlQueryParamsParser) => parse.URL; +declare const parse: { + new(address: string, location?: string | object, parser?: boolean | QueryParser): URLParse; + (address: string, location?: string | object, parser?: boolean | QueryParser): URLParse; -interface Protocol { - slashes: boolean; - protocol: string; - rest: string; -} - -type ExtractProtocolFunctionType = (url: string) => Protocol; - -type LocationFunctionType = (url: string) => string; - -interface ExtendedParseFunctionType extends ParseFunctionNodeType, ParseFunctionType { - extractProtocol: ExtractProtocolFunctionType; - location: LocationFunctionType; - qs: any; -} - -declare const parse: ExtendedParseFunctionType; + extractProtocol(url: string): { + slashes: boolean; + protocol: string; + rest: string; + }; + location(url: string): object; + qs: { + parse: QueryParser; + stringify(query: object): string; + }; +}; export = parse; diff --git a/types/url-parse/url-parse-tests.ts b/types/url-parse/url-parse-tests.ts index 61dc650ee1..12d056f928 100644 --- a/types/url-parse/url-parse-tests.ts +++ b/types/url-parse/url-parse-tests.ts @@ -1,18 +1,19 @@ -import parse = require("url-parse"); +import URL = require('url-parse'); +const parse = URL; -const url1 = new URL("foo/bar", "https://github.com/"); -const url2: parse.URL = parse("https://github.com/foo/bar?baz=true"); -const url3: parse.URL = parse("https://github.com/foo/bar", true, true); -const url4: parse.URL = parse("foo/bar", "https://github.com/"); -const url5: parse.URL = parse("foo/bar", "https://github.com/", () => "queryParserOverride"); +new URL('foo/bar', 'https://github.com/'); +new URL('foo/bar', 'https://github.com/', (query: string) => ({ query })); +parse('foo/bar', 'https://github.com/'); +parse('foo/bar', 'https://github.com/', (query: string) => ({ query })); -url2.hash; -url2.hostname; -url2.query.baz; +const url1 = new URL('https://github.com/foo/bar?baz=true'); +url1.hash; +url1.hostname; +url1.query.baz; -url3.slashes; -url3.set("protocol", "http://"); +const url2 = new URL('foo/bar', 'https://github.com/'); +url2.set('protocol', 'http://'); -parse.extractProtocol("https://github.com/foo/bar"); -parse.location("https://github.com/foo/bar"); -parse.qs; +URL.extractProtocol('https://github.com/foo/bar'); +URL.location('https://github.com/foo/bar'); +URL.qs.parse('a=b'); From 03212af7dab98266839c0826b3a14c8e5e6b95be Mon Sep 17 00:00:00 2001 From: Martin Charles Date: Mon, 23 Jul 2018 13:10:12 -0400 Subject: [PATCH 212/738] [react-side-effect] Removed Any Types (#27132) * Improved react-side-effect Typings Removed all `any` typings. Added tests which test usage. * Made Lint Less Permissive It doesn't need to be so permissive. * Fixed Whitespace * Added Typings for Server Stuff Used a more robust way than suggested in review. Added tests too. * Fixed Server Types `peek` can return either a `TServerState` or `TState` when `withSideEffect` is provided `mapStateOnServer` (based on runtime). `rewind` always returns `TServerState` when `mapStateOnServer` is provided, otherwise it returns `TState`. --- types/react-side-effect/index.d.ts | 31 +++++--- .../react-side-effect-tests.ts | 34 -------- .../react-side-effect-tests.tsx | 59 ++++++++++++++ types/react-side-effect/tsconfig.json | 3 +- types/react-side-effect/tslint.json | 78 +------------------ 5 files changed, 83 insertions(+), 122 deletions(-) delete mode 100644 types/react-side-effect/react-side-effect-tests.ts create mode 100644 types/react-side-effect/react-side-effect-tests.tsx diff --git a/types/react-side-effect/index.d.ts b/types/react-side-effect/index.d.ts index 358acbbf05..1f15038c4b 100644 --- a/types/react-side-effect/index.d.ts +++ b/types/react-side-effect/index.d.ts @@ -1,23 +1,34 @@ -// Type definitions for react-side-effect v1.0.2 +// Type definitions for react-side-effect 1.1 // Project: https://github.com/gaearon/react-side-effect // Definitions by: Remo H. Jansen +// Martin Charles // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 import * as React from "react"; -declare function withSideEffect( - reducePropsToState: (propsList: any[]) => any, - handleStateChangeOnClient: (state: any) => any, - mapStateOnServer?: (state: any) => any -): ClassDecorator; +interface WithSideEffect { + ( + reducePropsToState: (propsList: TProp[]) => TState, + handleStateChangeOnClient: (state: TState) => void + ): ClassDecorator; -declare class ElementClass extends React.Component {} - -interface ClassDecorator { - (component:T): T; + ( + reducePropsToState: (propsList: TProp[]) => TState, + handleStateChangeOnClient: (state: TState) => void, + mapStateOnServer: (state: TState) => TServerState + ): ClassDecorator; } +declare const withSideEffect: WithSideEffect; + +type ClassDecorator = ( + component: React.ComponentType +) => React.ComponentType & { + peek: () => TPeek; + rewind: () => TRewind; +}; + declare namespace withSideEffect {} // https://github.com/Microsoft/TypeScript/issues/5073 export = withSideEffect; diff --git a/types/react-side-effect/react-side-effect-tests.ts b/types/react-side-effect/react-side-effect-tests.ts deleted file mode 100644 index d568fed4cc..0000000000 --- a/types/react-side-effect/react-side-effect-tests.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as React from "react"; -import withSideEffect = require("react-side-effect"); - -interface DocumentTitleProps { - title: string -} - -class DocumentTitle extends React.Component { - public render() { - if (this.props.children) { - return React.Children.only(this.props.children); - } else { - return null; - } - } -} - -function reducePropsToState(propsList: any[]) { - var innermostProps = propsList[propsList.length - 1]; - if (innermostProps) { - return innermostProps.title; - } -} - -function handleStateChangeOnClient(title: string) { - document.title = title || ""; -} - -let DocumentTitleWithSideEffects = withSideEffect( - reducePropsToState, - handleStateChangeOnClient -)(DocumentTitle); - -export default DocumentTitleWithSideEffects; diff --git a/types/react-side-effect/react-side-effect-tests.tsx b/types/react-side-effect/react-side-effect-tests.tsx new file mode 100644 index 0000000000..7cbe8fc043 --- /dev/null +++ b/types/react-side-effect/react-side-effect-tests.tsx @@ -0,0 +1,59 @@ +import * as React from "react"; +import withSideEffect = require("react-side-effect"); + +interface DocumentTitleProps { + title: string; +} + +type State = string | undefined; + +interface ServerState { + innerState: State; +} + +const DocumentTitle = () => null; + +function reducePropsToState(propsList: DocumentTitleProps[]): State { + const innermostProps = propsList[propsList.length - 1]; + if (innermostProps) { + return innermostProps.title; + } +} + +function handleStateChangeOnClient(title: State) { + document.title = title || ""; +} + +const mapStateOnServer = (state: State): ServerState => ({ innerState: state }); + +const DocumentTitleWithServerMapState = withSideEffect( + reducePropsToState, + handleStateChangeOnClient, + mapStateOnServer +)(DocumentTitle); + +const testWithServerMapState = () => { + const testComponent = () => ( + + ); + const peekedState: + | ServerState + | State = DocumentTitleWithServerMapState.peek(); + const rewindedState: ServerState = DocumentTitleWithServerMapState.rewind(); +}; + +const DocumentTitleNotServer = withSideEffect( + reducePropsToState, + handleStateChangeOnClient +)(DocumentTitle); + +const testWithoutMapState = () => { + const testComponent = () => ; + const peekedState: State = DocumentTitleNotServer.peek(); + const rewindedState: State = DocumentTitleNotServer.rewind(); +}; + +const testInvalidProp = () => ( + // $ExpectError + +); diff --git a/types/react-side-effect/tsconfig.json b/types/react-side-effect/tsconfig.json index f64b0cedec..752e806984 100644 --- a/types/react-side-effect/tsconfig.json +++ b/types/react-side-effect/tsconfig.json @@ -5,6 +5,7 @@ "es6", "dom" ], + "jsx": "react", "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, @@ -19,6 +20,6 @@ }, "files": [ "index.d.ts", - "react-side-effect-tests.ts" + "react-side-effect-tests.tsx" ] } \ No newline at end of file diff --git a/types/react-side-effect/tslint.json b/types/react-side-effect/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/react-side-effect/tslint.json +++ b/types/react-side-effect/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } From 401f812db2c8718a9638293b89c58f0fb6dba4f0 Mon Sep 17 00:00:00 2001 From: Jake Marsh Date: Mon, 23 Jul 2018 10:10:40 -0700 Subject: [PATCH 213/738] Update next definitions for 6.1.1 - router events API (#27143) * Update nextjs router events API * fix tests and update header * fix header * handle routeChangeError and update tests --- types/next/index.d.ts | 2 +- types/next/router.d.ts | 26 +++++++++++++++++++------- types/next/test/next-router-tests.tsx | 13 ++++--------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 904209dd2d..1beaffdfac 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for next 6.0 +// Type definitions for next 6.1 // Project: https://github.com/zeit/next.js // Definitions by: Drew Hays // Brice BERNARD diff --git a/types/next/router.d.ts b/types/next/router.d.ts index 4eb24dc3ff..74aafd4a33 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -3,6 +3,20 @@ import * as url from "url"; type UrlLike = url.UrlObject | url.Url; +type EventName = 'routeChangeStart' + | 'routeChangeComplete' + | 'routeChangeError' + | 'beforeHistoryChange' + | 'hashChangeStart' + | 'hashChangeComplete'; + +interface RouteChangeError { + cancelled: boolean; +} + +type EventHandler = (url: string) => any; +type ErrorEventHandler = (err: RouteChangeError, url: string) => any; + export interface EventChangeOptions { shallow?: boolean; [key: string]: any; @@ -11,6 +25,7 @@ export interface EventChangeOptions { export type PopStateCallback = (state: any) => boolean | undefined; export type RouterCallback = () => void; + export interface RouterProps { // url property fields readonly pathname: string; @@ -48,13 +63,10 @@ export interface RouterProps { ): Promise; // events - onAppUpdated?(nextRoute: string): void; - onBeforeHistoryChange?(as: string): void; - onHashChangeStart?(url: string): void; - onHashChangeComplete?(url: string): void; - onRouteChangeComplete?(url: string): void; - onRouteChangeError?(error: any, url: string): void; - onRouteChangeStart?(url: string): void; + readonly events: { + on: (eventName: EventName, handler: EventHandler | ErrorEventHandler) => void; + off: (eventName: EventName, handler: (url: string) => any) => void; + }; } export interface SingletonRouter extends RouterProps { diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx index 70c41081bd..fdcf1de3ff 100644 --- a/types/next/test/next-router-tests.tsx +++ b/types/next/test/next-router-tests.tsx @@ -36,15 +36,10 @@ split(Router.pathname); const query = `?${qs.stringify(Router.query)}`; // Assign some callback methods. -Router.onAppUpdated = (nextRoute: string) => console.log(nextRoute); -Router.onRouteChangeStart = (url: string) => - console.log("Route is starting to change.", url); -Router.onBeforeHistoryChange = (as: string) => - console.log("History hasn't changed yet.", as); -Router.onRouteChangeComplete = (url: string) => - console.log("Route chaneg is complete.", url); -Router.onRouteChangeError = (err: any, url: string) => - console.log("Route is starting to change.", url, err); +Router.events.on('routeChangeStart', (url: string) => console.log("Route is starting to change.", url)); +Router.events.on('beforeHistoryChange', (as: string) => console.log("History hasn't changed yet.", as)); +Router.events.on('routeChangeComplete', (url: string) => console.log("Route change is complete.", url)); +Router.events.on('routeChangeError', (err: any, url: string) => console.log("Route change errored.", err, url)); // Call methods on the router itself. Router.reload("/route").then(() => console.log("route was reloaded")); From fe1eceaa121fe58a267bc1ee8789f17c5373b600 Mon Sep 17 00:00:00 2001 From: Tim Keiner Date: Mon, 23 Jul 2018 19:11:19 +0200 Subject: [PATCH 214/738] Adding type definiton for npm package of yoga-layout (#27184) * Created type-definitons for yoga-layout package * 331 * Fixed issues according to tslint * Fixed typo * fixed file name to match suddenly appeared new file-name-casing rule * go back to -tests.ts and disable file-name-casing to false --- types/yoga-layout/index.d.ts | 414 +++++++++++++++++++++++++ types/yoga-layout/tsconfig.json | 23 ++ types/yoga-layout/tslint.json | 6 + types/yoga-layout/yoga-layout-tests.ts | 24 ++ 4 files changed, 467 insertions(+) create mode 100644 types/yoga-layout/index.d.ts create mode 100644 types/yoga-layout/tsconfig.json create mode 100644 types/yoga-layout/tslint.json create mode 100644 types/yoga-layout/yoga-layout-tests.ts diff --git a/types/yoga-layout/index.d.ts b/types/yoga-layout/index.d.ts new file mode 100644 index 0000000000..4014834802 --- /dev/null +++ b/types/yoga-layout/index.d.ts @@ -0,0 +1,414 @@ +// Type definitions for yoga-layout 1.9 +// Project: https://github.com/facebook/yoga#readme +// Definitions by: tnobody +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export const ALIGN_AUTO: 0; +export const ALIGN_COUNT: 8; +export const ALIGN_FLEX_START: 1; +export const ALIGN_CENTER: 2; +export const ALIGN_FLEX_END: 3; +export const ALIGN_STRETCH: 4; +export const ALIGN_BASELINE: 5; +export const ALIGN_SPACE_BETWEEN: 6; +export const ALIGN_SPACE_AROUND: 7; +export const DIMENSION_COUNT: 2; +export const DIMENSION_WIDTH: 0; +export const DIMENSION_HEIGHT: 1; +export const DIRECTION_COUNT: 3; +export const DIRECTION_INHERIT: 0; +export const DIRECTION_LTR: 1; +export const DIRECTION_RTL: 2; +export const DISPLAY_COUNT: 2; +export const DISPLAY_FLEX: 0; +export const DISPLAY_NONE: 1; +export const EDGE_COUNT: 9; +export const EDGE_LEFT: 0; +export const EDGE_TOP: 1; +export const EDGE_RIGHT: 2; +export const EDGE_BOTTOM: 3; +export const EDGE_START: 4; +export const EDGE_END: 5; +export const EDGE_HORIZONTAL: 6; +export const EDGE_VERTICAL: 7; +export const EDGE_ALL: 8; +export const EXPERIMENTAL_FEATURE_COUNT: 1; +export const EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: 0; +export const FLEX_DIRECTION_COUNT: 4; +export const FLEX_DIRECTION_COLUMN: 0; +export const FLEX_DIRECTION_COLUMN_REVERSE: 1; +export const FLEX_DIRECTION_ROW: 2; +export const FLEX_DIRECTION_ROW_REVERSE: 3; +export const JUSTIFY_COUNT: 6; +export const JUSTIFY_FLEX_START: 0; +export const JUSTIFY_CENTER: 1; +export const JUSTIFY_FLEX_END: 2; +export const JUSTIFY_SPACE_BETWEEN: 3; +export const JUSTIFY_SPACE_AROUND: 4; +export const JUSTIFY_SPACE_EVENLY: 5; +export const LOG_LEVEL_COUNT: 6; +export const LOG_LEVEL_ERROR: 0; +export const LOG_LEVEL_WARN: 1; +export const LOG_LEVEL_INFO: 2; +export const LOG_LEVEL_DEBUG: 3; +export const LOG_LEVEL_VERBOSE: 4; +export const LOG_LEVEL_FATAL: 5; +export const MEASURE_MODE_COUNT: 3; +export const MEASURE_MODE_UNDEFINED: 0; +export const MEASURE_MODE_EXACTLY: 1; +export const MEASURE_MODE_AT_MOST: 2; +export const NODE_TYPE_COUNT: 2; +export const NODE_TYPE_DEFAULT: 0; +export const NODE_TYPE_TEXT: 1; +export const OVERFLOW_COUNT: 3; +export const OVERFLOW_VISIBLE: 0; +export const OVERFLOW_HIDDEN: 1; +export const OVERFLOW_SCROLL: 2; +export const POSITION_TYPE_COUNT: 2; +export const POSITION_TYPE_RELATIVE: 0; +export const POSITION_TYPE_ABSOLUTE: 1; +export const PRINT_OPTIONS_COUNT: 3; +export const PRINT_OPTIONS_LAYOUT: 1; +export const PRINT_OPTIONS_STYLE: 2; +export const PRINT_OPTIONS_CHILDREN: 4; +export const UNIT_COUNT: 4; +export const UNIT_UNDEFINED: 0; +export const UNIT_POINT: 1; +export const UNIT_PERCENT: 2; +export const UNIT_AUTO: 3; +export const WRAP_COUNT: 3; +export const WRAP_NO_WRAP: 0; +export const WRAP_WRAP: 1; +export const WRAP_WRAP_REVERSE: 2; + +interface ConstantsStatic { + readonly ALIGN_AUTO: typeof ALIGN_AUTO; + readonly ALIGN_COUNT: typeof ALIGN_COUNT; + readonly ALIGN_FLEX_START: typeof ALIGN_FLEX_START; + readonly ALIGN_CENTER: typeof ALIGN_CENTER; + readonly ALIGN_FLEX_END: typeof ALIGN_FLEX_END; + readonly ALIGN_STRETCH: typeof ALIGN_STRETCH; + readonly ALIGN_BASELINE: typeof ALIGN_BASELINE; + readonly ALIGN_SPACE_BETWEEN: typeof ALIGN_SPACE_BETWEEN; + readonly ALIGN_SPACE_AROUND: typeof ALIGN_SPACE_AROUND; + readonly DIMENSION_COUNT: typeof DIMENSION_COUNT; + readonly DIMENSION_WIDTH: typeof DIMENSION_WIDTH; + readonly DIMENSION_HEIGHT: typeof DIMENSION_HEIGHT; + readonly DIRECTION_COUNT: typeof DIRECTION_COUNT; + readonly DIRECTION_INHERIT: typeof DIRECTION_INHERIT; + readonly DIRECTION_LTR: typeof DIRECTION_LTR; + readonly DIRECTION_RTL: typeof DIRECTION_RTL; + readonly DISPLAY_COUNT: typeof DISPLAY_COUNT; + readonly DISPLAY_FLEX: typeof DISPLAY_FLEX; + readonly DISPLAY_NONE: typeof DISPLAY_NONE; + readonly EDGE_COUNT: typeof EDGE_COUNT; + readonly EDGE_LEFT: typeof EDGE_LEFT; + readonly EDGE_TOP: typeof EDGE_TOP; + readonly EDGE_RIGHT: typeof EDGE_RIGHT; + readonly EDGE_BOTTOM: typeof EDGE_BOTTOM; + readonly EDGE_START: typeof EDGE_START; + readonly EDGE_END: typeof EDGE_END; + readonly EDGE_HORIZONTAL: typeof EDGE_HORIZONTAL; + readonly EDGE_VERTICAL: typeof EDGE_VERTICAL; + readonly EDGE_ALL: typeof EDGE_ALL; + readonly EXPERIMENTAL_FEATURE_COUNT: typeof EXPERIMENTAL_FEATURE_COUNT; + readonly EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: typeof EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS; + readonly FLEX_DIRECTION_COUNT: typeof FLEX_DIRECTION_COUNT; + readonly FLEX_DIRECTION_COLUMN: typeof FLEX_DIRECTION_COLUMN; + readonly FLEX_DIRECTION_COLUMN_REVERSE: typeof FLEX_DIRECTION_COLUMN_REVERSE; + readonly FLEX_DIRECTION_ROW: typeof FLEX_DIRECTION_ROW; + readonly FLEX_DIRECTION_ROW_REVERSE: typeof FLEX_DIRECTION_ROW_REVERSE; + readonly JUSTIFY_COUNT: typeof JUSTIFY_COUNT; + readonly JUSTIFY_FLEX_START: typeof JUSTIFY_FLEX_START; + readonly JUSTIFY_CENTER: typeof JUSTIFY_CENTER; + readonly JUSTIFY_FLEX_END: typeof JUSTIFY_FLEX_END; + readonly JUSTIFY_SPACE_BETWEEN: typeof JUSTIFY_SPACE_BETWEEN; + readonly JUSTIFY_SPACE_AROUND: typeof JUSTIFY_SPACE_AROUND; + readonly JUSTIFY_SPACE_EVENLY: typeof JUSTIFY_SPACE_EVENLY; + readonly LOG_LEVEL_COUNT: typeof LOG_LEVEL_COUNT; + readonly LOG_LEVEL_ERROR: typeof LOG_LEVEL_ERROR; + readonly LOG_LEVEL_WARN: typeof LOG_LEVEL_WARN; + readonly LOG_LEVEL_INFO: typeof LOG_LEVEL_INFO; + readonly LOG_LEVEL_DEBUG: typeof LOG_LEVEL_DEBUG; + readonly LOG_LEVEL_VERBOSE: typeof LOG_LEVEL_VERBOSE; + readonly LOG_LEVEL_FATAL: typeof LOG_LEVEL_FATAL; + readonly MEASURE_MODE_COUNT: typeof MEASURE_MODE_COUNT; + readonly MEASURE_MODE_UNDEFINED: typeof MEASURE_MODE_UNDEFINED; + readonly MEASURE_MODE_EXACTLY: typeof MEASURE_MODE_EXACTLY; + readonly MEASURE_MODE_AT_MOST: typeof MEASURE_MODE_AT_MOST; + readonly NODE_TYPE_COUNT: typeof NODE_TYPE_COUNT; + readonly NODE_TYPE_DEFAULT: typeof NODE_TYPE_DEFAULT; + readonly NODE_TYPE_TEXT: typeof NODE_TYPE_TEXT; + readonly OVERFLOW_COUNT: typeof OVERFLOW_COUNT; + readonly OVERFLOW_VISIBLE: typeof OVERFLOW_VISIBLE; + readonly OVERFLOW_HIDDEN: typeof OVERFLOW_HIDDEN; + readonly OVERFLOW_SCROLL: typeof OVERFLOW_SCROLL; + readonly POSITION_TYPE_COUNT: typeof POSITION_TYPE_COUNT; + readonly POSITION_TYPE_RELATIVE: typeof POSITION_TYPE_RELATIVE; + readonly POSITION_TYPE_ABSOLUTE: typeof POSITION_TYPE_ABSOLUTE; + readonly PRINT_OPTIONS_COUNT: typeof PRINT_OPTIONS_COUNT; + readonly PRINT_OPTIONS_LAYOUT: typeof PRINT_OPTIONS_LAYOUT; + readonly PRINT_OPTIONS_STYLE: typeof PRINT_OPTIONS_STYLE; + readonly PRINT_OPTIONS_CHILDREN: typeof PRINT_OPTIONS_CHILDREN; + readonly UNIT_COUNT: typeof UNIT_COUNT; + readonly UNIT_UNDEFINED: typeof UNIT_UNDEFINED; + readonly UNIT_POINT: typeof UNIT_POINT; + readonly UNIT_PERCENT: typeof UNIT_PERCENT; + readonly UNIT_AUTO: typeof UNIT_AUTO; + readonly WRAP_COUNT: typeof WRAP_COUNT; + readonly WRAP_NO_WRAP: typeof WRAP_NO_WRAP; + readonly WRAP_WRAP: typeof WRAP_WRAP; + readonly WRAP_WRAP_REVERSE: typeof WRAP_WRAP_REVERSE; +} + +declare const Constans: ConstantsStatic; + +export type YogaJustifyContent = + | typeof JUSTIFY_CENTER + | typeof JUSTIFY_FLEX_END + | typeof JUSTIFY_FLEX_START + | typeof JUSTIFY_SPACE_AROUND + | typeof JUSTIFY_SPACE_BETWEEN + | typeof JUSTIFY_SPACE_EVENLY; + +export type YogaAlign = + | typeof ALIGN_AUTO + | typeof ALIGN_BASELINE + | typeof ALIGN_CENTER + | typeof ALIGN_FLEX_END + | typeof ALIGN_FLEX_START + | typeof ALIGN_SPACE_AROUND + | typeof ALIGN_SPACE_BETWEEN + | typeof ALIGN_STRETCH; + +export type YogaFlexDirection = + | typeof FLEX_DIRECTION_COLUMN + | typeof FLEX_DIRECTION_COLUMN_REVERSE + | typeof FLEX_DIRECTION_COUNT + | typeof FLEX_DIRECTION_ROW + | typeof FLEX_DIRECTION_ROW_REVERSE; + +export type YogaDirection = + | typeof DIRECTION_INHERIT + | typeof DIRECTION_LTR + | typeof DIRECTION_RTL; + +export type YogaFlexWrap = + | typeof WRAP_NO_WRAP + | typeof WRAP_WRAP + | typeof WRAP_WRAP_REVERSE; + +export type YogaEdge = + | typeof EDGE_LEFT + | typeof EDGE_TOP + | typeof EDGE_RIGHT + | typeof EDGE_BOTTOM + | typeof EDGE_START + | typeof EDGE_END + | typeof EDGE_HORIZONTAL + | typeof EDGE_VERTICAL + | typeof EDGE_ALL; + +export type YogaDisplay = + | typeof DISPLAY_FLEX + | typeof DISPLAY_NONE; + +export type YogaUnit = + | typeof UNIT_AUTO + | typeof UNIT_PERCENT + | typeof UNIT_POINT + | typeof UNIT_UNDEFINED; + +export type YogaOverflow = + | typeof OVERFLOW_HIDDEN + | typeof OVERFLOW_SCROLL + | typeof OVERFLOW_VISIBLE; + +export type YogaPositionType = + | typeof POSITION_TYPE_ABSOLUTE + | typeof POSITION_TYPE_RELATIVE; + +export type YogaExperimentalFeature = typeof EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS; + +export interface YogaNode { + calculateLayout( + width?: number, + height?: number, + direction?: YogaDirection, + ): void; + copyStyle(node: YogaNode): void; + free(): void; + freeRecursive(): void; + getAlignContent(): YogaAlign; + getAlignItems(): YogaAlign; + getAlignSelf(): YogaAlign; + getAspectRatio(): number; + getBorder(edge: YogaEdge): number; + getChild(index: number): YogaNode; + getChildCount(): number; + getComputedBorder(edge: YogaEdge): number; + getComputedBottom(): number; + getComputedHeight(): number; + getComputedLayout(): Layout; + getComputedLeft(): number; + getComputedMargin(edge: YogaEdge): number; + getComputedPadding(edge: YogaEdge): number; + getComputedRight(): number; + getComputedTop(): number; + getComputedWidth(): number; + getDisplay(): YogaDisplay; + getFlexBasis(): number; + getFlexDirection(): YogaFlexDirection; + getFlexGrow(): number; + getFlexShrink(): number; + getFlexWrap(): YogaFlexWrap; + getHeight(): Value; + getJustifyContent(): YogaJustifyContent; + getMargin(edge: YogaEdge): Value; + getMaxHeight(): Value; + getMaxWidth(): Value; + getMinHeight(): Value; + getMinWidth(): Value; + getOverflow(): YogaOverflow; + getPadding(edge: YogaEdge): Value; + getParent(): YogaNode | null; + getPosition(edge: YogaEdge): Value; + getPositionType(): YogaPositionType; + getWidth(): Value; + insertChild(child: YogaNode, index: number): void; + isDirty(): boolean; + markDirty(): void; + removeChild(child: YogaNode): void; + reset(): void; + setAlignContent(alignContent: YogaAlign): void; + setAlignItems(alignItems: YogaAlign): void; + setAlignSelf(alignSelf: YogaAlign): void; + setAspectRatio(aspectRatio: number): void; + setBorder(edge: YogaEdge, borderWidth: number): void; + setDisplay(display: YogaDisplay): void; + setFlex(flex: number): void; + setFlexBasis(flexBasis: number | string): void; + setFlexBasisPercent(flexBasis: number): void; + setFlexDirection(flexDirection: YogaFlexDirection): void; + setFlexGrow(flexGrow: number): void; + setFlexShrink(flexShrink: number): void; + setFlexWrap(flexWrap: YogaFlexWrap): void; + setHeight(height: number | string): void; + setHeightAuto(): void; + setHeightPercent(height: number): void; + setJustifyContent(justifyContent: YogaJustifyContent): void; + setMargin(edge: YogaEdge, margin: number): void; + setMarginAuto(edge: YogaEdge): void; + setMarginPercent(edge: YogaEdge, margin: number): void; + setMaxHeight(maxHeight: number | string): void; + setMaxHeightPercent(maxHeight: number): void; + setMaxWidth(maxWidth: number | string): void; + setMaxWidthPercent(maxWidth: number): void; + setMeasureFunc(measureFunc: (() => any) | null): void; + setMinHeight(minHeight: number | string): void; + setMinHeightPercent(minHeight: number): void; + setMinWidth(minWidth: number | string): void; + setMinWidthPercent(minWidth: number): void; + setOverflow(overflow: YogaOverflow): void; + setPadding(edge: YogaEdge, padding: number | string): void; + setPaddingPercent(edge: YogaEdge, padding: number): void; + setPosition(edge: YogaEdge, position: number | string): void; + setPositionPercent(edge: YogaEdge, position: number): void; + setPositionType(positionType: YogaPositionType): void; + setWidth(width: number | string): void; + setWidthAuto(): void; + setWidthPercent(width: number): void; + unsetMeasureFun(): void; +} + +export class Layout { + readonly left: number; + readonly right: number; + readonly top: number; + readonly bottom: number; + readonly width: number; + readonly height: number; + constructor( + left: number, + right: number, + top: number, + bottom: number, + width: number, + height: number, + ); + + fromJs(expose: ( + left: number, + right: number, + top: number, + bottom: number, + width: number, + height: number, + ) => any): void; + + toString(): string; +} + +export class Size { + static fromJS(dim: { width: number, height: number }): Size; + + readonly width: number; + readonly height: number; + + constructor(width: number, height: number); + + fromJS(expose: (width: number, height: number) => any): void; + + toString(): string; +} + +export class Value { + readonly unit: YogaUnit | number; + readonly value: number; + + constructor(unit: YogaUnit | number, value: number); + + fromJS(expose: (unit: YogaUnit | number, value: number) => any): void; + + toString(): string; + valueOf(): number; +} + +export interface YogaConfig { + isExperimentalFeatureEnabled(feature: YogaExperimentalFeature): boolean; + setExperimentalFeatureEnabled( + feature: YogaExperimentalFeature, + enabled: boolean, + ): void; + setPointScaleFactor(factor: number): void; +} + +interface NodeStatic { + create(): YogaNode; + createDefault(): YogaNode; + createWithConfig(config: YogaConfig): YogaNode; + destroy(node: YogaNode): any; +} + +export const Node: NodeStatic; + +interface ConfigStatic { + create(): YogaConfig; + destroy(config: YogaConfig): any; +} + +export const Config: ConfigStatic; + +interface YogaStatic extends ConstantsStatic { + Node: typeof Node; + Config: typeof Config; + Layout: typeof Layout; + Size: typeof Size; + Value: typeof Value; + getInstanceCount(): number; +} + +declare const Yoga: YogaStatic; + +export default Yoga; diff --git a/types/yoga-layout/tsconfig.json b/types/yoga-layout/tsconfig.json new file mode 100644 index 0000000000..d7224a2b00 --- /dev/null +++ b/types/yoga-layout/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "strictFunctionTypes": true, + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "yoga-layout-tests.ts" + ] +} diff --git a/types/yoga-layout/tslint.json b/types/yoga-layout/tslint.json new file mode 100644 index 0000000000..369f49adf2 --- /dev/null +++ b/types/yoga-layout/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "file-name-casing": false + } +} diff --git a/types/yoga-layout/yoga-layout-tests.ts b/types/yoga-layout/yoga-layout-tests.ts new file mode 100644 index 0000000000..c2effbef23 --- /dev/null +++ b/types/yoga-layout/yoga-layout-tests.ts @@ -0,0 +1,24 @@ +import yoga, { Node, Config, Size, Value, DISPLAY_FLEX } from 'yoga-layout'; + +const cfg = Config.create(); + +cfg.isExperimentalFeatureEnabled(yoga.EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS); + +const root = Node.createWithConfig(cfg); +root.setWidth(500); +root.setHeight(300); +root.setJustifyContent(yoga.JUSTIFY_CENTER); + +const node1 = yoga.Node.create(); +node1.setWidth(100); +node1.setHeight(100); +node1.setDisplay(DISPLAY_FLEX); + +const node2 = Node.create(); +node2.setWidth(100); +node2.setHeight(100); + +root.insertChild(node1, 0); +root.insertChild(node2, 1); + +root.calculateLayout(500, 300, yoga.DIRECTION_LTR); From 2fa8371b3c01ebf25aaf0a39dc6118a909f58110 Mon Sep 17 00:00:00 2001 From: bill-improbableio Date: Mon, 23 Jul 2018 18:17:58 +0100 Subject: [PATCH 215/738] react-redux: Fix permissive decoration props not handled correctly (#27260) * Bump ts version to fix failing tests * Fix optional props not merged correctly * Bump version * Correct the fix * Add test for more-general injected props --- types/react-redux/index.d.ts | 10 +- types/react-redux/react-redux-tests.tsx | 126 ++++++++++++++++++++++++ 2 files changed, 131 insertions(+), 5 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index e33de8c1a7..25b3ae2668 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-redux 6.0.3 +// Type definitions for react-redux 6.0.4 // Project: https://github.com/reduxjs/react-redux // Definitions by: Qubo , // Thomas Hasner , @@ -55,18 +55,18 @@ interface AdvancedComponentDecorator { /** * a property P will be present if : * - it is present in both DecorationTargetProps and InjectedProps - * - DecorationTargetProps[P] extends InjectedProps[P] + * - InjectedProps[P] can satisfy DecorationTargetProps[P] * ie: decorated component can accept more types than decorator is injecting * - * For decoration, inject props or ownProps are all optionnaly + * For decoration, inject props or ownProps are all optionally * required by the decorated (right hand side) component. - * But any property required by the decorated component must extend the injected property + * But any property required by the decorated component must be satisfied by the injected property. */ type Shared< InjectedProps, DecorationTargetProps extends Shared > = { - [P in Extract]?: DecorationTargetProps[P] extends InjectedProps[P] ? InjectedProps[P] : never; + [P in Extract]?: InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : never; }; // Injects props and removes them from the prop requirements. diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index eab234d5c4..f446df9a1e 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -1001,3 +1001,129 @@ namespace ProviderAcceptsStoreWithCustomAction { ); } + +namespace TestOptionalPropsMergedCorrectly { + interface OptionalDecorationProps { + foo: string, + bar: number, + optionalProp?: boolean, + dependsOnDispatch?: () => void, + } + + class Component extends React.Component { + render () { + return
; + } + } + + type MapStateProps = { + foo: string, + bar: number, + optionalProp: boolean, + } + + type MapDispatchProps = { + dependsOnDispatch: () => void + } + + function mapStateToProps (state: any): MapStateProps { + return { + foo: 'foo', + bar: 42, + optionalProp: true, + }; + } + + function mapDispatchToProps (dispatch: any): MapDispatchProps { + return { + dependsOnDispatch: () => {} + }; + } + + connect(mapStateToProps, mapDispatchToProps)(Component) +} + +namespace TestMoreGeneralDecorationProps { + // connect() should support decoration props that are more permissive + // than the injected props, as long as the injected props can satisfy + // the decoration props. + interface MoreGeneralDecorationProps { + foo: string | number, + bar: number | 'foo', + optionalProp?: boolean | Object, + dependsOnDispatch?: () => void, + } + + class Component extends React.Component { + render () { + return
; + } + } + + type MapStateProps = { + foo: string, + bar: number, + optionalProp: boolean, + } + + type MapDispatchProps = { + dependsOnDispatch: () => void + } + + function mapStateToProps (state: any): MapStateProps { + return { + foo: 'foo', + bar: 42, + optionalProp: true, + }; + } + + function mapDispatchToProps (dispatch: any): MapDispatchProps { + return { + dependsOnDispatch: () => {} + }; + } + + connect(mapStateToProps, mapDispatchToProps)(Component) +} + +namespace TestFailsMoreSpecificInjectedProps { + interface MoreSpecificDecorationProps { + foo: string, + bar: number, + dependsOnDispatch: () => void, + } + + class Component extends React.Component { + render () { + return
; + } + } + + type MapStateProps = { + foo: string | number, + bar: number | 'foo', + dependsOnDispatch?: () => void, + } + + type MapDispatchProps = { + dependsOnDispatch?: () => void + } + + function mapStateToProps (state: any): MapStateProps { + return { + foo: 'foo', + bar: 42, + }; + } + + function mapDispatchToProps (dispatch: any): MapDispatchProps { + return { + dependsOnDispatch: () => {} + }; + } + + // Since it is possible the injected props could fail to satisfy the decoration props, + // the following line should fail to compile. + connect(mapStateToProps, mapDispatchToProps)(Component) // $ExpectError +} \ No newline at end of file From f73ffb216e4534f204197bbd19c009b9ace97cc8 Mon Sep 17 00:00:00 2001 From: RCGuillaume Date: Mon, 23 Jul 2018 13:19:24 -0400 Subject: [PATCH 216/738] @types/react-select: missing parameter 'index' to ValueRendererHandler (#27265) * @types/react-select: added missing parameter 'index' to ValueRendererHandler * @types/react-select: increment version --- types/react-select/index.d.ts | 5 +++-- types/react-select/react-select-tests.tsx | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index ed8326c26b..bde3c3c6a0 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-select 1.2 +// Type definitions for react-select 1.3 // Project: https://github.com/JedWatson/react-select // Definitions by: ESQUIBET Hugo // Gilad Gray @@ -13,6 +13,7 @@ // David Schkalee // Arthur Udalov // Sebastian Silbermann +// Guillaume Chartier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -49,7 +50,7 @@ export type OnOpenHandler = () => void; export type OnFocusHandler = React.FocusEventHandler; export type OnBlurHandler = React.FocusEventHandler; export type OptionRendererHandler = (option: Option) => HandlerRendererResult; -export type ValueRendererHandler = (option: Option) => HandlerRendererResult; +export type ValueRendererHandler = (option: Option, index?: number) => HandlerRendererResult; export type OnValueClickHandler = (option: Option, event: React.MouseEvent) => void; export type IsOptionUniqueHandler = (arg: { option: Option, options: Options, labelKey: string, valueKey: string }) => boolean; export type IsValidNewOptionHandler = (arg: { label: string }) => boolean; diff --git a/types/react-select/react-select-tests.tsx b/types/react-select/react-select-tests.tsx index a6b450f513..7afe6d0023 100644 --- a/types/react-select/react-select-tests.tsx +++ b/types/react-select/react-select-tests.tsx @@ -430,6 +430,15 @@ describe("Examples", () => { />; }); + it("Value render with custom value option and index", () => { + const valueRenderer = (option: ReactSelectModule.Option, index: number): ReactSelectModule.HandlerRendererResult => + null; + + ; + }); + it("No Results renderer with string", () => { ; }); From 93016410a96b3e0ab058c188ac4bce97f7a9115a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Serrano=20Ar=C3=A9valo?= Date: Mon, 23 Jul 2018 20:20:20 +0300 Subject: [PATCH 217/738] =?UTF-8?q?Gestalt:=20A=20set=20of=20React=20UI=20?= =?UTF-8?q?components=20that=20supports=20Pinterest=E2=80=99s=20design=20l?= =?UTF-8?q?anguage=20=20(#27279)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Avatar Props Interface : * Box Props Interface * Button Props Interface * Card Props Interface * Nicked the types, Column Props Interface * Container Interface Props * GroupAvatar interface * Finished * Linted and fixed: * 2.6 * Added Project Github URL --- types/gestalt/gestalt-tests.tsx | 28 + types/gestalt/index.d.ts | 1642 +++++++++++++++++++++++++++++++ types/gestalt/tsconfig.json | 17 + types/gestalt/tslint.json | 1 + 4 files changed, 1688 insertions(+) create mode 100644 types/gestalt/gestalt-tests.tsx create mode 100644 types/gestalt/index.d.ts create mode 100644 types/gestalt/tsconfig.json create mode 100644 types/gestalt/tslint.json diff --git a/types/gestalt/gestalt-tests.tsx b/types/gestalt/gestalt-tests.tsx new file mode 100644 index 0000000000..6445062d1a --- /dev/null +++ b/types/gestalt/gestalt-tests.tsx @@ -0,0 +1,28 @@ +import * as React from "react"; +import { + Avatar, + Box, + Button, + Card, + Checkbox, + Column, + Container, + GroupAvatar, + Icon, + IconButton +} from "gestalt"; + +; +; +