diff --git a/auth0-js/auth0-js.d.ts b/auth0-js/auth0-js.d.ts
index 1ee4ab9d7c..515d52af7e 100644
--- a/auth0-js/auth0-js.d.ts
+++ b/auth0-js/auth0-js.d.ts
@@ -127,6 +127,6 @@ interface Auth0DelegationToken {
declare var Auth0: Auth0Static;
-declare module "auth0" {
+declare module "auth0-js" {
export = Auth0
}
diff --git a/blessed/blessed-tests.ts b/blessed/blessed-tests.ts
new file mode 100644
index 0000000000..4e7f7002e6
--- /dev/null
+++ b/blessed/blessed-tests.ts
@@ -0,0 +1,773 @@
+///
+
+import * as blessed from 'blessed';
+
+let screen: blessed.Widgets.Screen = null;
+
+// https://github.com/chjj/blessed/blob/master/test/widget-autopad.js
+
+screen = blessed.screen({
+ dump: __dirname + '/logs/autopad.log',
+ smartCSR: true,
+ autoPadding: true,
+ warnings: true
+});
+
+var box1 = blessed.box({
+ parent: screen,
+ top: 'center',
+ left: 'center',
+ width: 20,
+ height: 10,
+ border: 'line'
+});
+
+var box2 = blessed.box({
+ parent: box1,
+ top: 0,
+ left: 0,
+ width: 10,
+ height: 5,
+ border: 'line'
+});
+
+screen.key('q', function() {
+ return screen.destroy();
+});
+
+screen.render();
+
+// https://github.com/chjj/blessed/blob/master/test/widget-bigtext.js
+
+screen = blessed.screen({
+ dump: __dirname + '/logs/bigtext.log',
+ smartCSR: true,
+ warnings: true
+});
+
+var box = blessed.bigtext({
+ parent: screen,
+ content: 'Hello',
+ shrink: true,
+ width: '80%',
+ // height: '80%',
+ height: 'shrink',
+ // width: 'shrink',
+ border: 'line',
+ fch: ' ',
+ ch: '\u2592',
+ style: {
+ fg: 'red',
+ bg: 'blue',
+ bold: false
+ }
+});
+
+screen.key('q', function() {
+ return screen.destroy();
+});
+
+screen.render();
+
+// https://github.com/chjj/blessed/blob/master/test/widget-csr.js
+
+screen = blessed.screen({
+ dump: __dirname + '/logs/csr.log',
+ smartCSR: true,
+ warnings: true
+});
+
+var lorem = require('fs').readFileSync(__dirname + '/git.diff', 'utf8');
+
+var cleanSides = screen.cleanSides;
+function expectClean(value: any) {
+ screen.cleanSides = function(el: blessed.widget.Element) {
+ var ret = cleanSides.apply(this, arguments);
+ if (ret !== value) {
+ throw new Error('Failed. Expected '
+ + value + ' from cleanSides. Got '
+ + ret + '.');
+ }
+ return ret;
+ };
+}
+var btext = blessed.box({
+ parent: screen,
+ left: 'center',
+ top: 'center',
+ width: '80%',
+ height: '80%',
+ style: {
+ bg: 'green'
+ },
+ border: 'line',
+ content: 'CSR should still work.'
+});
+let _oscroll = btext.scroll;
+btext.scroll = function(offset, always) {
+ expectClean(true);
+ return _oscroll(offset, always);
+};
+
+var text = blessed.scrollabletext({
+ parent: screen,
+ content: lorem,
+ border: 'line',
+ left: 'center',
+ top: 'center',
+ draggable: true,
+ width: '50%',
+ height: '50%',
+ mouse: true,
+ keys: true,
+ vi: true
+});
+
+_oscroll = text.scroll;
+text.scroll = function(offset, always) {
+ var el = this;
+ var value = true;
+ if (el.left < 0) value = true;
+ if (el.top < 0) value = false;
+ if (el.left + el.width > screen.width) value = true;
+ if (el.top + el.height > screen.height) value = false;
+ expectClean(value);
+ return _oscroll(offset, always);
+};
+
+text.focus();
+
+screen.key('q', function() {
+ return screen.destroy();
+});
+
+screen.render();
+
+// https://github.com/chjj/blessed/blob/master/test/widget-dock-noborder.js
+
+screen = blessed.screen({
+ dump: __dirname + '/logs/dock.log',
+ smartCSR: true,
+ dockBorders: true,
+ warnings: true
+});
+
+blessed.box({
+ parent: screen,
+ left: -1,
+ top: -1,
+ width: '50%+1',
+ height: '50%+1',
+ border: 'line',
+ content: 'Foo'
+});
+
+blessed.box({
+ parent: screen,
+ left: '50%-1',
+ top: -1,
+ width: '50%+3',
+ height: '50%+1',
+ content: 'Bar',
+ border: 'line'
+});
+
+blessed.box({
+ parent: screen,
+ left: -1,
+ top: '50%-1',
+ width: '50%+1',
+ height: '50%+3',
+ border: 'line',
+ content: 'Foo'
+});
+
+blessed.listtable({
+ parent: screen,
+ left: '50%-1',
+ top: '50%-1',
+ width: '50%+3',
+ height: '50%+3',
+ border: 'line',
+ align: 'center',
+ tags: true,
+ keys: true,
+ vi: true,
+ mouse: true,
+ style: {
+ header: {
+ fg: 'blue',
+ bold: true
+ },
+ cell: {
+ fg: 'magenta',
+ selected: {
+ bg: 'blue'
+ }
+ }
+ },
+ data: [
+ [ 'Animals', 'Foods', 'Times', 'Numbers' ],
+ [ 'Elephant', 'Apple', '1:00am', 'One' ],
+ [ 'Bird', 'Orange', '2:15pm', 'Two' ],
+ [ 'T-Rex', 'Taco', '8:45am', 'Three' ],
+ [ 'Mouse', 'Cheese', '9:05am', 'Four' ]
+ ]
+}).focus();
+
+screen.key('q', function() {
+ return screen.destroy();
+});
+
+screen.render();
+
+// https://raw.githubusercontent.com/chjj/blessed/master/example/simple-form.js
+
+var form = blessed.form({
+ parent: screen,
+ keys: true,
+ left: 0,
+ top: 0,
+ width: 30,
+ height: 4,
+ bg: 'green',
+ content: 'Submit or cancel?'
+});
+
+var submit = blessed.button({
+ parent: form,
+ mouse: true,
+ keys: true,
+ padding: {
+ left: 1,
+ right: 1
+ },
+ left: 10,
+ top: 2,
+ shrink: true,
+ name: 'submit',
+ content: 'submit',
+ style: {
+ bg: 'blue',
+ focus: {
+ bg: 'red'
+ },
+ hover: {
+ bg: 'red'
+ }
+ }
+});
+
+var cancel = blessed.button({
+ parent: form,
+ mouse: true,
+ keys: true,
+ padding: {
+ left: 1,
+ right: 1
+ },
+ left: 20,
+ top: 2,
+ shrink: true,
+ name: 'cancel',
+ content: 'cancel',
+ style: {
+ bg: 'blue',
+ focus: {
+ bg: 'red'
+ },
+ hover: {
+ bg: 'red'
+ }
+ }
+});
+
+// https://github.com/chjj/blessed/blob/master/test/widget-layout.js
+
+screen = blessed.screen({
+ dump: __dirname + '/logs/layout.log',
+ smartCSR: true,
+ autoPadding: true,
+ warnings: true
+});
+
+var layout = blessed.layout({
+ parent: screen,
+ top: 'center',
+ left: 'center',
+ width: '50%',
+ height: '50%',
+ border: 'line',
+ layout: process.argv[2] === 'grid' ? 'grid' : 'inline',
+ style: {
+ bg: 'red',
+ border: {
+ fg: 'blue'
+ }
+ }
+});
+
+var box1 = blessed.box({
+ parent: layout,
+ top: 'center',
+ left: 'center',
+ width: 20,
+ height: 10,
+ border: 'line',
+ content: '1'
+});
+
+var box2 = blessed.box({
+ parent: layout,
+ top: 0,
+ left: 0,
+ width: 10,
+ height: 5,
+ border: 'line',
+ content: '2'
+});
+
+var box3 = blessed.box({
+ parent: layout,
+ top: 0,
+ left: 0,
+ width: 10,
+ height: 5,
+ border: 'line',
+ content: '3'
+});
+
+var box4 = blessed.box({
+ parent: layout,
+ top: 0,
+ left: 0,
+ width: 10,
+ height: 5,
+ border: 'line',
+ content: '4'
+});
+
+var box5 = blessed.box({
+ parent: layout,
+ top: 0,
+ left: 0,
+ width: 10,
+ height: 5,
+ border: 'line',
+ content: '5'
+});
+
+var box6 = blessed.box({
+ parent: layout,
+ top: 0,
+ left: 0,
+ width: 10,
+ height: 5,
+ border: 'line',
+ content: '6'
+});
+
+var box7 = blessed.box({
+ parent: layout,
+ top: 0,
+ left: 0,
+ width: 10,
+ height: 5,
+ border: 'line',
+ content: '7'
+});
+
+var box8 = blessed.box({
+ parent: layout,
+ top: 'center',
+ left: 'center',
+ width: 20,
+ height: 10,
+ border: 'line',
+ content: '8'
+});
+
+var box9 = blessed.box({
+ parent: layout,
+ top: 0,
+ left: 0,
+ width: 10,
+ height: 5,
+ border: 'line',
+ content: '9'
+});
+
+var box10 = blessed.box({
+ parent: layout,
+ top: 'center',
+ left: 'center',
+ width: 20,
+ height: 10,
+ border: 'line',
+ content: '10'
+});
+
+var box11 = blessed.box({
+ parent: layout,
+ top: 0,
+ left: 0,
+ width: 10,
+ height: 5,
+ border: 'line',
+ content: '11'
+});
+
+var box12 = blessed.box({
+ parent: layout,
+ top: 'center',
+ left: 'center',
+ width: 20,
+ height: 10,
+ border: 'line',
+ content: '12'
+});
+
+if (process.argv[2] !== 'grid') {
+ for (var i = 0; i < 10; i++) {
+ blessed.box({
+ parent: layout,
+ // width: i % 2 === 0 ? 10 : 20,
+ // height: i % 2 === 0 ? 5 : 10,
+ width: Math.random() > 0.5 ? 10 : 20,
+ height: Math.random() > 0.5 ? 5 : 10,
+ border: 'line',
+ content: (i + 1 + 12) + ''
+ });
+ }
+}
+
+screen.key('q', function() {
+ return screen.destroy();
+});
+
+screen.render();
+
+// https://github.com/chjj/blessed/blob/master/test/widget-form.js
+
+screen = blessed.screen({
+ dump: __dirname + '/logs/form.log',
+ warnings: true
+});
+
+type FormData = {
+ radio1: boolean;
+ radio2: boolean;
+ text: string;
+ check: boolean;
+};
+
+var form2 = blessed.form({
+ parent: screen,
+ mouse: true,
+ keys: true,
+ vi: true,
+ left: 0,
+ top: 0,
+ width: '100%',
+ //height: 12,
+ style: {
+ bg: 'green',
+ border: {
+ inverse: true
+ },
+ scrollbar: {
+ inverse: true
+ }
+ },
+ content: 'foobar',
+ scrollable: true,
+ scrollbar: {
+ ch: ' '
+ }
+ //alwaysScroll: true
+});
+
+form2.on('submit', (data) => {
+ output.setContent(JSON.stringify(data, null, 2));
+ screen.render();
+});
+
+form2.key('d', function() {
+ form2.scroll(1, true);
+ screen.render();
+});
+
+form2.key('u', function() {
+ form2.scroll(-1, true);
+ screen.render();
+});
+
+var set = blessed.radioset({
+ parent: form2,
+ left: 1,
+ top: 1,
+ shrink: true,
+ //padding: 1,
+ //content: 'f',
+ style: {
+ bg: 'magenta'
+ }
+});
+
+var radio1 = blessed.radiobutton({
+ parent: set,
+ mouse: true,
+ keys: true,
+ shrink: true,
+ style: {
+ bg: 'magenta'
+ },
+ height: 1,
+ left: 0,
+ top: 0,
+ name: 'radio1',
+ content: 'radio1'
+});
+
+var radio2 = blessed.radiobutton({
+ parent: set,
+ mouse: true,
+ keys: true,
+ shrink: true,
+ style: {
+ bg: 'magenta'
+ },
+ height: 1,
+ left: 15,
+ top: 0,
+ name: 'radio2',
+ content: 'radio2'
+});
+
+var text2 = blessed.textbox({
+ parent: form2,
+ mouse: true,
+ keys: true,
+ style: {
+ bg: 'blue'
+ },
+ height: 1,
+ width: 20,
+ left: 1,
+ top: 3,
+ name: 'text'
+});
+
+text2.on('focus', function() {
+ text2.readInput();
+});
+
+var check = blessed.checkbox({
+ parent: form2,
+ mouse: true,
+ keys: true,
+ shrink: true,
+ style: {
+ bg: 'magenta'
+ },
+ height: 1,
+ left: 28,
+ top: 1,
+ name: 'check',
+ content: 'check'
+});
+
+var check2 = blessed.checkbox({
+ parent: form2,
+ mouse: true,
+ keys: true,
+ shrink: true,
+ style: {
+ bg: 'magenta'
+ },
+ height: 1,
+ left: 28,
+ top: 14,
+ name: 'foooooooo2',
+ content: 'foooooooo2'
+});
+
+var submit = blessed.button({
+ parent: form2,
+ mouse: true,
+ keys: true,
+ shrink: true,
+ padding: {
+ left: 1,
+ right: 1
+ },
+ left: 29,
+ top: 3,
+ name: 'submit',
+ content: 'submit',
+ style: {
+ bg: 'blue',
+ focus: {
+ bg: 'red'
+ }
+ }
+});
+
+submit.on('press', function() {
+ form2.submit();
+});
+
+var box1 = blessed.box({
+ parent: form2,
+ left: 1,
+ top: 10,
+ height: 10,
+ width: 10,
+ content: 'one',
+ style: {
+ bg: 'cyan'
+ }
+});
+
+var box2 = blessed.box({
+ parent: box1,
+ left: 1,
+ top: 2,
+ height: 8,
+ width: 9,
+ content: 'two',
+ style: {
+ bg: 'magenta'
+ }
+});
+
+var box3 = blessed.box({
+ parent: box2,
+ left: 1,
+ top: 2,
+ height: 6,
+ width: 8,
+ content: 'three',
+ style: {
+ bg: 'yellow'
+ }
+});
+
+var box4 = blessed.box({
+ parent: box3,
+ left: 1,
+ top: 2,
+ height: 4,
+ width: 7,
+ content: 'four',
+ style: {
+ bg: 'blue'
+ }
+});
+
+var output = blessed.scrollabletext({
+ parent: form2,
+ mouse: true,
+ keys: true,
+ left: 0,
+ top: 20,
+ height: 5,
+ right: 0,
+ style: {
+ bg: 'red'
+ },
+ content: 'foobar'
+});
+
+var bottom = blessed.line({
+ parent: form2,
+ type: 'line',
+ orientation: 'horizontal',
+ left: 0,
+ right: 0,
+ top: 50,
+ style: {
+ fg: 'blue'
+ }
+});
+
+screen.key('q', function() {
+ return screen.destroy();
+});
+
+form2.focus();
+
+form2.submit();
+
+screen.render();
+
+// https://github.com/chjj/blessed/blob/master/test/widget-table.js
+
+screen = blessed.screen({
+ dump: __dirname + '/logs/table.log',
+ autoPadding: false,
+ fullUnicode: true,
+ warnings: true
+});
+
+var DU = '杜';
+var JUAN = '鹃';
+
+var table = blessed.table({
+ //parent: screen,
+ top: 'center',
+ left: 'center',
+ data: null,
+ border: 'line',
+ align: 'center',
+ tags: true,
+ //width: '80%',
+ width: 'shrink',
+ style: {
+ border: {
+ fg: 'red'
+ },
+ header: {
+ fg: 'blue',
+ bold: true
+ },
+ cell: {
+ fg: 'magenta'
+ }
+ }
+});
+
+var data1 = [
+ [ 'Animals', 'Foods', 'Times' ],
+ [ 'Elephant', 'Apple', '1:00am' ],
+ [ 'Bird', 'Orange', '2:15pm' ],
+ [ 'T-Rex', 'Taco', '8:45am' ],
+ [ 'Mouse', 'Cheese', '9:05am' ]
+];
+
+data1[1][0] = '{red-fg}' + data1[1][0] + '{/red-fg}';
+data1[2][0] += ' (' + DU + JUAN + ')';
+
+var data2 = [
+ [ 'Animals', 'Foods', 'Times', 'Numbers' ],
+ [ 'Elephant', 'Apple', '1:00am', 'One' ],
+ [ 'Bird', 'Orange', '2:15pm', 'Two' ],
+ [ 'T-Rex', 'Taco', '8:45am', 'Three' ],
+ [ 'Mouse', 'Cheese', '9:05am', 'Four' ]
+];
+
+data2[1][0] = '{red-fg}' + data2[1][0] + '{/red-fg}';
+data2[2][0] += ' (' + DU + JUAN + ')';
+
+screen.key('q', function() {
+ return screen.destroy();
+});
+
+table.setData(data2);
+screen.append(table);
+screen.render();
+
+setTimeout(function() {
+ table.setData(data1);
+ screen.render();
+}, 3000);
diff --git a/blessed/blessed.d.ts b/blessed/blessed.d.ts
index 6746afe5f5..cb9bd393ed 100644
--- a/blessed/blessed.d.ts
+++ b/blessed/blessed.d.ts
@@ -1,1256 +1,155 @@
-// Type definitions for blessed 0.1.5
+// Type definitions for blessed 0.1.81
// Project: https://github.com/chjj/blessed
-// Definitions by: bryn austin bellomy
+// Definitions by: bryn austin bellomy , Diullei Gomes
// Definitions: https://github.com/borisyankov/DefinitelyTyped
-///
+///
-declare module "blessed"
-{
- import events = require('events');
- import buffer = require('buffer');
- import child_process = require('child_process');
+declare module "blessed" {
+ import {EventEmitter} from 'events';
+ import * as stream from "stream"
+ import * as child_process from "child_process";
- module Blessed
- {
- export var colors: Colors;
+ export class BlessedProgram {
+ hideCursor: () => void;
+ move: any;
+ showCursor: any;
+ }
- export interface GenericCallback {
- (...args:any[]): void;
+ export module Widgets {
+
+ export module Types {
+
+ export type TTopLeft = string | number | "center";
+
+ export type TPosition = string | number;
+
+ export type TMouseAction = "mousedown" | "mouseup" | "mousemove";
+
+ export type TStyle = {
+ type?: string;
+ bg?: string;
+ fg?: string;
+ ch?: string;
+ bold?: boolean;
+ underline?: boolean;
+ blink?: boolean;
+ inverse?: boolean;
+ invisible?: boolean;
+ transparent?: boolean;
+ border?: "line" | "bg" | TBorder;
+ hover?: boolean;
+ focus?: boolean;
+ label?: string;
+ track?: {bg?: string; fg?: string;};
+ scrollbar?: {bg?: string; fg?: string;};
+ }
+
+ export type TBorder = {
+ /**
+ * Type of border (line or bg). bg by default.
+ */
+ type?: "line" | "bg";
+ /**
+ * Character to use if bg type, default is space.
+ */
+ ch?: string;
+ /**
+ * Border foreground and background, must be numbers (-1 for default).
+ */
+ bg?: number;
+ fg?: number;
+ /**
+ * Border attributes.
+ */
+ bold?: string;
+ underline?: string;
+ }
+
+ export type TCursor = {
+ /**
+ * Have blessed draw a custom cursor and hide the terminal cursor (experimental).
+ */
+ artificial: boolean;
+ /**
+ * Shape of the cursor. Can be: block, underline, or line.
+ */
+ shape: boolean;
+ /**
+ * Whether the cursor blinks.
+ */
+ blink: boolean;
+ /**
+ * Color of the color. Accepts any valid color value (null is default).
+ */
+ color: string;
+ }
+
+ export type TAlign = "left" | "center" | "right";
+
+ export type ListbarCommand = {
+ key: string;
+ callback: () => void;
+ };
+
+ export type TImage = {
+ /**
+ * Pixel width.
+ */
+ width: number;
+ /**
+ * Pixel height.
+ */
+ height: number;
+ /**
+ * Image bitmap.
+ * */
+ bmp: any;
+ /**
+ * Image cellmap (bitmap scaled down to cell size).
+ */
+ cellmap: any;
+ };
+
+ export type Cursor = {
+ /**
+ * Have blessed draw a custom cursor and hide the terminal cursor (experimental).
+ */
+ artificial: boolean;
+ /**
+ * Shape of the cursor. Can be: block, underline, or line.
+ */
+ shape: boolean;
+ /**
+ * Whether the cursor blinks.
+ */
+ blink: boolean;
+ /**
+ * Color of the color. Accepts any valid color value (null is default).
+ */
+ color: string;
+ }
}
- export interface ColorPair {
- /** background, must be number (-1 for default). */
- bg?: number;
- /** foreground, must be number (-1 for default). */
- fg?: number;
- }
-
- export interface Style extends ColorPair {
- bold?: boolean;
- underline?: boolean;
- border: Border;
- hover: ColorPair;
- }
-
- export interface Border extends ColorPair {
- /** type of border ('line' or 'bg'). */
- type?: string; //'line'|'bg';
- /** character to use if bg type, default is space. */
- ch?: string;
- }
-
- export interface Padding {
- top?:number;
- right?:number;
- bottom?:number;
- left?:number;
- }
-
- export interface Position {
- /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
- top?:number|string;
- /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
- right?:number|string;
- /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
- bottom?:number|string;
- /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
- left?:number|string;
- /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
- width?:number|string;
- /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
- height?:number|string;
- }
-
- export interface KeyCode {
- name: string;
- ctrl: boolean;
- meta: boolean;
- shift: boolean;
- sequence: string;
- full: string;
- }
-
- export class Program
- {
- /**
- Wrap the given text in terminal formatting codes corresponding to the given attribute
- name. The `attr` string can be of the form `red fg` or `52 bg` where `52` is a 0-255
- integer color number.
- */
- text (text:string, attr:string): string;
- }
-
- export interface Colors {
- /** Either pass a hex string, an array of 3 numbers, or three separate numbers representing an RGB value. This returns the 0-255 color number for that color. */
- match (r:string|number[]|number, g?:number, b?:number): number;
-
- /** An array of the 255 colors as hex strings. */
- colors: string[];
- }
-
- export interface NodeOptions
- {
- screen?: Screen;
- parent?: Node;
- children?: Node[];
- }
-
- export class Node extends events.EventEmitter
- {
- constructor(options?:NodeOptions);
-
- type : string;
- options : NodeOptions;
- parent : Node;
- screen : Screen;
- children : Node[];
- data : any;
- _ : any;
- $ : any;
- index : number;
-
- // on(event:string, callback:() => void);
- // on(event:'adopt', callback:() => void);
- // on(event:'remove', callback:() => void);
- // on(event:'reparent', callback:() => void);
- // on(event:'attach', callback:() => void);
- // on(event:'detach', callback:() => void);
-
- prepend(node:Node): void;
- append(node:Node): void;
- remove(node:Node): void;
- insert(node:Node, index:number): void;
- insertBefore(node:Node, refNode:Node): void;
- insertAfter(node:Node, refNode:Node): void;
- detach(): void;
- // emitDescendants(): void;
- // get(key:string): any;
- // get(key:string, default:any): any;
- // set(key:string, value:any): void;
- }
-
- export interface ScreenOptions extends NodeOptions
- {
- /** the blessed Program to be associated with. will be automatically instantiated if none is provided. */
- program?: any;
- /** attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with uniform cells to their sides). this is known to cause flickering with elements that are not full-width, however, it is more optimal for terminal rendering. */
- smartCSR?: boolean;
- /** do CSR on any element within 20 cols of the screen edge on either side. faster than smartCSR, but may cause flickering depending on what is on each side of the element. */
- fastCSR?: boolean;
- /** attempt to perform back_color_erase optimizations for terminals that support it. it will also work with terminals that don't support it, but only on lines with the default background color. as it stands with the current implementation, it's uncertain how much terminal performance this adds at the cost of overhead within node. */
- useBCE?: boolean;
- /** amount of time (in ms) to redraw the screen after the terminal is resized (default: 300). */
- resizeTimeout?: number;
- /** the width of tabs within an element's content. */
- tabSize?: number;
- /** automatically position child elements with border and padding in mind. */
- autoPadding?: boolean;
- /** the name of the logfile to use. if specified but the file does not exist, it will be created. see log method. */
- log?: string;
- /** dump all output and input to desired file. can be used together with log option if set as a boolean. */
- dump?: any;
- /** debug mode. enables usage of the `debug` method. also creates a debug console which will display when pressing F12. it will display all log and debug messages. */
- debug?: boolean;
- /** Array of keys in their full format (e.g. C-c) to ignore when keys are locked. Useful for creating a key that will always exit no matter whether the keys are locked. */
- ignoreLocked?: string[];
-
- /** Do not clear the screen, only scroll down enough to make room for the elements on the screen. do not use the alternate screenbuffer. useful for writing a CLI tool or some kind of prompt (experimental - see test/widget-noalt.js) */
- noAlt?: boolean;
-
- /** Options for the cursor. */
- cursor?: CursorOptions;
- }
-
- export interface CursorOptions {
- /** have blessed draw a custom cursor and hide the terminal cursor (experimental). */
- artificial?: boolean;
- /** shape of the artificial cursor. can be: block, underline, or line. */
- shape?: string; //'block'|'underline'|'line';
- /** whether the artificial cursor blinks. */
- blink?: boolean;
- /** color of the artificial cursor. accepts any valid color value (null is default). */
- color?: string;
- }
-
- export interface ScreenEventCallback {
- (character:string, keyCode:KeyCode): void;
- }
-
- export class Screen extends Node
- {
- constructor(options?:ScreenOptions);
-
- /** the blessed Program object. */
- program: any;
- /** the blessed Tput object (only available if you passed tput: true to the Program constructor.) */
- tput: any;
- /** top of the focus history stack. */
- focused: any;
- /** width of the screen (same as program.cols). */
- width: number;
- /** height of the screen (same as program.rows). */
- height: number;
- /** same as screen.width. */
- cols: number;
- /** same as screen.height. */
- rows: number;
-
- /** calculated relative left offset. */
- left: number;
- /** calculated relative right offset. */
- right: number;
- /** calculated relative top offset. */
- top: number;
- /** calculated relative bottom offset. */
- bottom: number;
- /** calculated absolute left offset. */
- aleft: number;
- /** calculated absolute right offset. */
- aright: number;
- /** calculated absolute top offset. */
- atop: number;
- /** calculated absolute bottom offset. */
- abottom: number;
-
-
- /** whether the focused element grabs all keypresses. */
- grabKeys: boolean;
- /** prevent keypresses from being received by any element. */
- lockKeys: boolean;
- /** the currently hovered element. only set if mouse events are bound. */
- hover: Element;
- /** set or get window title. */
- title: string;
-
- /** write string to the log file if one was created. */
- log(...msg:any[]): void;
- /** same as the log method, but only gets called if the debug option was set. */
- debug(...msg:string[]): void;
- /** allocate a new pending screen buffer and a new output screen buffer. */
- alloc(): void;
- /** draw the screen based on the contents of the screen buffer. */
- draw(start:number, end:number): void;
- /** render all child elements, writing all data to the screen buffer and drawing the screen. */
- render(): void;
- /** clear any region on the screen. */
- clearRegion(x1:number, x2:number, y1:number, y2:number): void;
- /** fill any region with a character of a certain attribute. */
- fillRegion(attr:number, ch:string, x1:number, x2:number, y1:number, y2:number): void;
- /** focus element by offset of focusable elements. */
- focusOffset(offset:number): void;
- /** focus previous element in the index. */
- focusPrevious(): void;
- /** focus next element in the index. */
- focusNext(): void;
- /** push element on the focus stack (equivalent to screen.focused = el). */
- focusPush(element:Element): void;
- /** pop element off the focus stack. */
- focusPop(): void;
- /** save the focused element. */
- saveFocus(): void;
- /** restore the saved focused element. */
- restoreFocus(): void;
- /** "rewind" focus to the last visible and attached element. */
- rewindFocus(): void;
- /** bind a keypress listener for a specific key. */
- key(keyEvents:string|string[], callback:ScreenEventCallback): void;
- /** bind a keypress listener for a specific key once. */
- onceKey(keyEvents:string|string[], callback:ScreenEventCallback): void;
- /** remove a keypress listener for a specific key. */
- unkey(name:string, listener:ScreenEventCallback): void;
- /** spawn a process in the foreground, return to blessed app after exit. */
- spawn(file:string, args:string[], options:NodeChildProcessExecOptions): child_process.ChildProcess;
- /** spawn a process in the foreground, return to blessed app after exit. executes callback on error or exit. */
- exec(file:string, args:string[], options:NodeChildProcessExecOptions, callback:GenericCallback): child_process.ChildProcess;
- /** read data from text editor. */
- readEditor(options:{}, callback:GenericCallback): void;
- /** set effects based on two events and attributes. */
- setEffects(el:Element, fel:Element, over:string, out:string, effects:Style, temp?:string): void;
- /** insert a line into the screen (using csr: this bypasses the output buffer). */
- insertLine(n:number, y:number, top:number, bottom:number): void;
- /** delete a line from the screen (using csr: this bypasses the output buffer). */
- deleteLine(n:number, y:number, top:number, bottom:number): void;
- /** insert a line at the bottom of the screen. */
- insertBottom(top:number, bottom:number): void;
- /** insert a line at the top of the screen. */
- insertTop(top:number, bottom:number): void;
- /** delete a line at the bottom of the screen. */
- deleteBottom(top:number, bottom:number): void;
- /** delete a line at the top of the screen. */
- deleteTop(top:number, bottom:number): void;
-
- /** enable mouse events for the screen and optionally an element (automatically called when a form of on('mouse') is bound). */
- enableMouse(el?:Element): void;
- /** enable keypress events for the screen and optionally an element (automatically called when a form of on('keypress') is bound). */
- enableKeys(el?:Element): void;
- /** enable key and mouse events. calls bot enableMouse and enableKeys. */
- enableInput(el?:Element): void;
-
- /** attempt to copy text to clipboard using iTerm2's propriety sequence. returns true if successful. */
- copyToClipboard(text:string): boolean;
- /** attempt to change cursor shape. will not work in all terminals (see artificial cursors for a solution to this). returns true if successful. */
- cursorShape(shape:string, blink:boolean): boolean;
- /** attempt to change cursor color. returns true if successful. */
- cursorColor(color: string): boolean;
- /** attempt to reset cursor. returns true if successful. */
- cursorReset(): boolean;
-
- }
-
- export interface ElementOptions extends NodeOptions
- {
- fg?: string;
- bg?: string;
- scrollbar?: ColorPair;
- focus?: Style;
- hover?: Style;
-
- /** border object, see below. */
- border?: Border;
- /** positioning options. */
- position?: Position;
- /** amount of padding on the inside of the element. can be a number or an object containing the properties: left, right, top, and bottom. */
- padding?: number|Padding;
- /** element's text content. */
- content?: string;
- /** element is clickable. */
- clickable?: boolean;
- /** element is focusable and can receive key input. */
- input?: boolean;
- /** element is focused. */
- focused?: boolean;
- /** whether the element is hidden. */
- hidden?: boolean;
- /** a simple text label for the element. */
- label?: string;
- /** a floating text label for the element which appears on mouseover. */
- hoverText?: string;
- /** text alignment: left, center, or right. */
- align?: string;
- /** vertical text alignment: top, middle, or bottom. */
- valign?: string;
- /** shrink/flex/grow to content and child elements. width/height during render. */
- shrink?: any;
- /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
- width?: number|string;
- /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
- height?: number|string;
- /** whether the element is scrollable or not. */
- scrollable?: boolean;
- /** background character (default is whitespace ). */
- ch?: string;
- /** allow the element to be dragged with the mouse. */
- draggable?: boolean;
- }
-
- export class Element extends Node
- {
- constructor(options?:ElementOptions);
-
- /** name of the element. useful for form submission. */
- name: string;
- /** border object. */
- border: Border;
- /** contains attributes (e.g. fg/bg/underline). see above. */
- style: Style;
- /** raw width, height, and offsets. */
- position: Position;
- /** type of border (line or bg). bg by default. */
- type: string; //'line'|'bg';
- /** character to use if bg type, default is space. */
- ch: string;
- /** raw text content. */
- content: string;
- /** whether the element is hidden or not. */
- hidden: boolean;
- /** whether the element is visible or not. */
- visible: boolean;
- /** whether the element is attached to a screen in its ancestry somewhere. */
- detached: boolean;
- /** calculated width. */
- width: number;
- /** calculated height. */
- height: number;
- /** whether the element is draggable. set to true to allow dragging. */
- draggable: boolean;
-
-
-
- /** calculated relative left offset. */
- left: number;
- /** calculated relative right offset. */
- right: number;
- /** calculated relative top offset. */
- top: number;
- /** calculated relative bottom offset. */
- bottom: number;
- /** calculated absolute left offset. */
- aleft: number;
- /** calculated absolute right offset. */
- aright: number;
- /** calculated absolute top offset. */
- atop: number;
- /** calculated absolute bottom offset. */
- abottom: number;
-
-
- /** write content and children to the screen buffer. */
- render(): void;
- /** hide element. */
- hide(): void;
- /** show element. */
- show(): void;
- /** toggle hidden/shown. */
- toggle(): void;
- /** focus element. */
- focus(): void;
- /** bind a keypress listener for a specific key. */
- key(name:string|string[], listener:(character?:any, keyCode?:any) => void): void;
- /** bind a keypress listener for a specific key once. */
- onceKey(name:string, listener:() => void): void;
- /** remove a keypress listener for a specific key. */
- unkey(name:string, listener:() => void): void;
- /** same as el.on('screen', ...) except this will automatically cleanup listeners after the element is detached. */
- onScreenEvent(event:string, listener:(...args:any[]) => void): void;
- /** set the z-index of the element (changes rendering order). */
- setIndex(z:number): void;
- /** put the element in front of its siblings. */
- setFront(): void;
- /** put the element in back of its siblings. */
- setBack(): void;
- /** set the label text for the top-left corner. example options: {text:'foo',side:'left'} */
- setLabel(textOrOptions:string|{}): void;
- /** remove the label completely. */
- removeLabel(): void;
- /** set the hover text for the bottom-right corner. example options: {text:'foo'} */
- setHover(textOrOptions:string|{}): void;
- /** remove the hover label completely. */
- removeHover(): void;
- /** set the content. note: when text is input, it will be stripped of all non-SGR escape codes, tabs will be replaced with 8 spaces, and tags will be replaced with SGR codes (if enabled). */
- setContent(text:string): void;
- /** return content, slightly different from el.content. assume the above formatting. */
- getContent(): void;
- /** similar to setContent, but ignore tags and remove escape codes. */
- setText(text:string): void;
- /** similar to getContent, but return content with tags and escape codes removed. */
- getText(): void;
- /** insert a line into the box's content. */
- insertLine(index:number, lines:string|string[]): void;
- /** delete a line from the box's content. */
- deleteLine(index:number, numLines:number): void;
- /** get a line from the box's content. */
- getLine(index:number): void;
- /** get a line from the box's content from the visible top. */
- getBaseLine(index:number): void;
- /** set a line in the box's content. */
- setLine(index:number, line:string): void;
- /** set a line in the box's content from the visible top. */
- setBaseLine(index:number, line:string): void;
- /** clear a line from the box's content. */
- clearLine(index:number): void;
- /** clear a line from the box's content from the visible top. */
- clearBaseLine(index:number): void;
- /** insert a line at the top of the box. */
- insertTop(lines:string|string[]): void;
- /** insert a line at the bottom of the box. */
- insertBottom(lines:string|string[]): void;
- /** delete a line at the top of the box. */
- deleteTop(): void;
- /** delete a line at the bottom of the box. */
- deleteBottom(): void;
- /** unshift a line onto the top of the content. */
- unshiftLine(lines:string|string[]): void;
- /** shift a line off the top of the content. */
- shiftLine(index:number): void;
- /** push a line onto the bottom of the content. */
- pushLine(lines:string|string[]): void;
- /** pop a line off the bottom of the content. */
- popLine(index:number): void;
- /** an array containing the content lines. */
- getLines(): void;
- /** an array containing the lines as they are displayed on the screen. */
- getScreenLines(): void;
- /** get a string's real length, taking into account tags. */
- textLength(text:string): number;
-
- /** enable dragging of the element. */
- enableDrag(): void;
- /** disable dragging of the element. */
- disableDrag(): void;
- }
-
-
- //
- // Box
- //
-
- export interface BoxOptions extends ElementOptions {
- // intentionally empty
- }
-
- export class Box extends Element {
- constructor(options?:BoxOptions);
- // intentionally empty
- }
-
-
- //
- // ScrollableBox
- //
-
- export interface ScrollableBoxOptions extends BoxOptions {
- /** a limit to the childBase. default is `Infinity`. */
- baseLimit: number;
- /** a option which causes the ignoring of `childOffset`. this in turn causes the childBase to change every time the element is scrolled. */
- alwaysScroll: boolean;
- /** object enabling a scrollbar. */
- scrollbar: ScrollBar;
- }
-
- /** A box with scrollable content. */
- export class ScrollableBox extends Box {
- constructor(options?:ScrollableBoxOptions);
-
- /** the offset of the top of the scroll content. */
- childBase: number;
- /** the offset of the chosen item/line. */
- childOffset: number;
- /** scroll the content by a relative offset. */
- scroll(offset:number): void;
- /** scroll the content to an absolute index. */
- scrollTo(index:number): void;
- /** same as `scrollTo`. */
- setScroll(index:number): void;
- /** set the current scroll index in percentage (0-100). */
- setScrollPerc(perc:number): void;
- /** get the current scroll index in lines. */
- getScroll(): number;
- /** get the actual height of the scrolling area. */
- getScrollHeight(): number;
- /** get the current scroll index in percentage. */
- getScrollPerc(): number;
- /** reset the scroll index to its initial state. */
- resetScroll(): void;
-
- }
-
- export interface ScrollBar {
- /** style of the scrollbar. */
- style: Style;
- /** style of the scrollbar track if present (takes regular style options). */
- track: Style;
- }
-
-
- //
- // ScrollableText
- //
-
- export interface ScrollableTextOptions extends ScrollableBoxOptions {
- /** whether to enable automatic mouse support for this element. */
- mouse: boolean;
- /** use predefined keys for navigating the text. */
- keys: boolean;
- /** use vi keys with the `keys` option. */
- vi: boolean;
- }
-
- /** __DEPRECATED__ - Use Box with the `scrollable` and `alwaysScroll` options instead. A scrollable text box which can display and scroll text, as well as handle pre-existing newlines and escape codes. */
- export class ScrollableText extends ScrollableBox {
- constructor(options?:ScrollableTextOptions);
- }
-
-
-
- //
- // Text
- //
-
- export interface TextOptions extends ElementOptions {
- align?: string; //'left'|'center'|'right';
- }
-
- export class Text extends Element {
- constructor(options?:TextOptions);
- // intentionally empty
- }
-
-
- //
- // Line
- //
-
- export interface LineOptions extends BoxOptions {
- orientation?: string; //'vertical'|'horizontal';
- style?: Style;
- }
-
- export class Line extends Box {
- constructor(options?:LineOptions);
- // intentionally empty
- }
-
-
- //
- // List
- //
-
- export interface ListStyle extends Style {
- selected?: Style;
- item?: Style;
- }
-
- export interface ListOptions extends BoxOptions
- {
- style?: ListStyle;
-
- /** whether to automatically enable mouse support for this list (allows clicking items). */
- mouse?: boolean;
- /** use predefined keys for navigating the list. */
- keys?: any;
- /** use vi keys with the keys option. */
- vi?: boolean;
- /** an array of strings which become the list's items. */
- items?: string[];
- /** a function that is called when vi mode is enabled and the key / is pressed. This function accepts a callback function which should be called with the search string. The search string is then used to jump to an item that is found in items. */
- search?: (callback:(searchString:string) => void) => void;
- /** whether the list is interactive and can have items selected (default: true). */
- interactive?: boolean;
- }
-
- export class List extends Box
- {
- constructor(options?:ListOptions);
-
- /** The text of the currently selected item. */
- value:string;
- /** The items in the list. */
- items:string[];
- /** The items in the list. */
- ritems:string[];
- /** The index of the current selection. */
- selected:number;
-
- /** add an item based on a string. */
- addItem(text:string): void;
- /** returns the item index from the list. child can be an element, index, or string. */
- getItemIndex(child:Element|number|string): void;
- /** returns the item element. child can be an element, index, or string. */
- getItem(child:Element|number|string): void;
- /** removes an item from the list. child can be an element, index, or string. */
- removeItem(child:Element|number|string): void;
- /** clears all items from the list. */
- clearItems(): void;
- /** sets the list items to multiple strings. */
- setItems(items:string[]): void;
- /** Sets the current selection by absolute index. */
- select(index:number): void;
- /** Changes the current selection based on current offset. */
- move(offset:number): void;
- /** select item above selected. */
- up(amount:number): void;
- /** select item below selected. */
- down(amount:number): void;
- /** show/focus list and pick an item. the callback is executed with the result. */
- pick(cwd:string, callback:(err:any, file:string) => void): void;
-
- /** show/focus list and pick an item. the callback is executed with the result. */
- pick(callback:(err:any, file:string) => void): void;
- }
-
- //
- // Input
- //
-
- export interface InputOptions extends BoxOptions {
- // intentionally empty
- }
-
- export class Input extends Box {
- constructor(options?:InputOptions);
- // intentionally empty
- }
-
- export interface InputOptions extends BoxOptions {
- // intentionally empty
- }
-
- //
- // Textarea
- //
-
- export interface TextareaOptions extends InputOptions
- {
- /** use pre-defined keys (`i` or `enter` for insert, `e` for editor, `C-e` for editor while inserting). */
- keys?: boolean;
- /** use pre-defined mouse events (right-click for editor). */
- mouse?: boolean;
- /** call `readInput()` when the element is focused. automatically unfocus. */
- inputOnFocus?: boolean;
- }
-
- /** A box which allows multiline text input. */
- export class Textarea extends Input
- {
- constructor(options?:TextareaOptions);
-
- /** the input text. __read-only__. */
- value: string;
-
- /** submit the textarea (emits `submit`). */
- submit(): void;
- /** cancel the textarea (emits `cancel`). */
- cancel(): void;
- /** grab key events and start reading text from the keyboard. takes a callback which receives the final value. */
- readInput(callback:GenericCallback): void;
- /** open text editor in `$EDITOR`, read the output from the resulting file. takes a callback which receives the final value. */
- readEditor(callback:GenericCallback): void;
- /** the same as `this.value`, for now. */
- getValue(): string;
- /** clear input. */
- clearValue(): void;
- /** set value. */
- setValue(text:string): void;
- }
-
-
- //
- // Textbox
- //
-
- export interface TextboxOptions extends TextareaOptions {
- /** completely hide text. */
- secret?: boolean;
- /** replace text with asterisks (`*`). */
- censor?: boolean;
- }
-
- /** A box which allows text input. */
- export class Textbox extends Textarea {
- constructor(options?:TextboxOptions);
-
- /** completely hide text. */
- secret: boolean;
- /** replace text with asterisks (`*`). */
- censor: boolean;
- }
-
-
- //
- // Button
- //
-
- export interface ButtonOptions extends InputOptions {
- }
-
- /** A button which can be focused and allows key and mouse input. */
- export class Button extends Input {
- constructor(options?:ButtonOptions);
-
- // on(event:string, callback:() => void): void;
- // on(event:'press', callback:() => void);
-
- /** press button. emits 'press'. */
- press(): void;
- }
-
-
- //
- // ProgressBar
- //
-
- export interface ProgressBarOptions extends InputOptions {
- /** can be `horizontal` or `vertical`. */
- orientation: string;
- /** the character to fill the bar with (default is space). */
- pch: string;
- /** the amount filled (0 - 100). */
- filled: number;
- /** same as `filled`. */
- value: number;
- /** enable key support. */
- keys: boolean;
- /** enable mouse support. */
- mouse: boolean;
-
- /** contains the extra key 'bar', which defines the style of the bar contents itself. */
- style: ProgressBarStyle;
- }
-
- export interface ProgressBarStyle extends Style {
- /** style of the bar contents itself. */
- bar: Style;
- }
-
-
- export class ProgressBar extends Input {
- constructor(options?:ProgressBarOptions);
-
- /** progress the bar by a fill amount. */
- progress(amount:number): void;
- /** set progress to specific amount. */
- setProgress(amount:number): void;
- /** reset the bar. */
- reset(): void;
- }
-
- //
- // Checkbox
- //
-
- export interface CheckboxOptions extends InputOptions {
- /** whether the element is checked or not. */
- checked: boolean;
- /** enable mouse support. */
- mouse: boolean;
+ export module Events {
+
+ export interface IMouseEventArg {
+ x: number;
+ y: number;
+ action: Types.TMouseAction;
+ }
+
+ export interface IKeyEventArg {
+ full: string;
+ name: string;
+ shift: boolean;
+ ctrl: boolean;
+ meta: boolean;
+ sequence: string;
+ }
}
-
- /** A checkbox which can be used in a form element. */
- export class Checkbox extends Input
- {
- constructor(options?:CheckboxOptions);
-
- /** the text next to the checkbox (do not use setcontent, use `check.text = ''`). */
- text: string;
- /** whether the element is checked or not. */
- checked: boolean;
- /** same as `checked`. */
- value: boolean;
-
- /** check the element. */
- check(): void;
- /** uncheck the element. */
- uncheck(): void;
- /** toggle checked state. */
- toggle(): void;
- }
-
-
- //
- // RadioSet
- //
-
- export interface RadioSetOptions extends BoxOptions {
- }
-
-
- export class RadioSet extends Box {
- constructor(options?:RadioSetOptions);
- }
-
-
- //
- // RadioButton
- //
-
- export interface RadioButtonOptions extends CheckboxOptions {
- }
-
-
- /** A radio button which can be used in a form element. */
- export class RadioButton extends Checkbox {
- constructor(options?:RadioButtonOptions);
- }
-
-
-
- //
- // Prompt
- //
-
- export interface PromptOptions extends BoxOptions {
- }
-
-
- /** A prompt box containing a text input, okay, and cancel buttons (automatically hidden). */
- export class Prompt extends Box
- {
- constructor(options?:PromptOptions);
-
- /** show the prompt and wait for the result of the textbox. set text and initial value */
- input(text:string, value:any, callback:(val:any) => void): void;
- /** show the prompt and wait for the result of the textbox. set text and initial value */
- setInput(text:string, value:any, callback:(val:any) => void): void;
- /** show the prompt and wait for the result of the textbox. set text and initial value */
- readInput(text:string, value:any, callback:(val:any) => void): void;
- }
-
-
- //
- // Question
- //
-
- export interface QuestionOptions extends BoxOptions {
- }
-
-
- /** A question box containing okay and cancel buttons (automatically hidden). */
- export class Question extends Box
- {
- constructor(options?:QuestionOptions);
-
- /** ask a `question`. `callback` will yield the result. */
- ask(question:string, callback:(result:any) => void): void;
- }
-
-
- //
- // Message
- //
-
- export interface MessageOptions extends BoxOptions {
- }
-
-
- /** A box containing a message to be displayed (automatically hidden). */
- export class Message extends Box
- {
- constructor(options?:MessageOptions);
-
- /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */
- log(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void;
- /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */
- display(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void;
- /** display an error in the same way. */
- error(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void;
- }
-
- export interface MessageCallback {
- (): void;
- }
-
-
- //
- // Loading
- //
-
- export interface LoadingOptions extends BoxOptions {
- }
-
- /** A box with a spinning line to denote loading (automatically hidden). */
- export class Loading extends Box
- {
- constructor(options?:LoadingOptions);
-
- /** display the loading box with a message. will lock keys until `stop` is called. */
- load(text:string): void;
- /** hide loading box. unlock keys. */
- stop(): void;
- }
-
-
- //
- // Listbar
- //
-
- export interface ListbarOptions extends BoxOptions
- {
- /** Listbar's `style` object includes sub-styles for `selected` and `item`. */
- style?: ListbarStyle;
-
- /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */
- items?: ListbarItemSet;
- /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */
- commands?: ListbarItemSet;
- /** automatically bind list buttons to keys 0-9. */
- autoCommandKeys?: boolean;
- }
-
- export interface ListbarItemSet {
- [name: string]: ListbarItem;
- }
-
- export interface ListbarItem {
- keys: string[];
- callback: GenericCallback;
- }
-
- export interface ListbarStyle extends Style
- {
- /** style for a selected item. */
- selected: Style;
- /** style for an unselected item. */
- item: Style;
- }
-
- /** A horizontal list. Useful for a main menu bar. */
- export class Listbar extends Box
- {
- constructor(options?:ListbarOptions);
-
- /** append an item to the bar. */
- add(item:ListbarItem, callback:GenericCallback): void;
- /** append an item to the bar. */
- addItem(item:ListbarItem, callback:GenericCallback): void;
- /** append an item to the bar. */
- appendItem(item:ListbarItem, callback:GenericCallback): void;
-
- /** select button and execute its callback. */
- selectTab(index: number): void;
-
- /** set commands (see `commands` option above). */
- setItems(commands: ListbarItemSet): void;
- /** select an item on the bar. */
- select(offset: number): void;
- /** remove item from the bar. */
- removeItem(child:ListbarItem): void;
- /** move focus relatively across the bar. */
- move(offset: number): void;
- /** move focus left relatively across the bar. */
- moveLeft(offset: number): void;
- /** move focus right relatively across the bar. */
- moveRight(offset: number): void;
- }
-
-
- //
- // Log
- //
-
- export interface LogOptions extends ScrollableTextOptions {
- /** amount of scrollback allowed. default: Infinity. */
- scrollback?: number;
- /** scroll to bottom on input even if the user has scrolled up. default: false. */
- scrollOnInput?: boolean;
- }
-
-
- /** A log permanently scrolled to the bottom. */
- export class Log extends ScrollableText
- {
- constructor(options?:LogOptions);
-
- /** amount of scrollback allowed. default: Infinity. */
- scrollback: number;
- /** scroll to bottom on input even if the user has scrolled up. default: false. */
- scrollOnInput: boolean;
-
- /** add a log line. */
- log(text:string): void;
- /** add a log line. */
- add(text:string): void;
- }
-
-
- //
- // Table
- //
-
- export interface TableOptions extends BoxOptions
- {
- /** array of array of strings representing rows (same as `data`). */
- rows?: string[][];
- /** array of array of strings representing rows (same as `rows`). */
- data?: string[][];
- /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */
- pad?: number;
- /** do not draw inner cells. */
- noCellBorders?: boolean;
- /** fill cell borders with the adjacent background color. */
- fillCellBorders?: boolean;
-
- /** includes `header` and `cell` substyles. */
- style?: TableStyle;
- }
-
- export interface TableStyle extends Style {
- /** header style. */
- header: Style;
- /** cell style. */
- cell: Style;
- }
-
- /** A stylized table of text elements. */
- export class Table extends Box
- {
- /** includes `header` and `cell` substyles. */
- style: TableStyle;
-
- /** set rows in table. array of arrays of strings. */
- setData(rows: string[][]): void;
- /** set rows in table. array of arrays of strings. */
- setRows(rows: string[][]): void;
- }
-
-
- //
- // ListTable
- //
-
- export interface ListTableOptions extends ListOptions
- {
- /** array of array of strings representing rows (same as `data`). */
- rows?: string[][];
- /** array of array of strings representing rows (same as `rows`). */
- data?: string[][];
- /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */
- pad?: number;
-
- /** do not draw inner cells. */
- noCellBorders?: boolean;
-
- /** includes `header` and `cell` substyles. */
- style?: TableStyle;
- }
-
- export interface ListTableStyle extends TableStyle {
- }
-
-
- /** A stylized table of text elements with a list. */
- export class ListTable extends List
- {
- constructor(options?:ListTableOptions);
-
- /** set rows in table. array of arrays of strings. */
- setData(rows: string[][]): void;
- /** set rows in table. array of arrays of strings. */
- setRows(rows: string[][]): void;
- }
-
- //
- // Image
- //
-
- export interface ImageOptions extends BoxOptions {
- /** path to image. */
- file: string;
- /** path to w3mimgdisplay. if a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. */
- w3m: string;
- }
-
-
- /** Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals. */
- export class Image extends Box
- {
- constructor(options?:ImageOptions);
-
- /** set the image in the box to a new path. */
- setImage (img:string, callback:GenericCallback): void;
- /** clear the current image. */
- clearImage (callback:GenericCallback): void;
- /** get the size of an image file in pixels. */
- imageSize (img:string, callback:GenericCallback): void;
- /** get the size of the terminal in pixels. */
- termSize (callback:GenericCallback): void;
- /** get the pixel to cell ratio for the terminal. */
- getPixelRatio (callback:GenericCallback): void;
- }
-
-
- //
- // Form
- //
-
- export interface FormOptions extends BoxOptions {
- /** allow default keys (tab, vi keys, enter). */
- keys?:boolean;
- /** allow vi keys. */
- vi?:boolean;
- }
-
- export class Form extends Box
- {
- constructor(options?:FormOptions);
-
- /** last submitted data. */
- submission: any;
-
- // on(event:string, callback:() => void): void;
- // on(event:'submit', callback:(data) => void): void;
- // on(event:'cancel', callback:() => void): void;
- // on(event:'reset', callback:() => void): void;
-
- next(): void;
- previous(): void;
-
- resetSelected(): void;
- /** focus first form element. */
- focusFirst(): void;
- /** focus last form element. */
- focusLast(): void;
- /** focus next form element. */
- focusNext(): void;
- /** focus previous form element. */
- focusPrevious(): void;
- /** submit the form. */
- submit(): void;
- /** discard the form. */
- cancel(): void;
- /** clear the form. */
- reset(): void;
- }
-
-
- //
- // FileManager
- //
-
- export interface FileManagerOptions extends ListOptions {
- cwd?: string;
- }
-
- export interface DirectoryEntry {
- name: string;
- text: string;
- dir: boolean;
- symlink: boolean;
- }
-
- export class FileManager extends List
- {
- constructor(options?:FileManagerOptions);
-
- cwd: string;
-
- useFormatter (formatterFn:(entry:DirectoryEntry) => DirectoryEntry): void;
-
- /** refresh the file list (perform a readdir on cwd and update the list items). */
- refresh (cwd?:string, callback?:() => void): void;
-
- /** refresh the file list. */
- refresh (callback?:() => void): void;
-
- /** reset back to original cwd. */
- reset (cwd?:string, callback?:() => void): void;
- }
-
-
- //
- // Terminal
- //
-
- export interface TerminalOptions extends BoxOptions
- {
- /** handler for input data. */
- handler?: (userInput:Buffer) => void;
- /** name of shell. $SHELL by default. */
- shell?:string;
- /** args for shell. */
- args?:any;
- /** can be line, underline, and block. */
- cursor?:string; //'line'|'underline'|'block';
- }
-
- export class Terminal extends Box
- {
- /** reference to the headless term.js terminal. */
- term: any;
- /** reference to the pty.js pseudo terminal. */
- pty: any;
-
- /** write data to the terminal. */
- write(data:string): void;
-
- /** nearly identical to `element.screenshot`, however, the specified region includes the terminal's _entire_ scrollback, rather than just what is visible on the screen. */
- screenshot(xi?:number, xl?:number, yi?:number, yl?:number): string;
- }
-
-
- export interface NodeChildProcessExecOptions
- {
+ export interface NodeChildProcessExecOptions {
cwd?: string;
stdio?: any;
customFds?: any;
@@ -1260,10 +159,2676 @@ declare module "blessed"
maxBuffer?: number;
killSignal?: string;
}
+
+ export interface IDestroyable {
+ destroy(): void;
+ }
+
+ export interface IOptions {
+ }
+
+ export interface IHasOptions {
+ options: T;
+ }
+
+ export interface TputsOptions extends IOptions {
+ terminal?: string;
+ extended?: boolean;
+ debug?: boolean;
+ termcap?: string;
+ terminfoFile?: string;
+ terminfoPrefix?: string;
+ termcapFile?: string;
+ }
+
+ export class Tput implements IHasOptions {
+ constructor(opts: TputsOptions);
+
+ // ** properties ** //
+
+ /**
+ * Original options object.
+ */
+ options: TputsOptions;
+
+ debug: boolean;
+ padding: boolean;
+ extended: boolean;
+ printf: boolean;
+ termcap: string;
+ terminfoPrefix: string;
+ terminfoFile: string;
+ termcapFile: string;
+ error: Error;
+ terminal: string;
+
+ setup(): void;
+ term(is: any): boolean;
+ readTerminfo(term: string): string;
+ parseTerminfo(data: any, file: string): {
+ header: {
+ dataSize: number;
+ headerSize: number;
+ magicNumber: boolean;
+ namesSize: number;
+ boolCount: number;
+ numCount: number;
+ strCount: number;
+ strTableSize: number;
+ extended: {
+ dataSize: number;
+ headerSize: number;
+ boolCount: number;
+ numCount: number;
+ strCount: number;
+ strTableSize: number;
+ lastStrTableOffset: number;
+ }
+ }
+ name: string;
+ names: string[];
+ desc: string;
+ bools: Object;
+ numbers: Object;
+ strings: Object;
+ };
+ }
+
+ export interface IDestroyable {
+ destroy(): void;
+ }
+
+ export interface INodeOptions extends IOptions {
+ name?: string;
+ screen?: Screen;
+ parent?: Node;
+ children?: Node[];
+ focusable?: boolean;
+ }
+
+ export abstract class Node extends EventEmitter implements IHasOptions, IDestroyable {
+ constructor(options: INodeOptions);
+
+ // ** properties ** //
+
+ focusable: boolean;
+
+ /**
+ * Original options object.
+ */
+ options: INodeOptions;
+
+ /**
+ * An object for any miscellanous user data.
+ */
+ data: {[index: string]: any;};
+ /**
+ * An object for any miscellanous user data.
+ */
+ _: {[index: string]: any;};
+ /**
+ * An object for any miscellanous user data.
+ */
+ $: {[index: string]: any;};
+ /**
+ * Type of the node (e.g. box).
+ */
+ type: string;
+ /**
+ * Render index (document order index) of the last render call.
+ */
+ index: number;
+ /**
+ * Parent screen.
+ */
+ screen: Screen;
+ /**
+ * Parent node.
+ */
+ parent: Node;
+ /**
+ * Array of node's children.
+ */
+ children: Node[];
+
+ // ** methods ** //
+
+ /**
+ * Prepend a node to this node's children.
+ */
+ prepend(node: Node): void;
+ /**
+ * Append a node to this node's children.
+ */
+ append(node: Node): void;
+ /**
+ * Remove child node from node.
+ */
+ remove(node: Node): void;
+ /**
+ * Insert a node to this node's children at index i.
+ */
+ insert(node: Node, index: number): void;
+ /**
+ * Insert a node to this node's children before the reference node.
+ */
+ insertBefore(node: Node, refNode: Node): void;
+ /**
+ * Insert a node from node after the reference node.
+ */
+ insertAfter(node: Node, refNode: Node): void;
+ /**
+ * Remove node from its parent.
+ */
+ detach(): void;
+ /**
+ * Remove node from its parent.
+ */
+ free(): void;
+ /**
+ * Remove node from its parent.
+ */
+ forDescendants(iter: Function, s: any): void;
+ /**
+ * Remove node from its parent.
+ */
+ forAncestors(iter: Function, s: any): void;
+ /**
+ * Remove node from its parent.
+ */
+ collectDescendants(s: any): void;
+ /**
+ * Remove node from its parent.
+ */
+ collectAncestors(s: any): void;
+ /**
+ * Remove node from its parent.
+ */
+ emitDescendants(): void;
+ /**
+ * Remove node from its parent.
+ */
+ emitAncestors(): void;
+ /**
+ * Remove node from its parent.
+ */
+ hasDescendant(target: Node): void;
+ /**
+ * Remove node from its parent.
+ */
+ hasAncestor(target: Node): boolean;
+ /**
+ * Remove node from its parent.
+ */
+ destroy(): void;
+ /**
+ * Emit event for element, and recursively emit same event for all descendants.
+ */
+ emitDescendants(type: string, ...args: any[]): void;
+ /**
+ * Get user property with a potential default value.
+ */
+ get(name: string, def: T): T;
+ /**
+ * Set user property to value.
+ */
+ set(name: string, value: T): void;
+
+ // ** events ** //
+
+ on(event: string, listener: Function): this;
+ /**
+ * Received when node is added to a parent.
+ */
+ on(event: "adopt", callback: (arg: Node) => void): this;
+ /**
+ * Received when node is removed from it's current parent.
+ */
+ on(event: "remove", callback: (arg: Node) => void): this;
+ /**
+ * Received when node gains a new parent.
+ */
+ on(event: "reparent", callback: (arg: Node) => void): this;
+ /**
+ * Received when node is attached to the screen directly or somewhere in its ancestry.
+ */
+ on(event: "attach", callback: (arg: Node) => void): this;
+ /**
+ * Received when node is detached from the screen directly or somewhere in its ancestry.
+ */
+ on(event: "detach", callback: (arg: Node) => void): this;
+ }
+
+ export class NodeWithEvents extends Node {
+ // ** methods ** //
+
+ /**
+ * Bind a keypress listener for a specific key.
+ */
+ key(name: string | string[], listener: Function): void;
+ /**
+ * Bind a keypress listener for a specific key once.
+ */
+ onceKey(name: string, listener: Function): void;
+ /**
+ * Remove a keypress listener for a specific key.
+ */
+ unkey(name: string, listener: Function): void;
+ removeKey(name: string, listener: Function): void;
+
+ // ** events ** //
+
+ on(event: string, listener: Function): this;
+ /**
+ * Received on screen resize.
+ */
+ on(event: "resize", callback: () => void): this;
+ /**
+ * Received on mouse events.
+ */
+ on(event: "mouse", callback: (arg: Events.IMouseEventArg) => void): this;
+ on(event: "mouseout", callback: (arg: Events.IMouseEventArg) => void): this;
+ on(event: "mouseover", callback: (arg: Events.IMouseEventArg) => void): this;
+ on(event: "mousedown", callback: (arg: Events.IMouseEventArg) => void): this;
+ on(event: "mouseup", callback: (arg: Events.IMouseEventArg) => void): this;
+ on(event: "mousewheel", callback: (arg: Events.IMouseEventArg) => void): this;
+ on(event: "wheeldown", callback: (arg: Events.IMouseEventArg) => void): this;
+ on(event: "wheelup", callback: (arg: Events.IMouseEventArg) => void): this;
+ on(event: "mousemove", callback: (arg: Events.IMouseEventArg) => void): this;
+ /**
+ * Received on key events.
+ */
+ on(event: "keypress", callback: (ch: string, key: Events.IKeyEventArg) => void): this;
+ /**
+ * Global events received for all elements.
+ */
+ on(event: "element click", callback: (arg: Screen) => void): this;
+ on(event: "element mouseover", callback: (arg: Screen) => void): this;
+ on(event: "element mouseout", callback: (arg: Screen) => void): this;
+ on(event: "element mouseup", callback: (arg: Screen) => void): this;
+ /**
+ * Received on key event for [name].
+ */
+ //on(event: "key", callback: (arg: BlessedScreen) => void): this;
+ /**
+ * Received when the terminal window focuses/blurs. Requires a terminal supporting the
+ * focus protocol and focus needs to be passed to program.enableMouse().
+ */
+ on(event: "focus", callback: (arg: Screen) => void): this;
+ /**
+ * Received when the terminal window focuses/blurs. Requires a terminal supporting the
+ * focus protocol and focus needs to be passed to program.enableMouse().
+ */
+ on(event: "blur", callback: (arg: Screen) => void): this;
+ /**
+ * Received before render.
+ */
+ on(event: "prerender", callback: () => void): this;
+ /**
+ * Received on render.
+ */
+ on(event: "render", callback: () => void): this;
+ /**
+ * Received when blessed notices something untoward (output is not a tty, terminfo not found, etc).
+ */
+ on(event: "warning", callback: (text: string) => void): this;
+ /**
+ * Received when the screen is destroyed (only useful when using multiple screens).
+ */
+ on(event: "destroy", callback: () => void): this;
+ /**
+ * Received when the element is moved.
+ */
+ on(event: "move", callback: () => void): this;
+ /**
+ * Element was clicked (slightly smarter than mouseup).
+ */
+ on(event: "click", callback: (arg: Screen) => void): this;
+ /**
+ * Received when element is shown.
+ */
+ on(event: "show", callback: () => void): this;
+ /**
+ * Received when element becomes hidden.
+ */
+ on(event: "hide", callback: () => void): this;
+
+ on(event: "set content", callback: () => void): this;
+ on(event: "parsed content", callback: () => void): this;
+ }
+
+ export interface IScreenOptions extends INodeOptions {
+ /**
+ * The blessed Program to be associated with. Will be automatically instantiated if none is provided.
+ */
+ program?: BlessedProgram;
+ /**
+ * Attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with
+ * uniform cells to their sides). This is known to cause flickering with elements that are not full-width,
+ * however, it is more optimal for terminal rendering.
+ */
+ smartCSR?: boolean;
+ /**
+ * Do CSR on any element within 20 cols of the screen edge on either side. Faster than smartCSR,
+ * but may cause flickering depending on what is on each side of the element.
+ */
+ fastCSR?: boolean;
+ /**
+ * Attempt to perform back_color_erase optimizations for terminals that support it. It will also work
+ * with terminals that don't support it, but only on lines with the default background color. As it
+ * stands with the current implementation, it's uncertain how much terminal performance this adds at
+ * the cost of overhead within node.
+ */
+ useBCE?: boolean;
+ /**
+ * Amount of time (in ms) to redraw the screen after the terminal is resized (Default: 300).
+ */
+ resizeTimeout?: number;
+ /**
+ * The width of tabs within an element's content.
+ */
+ tabSize?: number;
+ /**
+ * Automatically position child elements with border and padding in mind (NOTE: this is a recommended
+ * option. It may become default in the future).
+ */
+ autoPadding?: boolean;
+
+ cursor?: Types.TCursor;
+
+ /**
+ * Create a log file. See log method.
+ */
+ log?: (...msg: any[]) => void;
+ /**
+ * Dump all output and input to desired file. Can be used together with log option if set as a boolean.
+ */
+ dump?: string;
+ /**
+ * Debug mode. Enables usage of the debug method. Also creates a debug console which will display when
+ * pressing F12. It will display all log and debug messages.
+ */
+ debug?: (...msg: string[]) => void;
+ /**
+ * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful
+ * for creating a key that will always exit no matter whether the keys are locked.
+ */
+ ignoreLocked?: boolean;
+ /**
+ * Automatically "dock" borders with other elements instead of overlapping, depending on position
+ * (experimental). For example: These border-overlapped elements:
+ */
+ dockBorders?: boolean;
+ /**
+ * Normally, dockable borders will not dock if the colors or attributes are different. This option
+ * will allow them to dock regardless. It may produce some odd looking multi-colored borders though.
+ */
+ ignoreDockContrast?: boolean;
+ /**
+ * Allow for rendering of East Asian double-width characters, utf-16 surrogate pairs, and unicode
+ * combining characters. This allows you to display text above the basic multilingual plane. This
+ * is behind an option because it may affect performance slightly negatively. Without this option
+ * enabled, all double-width, surrogate pair, and combining characters will be replaced by '??',
+ * '?', '' respectively. (NOTE: iTerm2 cannot display combining characters properly. Blessed simply
+ * removes them from an element's content if iTerm2 is detected).
+ */
+ fullUnicode?: boolean;
+ /**
+ * Send focus events after mouse is enabled.
+ */
+ sendFocus?: boolean;
+ /**
+ * Display warnings (such as the output not being a TTY, similar to ncurses).
+ */
+ warnings?: boolean;
+ /**
+ * Force blessed to use unicode even if it is not detected via terminfo, env variables, or windows code page.
+ * If value is true unicode is forced. If value is false non-unicode is forced (default: null).
+ */
+ forceUnicode?: boolean;
+ /**
+ * Input and output streams. process.stdin/process.stdout by default, however, it could be a
+ * net.Socket if you want to make a program that runs over telnet or something of that nature.
+ * */
+ input?: stream.Writable;
+ /**
+ * Input and output streams. process.stdin/process.stdout by default, however, it could be a
+ * net.Socket if you want to make a program that runs over telnet or something of that nature.
+ * */
+ output?: stream.Readable;
+ /**
+ * The blessed Tput object (only available if you passed tput: true to the Program constructor.)
+ */
+ tput?: Tput;
+ /**
+ * Top of the focus history stack.
+ */
+ focused?: BlessedElement;
+ /**
+ * Width of the screen (same as program.cols).
+ */
+ width?: Types.TPosition;
+ /**
+ * Height of the screen (same as program.rows).
+ */
+ height?: Types.TPosition;
+ /**
+ * Same as screen.width.
+ */
+ cols?: number;
+ /**
+ * Same as screen.height.
+ */
+ rows?: number;
+ /**
+ * Relative top offset, always zero.
+ */
+ top?: Types.TTopLeft;
+ /**
+ * Relative left offset, always zero.
+ */
+ left?: Types.TTopLeft;
+ /**
+ * Relative right offset, always zero.
+ */
+ right?: Types.TPosition;
+ /**
+ * Relative bottom offset, always zero.
+ */
+ bottom?: Types.TPosition;
+ /**
+ * Absolute top offset, always zero.
+ */
+ atop?: Types.TTopLeft;
+ /**
+ * Absolute left offset, always zero.
+ */
+ aleft?: Types.TTopLeft;
+ /**
+ * Absolute right offset, always zero.
+ */
+ aright?: Types.TPosition;
+ /**
+ * Absolute bottom offset, always zero.
+ */
+ abottom?: Types.TPosition;
+ /**
+ * Whether the focused element grabs all keypresses.
+ */
+ grabKeys?: any;
+ /**
+ * Prevent keypresses from being received by any element.
+ */
+ lockKeys?: boolean;
+ /**
+ * The currently hovered element. Only set if mouse events are bound.
+ */
+ hover?: any;
+ /**
+ * Set or get terminal name. Set calls screen.setTerminal() internally.
+ */
+ terminal?: string;
+ /**
+ * Set or get window title.
+ */
+ title?: string;
+ }
+
+ export class Screen extends NodeWithEvents implements IHasOptions {
+ constructor(opts: IScreenOptions);
+
+ // ** properties ** //
+ cleanSides: any;
+
+ /**
+ * Original options object.
+ */
+ options: IScreenOptions;
+
+ /**
+ * The blessed Program to be associated with. Will be automatically instantiated if none is provided.
+ */
+ program: BlessedProgram;
+ /**
+ * Attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with
+ * uniform cells to their sides). This is known to cause flickering with elements that are not full-width,
+ * however, it is more optimal for terminal rendering.
+ */
+ smartCSR: boolean;
+ /**
+ * Do CSR on any element within 20 cols of the screen edge on either side. Faster than smartCSR,
+ * but may cause flickering depending on what is on each side of the element.
+ */
+ fastCSR: boolean;
+ /**
+ * Attempt to perform back_color_erase optimizations for terminals that support it. It will also work
+ * with terminals that don't support it, but only on lines with the default background color. As it
+ * stands with the current implementation, it's uncertain how much terminal performance this adds at
+ * the cost of overhead within node.
+ */
+ useBCE: boolean;
+ /**
+ * Amount of time (in ms) to redraw the screen after the terminal is resized (Default: 300).
+ */
+ resizeTimeout: number;
+ /**
+ * The width of tabs within an element's content.
+ */
+ tabSize: number;
+ /**
+ * Automatically position child elements with border and padding in mind (NOTE: this is a recommended
+ * option. It may become default in the future).
+ */
+ autoPadding: boolean;
+
+ cursor: Types.TCursor;
+
+ /**
+ * Dump all output and input to desired file. Can be used together with log option if set as a boolean.
+ */
+ dump: string;
+ /**
+ * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful
+ * for creating a key that will always exit no matter whether the keys are locked.
+ */
+ ignoreLocked: boolean;
+ /**
+ * Automatically "dock" borders with other elements instead of overlapping, depending on position
+ * (experimental). For example: These border-overlapped elements:
+ */
+ dockBorders: boolean;
+ /**
+ * Normally, dockable borders will not dock if the colors or attributes are different. This option
+ * will allow them to dock regardless. It may produce some odd looking multi-colored borders though.
+ */
+ ignoreDockContrast: boolean;
+ /**
+ * Allow for rendering of East Asian double-width characters, utf-16 surrogate pairs, and unicode
+ * combining characters. This allows you to display text above the basic multilingual plane. This
+ * is behind an option because it may affect performance slightly negatively. Without this option
+ * enabled, all double-width, surrogate pair, and combining characters will be replaced by '??',
+ * '?', '' respectively. (NOTE: iTerm2 cannot display combining characters properly. Blessed simply
+ * removes them from an element's content if iTerm2 is detected).
+ */
+ fullUnicode: boolean;
+ /**
+ * Send focus events after mouse is enabled.
+ */
+ sendFocus: boolean;
+ /**
+ * Display warnings (such as the output not being a TTY, similar to ncurses).
+ */
+ warnings: boolean;
+ /**
+ * Force blessed to use unicode even if it is not detected via terminfo, env variables, or windows code page.
+ * If value is true unicode is forced. If value is false non-unicode is forced (default: null).
+ */
+ forceUnicode: boolean;
+ /**
+ * Input and output streams. process.stdin/process.stdout by default, however, it could be a
+ * net.Socket if you want to make a program that runs over telnet or something of that nature.
+ * */
+ input: stream.Writable;
+ /**
+ * Input and output streams. process.stdin/process.stdout by default, however, it could be a
+ * net.Socket if you want to make a program that runs over telnet or something of that nature.
+ * */
+ output: stream.Readable;
+ /**
+ * The blessed Tput object (only available if you passed tput: true to the Program constructor.)
+ */
+ tput: Tput;
+ /**
+ * Top of the focus history stack.
+ */
+ focused: BlessedElement;
+ /**
+ * Width of the screen (same as program.cols).
+ */
+ width: Types.TPosition;
+ /**
+ * Height of the screen (same as program.rows).
+ */
+ height: Types.TPosition;
+ /**
+ * Same as screen.width.
+ */
+ cols: number;
+ /**
+ * Same as screen.height.
+ */
+ rows: number;
+ /**
+ * Relative top offset, always zero.
+ */
+ top: Types.TTopLeft;
+ /**
+ * Relative left offset, always zero.
+ */
+ left: Types.TTopLeft;
+ /**
+ * Relative right offset, always zero.
+ */
+ right: Types.TPosition;
+ /**
+ * Relative bottom offset, always zero.
+ */
+ bottom: Types.TPosition;
+ /**
+ * Absolute top offset, always zero.
+ */
+ atop: Types.TTopLeft;
+ /**
+ * Absolute left offset, always zero.
+ */
+ aleft: Types.TTopLeft;
+ /**
+ * Absolute right offset, always zero.
+ */
+ aright: Types.TPosition;
+ /**
+ * Absolute bottom offset, always zero.
+ */
+ abottom: Types.TPosition;
+ /**
+ * Whether the focused element grabs all keypresses.
+ */
+ grabKeys: any;
+ /**
+ * Prevent keypresses from being received by any element.
+ */
+ lockKeys: boolean;
+ /**
+ * The currently hovered element. Only set if mouse events are bound.
+ */
+ hover: any;
+ /**
+ * Set or get terminal name. Set calls screen.setTerminal() internally.
+ */
+ terminal: string;
+ /**
+ * Set or get window title.
+ */
+ title: string;
+
+ // ** methods ** //
+
+ /**
+ * Write string to the log file if one was created.
+ */
+ log(...msg: any[]): void;
+ /**
+ * Same as the log method, but only gets called if the debug option was set.
+ */
+ debug(...msg: string[]): void;
+ /**
+ * Allocate a new pending screen buffer and a new output screen buffer.
+ */
+ alloc(): void;
+ /**
+ * Reallocate the screen buffers and clear the screen.
+ */
+ realloc(): void;
+ /**
+ * Draw the screen based on the contents of the screen buffer.
+ */
+ draw(start: number, end: number): void;
+ /**
+ * Render all child elements, writing all data to the screen buffer and drawing the screen.
+ */
+ render(): void;
+ /**
+ * Clear any region on the screen.
+ */
+ clearRegion(x1: number, x2: number, y1: number, y2: number): void;
+ /**
+ * Fill any region with a character of a certain attribute.
+ */
+ fillRegion(attr: string, ch: string, x1: number, x2: number, y1: number, y2: number): void;
+ /**
+ * Focus element by offset of focusable elements.
+ */
+ focusOffset(offset: number): any;
+ /**
+ * Focus previous element in the index.
+ */
+ focusPrevious(): void;
+ /**
+ * Focus next element in the index.
+ */
+ focusNext(): void;
+ /**
+ * Push element on the focus stack (equivalent to screen.focused = el).
+ */
+ focusPush(element: BlessedElement): void;
+ /**
+ * Pop element off the focus stack.
+ */
+ focusPop(): BlessedElement;
+ /**
+ * Save the focused element.
+ */
+ saveFocus(): BlessedElement;
+ /**
+ * Restore the saved focused element.
+ */
+ restoreFocus(): BlessedElement;
+ /**
+ * "Rewind" focus to the last visible and attached element.
+ */
+ rewindFocus(): BlessedElement;
+ /**
+ * Spawn a process in the foreground, return to blessed app after exit.
+ */
+ spawn(file: string, args: string[], options: NodeChildProcessExecOptions): child_process.ChildProcess;
+ /**
+ * Spawn a process in the foreground, return to blessed app after exit. Executes callback on error or exit.
+ */
+ exec(file: string, args: string[], options: NodeChildProcessExecOptions, callback: Function): child_process.ChildProcess;
+ /**
+ * Read data from text editor.
+ */
+ readEditor(options: any, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
+ readEditor(callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
+ /**
+ * Set effects based on two events and attributes.
+ */
+ setEffects(el: BlessedElement, fel: BlessedElement, over: any, out: any, effects: any, temp: any): void;
+ /**
+ * Insert a line into the screen (using csr: this bypasses the output buffer).
+ */
+ insertLine(n: number, y: number, top: number, bottom: number): void;
+ /**
+ * Delete a line from the screen (using csr: this bypasses the output buffer).
+ */
+ deleteLine(n: number, y: number, top: number, bottom: number): void;
+ /**
+ * Insert a line at the bottom of the screen.
+ */
+ insertBottom(top: number, bottom: number): void;
+ /**
+ * Insert a line at the top of the screen.
+ */
+ insertTop(top: number, bottom: number): void;
+ /**
+ * Delete a line at the bottom of the screen.
+ */
+ deleteBottom(top: number, bottom: number): void;
+ /**
+ * Delete a line at the top of the screen.
+ */
+ deleteTop(top: number, bottom: number): void;
+ /**
+ * Enable mouse events for the screen and optionally an element (automatically called when a form of
+ * on('mouse') is bound).
+ */
+ enableMouse(el: BlessedElement): void;
+ enableMouse(): void;
+ /**
+ * Enable keypress events for the screen and optionally an element (automatically called when a form of
+ * on('keypress') is bound).
+ */
+ enableKeys(el: BlessedElement): void;
+ enableKeys(): void;
+ /**
+ * Enable key and mouse events. Calls bot enableMouse and enableKeys.
+ */
+ enableInput(el: BlessedElement): void;
+ enableInput(): void;
+ /**
+ * Attempt to copy text to clipboard using iTerm2's proprietary sequence. Returns true if successful.
+ */
+ copyToClipboard(text: string): void;
+ /**
+ * Attempt to change cursor shape. Will not work in all terminals (see artificial cursors for a solution
+ * to this). Returns true if successful.
+ */
+ cursorShape(shape: boolean, blink: boolean): any;
+ /**
+ * Attempt to change cursor color. Returns true if successful.
+ */
+ cursorColor(color: string): void;
+ /**
+ * Attempt to reset cursor. Returns true if successful.
+ */
+ cursorReset(): void;
+ /**
+ * Take an SGR screenshot of the screen within the region. Returns a string containing only
+ * characters and SGR codes. Can be displayed by simply echoing it in a terminal.
+ */
+ screenshot(xi: number, xl: number, yi: number, yl: number): string;
+ screenshot(): void;
+ /**
+ * Destroy the screen object and remove it from the global list. Also remove all global events relevant
+ * to the screen object. If all screen objects are destroyed, the node process is essentially reset
+ * to its initial state.
+ */
+ destroy(): void;
+ /**
+ * Reset the terminal to term. Reloads terminfo.
+ */
+ setTerminal(term: string): void;
+ }
+
+ export interface Padding {
+ left?: number;
+ right?: number;
+ top?: number;
+ bottom?: number;
+ }
+
+ export class PositionCoords {
+ xi: number;
+ xl: number;
+ yi: number;
+ yl: number;
+ }
+
+ export interface Position {
+ left: number | string;
+ right: number | string;
+ top: number | string;
+ bottom: number | string;
+ }
+
+ export interface Border {
+ /**
+ * Type of border (line or bg). bg by default.
+ */
+ type?: "line" | "bg";
+ /**
+ * Character to use if bg type, default is space.
+ */
+ ch?: string;
+ /**
+ * Border foreground and background, must be numbers (-1 for default).
+ */
+ bg?: number;
+ fg?: number;
+ /**
+ * Border attributes.
+ */
+ bold?: string;
+ underline?: string;
+ }
+
+ export interface ElementOptions extends INodeOptions {
+ tags?: boolean;
+
+ fg?: string;
+ bg?: string;
+ bold?: string;
+ underline?: string;
+
+ style?: any;
+ /**
+ * Border object, see below.
+ */
+ border?: Border | "line" | "bg";
+ /**
+ * Element's text content.
+ */
+ content?: string;
+ /**
+ * Element is clickable.
+ */
+ clickable?: boolean;
+ /**
+ * Element is focusable and can receive key input.
+ */
+ input?: boolean;
+ keyable?: boolean;
+ /**
+ * Element is focused.
+ */
+ focused?: BlessedElement;
+ /**
+ * Whether the element is hidden.
+ */
+ hidden?: boolean;
+ /**
+ * A simple text label for the element.
+ */
+ label?: string;
+ /**
+ * A floating text label for the element which appears on mouseover.
+ */
+ hoverText?: string;
+ /**
+ * Text alignment: left, center, or right.
+ */
+ align?: "left" | "center" | "right";
+ /**
+ * Vertical text alignment: top, middle, or bottom.
+ */
+ valign?: "top" | "middle" | "bottom";
+ /**
+ * Shrink/flex/grow to content and child elements. Width/height during render.
+ */
+ shrink?: boolean;
+ /**
+ * Amount of padding on the inside of the element. Can be a number or an object containing
+ * the properties: left, right, top, and bottom.
+ */
+ padding?: number | Padding;
+
+ top?: Types.TTopLeft;
+ left?: Types.TTopLeft;
+ right?: Types.TPosition;
+ bottom?: Types.TPosition;
+
+ /**
+ * Width/height of the element, can be a number, percentage (0-100%), or keyword (half or shrink).
+ * Percentages can also have offsets (50%+1, 50%-1).
+ */
+ width?: number | string;
+ /**
+ * Offsets of the element relative to its parent. Can be a number, percentage (0-100%), or
+ * keyword (center). right and bottom do not accept keywords. Percentages can also have
+ * offsets (50%+1, 50%-1).
+ */
+ height?: number | string;
+ /**
+ * Can contain the above options.
+ */
+ position?: Position;
+ /**
+ * Whether the element is scrollable or not.
+ */
+ scrollable?: boolean;
+ /**
+ * Background character (default is whitespace ).
+ */
+ ch?: string;
+ /**
+ * Allow the element to be dragged with the mouse.
+ */
+ draggable?: boolean;
+ /**
+ * Draw a translucent offset shadow behind the element.
+ */
+ shadow?: boolean;
+ }
+
+ export interface Coords {
+ xl: number;
+ xi: number;
+ yl: number;
+ yi: number;
+ base: number;
+ _contentEnd: {x: number; y: number;};
+ notop: Types.TTopLeft;
+ noleft: Types.TTopLeft;
+ noright: Types.TPosition;
+ nobot: Types.TPosition;
+ }
+
+ export interface LabelOptions {
+ text: string;
+ side: Types.TAlign;
+ }
+
+ // TODO: scrollable - Note: If the scrollable option is enabled, Element inherits all methods from ScrollableBox.
+ export abstract class BlessedElement extends NodeWithEvents implements IHasOptions {
+ constructor(opts: ElementOptions);
+
+ // ** properties ** //
+
+ /**
+ * Original options object.
+ */
+ options: ElementOptions;
+ /**
+ * Name of the element. Useful for form submission.
+ */
+ name: string;
+ /**
+ * Border object.
+ */
+ border: Border;
+
+ style: any;
+ position: Position;
+ content: string;
+ hidden: boolean;
+ visible: boolean;
+ detached: boolean;
+ /**
+ * Border foreground and background, must be numbers (-1 for default).
+ */
+ bg: number;
+ fg: number;
+ /**
+ * Border attributes.
+ */
+ bold: string;
+ underline: string;
+ /**
+ * Calculated width.
+ */
+ width: number | string;
+ /**
+ * Calculated height.
+ */
+ height: number | string;
+ /**
+ * Calculated relative top offset.*/
+ top: Types.TTopLeft;
+ /**
+ * Calculated relative left offset.
+ */
+ left: Types.TTopLeft;
+ /**
+ * Calculated relative right offset.
+ */
+ right: Types.TPosition;
+ /**
+ * Calculated relative bottom offset.
+ */
+ bottom: Types.TPosition;
+ /**
+ * Calculated absolute top offset.
+ */
+ atop: Types.TTopLeft;
+ /**
+ * Calculated absolute left offset.
+ */
+ aleft: Types.TTopLeft;
+ /**
+ * Calculated absolute right offset.
+ */
+ aright: Types.TPosition;
+ /**
+ * Calculated absolute bottom offset.
+ */
+ abottom: Types.TPosition;
+
+ /**
+ * Whether the element is draggable. Set to true to allow dragging.
+ */
+ draggable: boolean;
+
+ itop: Types.TTopLeft;
+ ileft: Types.TTopLeft;
+ iheight: Types.TPosition;
+ iwidth: Types.TPosition;
+
+ /**
+ * Calculated relative top offset.
+ */
+ rtop: Types.TTopLeft;
+ /**
+ * Calculated relative left offset.
+ */
+ rleft: Types.TTopLeft;
+ /**
+ * Calculated relative right offset.
+ */
+ rright: Types.TPosition;
+ /**
+ * Calculated relative bottom offset.
+ */
+ rbottom: Types.TPosition;
+
+ lpos: PositionCoords;
+
+ // ** methods ** //
+
+ /**
+ * Write content and children to the screen buffer.
+ */
+ render(): Coords;
+ /**
+ * Hide element.*/
+ hide(): void;
+ /**
+ * Show element.
+ */
+ show(): void;
+ /**
+ * Toggle hidden/shown.
+ */
+ toggle(): void;
+ /**
+ * Focus element.
+ */
+ focus(): void;
+ /**
+ * Same asel.on('screen', ...) except this will automatically keep track of which listeners
+ * are bound to the screen object. For use with removeScreenEvent(), free(), and destroy().
+ */
+ onScreenEvent(type: string, handler: Function): void;
+ /**
+ * Same asel.removeListener('screen', ...) except this will automatically keep track of which
+ * listeners are bound to the screen object. For use with onScreenEvent(), free(), and destroy().
+ */
+ removeScreenEvent(type: string, handler: Function): void;
+ /**
+ * Free up the element. Automatically unbind all events that may have been bound to the screen
+ * object. This prevents memory leaks. For use with onScreenEvent(), removeScreenEvent(),
+ * and destroy().
+ */
+ free(): void;
+ /**
+ * Same as the detach() method, except this will automatically call free() and unbind any screen
+ * events to prevent memory leaks. for use with onScreenEvent(), removeScreenEvent(), and free().
+ */
+ destroy(): void;
+ /**
+ * Set the z-index of the element (changes rendering order).
+ */
+ setIndex(z: number): void;
+ /**
+ * Put the element in front of its siblings.*/
+ setFront(): void;
+ /**
+ * Put the element in back of its siblings.
+ */
+ setBack(): void;
+ /**
+ * text/options - Set the label text for the top-left corner. Example options: {text:'foo',side:'left'}
+ */
+ setLabel(arg: string | LabelOptions): void;
+ /**
+ * Remove the label completely.
+ */
+ removeLabel(): any;
+ /**
+ * text/options - Set a hover text box to follow the cursor. Similar to the "title" DOM attribute
+ * in the browser. Example options: {text:'foo'}
+ */
+ setHover(arg: string | LabelOptions): void;
+ /**
+ * Remove the hover label completely.
+ */
+ removeHover(): void;
+ /**
+ * Enable mouse events for the element (automatically called when a form of on('mouse') is bound).
+ */
+ enableMouse(): void;
+ /**
+ * Enable keypress events for the element (automatically called when a form of on('keypress') is bound).
+ */
+ enableKeys(): void;
+ /**
+ * Enable key and mouse events. Calls bot enableMouse and enableKeys.
+ */
+ enableInput(): void;
+ /**
+ * Enable dragging of the element.
+ */
+ enableDrag(): void;
+ /**
+ * Disable dragging of the element.
+ */
+ disableDrag(): void;
+ /**
+ * Take an SGR screenshot of the screen within the region. Returns a string containing only
+ * characters and SGR codes. Can be displayed by simply echoing it in a terminal.
+ */
+ screenshot(xi: number, xl: number, yi: number, yl: number): string;
+ screenshot(): void;
+
+ /*
+ Content Methods
+
+ Methods for dealing with text content, line by line. Useful for writing a text editor,
+ irc client, etc.
+
+ Note: All of these methods deal with pre-aligned, pre-wrapped text. If you use deleteTop()
+ on a box with a wrapped line at the top, it may remove 3-4 "real" lines (rows) depending
+ on how long the original line was.
+
+ The lines parameter can be a string or an array of strings. The line parameter must
+ be a string.
+ */
+
+ /**
+ * Set the content. Note: When text is input, it will be stripped of all non-SGR
+ * escape codes, tabs will be replaced with 8 spaces, and tags will be replaced
+ * with SGR codes (if enabled).
+ */
+ setContent(text: string): void;
+ /**
+ * Return content, slightly different from el.content. Assume the above formatting.
+ */
+ getContent(): string;
+ /**
+ * Similar to setContent, but ignore tags and remove escape codes.
+ */
+ setText(text: string): void;
+ /**
+ * Similar to getContent, but return content with tags and escape codes removed.
+ */
+ getText(): string;
+ /**
+ * Insert a line into the box's content.
+ */
+ insertLine(i: number, lines: string | string[]): void;
+ /**
+ * Delete a line from the box's content.
+ */
+ deleteLine(i: number): void;
+ /**
+ * Get a line from the box's content.
+ */
+ getLine(i: number): string;
+ /**
+ * Get a line from the box's content from the visible top.
+ */
+ getBaseLine(i: number): string;
+ /**
+ * Set a line in the box's content.
+ */
+ setLine(i: number, line: string | string[]): void;
+ /**
+ * Set a line in the box's content from the visible top.
+ */
+ setBaseLine(i: number, line: string | string[]): void;
+ /**
+ * Clear a line from the box's content.
+ */
+ clearLine(i: number): void;
+ /**
+ * Clear a line from the box's content from the visible top.
+ */
+ clearBaseLine(i: number): void;
+ /**
+ * Insert a line at the top of the box.
+ */
+ insertTop(lines: string | string[]): void;
+ /**
+ * Insert a line at the bottom of the box.
+ */
+ insertBottom(lines: string | string[]): void;
+ /**
+ * Delete a line at the top of the box.
+ */
+ deleteTop(): void;
+ /**
+ * Delete a line at the bottom of the box.
+ */
+ deleteBottom(): void;
+ /**
+ * Unshift a line onto the top of the content.
+ */
+ unshiftLine(lines: string | string[]): void;
+ /**
+ * Shift a line off the top of the content.
+ */
+ shiftLine(i: number): void;
+ /**
+ * Push a line onto the bottom of the content.
+ */
+ pushLine(lines: string | string[]): void;
+ /**
+ * Pop a line off the bottom of the content.
+ */
+ popLine(i: number): string;
+ /**
+ * An array containing the content lines.
+ */
+ getLines(): string[];
+ /**
+ * An array containing the lines as they are displayed on the screen.
+ */
+ getScreenLines(): string[];
+ /**
+ * Get a string's displayed width, taking into account double-width, surrogate pairs,
+ * combining characters, tags, and SGR escape codes.
+ */
+ strWidth(text: string): string;
+
+ // ** events ** //
+ }
+
+ export interface ScrollableBoxOptions extends ElementOptions {
+ /**
+ * A limit to the childBase. Default is Infinity.
+ */
+ baseLimit?: number;
+ /**
+ * A option which causes the ignoring of childOffset. This in turn causes the
+ * childBase to change every time the element is scrolled.
+ */
+ alwaysScroll?: boolean;
+ /**
+ * Object enabling a scrollbar.
+ * Style of the scrollbar track if present (takes regular style options).
+ */
+ scrollbar?: { style?: any; track?: any; ch?: string; }
+ }
+
+ export interface ScrollableTextOptions extends ScrollableBoxOptions {
+ /**
+ * Whether to enable automatic mouse support for this element.
+ * Use pre-defined mouse events (right-click for editor).
+ */
+ mouse?: boolean | (() => void);
+ /**
+ * Use pre-defined keys (i or enter for insert, e for editor, C-e for editor while inserting).
+ */
+ keys?: string | string[] | boolean;
+ /**
+ * Use vi keys with the keys option.
+ */
+ vi?: boolean;
+ }
+
+ export interface BoxOptions extends ScrollableTextOptions {
+ bindings?: any;
+ }
+
+ /**
+ * DEPRECATED - Use Box with the scrollable option instead. A box with scrollable content.
+ */
+ export class ScrollableBoxElement extends BlessedElement {
+ /**
+ * The offset of the top of the scroll content.
+ */
+ childBase: number;
+ /**
+ * The offset of the chosen item/line.
+ */
+ childOffset: number;
+
+ /**
+ * Scroll the content by a relative offset.
+ */
+ scroll(offset: number, always?: boolean): void;
+ /**
+ * Scroll the content to an absolute index.
+ */
+ scrollTo(index: number): void;
+ /**
+ * Same as scrollTo.
+ */
+ setScroll(index: number): void;
+ /**
+ * Set the current scroll index in percentage (0-100).
+ */
+ setScrollPerc(perc: number): void;
+ /**
+ * Get the current scroll index in lines.
+ */
+ getScroll(): void;
+ /**
+ * Get the actual height of the scrolling area.
+ */
+ getScrollHeight(): void;
+ /**
+ * Get the current scroll index in percentage.
+ */
+ getScrollPerc(): void;
+ /**
+ * Reset the scroll index to its initial state.
+ */
+ resetScroll(): void;
+
+ on(event: string, listener: Function): this;
+ /**
+ * Received when the element is scrolled.
+ */
+ on(event: "scroll", callback: () => void): this;
+ }
+
+ /**
+ * DEPRECATED - Use Box with the scrollable and alwaysScroll options instead.
+ * A scrollable text box which can display and scroll text, as well as handle
+ * pre-existing newlines and escape codes.
+ */
+ export class ScrollableTextElement extends ScrollableBoxElement {
+ }
+
+ /**
+ * A box element which draws a simple box containing content or other elements.
+ */
+ export class BoxElement extends ScrollableTextElement implements IHasOptions {
+ constructor(opts: BoxOptions);
+
+ /**
+ * Original options object.
+ */
+ options: BoxOptions;
+ }
+
+ export interface TextOptions extends ElementOptions {
+ /**
+ * Fill the entire line with chosen bg until parent bg ends, even if there
+ * is not enough text to fill the entire width.
+ */
+ fill?: boolean;
+ /**
+ * Text alignment: left, center, or right.
+ */
+ align?: Types.TAlign;
+ }
+
+ /**
+ * An element similar to Box, but geared towards rendering simple text elements.
+ */
+ export class TextElement extends BlessedElement implements IHasOptions {
+ constructor(opts: TextOptions);
+
+ /**
+ * Original options object.
+ */
+ options: TextOptions;
+ }
+
+ /**
+ * A simple line which can be line or bg styled.
+ */
+ export interface LineOptions extends BoxOptions {
+ /**
+ * Can be vertical or horizontal.
+ */
+ orientation?: "vertical" | "horizontal";
+ /**
+ * Treated the same as a border object. (attributes can be contained in style).
+ */
+ type?: string;
+ bg?: string;
+ fg?: string;
+ ch?: string;
+ }
+
+ /**
+ * A simple line which can be line or bg styled.
+ */
+ export class LineElement extends BoxElement implements IHasOptions {
+ constructor(opts: LineOptions);
+
+ /**
+ * Original options object.
+ */
+ options: LineOptions;
+ }
+
+ export interface BigTextOptions extends BoxOptions {
+ /**
+ * bdf->json font file to use (see ttystudio for instructions on compiling BDFs to JSON).
+ */
+ font?: string;
+ /**
+ * bdf->json bold font file to use (see ttystudio for instructions on compiling BDFs to JSON).
+ */
+ fontBold?: string;
+ /**
+ * foreground character. (default: ' ')
+ */
+ fch?: string;
+ }
+
+ /**
+ * A box which can render content drawn as 8x14 cell characters using the terminus font.
+ */
+ export class BigTextElement extends BoxElement implements IHasOptions {
+ constructor(opts: BigTextOptions);
+
+ /**
+ * Original options object.
+ */
+ options: BigTextOptions;
+ }
+
+ export interface ListElementStyle {
+ selected?: any;
+ item?: any;
+ }
+
+ export interface ListOptions extends BoxOptions {
+ /**
+ * Style for a selected item. Style for an unselected item.
+ */
+ style?: TStyle;
+ /**
+ * An array of strings which become the list's items.
+ */
+ items?: string[];
+ /**
+ * A function that is called when vi mode is enabled and the key / is pressed. This function accepts a
+ * callback function which should be called with the search string. The search string is then used to
+ * jump to an item that is found in items.
+ */
+ search?: () => void;
+ /**
+ * Whether the list is interactive and can have items selected (Default: true).
+ */
+ interactive?: boolean;
+ /**
+ * Whether to automatically override tags and invert fg of item when selected (Default: true).
+ */
+ invertSelected?: boolean;
+ }
+
+ export class ListElement extends BoxElement implements IHasOptions> {
+ constructor(opts: ListOptions);
+
+ /**
+ * Original options object.
+ */
+ options: ListOptions;
+
+ /**
+ * Add an item based on a string.
+ */
+ add(text: string): void;
+ /**
+ * Add an item based on a string.
+ */
+ addItem(text: string): void;
+ /**
+ * Removes an item from the list. Child can be an element, index, or string.
+ */
+ removeItem(child: BlessedElement): BlessedElement;
+ /**
+ * Push an item onto the list.
+ * */
+ pushItem(child: BlessedElement): number;
+ /**
+ * Pop an item off the list.
+ * */
+ popItem(): BlessedElement;
+ /**
+ * Unshift an item onto the list.
+ */
+ unshiftItem(child: BlessedElement): number;
+ /**
+ * Shift an item off the list.
+ * */
+ shiftItem(): BlessedElement;
+ /**
+ * Inserts an item to the list. Child can be an element, index, or string.
+ */
+ insertItem(i: number, child: BlessedElement): void;
+ /**
+ * Returns the item element. Child can be an element, index, or string.
+ */
+ getItem(child: BlessedElement): BlessedElement;
+ /**
+ * Set item to content.
+ */
+ setItem(child: BlessedElement, content: BlessedElement | string): void;
+ /**
+ * Remove and insert items to the list.
+ * */
+ spliceItem(i: number, n: number, ...items: BlessedElement[]): void;
+ /**
+ * Clears all items from the list.
+ * */
+ clearItems(): void;
+ /**
+ * Sets the list items to multiple strings.
+ */
+ setItems(items: BlessedElement[]): void;
+ /**
+ * Returns the item index from the list. Child can be an element, index, or string.
+ */
+ getItemIndex(child: BlessedElement): number;
+ /**
+ * Select an index of an item.
+ * */
+ select(index: number): void;
+ /**
+ * Select item based on current offset.
+ * */
+ move(offset: number): void;
+ /**
+ * Select item above selected.
+ * */
+ up(amount: number): void;
+ /**
+ * Select item below selected.
+ */
+ down(amount: number): void;
+ /**
+ * Show/focus list and pick an item. The callback is executed with the result.
+ */
+ pick(callback: () => void): void;
+ /**
+ * Find an item based on its text content.
+ */
+ fuzzyFind(arg: string | RegExp | (() => void)): void;
+
+ // ** events ** //
+
+ on(event: string, listener: Function): this;
+ /**
+ * Received when an item is selected.
+ */
+ on(event: "select", callback: (item: BoxElement, index: number) => void): this;
+ /**
+ * List was canceled (when esc is pressed with the keys option).
+ */
+ on(event: "cancel", callback: () => void): this;
+ /**
+ * Either a select or a cancel event was received.
+ */
+ on(event: "action", callback: () => void): this;
+
+ on(event: "create item", callback: () => void): this;
+ on(event: "add item", callback: () => void): this;
+ on(event: "remove item", callback: () => void): this;
+ on(event: "insert item", callback: () => void): this;
+ on(event: "set items", callback: () => void): this;
+ on(event: "select item", callback: (item: BlessedElement, index: number) => void): this;
+ }
+
+ export interface FileManagerOptions extends ListOptions {
+ /**
+ * Current working directory.
+ */
+ cwd?: string;
+ }
+
+ export class FileManagerElement extends ListElement implements IHasOptions {
+ constructor(opts: FileManagerOptions);
+
+ /**
+ * Original options object.
+ */
+ options: FileManagerOptions;
+ /**
+ * Current working directory.
+ */
+ cwd: string;
+
+ /**
+ * Refresh the file list (perform a readdir on cwd and update the list items).
+ */
+ refresh(cwd:string, callback: () => void): void;
+ refresh(callback: () => void): void;
+ refresh(): void;
+ /**
+ * Pick a single file and return the path in the callback.
+ */
+ pick(cwd:string, callback: () => void): void;
+ pick(callback: () => void): void;
+ /**
+ * Reset back to original cwd.
+ */
+ reset(cwd:string, callback: () => void): void;
+ reset(callback: () => void): void;
+ reset(): void;
+
+ // ** events ** //
+
+ on(event: string, listener: Function): this;
+ /**
+ * Received when an item is selected.
+ */
+ on(event: "cd", callback: (file: string, cwd: string) => void): this;
+ /**
+ * Received when an item is selected.
+ */
+ on(event: "file", callback: (file: string) => void): this;
+
+ on(event: "error", callback: (err: any, file: string) => void): this;
+ on(event: "refresh", callback: () => void): this;
+ }
+
+ export interface StyleListTable extends ListElementStyle {
+ /**
+ * Header style.
+ */
+ header?: any;
+ /**
+ * Cell style.
+ */
+ cell?: any;
+ }
+
+ export interface ListTableOptions extends ListOptions {
+ /**
+ * Array of array of strings representing rows.
+ */
+ rows?: string[];
+ data?: string[][];
+ /**
+ * Spaces to attempt to pad on the sides of each cell. 2 by default: one space on each side
+ * (only useful if the width is shrunken).
+ */
+ pad?: number;
+ /**
+ * Do not draw inner cells.
+ */
+ noCellBorders?: boolean;
+
+ style?: StyleListTable;
+ }
+
+ export class ListTableElement extends ListElement implements IHasOptions {
+ constructor(opts: ListTableOptions);
+
+ /**
+ * Original options object.
+ */
+ options: ListTableOptions;
+
+ /**
+ * Set rows in table. Array of arrays of strings.
+ * @example:
+ *
+ * table.setData([
+ [ 'Animals', 'Foods' ],
+ [ 'Elephant', 'Apple' ],
+ [ 'Bird', 'Orange' ]
+ ]);
+ */
+ setRows(rows: string[][]): void;
+ /**
+ * Set rows in table. Array of arrays of strings.
+ * @example:
+ *
+ * table.setData([
+ [ 'Animals', 'Foods' ],
+ [ 'Elephant', 'Apple' ],
+ [ 'Bird', 'Orange' ]
+ ]);
+ */
+ setData(rows: string[][]): void;
+ }
+
+ export interface ListbarOptions extends BoxOptions {
+ style?: ListElementStyle;
+ /**
+ * Set buttons using an object with keys as titles of buttons, containing of objects
+ * containing keys of keys and callback.
+ */
+ commands: Types.ListbarCommand[];
+ items: Types.ListbarCommand[];
+ /**
+ * Automatically bind list buttons to keys 0-9.
+ */
+ autoCommandKeys: boolean;
+ }
+
+ export class ListbarElement extends BoxElement implements IHasOptions {
+ constructor(opts: ListbarOptions);
+
+ /**
+ * Original options object.
+ */
+ options: ListbarOptions;
+
+ /**
+ * Set commands (see commands option above).
+ */
+ setItems(commands: Types.ListbarCommand[]): void;
+ /**
+ * Append an item to the bar.
+ */
+ add(item: Types.ListbarCommand, callback: () => void): void;
+ /**
+ * Append an item to the bar.
+ */
+ addItem(item: Types.ListbarCommand, callback: () => void): void;
+ /**
+ * Append an item to the bar.
+ */
+ appendItem(item: Types.ListbarCommand, callback: () => void): void;
+ /**
+ * Select an item on the bar.
+ */
+ select(offset: number): void;
+ /**
+ * Remove item from the bar.
+ */
+ removeItem(child: BlessedElement): void;
+ /**
+ * Move relatively across the bar.
+ */
+ move(offset: number): void;
+ /**
+ * Move left relatively across the bar.
+ */
+ moveLeft(offset: number): void;
+ /**
+ * Move right relatively across the bar.
+ */
+ moveRight(offset: number): void;
+ /**
+ * Select button and execute its callback.
+ */
+ selectTab(index: number): void;
+
+ // ** events ** //
+
+ on(event: string, listener: Function): this;
+
+ on(event: "set items", callback: () => void): this;
+ on(event: "remove item", callback: () => void): this;
+ on(event: "select tab", callback: () => void): this;
+ }
+
+ export interface FormOptions extends BoxOptions {
+ /**
+ * Allow default keys (tab, vi keys, enter).
+ */
+ keys?: any;
+ /**
+ * Allow vi keys.
+ */
+ vi?: boolean;
+ }
+
+ export class FormElement extends BoxElement implements IHasOptions {
+ constructor(opts: FormOptions);
+
+ /**
+ * Original options object.
+ */
+ options: FormOptions;
+ /**
+ * Last submitted data.
+ */
+ submission: TFormData;
+
+ /**
+ * Focus next form element.
+ */
+ focusNext(): void;
+ /**
+ * Focus previous form element.
+ */
+ focusPrevious(): void;
+ /**
+ * Submit the form.
+ */
+ submit(): void;
+ /**
+ * Discard the form.
+ */
+ cancel(): void;
+ /**
+ * Clear the form.
+ */
+ reset(): void;
+
+ // ** events ** //
+
+ on(event: string, listener: Function): this;
+ /**
+ * Form is submitted. Receives a data object.
+ */
+ on(event: "submit", callback: (out: TFormData) => void): this;
+ /**
+ * Form is discarded.
+ */
+ on(event: "cancel", callback: () => void): this;
+ /**
+ * Form is cleared.
+ */
+ on(event: "reset", callback: () => void): this;
+ }
+
+ export interface InputOptions extends BoxOptions { }
+
+ export abstract class InputElement extends BoxElement {
+ constructor(opts: InputOptions);
+ }
+
+ /**
+ * A box which allows multiline text input.
+ */
+ export interface TextareaOptions extends InputOptions {
+ /**
+ * Call readInput() when the element is focused. Automatically unfocus.
+ */
+ inputOnFocus?: boolean;
+ }
+
+ export class TextareaElement extends InputElement implements IHasOptions {
+ constructor(opts: TextareaOptions);
+
+ /**
+ * Original options object.
+ */
+ options: TextareaOptions;
+
+ /**
+ * The input text. read-only.
+ */
+ value: string;
+
+ /**
+ * Submit the textarea (emits submit).
+ */
+ submit(): void;
+ /**
+ * Cancel the textarea (emits cancel).
+ */
+ cancel(): void;
+ /**
+ * Grab key events and start reading text from the keyboard. Takes a callback which receives
+ * the final value.
+ */
+ readInput(callback?: (err: any, value?: string) => void): void;
+ /**
+ * Grab key events and start reading text from the keyboard. Takes a callback which receives
+ * the final value.
+ */
+ input(callback: (err: any, value?: string) => void): void;
+ /**
+ * Grab key events and start reading text from the keyboard. Takes a callback which receives
+ * the final value.
+ */
+ setInput(callback: (err: any, value?: string) => void): void;
+ /**
+ * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which
+ * receives the final value.
+ */
+ readEditor(callback: (err: any, value?: string) => void): void;
+ /**
+ * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which
+ * receives the final value.
+ */
+ editor(callback: (err: any, value?: string) => void): void;
+ /**
+ * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which
+ * receives the final value.
+ */
+ setEditor(callback: (err: any, value?: string) => void): void;
+ /**
+ * The same as this.value, for now.
+ */
+ getValue(): string;
+ /**
+ * Clear input.
+ */
+ clearValue(): void;
+ /**
+ * Set value.
+ */
+ setValue(text: string): void;
+
+ // ** events ** //
+
+ on(event: string, listener: Function): this;
+
+ on(event: "error", callback: (err: any) => void): this;
+
+ /**
+ * Value is submitted (enter).
+ */
+ on(event: "submit", callback: (value: any) => void): this;
+ /**
+ * Value is discared (escape).
+ */
+ on(event: "cancel", callback: (value: any) => void): this;
+ /**
+ * Either submit or cancel.
+ */
+ on(event: "action", callback: (value: any) => void): this;
+ }
+
+ export interface TextboxOptions extends TextareaOptions {
+ /**
+ * Completely hide text.
+ */
+ secret?: boolean;
+ /**
+ * Replace text with asterisks (*).
+ */
+ censor?: boolean;
+ }
+
+ export class TextboxElement extends TextareaElement implements IHasOptions {
+ constructor(opts: TextboxOptions);
+
+ /**
+ * Original options object.
+ */
+ options: TextboxOptions;
+
+ /**
+ * Completely hide text.
+ */
+ secret: boolean;
+ /**
+ * Replace text with asterisks (*).
+ */
+ censor: boolean;
+ }
+
+ export interface ButtonOptions extends BoxOptions { }
+
+ export class ButtonElement extends InputElement implements IHasOptions {
+ constructor(opts: ButtonOptions);
+
+ /**
+ * Original options object.
+ */
+ options: ButtonOptions;
+
+ /**
+ * Press button. Emits press.
+ */
+ press(): void;
+
+ on(event: string, listener: Function): this;
+
+ on(event: "press", callback: () => void): this;
+ }
+
+ export interface CheckboxOptions extends BoxOptions {
+ /**
+ * whether the element is checked or not.
+ * */
+ checked?: boolean;
+ /**
+ * enable mouse support.
+ * */
+ mouse?: boolean;
+ }
+
+ /**
+ * A checkbox which can be used in a form element.
+ * */
+ export class CheckboxElement extends InputElement implements IHasOptions {
+ constructor(options?: CheckboxOptions);
+
+ /**
+ * Original options object.
+ */
+ options: CheckboxOptions;
+
+ /**
+ * the text next to the checkbox (do not use setcontent, use `check.text = ''`).
+ * */
+ text: string;
+ /**
+ * whether the element is checked or not.
+ * */
+ checked: boolean;
+ /**
+ * same as `checked`.
+ * */
+ value: boolean;
+
+ /**
+ * check the element.
+ * */
+ check(): void;
+ /**
+ * uncheck the element.
+ * */
+ uncheck(): void;
+ /**
+ * toggle checked state.
+ * */
+ toggle(): void;
+ }
+
+ export interface RadioSetOptions extends BoxOptions { }
+
+ /**
+ * An element wrapping RadioButtons. RadioButtons within this element will be mutually exclusive
+ * with each other.
+ * */
+ export abstract class RadioSetElement extends BoxElement {
+ constructor(opts: RadioSetOptions);
+ }
+
+ export interface RadioButtonOptions extends BoxOptions { }
+
+ /**
+ * A radio button which can be used in a form element.
+ */
+ export abstract class RadioButtonElement extends CheckboxElement {
+ constructor(opts: RadioButtonOptions);
+ }
+
+ export interface PromptOptions extends BoxOptions { }
+
+ /**
+ * A prompt box containing a text input, okay, and cancel buttons (automatically hidden).
+ */
+ export class PromptElement extends BoxElement implements IHasOptions {
+ constructor(opts: PromptOptions);
+
+ options: PromptOptions;
+
+ /**
+ * Show the prompt and wait for the result of the textbox. Set text and initial value.
+ */
+ input(text: string, value: string, callback: (err: any, value: string) => void): void;
+ setInput(text: string, value: string, callback: (err: any, value: string) => void): void;
+ readInput(text: string, value: string, callback: (err: any, value: string) => void): void;
+ }
+
+ export interface QuestionOptions extends BoxOptions { }
+
+ /**
+ * A question box containing okay and cancel buttons (automatically hidden).
+ */
+ export class QuestionElement extends BoxElement implements IHasOptions {
+ constructor(opts: QuestionOptions);
+
+ options: QuestionOptions;
+
+ /**
+ * Ask a question. callback will yield the result.
+ */
+ ask(question: string, callback: (err: any, value: string) => void): void;
+ }
+
+ export interface MessageOptions extends BoxOptions { }
+
+ /**
+ * A box containing a message to be displayed (automatically hidden).
+ */
+ export class MessageElement extends BoxElement implements IHasOptions {
+ constructor(opts: MessageOptions);
+
+ options: MessageOptions;
+
+ /**
+ * Display a message for a time (default is 3 seconds). Set time to 0 for a perpetual message that is dismissed on keypress.
+ */
+ log(text: string, time: number, callback: (err: any) => void): void;
+ log(text: string, callback: (err: any) => void): void;
+ display(text: string, time: number, callback: (err: any) => void): void;
+ display(text: string, callback: (err: any) => void): void;
+
+ /**
+ * Display an error in the same way.
+ */
+ error(text: string, time: number, callback: () => void): void;
+ error(text: string, callback: () => void): void;
+ }
+
+ export interface LoadingOptions extends BoxOptions { }
+
+ /**
+ * A box with a spinning line to denote loading (automatically hidden).
+ */
+ export class LoadingElement extends BoxElement implements IHasOptions {
+ constructor(opts: LoadingOptions);
+
+ options: LoadingOptions;
+
+ /**
+ * Display the loading box with a message. Will lock keys until stop is called.
+ */
+ load(text: string): void;
+ /**
+ * Hide loading box. Unlock keys.
+ */
+ stop(): void;
+ }
+
+ export interface ProgressBarOptions extends BoxOptions {
+ /**
+ * can be `horizontal` or `vertical`.
+ * */
+ orientation: string;
+ /**
+ * the character to fill the bar with (default is space).
+ * */
+ pch: string;
+ /**
+ * the amount filled (0 - 100).
+ * */
+ filled: number;
+ /**
+ * same as `filled`.
+ * */
+ value: number;
+ /**
+ * enable key support.
+ * */
+ keys: boolean;
+ /**
+ * enable mouse support.
+ * */
+ mouse: boolean;
+ }
+
+ /**
+ * A progress bar allowing various styles. This can also be used as a form input.
+ */
+ export class ProgressBarElement extends InputElement implements IHasOptions {
+ constructor(options?: ProgressBarOptions);
+
+ options: ProgressBarOptions;
+
+ /**
+ * progress the bar by a fill amount.
+ * */
+ progress(amount:number): void;
+ /**
+ * set progress to specific amount.
+ * */
+ setProgress(amount:number): void;
+ /**
+ * reset the bar.
+ * */
+ reset(): void;
+
+ on(event: string, listener: Function): this;
+ /**
+ * Bar was reset.
+ */
+ on(event: "reset", callback: () => void): this;
+ /**
+ * Bar has completely filled.
+ */
+ on(event: "complete", callback: () => void): this;
+ }
+
+ export interface LogOptions extends ScrollableTextOptions {
+ /**
+ * amount of scrollback allowed. default: Infinity.
+ * */
+ scrollback?: number;
+ /**
+ * scroll to bottom on input even if the user has scrolled up. default: false.
+ * */
+ scrollOnInput?: boolean;
+ }
+
+ /**
+ * A log permanently scrolled to the bottom.
+ * */
+ export class Log extends ScrollableTextElement implements IHasOptions {
+ constructor(options?: LogOptions);
+
+ options: LogOptions;
+
+ /**
+ * amount of scrollback allowed. default: Infinity.
+ * */
+ scrollback: number;
+ /**
+ * scroll to bottom on input even if the user has scrolled up. default: false.
+ * */
+ scrollOnInput: boolean;
+
+ /**
+ * add a log line.
+ * */
+ log(text:string): void;
+ /**
+ * add a log line.
+ * */
+ add(text:string): void;
+ }
+
+ export interface TableOptions extends BoxOptions {
+ /**
+ * array of array of strings representing rows (same as `data`).
+ * */
+ rows?: string[][];
+ /**
+ * array of array of strings representing rows (same as `rows`).
+ * */
+ data?: string[][];
+ /**
+ * spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken).
+ * */
+ pad?: number;
+ /**
+ * do not draw inner cells.
+ * */
+ noCellBorders?: boolean;
+ /**
+ * fill cell borders with the adjacent background color.
+ * */
+ fillCellBorders?: boolean;
+ }
+
+ /**
+ * A stylized table of text elements.
+ * */
+ export class TableElement extends BoxElement implements IHasOptions {
+ constructor(opts: TableOptions);
+
+ options: TableOptions;
+
+ /**
+ * set rows in table. array of arrays of strings.
+ * */
+ setData(rows: string[][]): void;
+ /**
+ * set rows in table. array of arrays of strings.
+ * */
+ setRows(rows: string[][]): void;
+ }
+
+ export interface TerminalOptions extends BoxOptions {
+ /**
+ * handler for input data.
+ * */
+ handler?: (userInput:Buffer) => void;
+ /**
+ * name of shell. $SHELL by default.
+ * */
+ shell?:string;
+ /**
+ * args for shell.
+ * */
+ args?:any;
+ /**
+ * can be line, underline, and block.
+ * */
+ cursor?: 'line'|'underline'|'block';
+
+ terminal?: string;
+
+ /**
+ * Object for process env.
+ */
+ env?: any;
+ }
+
+ export class TerminalElement extends BoxElement implements IHasOptions {
+ constructor(opts: TerminalOptions);
+
+ options: TerminalOptions;
+
+ /**
+ * reference to the headless term.js terminal.
+ * */
+ term: any;
+ /**
+ * reference to the pty.js pseudo terminal.
+ * */
+ pty: any;
+
+ /**
+ * write data to the terminal.
+ * */
+ write(data:string): void;
+
+ /**
+ * nearly identical to `element.screenshot`, however, the specified region includes the terminal's _entire_ scrollback, rather than just what is visible on the screen.
+ * */
+ screenshot(xi?:number, xl?:number, yi?:number, yl?:number): string;
+ }
+
+ export interface ImageOptions extends BoxOptions {
+ /**
+ * path to image.
+ * */
+ file: string;
+ /**
+ * path to w3mimgdisplay. if a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary.
+ * */
+ type: "ansi" | "overlay" | "w3m";
+ }
+
+ /**
+ * Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals.
+ * */
+ export class ImageElement extends BoxElement implements IHasOptions {
+ constructor(options?: ImageOptions);
+
+ options: ImageOptions;
+ }
+
+ export interface ANSIImageOptions extends BoxOptions {
+ /**
+ * URL or path to PNG/GIF file. Can also be a buffer.
+ * */
+ file: string;
+ /**
+ * Scale cellmap down (0-1.0) from its original pixel width/height (Default: 1.0).
+ * */
+ scale: number;
+
+ /**
+ * This differs from other element's width or height in that only one of them is needed: blessed will maintain the aspect ratio of the image as it scales down to the proper number of cells. NOTE: PNG/GIF's are always automatically shrunken to size (based on scale) if a width or height is not given.
+ * */
+ width: number | string;
+ height: number | string;
+
+ /**
+ * Add various "density" ASCII characters over the rendering to give the image more detail, similar to libcaca/libcucul (the library mplayer uses to display videos in the terminal).
+ */
+ ascii: string;
+
+ /**
+ * Whether to animate if the image is an APNG/animating GIF. If false, only display the first frame or IDAT (Default: true).
+ */
+ animate: boolean;
+
+ /**
+ * Set the speed of animation. Slower: 0.0-1.0. Faster: 1-1000. It cannot go faster than 1 frame per millisecond, so 1000 is the fastest. (Default: 1.0)
+ */
+ speed: number;
+
+ /**
+ * mem or cpu. If optimizing for memory, animation frames will be rendered to bitmaps as the animation plays, using less memory. Optimizing for cpu will precompile all bitmaps beforehand, which may be faster, but might also OOM the process on large images. (Default: mem).
+ */
+ optimization: "mem" | "cpu";
+ }
+
+ /**
+ * Convert any .png file (or .gif, see below) to an ANSI image and display it as an element.
+ * */
+ export class ANSIImageElement extends BoxElement implements IHasOptions {
+ constructor(options?:ANSIImageOptions);
+
+ options: ANSIImageOptions;
+
+ /**
+ * Image object from the png reader.
+ */
+ img: Types.TImage;
+
+ /**
+ * set the image in the box to a new path.
+ * */
+ setImage(img: string, callback: () => void): void;
+ /**
+ * clear the current image.
+ * */
+ clearImage(callback: () => void): void;
+ /**
+ * Play animation if it has been paused or stopped.
+ */
+ play(): void;
+ /**
+ * Pause animation.
+ */
+ pause(): void;
+ /**
+ * Stop animation.
+ */
+ stop(): void;
+ }
+
+ export interface OverlayImageOptions extends BoxOptions {
+ /**
+ * Path to image.
+ */
+ file: string;
+ /**
+ * Render the file as ANSI art instead of using w3m to overlay Internally uses the ANSIImage element. See the ANSIImage element for more information/options. (Default: true).
+ */
+ ansi: boolean;
+ /**
+ * Path to w3mimgdisplay. If a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary.
+ */
+ w3m: string;
+ /**
+ * Whether to search /usr, /bin, and /lib for w3mimgdisplay (Default: true).
+ */
+ search: string;
+ }
+
+ /**
+ * Convert any .png file (or .gif, see below) to an ANSI image and display it as an element.
+ * */
+ export class OverlayImageElement extends BoxElement implements IHasOptions {
+ constructor(options?: OverlayImageOptions);
+
+ options: OverlayImageOptions;
+
+ /**
+ * set the image in the box to a new path.
+ * */
+ setImage(img: string, callback: () => void): void;
+ /**
+ * clear the current image.
+ * */
+ clearImage(callback: () => void): void;
+ /**
+ * get the size of an image file in pixels.
+ * */
+ imageSize(img:string, callback: () => void): void;
+ /**
+ * get the size of the terminal in pixels.
+ * */
+ termSize(callback: () => void): void;
+ /**
+ * get the pixel to cell ratio for the terminal.
+ * */
+ getPixelRatio(callback: () => void): void;
+ }
+
+ export interface VideoOptions extends BoxOptions {
+ /**
+ * Video to play.
+ */
+ file: string;
+ /**
+ * Start time in seconds.
+ */
+ start: number;
+ }
+
+ export class VideoElement extends BoxElement implements IHasOptions {
+ constructor(options?: VideoOptions);
+
+ options: VideoOptions;
+
+ /**
+ * The terminal element running mplayer or mpv.
+ */
+ tty: any;
+ }
+
+ export interface LayoutOptions extends ElementOptions {
+ /**
+ * A callback which is called right before the children are iterated over to be rendered. Should return an
+ * iterator callback which is called on each child element: iterator(el, i).
+ */
+ renderer?: () => void;
+
+ /**
+ * Using the default renderer, it provides two layouts: inline, and grid. inline is the default and will render
+ * akin to inline-block. grid will create an automatic grid based on element dimensions. The grid cells'
+ * width and height are always determined by the largest children in the layout.
+ */
+ layout: "inline" | "inline-block" | "grid";
+ }
+
+ export class LayoutElement extends BlessedElement implements IHasOptions {
+ constructor(options?: LayoutOptions);
+
+ options: LayoutOptions;
+
+ /**
+ * A callback which is called right before the children are iterated over to be rendered. Should return an
+ * iterator callback which is called on each child element: iterator(el, i).
+ */
+ renderer(coords: PositionCoords): void;
+ /**
+ * Check to see if a previous child element has been rendered and is visible on screen. This is only useful
+ * for checking child elements that have already been attempted to be rendered! see the example below.
+ */
+ isRendered(el: BlessedElement): boolean;
+ /**
+ * Get the last rendered and visible child element based on an index. This is useful for basing the position
+ * of the current child element on the position of the last child element.
+ */
+ getLast(i: number): Element;
+ /**
+ * Get the last rendered and visible child element coords based on an index. This is useful for basing the position
+ * of the current child element on the position of the last child element. See the example below.
+ */
+ getLastCoords(i: number): PositionCoords;
+ }
+
+ export class Program {
+ /**
+ Wrap the given text in terminal formatting codes corresponding to the given attribute
+ name. The `attr` string can be of the form `red fg` or `52 bg` where `52` is a 0-255
+ integer color number.
+ */
+ text (text:string, attr:string): string;
+ }
}
- export = Blessed;
+ export module widget {
+ export class Element extends Widgets.BlessedElement { }
+ export class Node extends Widgets.Node { }
+ export class Screen extends Widgets.Screen { }
+
+ export class Box extends Widgets.BoxElement { }
+ export class ScrollableBox extends Widgets.ScrollableBoxElement { }
+ export class ScrollableText extends Widgets.ScrollableTextElement { }
+ export class Text extends Widgets.BoxElement { }
+ export class Line extends Widgets.LineElement { }
+ export class BigText extends Widgets.BigTextElement { }
+ export class List extends Widgets.ListElement { }
+ export class FileManager extends Widgets.FileManagerElement { }
+ export class ListTable extends Widgets.ListTableElement { }
+ export class ListBar extends Widgets.ListbarElement { }
+ export class Form extends Widgets.FormElement { }
+ export class Textarea extends Widgets.TextareaElement { }
+ export class Button extends Widgets.ButtonElement { }
+ export class Checkbox extends Widgets.CheckboxElement { }
+ export class RadioSet extends Widgets.RadioSetElement { }
+ export class RadioButton extends Widgets.RadioButtonElement { }
+
+ export class Prompt extends Widgets.PromptElement { }
+ export class question extends Widgets.QuestionElement { }
+ export class Message extends Widgets.MessageElement { }
+ export class Loading extends Widgets.LoadingElement { }
+
+ export class ProgressBar extends Widgets.ProgressBarElement { }
+ export class Terminal extends Widgets.TerminalElement { }
+ }
+
+ export function screen(options?: Widgets.IScreenOptions): Widgets.Screen;
+
+ export function box(options?: Widgets.BoxOptions): Widgets.BoxElement;
+ export function text(options?: Widgets.TextOptions): Widgets.TextElement;
+ export function line(options?: Widgets.LineOptions): Widgets.LineElement;
+ export function scrollablebox(options?: Widgets.BoxOptions): Widgets.BoxElement;
+ export function scrollabletext(options?: Widgets.BoxOptions): Widgets.BoxElement;
+ export function bigtext(options?: Widgets.BigTextOptions): Widgets.BigTextElement;
+ export function list(options?: Widgets.ListOptions): Widgets.ListElement;
+ export function filemanager(options?: Widgets.FileManagerOptions): Widgets.FileManagerElement;
+ export function listtable(options?: Widgets.ListTableOptions): Widgets.ListTableElement;
+ export function listbar(options?: Widgets.ListbarOptions): Widgets.ListbarElement;
+ export function form(options?: Widgets.FormOptions): Widgets.FormElement;
+ export function input(options?: Widgets.InputOptions): Widgets.InputElement;
+ export function textarea(options?: Widgets.TextareaOptions): Widgets.TextareaElement;
+ export function textbox(options?: Widgets.TextboxOptions): Widgets.TextboxElement;
+ export function button(options?: Widgets.ButtonOptions): Widgets.ButtonElement;
+ export function checkbox(options?: Widgets.CheckboxOptions): Widgets.CheckboxElement;
+ export function radioset(options?: Widgets.RadioSetOptions): Widgets.RadioSetElement;
+ export function radiobutton(options?: Widgets.RadioButtonOptions): Widgets.RadioButtonElement;
+
+ export function table(options?: Widgets.TableOptions): Widgets.TableElement;
+
+ export function prompt(options?: Widgets.PromptOptions): Widgets.PromptElement;
+ export function question(options?: Widgets.QuestionOptions): Widgets.QuestionElement;
+ export function message(options?: Widgets.MessageOptions): Widgets.MessageElement;
+ export function loading(options?: Widgets.LoadingOptions): Widgets.LoadingElement;
+
+ export function progressbar(options?: Widgets.ProgressBarOptions): Widgets.ProgressBarElement;
+ export function terminal(options?: Widgets.TerminalOptions): Widgets.TerminalElement;
+
+ export function layout(options?: Widgets.LayoutOptions): Widgets.LayoutElement;
+
+ export function escape(item: any): any;
+ export const colors: {
+ match: (hexColor: string) => string
+ }
}
-
-
-
diff --git a/daterangepicker/daterangepicker.d.ts b/daterangepicker/daterangepicker.d.ts
index f3534a197e..a86614cfe8 100644
--- a/daterangepicker/daterangepicker.d.ts
+++ b/daterangepicker/daterangepicker.d.ts
@@ -11,7 +11,7 @@ interface JQuery {
daterangepicker(settings?: daterangepicker.Settings, callback?: (start?: string | Date | moment.Moment, end?: string | Date | moment.Moment, label?: string) => any): JQuery;
}
-declare module daterangepicker {
+declare namespace daterangepicker {
interface DatepickerEventObject extends JQueryEventObject {
date: Date;
@@ -164,3 +164,7 @@ declare module daterangepicker {
monthNames?: string[];
}
}
+
+declare module "daterangepicker" {
+ export = daterangepicker;
+}
diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts
index 7b246966ab..f2fe5c3ba4 100644
--- a/github-electron/github-electron.d.ts
+++ b/github-electron/github-electron.d.ts
@@ -4766,6 +4766,10 @@ declare namespace Electron {
* @returns Whether the web page is destroyed.
*/
isDestroyed(): boolean;
+ /**
+ * @returns Whether the web page is focused.
+ */
+ isFocused(): boolean;
/**
* @returns Whether guest page is still loading resources.
*/
diff --git a/halfred/halfred-tests.ts b/halfred/halfred-tests.ts
new file mode 100644
index 0000000000..3aecf39962
--- /dev/null
+++ b/halfred/halfred-tests.ts
@@ -0,0 +1,13 @@
+///
+
+// run test with: $ tsc --noImplicitAny --target es6 --module commonjs halfred-tests.ts
+import { parse } from 'halfred'; // require('halfred');
+let resource = parse({foo: "bar", "_links": { "self": { href: "fooo" }}});
+console.log(resource);
+
+let allLinks = resource.allLinks();
+for (let key in allLinks) {
+ let link = allLinks[key];
+
+ console.log(link[0].href);
+}
diff --git a/halfred/halfred.d.ts b/halfred/halfred.d.ts
new file mode 100644
index 0000000000..9c1d571a9d
--- /dev/null
+++ b/halfred/halfred.d.ts
@@ -0,0 +1,247 @@
+// Type definitions for Halfred v1.0.0
+// Project: https://github.com/basti1302/halfred
+// Definitions by: David Herges
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+
+declare module "halfred" {
+
+ /**
+ * halfred.parse(object) returns a Resource object.
+ *
+ * @see https://github.com/basti1302/halfred#usage
+ */
+ export function parse(object: any): Resource;
+
+ /** @see https://github.com/basti1302/halfred#enabledisable-validation */
+ export function enableValidation(flag: boolean): void;
+
+ /** @see https://github.com/basti1302/halfred#enabledisable-validation */
+ export function disableValidation(): void;
+
+ /** @see https://github.com/basti1302/halfred#resource-api */
+ export interface Resource {
+
+ /**
+ * Returns an object which has an array for each link that was present in the source object.
+ * See below why each link is represented as an array.
+ */
+ allLinkArrays(): LinkCollection;
+
+ /** Alias for allLinkArrays() */
+ allLinks(): LinkCollection;
+
+ /**
+ * Returns the array of links for the given key, or null if there are no links for this key.
+ */
+ linkArray(key: string): Link[];
+
+ /**
+ * Returns the first element of the array of links for the given key or null if there are no
+ * links for this key.
+ */
+ link(key: string): Link;
+
+ /**
+ * Returns an object which has an array for each embedded resource that was present in the
+ * source object.
+ * See below why each embedded resource is represented as an array. Each element of any of
+ * this arrays is in turn a Resource object.
+ */
+ allEmbeddedResourceArrays(): ResourceCollection;
+
+ /** Alias for allEmbeddedResourceArrays() */
+ allEmbeddedArrays(): ResourceCollection;
+
+ /** Alias for allEmbeddedResourceArrays() */
+ allEmbeddedResources(): ResourceCollection;
+
+ /**
+ * Returns the array of embedded resources for the given key, or null if there are no embedded
+ * resources for this key. Each element of this arrays is in turn a Resource object.
+ */
+ embeddedResourceArray(key: string): Resource[];
+
+ /** Alias for embeddedResourceArray() */
+ embeddedArray(key: string): Resource[];
+
+ /**
+ * Returns the first element of the array of embedded resources for the given key or null if
+ * there are no embedded resources for this key. The returend object is a Resource object.
+ */
+ embeddedResource(key: string): Resource;
+
+ /** Alias for embeddedResource(key) */
+ embedded(key: string): Resource;
+
+ /**
+ * Returns the unmodified, original object that was parsed to this resource. This is rather
+ * uninteresting for the source object you give to the parse method (because you probably
+ * still have a reference to the source object) but it is a convenient way to get the part of
+ * the source object that corresponds to an embedded resource.
+ */
+ original(): any;
+
+ /**
+ * Returns true if the resource has any CURIEs (Compact URIs).
+ *
+ * @see http://www.w3.org/TR/2010/NOTE-curie-20101216/
+ */
+ hasCuries(): boolean;
+
+ /**
+ * Returns the array of CURIEs. Each object in the array is a link object, which means it
+ * can be templated etc. See below for the link object API.
+ */
+ curieArray(): Link[];
+
+ /**
+ * Returns the curie with the given name, if any. The returned object is a link object, which
+ * means it can be templated etc. See below for link object API.
+ */
+ curie(name: string): Link;
+
+ /**
+ * Returns the compact URI for the given full URL, if any
+ */
+ reverseResolveCurie(fullUrl: string): string;
+
+ /**
+ * Returns all validation issues. Validation issues are only gathered if validation has been
+ * turned on by calling ``halfred.enableValidation()`` before calling ``halfred.parse``.
+ */
+ validationIssues(): any;
+
+ /**
+ * Alias for validationIssues()
+ */
+ validation(): any;
+
+ /*
+ XX ... think we should NOT try to represent these things in TypeScript.
+
+ In addition to the methods mentioned here, resource has all properties of the source object.
+ This is also true for embedded Resource objects. The non-HAL properties (that is, any
+ property except _links and _embedded) are copied over to the Resource object. This is always
+ a shallow copy, so modifying the a non-HAL property in the Resource object might also alter
+ the source object and vice versa.
+
+ The Resource object also has the properties _links and _embedded but they might differ from
+ the _links/_embedded properties in the source object (Halfred applies some normalization to
+ them). These are not intended to be accessed by clients directly, instead, use the provided
+ methods to work with links and embedded resources.
+ */
+ }
+
+ /** @see https://github.com/basti1302/halfred#links-and-embedded-resources */
+ interface ResourceCollection {
+ [key: string]: Resource[];
+ }
+
+ /** @see https://github.com/basti1302/halfred#links-and-embedded-resources */
+ interface LinkCollection {
+ [rel: string]: Link[]
+ }
+
+ /**
+ * A Link Object represents a hyperlink from the containing resource to a URI.
+ *
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5
+ */
+ interface Link {
+
+ /**
+ * The "href" property is REQUIRED.
+ *
+ * Its value is either a URI [RFC3986] or a URI Template [RFC6570].
+ *
+ * If the value is a URI Template then the Link Object SHOULD have a
+ * "templated" attribute whose value is true.
+ *
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.1
+ */
+ href: string;
+
+ /**
+ * The "templated" property is OPTIONAL.
+ *
+ * Its value is boolean and SHOULD be true when the Link Object's "href"
+ * property is a URI Template.
+ *
+ * Its value SHOULD be considered false if it is undefined or any other
+ * value than true.
+ *
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.2
+ */
+ templated?: boolean;
+
+ /**
+ * The "type" property is OPTIONAL.
+ *
+ * Its value is a string used as a hint to indicate the media type
+ * expected when dereferencing the target resource.
+ *
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.3
+ */
+ type?: string;
+
+ /**
+ * The "deprecation" property is OPTIONAL.
+ *
+ * Its presence indicates that the link is to be deprecated (i.e.
+ * removed) at a future date. Its value is a URL that SHOULD provide
+ * further information about the deprecation.
+ *
+ * A client SHOULD provide some notification (for example, by logging a
+ * warning message) whenever it traverses over a link that has this
+ * property. The notification SHOULD include the deprecation property's
+ * value so that a client manitainer can easily find information about
+ * the deprecation.
+ *
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.4
+ */
+ deprecation?: string;
+
+ /**
+ * The "name" property is OPTIONAL.
+ *
+ * Its value MAY be used as a secondary key for selecting Link Objects
+ * which share the same relation type.
+ *
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.5
+ */
+ name?: string;
+
+ /**
+ * The "profile" property is OPTIONAL.
+ *
+ * Its value is a string which is a URI that hints about the profile (as
+ * defined by [I-D.wilde-profile-link]) of the target resource.
+ *
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.6
+ */
+ profile?: string;
+
+ /**
+ * The "title" property is OPTIONAL.
+ *
+ * Its value is a string and is intended for labelling the link with a
+ * human-readable identifier (as defined by [RFC5988]).
+ *
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.7
+ */
+ title?: string;
+
+ /**
+ * The "hreflang" property is OPTIONAL.
+ *
+ * Its value is a string and is intended for indicating the language of
+ * the target resource (as defined by [RFC5988]).
+ *
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.8
+ */
+ hreflang?: string;
+
+ }
+
+}
diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts
index de1e5343ca..bfe5a70235 100644
--- a/highcharts/highcharts.d.ts
+++ b/highcharts/highcharts.d.ts
@@ -240,7 +240,7 @@ interface HighchartsPlotBands {
* Border color for the plot band. Also requires borderWidth to be set.
* @default null
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* Border width for the plot band. Also requires borderColor to be set.
* @default 0
@@ -471,7 +471,7 @@ interface HighchartsAxisOptions {
/**
* Configure a crosshair that follows either the mouse pointer or the hovered point.
*/
- crosshair?: HighchartsCrosshairObject;
+ crosshair?: HighchartsCrosshairObject | boolean;
/**
* For a datetime axis, the scale will automatically adjust to the appropriate unit. This member gives the default
* string representations used for each unit. For an overview of the replacement codes, see dateFormat.
@@ -556,7 +556,7 @@ interface HighchartsAxisOptions {
* The color of the line marking the axis itself.
* @default '#C0D0E0'.
*/
- lineColor?: string;
+ lineColor?: string | HighchartsGradient;
/**
* The width of the line marking the axis itself.
* @default 1
@@ -820,7 +820,7 @@ interface HighchartsAxisOptions {
interface HighchartsColorAxisDataClass {
from?: number;
to?: number;
- color?: string;
+ color?: string | HighchartsGradient;
name?: string;
}
@@ -906,7 +906,7 @@ interface HighchartsColorAxisOptions {
* The color of the line marking the axis itself.
* @default '#C0D0E0'
*/
- lineColor?: string;
+ lineColor?: string | HighchartsGradient;
/**
* The width of the line marking the axis itself.
* @default 0
@@ -926,7 +926,7 @@ interface HighchartsColorAxisOptions {
* The color of the marker.
* @default 'gray'
*/
- color?: string;
+ color?: string | HighchartsGradient;
};
/**
* The maximum value of the axis in terms of map point values. If null, the max value is automatically calculated.
@@ -1382,7 +1382,7 @@ interface HighchartsShadow {
/**
* @default 'black'
*/
- color?: string;
+ color?: string | HighchartsGradient;
/**
* @default 1
*/
@@ -1491,7 +1491,7 @@ interface HighchartsChartOptions {
* The color of the outer chart border.
* @default '#4572A7'
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The corner radius of the outer chart border.
* @default 0
@@ -1721,7 +1721,7 @@ interface HighchartsChartOptions {
interface HighchartsCSSObject {
background?: string;
border?: string;
- color?: string;
+ color?: string | HighchartsGradient;
cursor?: string;
font?: string;
fontFamily?: string;
@@ -2429,7 +2429,7 @@ interface HighchartsLegendOptions {
* The color of the drawn border around the legend.
* @default '#909090'
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The border corner radius of the legend.
* @default 0
@@ -2724,7 +2724,7 @@ interface HighchartsPaneBackground {
/**
* @default 'silver'
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* @default 1
*/
@@ -2803,7 +2803,7 @@ interface HighchartsDataLabels {
* The border color for the data label.
* @since 2.2.1
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The border radius in pixels for the data label.
* @default 0
@@ -2820,7 +2820,7 @@ interface HighchartsDataLabels {
* The text color for the data labels.
* @default null
*/
- color?: string;
+ color?: string | HighchartsGradient;
/**
* Whether to hide data labels that are outside the plot area. By default, the data label is moved inside the plot
* area according to the overflow option.
@@ -3066,7 +3066,7 @@ interface HighchartsMarkerState {
* The color of the point marker's outline. When null, the series' or point's color is used.
* @default '#FFFFFF', '#000000' for select state
*/
- lineColor?: string;
+ lineColor?: string | HighchartsGradient;
/**
* The width of the point marker's outline.
* @default 0
@@ -3276,7 +3276,7 @@ interface HighchartsAreaZone {
* Defines the color of the series.
* @since 4.1.0
*/
- color?: string;
+ color?: string | HighchartsGradient;
/**
* A name for the dash style to use for the graph.
* @since 4.1.0
@@ -3321,7 +3321,7 @@ interface HighchartsRangeDataLabels {
* @default undefined
* @since 2.2.1
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The border radius in pixels for the data label.
* @default 0
@@ -3338,7 +3338,7 @@ interface HighchartsRangeDataLabels {
* The text color for the data labels.
* @default null
*/
- color?: string;
+ color?: string | HighchartsGradient;
/**
* Whether to hide data labels that are outside the plot area. By default, the data label is moved inside the plot
* area according to the overflow option.
@@ -3471,7 +3471,7 @@ interface HighchartsDial {
* @default 'black'
* @since 2.3.0
*/
- backgroundColor?: string;
+ backgroundColor?: string | HighchartsGradient;
/**
* The length of the dial's base part, relative to the total radius or length of the dial.
* @default '70%'.
@@ -3490,7 +3490,7 @@ interface HighchartsDial {
* @default 'silver'
* @since 2.3.0
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The width of the gauge dial border in pixels.
* @default 0
@@ -3524,14 +3524,14 @@ interface HighchartsPivot {
* @default 'black'
* @since 2.3.0
*/
- backgroundColor?: string;
+ backgroundColor?: string | HighchartsGradient;
/**
* The border or stroke color of the pivot. In able to change this, the borderWidth must also be set to something
* other than the default 0.
* @default 'silver'
* @since 2.3.0
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The border or stroke width of the pivot.
* @default 0
@@ -3554,7 +3554,7 @@ interface HighchartsTreeMapLevel {
* Can set borderColor on all points which lies on the same level.
* @since 4.1.0
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* et the dash style of the border of all the point which lies on the level.
* @since 4.1.0
@@ -3569,7 +3569,7 @@ interface HighchartsTreeMapLevel {
* Can set a color on all points which lies on the same level.
* @since 4.1.0
*/
- color?: string;
+ color?: string | HighchartsGradient;
/**
* Can set the options of dataLabels on each point which lies on the level.
* @default undefined
@@ -3594,7 +3594,7 @@ interface HighchartsTreeMapLevel {
}
/**
- * General options for all series types
+ * General options for all series types.
*/
interface HighchartsSeriesChart {
/**
@@ -3615,7 +3615,7 @@ interface HighchartsSeriesChart {
* specified. In bar type series it applies to the bars unless a color is specified per point. The default value is
* pulled from the options.colors array.
*/
- color?: string;
+ color?: string | HighchartsGradient;
/**
* Polar charts only. Whether to connect the ends of a line series plot across the extremes.
* @default true
@@ -3860,7 +3860,7 @@ interface HighchartsAreaChart extends HighchartsSeriesChart {
* A separate color for the graph line. By default the line takes the color of the series, but the lineColor setting
* allows setting a separate color for the line without altering the fillColor.
*/
- lineColor?: string;
+ lineColor?: string | HighchartsGradient;
/**
* A separate color for the negative part of the area.
* @since 3.0
@@ -3902,7 +3902,7 @@ interface HighchartsBarChart extends HighchartsSeriesChart {
* The color of the border surrounding each column or bar.
* @default '#FFFFFF'
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The corner radius of the border surrounding each column or bar.
* @default 0
@@ -4263,7 +4263,7 @@ interface HighchartsFunnelChart extends HighchartsSeriesChart {
* The color of the border surrounding each column or bar.
* @default '#FFFFFF'
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The width of the border surrounding each column or bar.
* @default 1
@@ -4385,7 +4385,7 @@ interface HighchartsHeatMapChart extends HighchartsSeriesChart {
* The color of the border surrounding each column or bar.
* @default '#FFFFFF'
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The corner radius of the border surrounding each column or bar.
* @default 0
@@ -4468,7 +4468,7 @@ interface HighchartsPieChart extends HighchartsSeriesChart {
* borderless pies.
* @default '#FFFFFF'
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The width of the border surrounding each column or bar.
* @default 1
@@ -4573,7 +4573,7 @@ interface HighchartsPyramidChart extends HighchartsSeriesChart {
* The color of the border surrounding each slice
* @default '#FFFFFF'
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The width of the border surrounding each slice
* @default 1
@@ -4688,7 +4688,7 @@ interface HighchartsTreeMapChart extends HighchartsSeriesChart {
* The color of the border surrounding each tree map item.
* @default '#E0E0E0'
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The width of the border surrounding each column or bar.
* @default 1
@@ -4783,7 +4783,7 @@ interface HighchartsWaterFallChart extends HighchartsBarChart {
* @default '#333333'
* @since 3.0
*/
- lineColor?: string;
+ lineColor?: string | HighchartsGradient;
/**
* The color used specifically for positive point columns. When not specified, the general series color is used.
*/
@@ -4834,7 +4834,7 @@ interface HighchartsIndividualSeriesOptions {
* specified. In bar type series it applies to the bars unless a color is specified per point. The default
* value is pulled from the options.colors array.
*/
- color?: string;
+ color?: string | HighchartsGradient;
/**
* You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user
* that the points and lines can be clicked.
@@ -4949,7 +4949,7 @@ interface HighchartsDataPoint {
* Individual color for the point. By default the color is pulled from the global colors array.
* @default undefined
*/
- color?: string;
+ color?: string | HighchartsGradient;
/**
* Serves a purpose only if a colorAxis object is defined in the chart options. This value will decide which color
* the point gets from the scale of the colorAxis.
@@ -5173,7 +5173,7 @@ interface HighchartsTitleOptions {
}
interface HighchartsCrosshairObject {
- color?: string;
+ color?: string | HighchartsGradient;
width?: number;
dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot
zIndex?: number;
@@ -5200,7 +5200,7 @@ interface HighchartsTooltipOptions extends HighchartsSeriesTooltipOptions {
* The color of the tooltip border. When null, the border takes the color of the corresponding series or point.
* @default null
*/
- borderColor?: string;
+ borderColor?: string | HighchartsGradient;
/**
* The radius of the rounded border corners.
* @default 3
@@ -5602,7 +5602,7 @@ interface HighchartsAxisObject {
* @param {boolean | HighchartsAnimation} animation When true, the resize will be animated with default animation options. The animation can also be a configuration object with properties duration and easing.
* @since 1.2.0
*/
- setExtremes(min?: number, max?: number, redraw?: boolean, animation?: boolean | HighchartsAnimation): void;
+ setExtremes(min?: number, max?: number, redraw?: boolean, animation?: boolean | HighchartsAnimation, eventArguments?: any): void;
/**
* Update the title of the axis after render time.
* @param {HighchartsAxisTitle} title The new title options on the same format as given in xAxis.title.
diff --git a/json-editor/json-editor.d.ts b/json-editor/json-editor.d.ts
index cbb0c9c29c..280c17e70f 100644
--- a/json-editor/json-editor.d.ts
+++ b/json-editor/json-editor.d.ts
@@ -39,7 +39,7 @@ type JSONEditorOptions = {
/**
* The icon library to use for the editor.
*/
- iconlib?: boolean;
+ iconlib?: "bootstrap2" | "bootstrap3" | "foundation2" | "foundation3" | "jqueryui" | "fontawesome3" | "fontawesome4";
/**
* If true, objects can only contain properties defined with the properties keyword.
*/
@@ -75,7 +75,7 @@ type JSONEditorOptions = {
/**
* The CSS theme to use.
*/
- theme?: string;
+ theme?: "barebones" | "html" | "bootstrap2" | "bootstrap3" | "foundation3" | "foundation4" | "foundation5" | "foundation6" | "jqueryui";
/**
* If true, only required properties will be included by default.
*/
diff --git a/karma-fixture/karma-fixture-tests.ts b/karma-fixture/karma-fixture-tests.ts
new file mode 100644
index 0000000000..b3a1d8e51c
--- /dev/null
+++ b/karma-fixture/karma-fixture-tests.ts
@@ -0,0 +1,10 @@
+///
+
+fixture.setBase('fixtures/base/path');
+fixture.load('test1.html', 'test1.json', false);
+fixture.load('test1.html', 'test2.html', 'test1.json');
+fixture.set('', true);
+fixture.set('', '');
+fixture.cleanup();
+fixture.el.firstChild;
+JSON.stringify(fixture.json[0]);
diff --git a/karma-fixture/karma-fixture.d.ts b/karma-fixture/karma-fixture.d.ts
new file mode 100644
index 0000000000..8e4d18fd47
--- /dev/null
+++ b/karma-fixture/karma-fixture.d.ts
@@ -0,0 +1,27 @@
+// Type definitions for karma-fixture 0.2.6
+// Project: https://github.com/billtrik/karma-fixture
+// Definitions by: Ezekiel Victor
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module fixture {
+ var el: HTMLElement;
+ var json: any[];
+
+ function load(...files: string[]): any;
+ function load(file1: string, append?: boolean): any;
+ function load(file1: string, file2: string, append?: boolean): any;
+ function load(file1: string, file2: string, file3: string, append?: boolean): any;
+ function load(file1: string, file2: string, file3: string, file4: string, append?: boolean): any;
+ function load(file1: string, file2: string, file3: string, file4: string, file5: string, append?: boolean): any;
+
+ function set(...htmlStrs: string[]): HTMLElement|HTMLElement[];
+ function set(htmlStr1: string, append?: boolean): HTMLElement|HTMLElement[];
+ function set(htmlStr1: string, htmlStr2: string, append?: boolean): HTMLElement|HTMLElement[];
+ function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, append?: boolean): HTMLElement|HTMLElement[];
+ function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, append?: boolean): HTMLElement|HTMLElement[];
+ function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, htmlStr5: string, append?: boolean): HTMLElement|HTMLElement[];
+
+ function cleanup(): void;
+
+ function setBase(fixtureBasePath: string): void;
+}
diff --git a/knex/knex.d.ts b/knex/knex.d.ts
index 23dc58af82..ec6403ed2c 100644
--- a/knex/knex.d.ts
+++ b/knex/knex.d.ts
@@ -12,7 +12,7 @@ declare module "knex" {
type Callback = Function;
type Client = Function;
- type Value = string|number|boolean|Date|Array|Array|Array|Array;
+ type Value = string|number|boolean|Date|Array|Array|Array|Array|Buffer;
type ColumnName = string|Knex.Raw|Knex.QueryBuilder;
type TableName = string|Knex.Raw|Knex.QueryBuilder;
diff --git a/node/node-4-tests.ts b/node/node-4-tests.ts
index 8cddf66987..9db708b910 100644
--- a/node/node-4-tests.ts
+++ b/node/node-4-tests.ts
@@ -826,3 +826,17 @@ namespace vm_tests {
Debug.scripts().forEach(function(script: any) { console.log(script.name); });
}
}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Errors Tests : https://nodejs.org/dist/latest-v4.x/docs/api/errors.html ///
+///////////////////////////////////////////////////////////////////////////////
+
+namespace errors_tests {
+ {
+ Error.stackTraceLimit = Infinity;
+ }
+ {
+ const myObject = {};
+ Error.captureStackTrace(myObject);
+ }
+}
\ No newline at end of file
diff --git a/node/node-4.d.ts b/node/node-4.d.ts
index e60da8e309..d6fb33f750 100644
--- a/node/node-4.d.ts
+++ b/node/node-4.d.ts
@@ -13,6 +13,10 @@ interface Error {
stack?: string;
}
+interface ErrorConstructor {
+ captureStackTrace(targetObject: Object, constructorOpt?: Function): void;
+ stackTraceLimit: number;
+}
// compat for TypeScript 1.8
// if you use with --target es3 or --target es5 and use below definitions,
@@ -2398,3 +2402,7 @@ declare module "constants" {
export var X_OK: number;
export var UV_UDP_REUSEADDR: number;
}
+
+declare module "process" {
+ export = process;
+}
diff --git a/node/node-tests.ts b/node/node-tests.ts
index fd79f28f9d..bd19697f31 100644
--- a/node/node-tests.ts
+++ b/node/node-tests.ts
@@ -244,10 +244,21 @@ function bufferTests() {
let index: number;
index = buffer.indexOf("23");
index = buffer.indexOf("23", 1);
+ index = buffer.indexOf("23", 1, "utf8");
index = buffer.indexOf(23);
index = buffer.indexOf(buffer);
}
+ {
+ let buffer = new Buffer('123');
+ let index: number;
+ index = buffer.lastIndexOf("23");
+ index = buffer.lastIndexOf("23", 1);
+ index = buffer.lastIndexOf("23", 1, "utf8");
+ index = buffer.lastIndexOf(23);
+ index = buffer.lastIndexOf(buffer);
+ }
+
// Imported Buffer from buffer module works properly
{
let b = new ImportedBuffer('123');
diff --git a/node/node.d.ts b/node/node.d.ts
index 750d273988..731b136585 100644
--- a/node/node.d.ts
+++ b/node/node.d.ts
@@ -503,8 +503,8 @@ interface NodeBuffer extends Uint8Array {
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
fill(value: any, offset?: number, end?: number): this;
- // TODO: encoding param
- indexOf(value: string | number | Buffer, byteOffset?: number): number;
+ indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
+ lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
// TODO: entries
// TODO: includes
// TODO: keys
@@ -2625,3 +2625,7 @@ declare module "constants" {
export var X_OK: number;
export var UV_UDP_REUSEADDR: number;
}
+
+declare module "process" {
+ export = process;
+}
\ No newline at end of file
diff --git a/object-assign/object-assign-tests.ts b/object-assign/object-assign-tests.ts
index 53dfd5e707..6b9a898ed4 100644
--- a/object-assign/object-assign-tests.ts
+++ b/object-assign/object-assign-tests.ts
@@ -1,17 +1,79 @@
///
import objectAssign = require("object-assign");
-function assign1() {
- var result = objectAssign({hello: "world"});
- return result;
+interface Target {
+ hellow: string;
}
-function assign2() {
- var result = objectAssign({hello: "world"}, {hello: "worlds", second: "extra"});
- return result;
+interface Source1 {
+ source1: string;
}
-function assign3() {
- var result = objectAssign({hello: "world"}, {hello: "worlds", second: "extra"}, {hello: "stop", the: "spinning"});
- return result;
+interface Result extends Target, Source1 {
+
}
+
+interface Source2 {
+ source2: string;
+}
+
+interface Result2 extends Result, Source2 {
+
+}
+
+interface Source3 {
+ source3: string;
+}
+
+interface Result3 extends Result2, Source3 {
+
+}
+
+interface Source4 {
+ source4: string;
+}
+
+interface Result4 extends Result3, Source4 {
+
+}
+
+interface Source5 {
+ source5: string;
+}
+
+interface Result5 extends Result4, Source5 {
+
+}
+
+function assign1(): Result {
+ return objectAssign({hellow: "world"}, {source1: "U"});
+}
+
+function assign2(): Result2 {
+ return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"});
+}
+
+function assign3(): Result3 {
+ return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"});
+}
+
+function assign4(): Result4 {
+ return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"});
+}
+
+function assign5(): Result5 {
+ return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"});
+}
+
+function assign() {
+ return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"}, {
+ hellow: "hellow",
+ source1: "source1",
+ source2: "source2",
+ source3: "source3",
+ source4: "source4",
+ source5: "source5",
+ generic: "any"
+ });
+}
+
diff --git a/object-assign/object-assign.d.ts b/object-assign/object-assign.d.ts
index 52ef486c72..c3f92b7592 100644
--- a/object-assign/object-assign.d.ts
+++ b/object-assign/object-assign.d.ts
@@ -4,6 +4,11 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "object-assign" {
+ function objectAssign(target: T, source: U): T & U;
+ function objectAssign(target: T, source1: U, source2: V): T & U & V;
+ function objectAssign(target: T, source1: U, source2: V, source3: W): T & U & V & W;
+ function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q;
+ function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R;
function objectAssign(target: any, ...sources: any[]): any;
export = objectAssign;
}
diff --git a/office-js/office-js.d.ts b/office-js/office-js.d.ts
index f2bebfe3da..2d76f3211c 100644
--- a/office-js/office-js.d.ts
+++ b/office-js/office-js.d.ts
@@ -53,7 +53,7 @@ declare namespace Office {
displayLanguage: string;
license: string;
touchEnabled: boolean;
- ui: UI;
+ ui: UI;
requirements: {
/**
* Check if the specified requirement set is supported by the host Office application.
@@ -67,51 +67,54 @@ declare namespace Office {
message: string;
name: string;
}
- export interface UI {
- /**
- * Displays a dialog to show or collect information from the user or to facilitate Web navigation.
- * @param startAddress Accepts the initial HTTPS Url that opens in the dialog.
- * @param options Optional. Accepts a DialogOptions object to define dialog behaviors.
- * @param callback Optional. Accepts a callback method to handle the dialog creation attempt.
- */
- displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void;
- /**
- * When called from an active add-in dialog, asynchronously closes the dialog.
- */
- close(): void;
- /**
- * Synchronously delivers a message from the dialog to its parent add-in.
- * @param messageObject Accepts a message from the dialog to deliver to the add-in.
- */
- messageParent(messageObject: any): void;
+ export interface UI {
+ /**
+ * Displays a dialog to show or collect information from the user or to facilitate Web navigation.
+ * @param startAddress Accepts the initial HTTPS Url that opens in the dialog.
+ * @param options Optional. Accepts a DialogOptions object to define dialog behaviors.
+ * @param callback Optional. Accepts a callback method to handle the dialog creation attempt.
+ */
+ displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void;
+ /**
+ * When called from an active add-in dialog, asynchronously closes the dialog.
+ */
+ close(): void;
+ /**
+ * Synchronously delivers a message from the dialog to its parent add-in.
+ * @param messageObject Accepts a message from the dialog to deliver to the add-in.
+ */
+ messageParent(messageObject: any): void;
}
export interface DialogOptions {
/**
* Optional. Defines the width of the dialog as a percentage of the current display. Defaults to 99%. 250px minimum.
*/
- height?: number,
+ height?: number,
/**
* Optional. Defines the height of the dialog as a percentage of the current display. Defaults to 99%. 150px minimum.
*/
- width?: number,
+ width?: number,
/**
* Optional. Specifies whether the dialog can only display pages that have HTTPS URLs.
*/
- requireHTTPS?: boolean,
+ requireHTTPS?: boolean,
/**
* Optional. Determines whether the dialog is safe to display within a Web frame.
*/
xFrameDenySafe?: boolean,
}
}
-declare namespace OfficeExtension {
+
+declare module OfficeExtension {
/** An abstract proxy object that represents an object in an Office document. You create proxy objects from the context (or from other proxy objects), add commands to a queue to act on the object, and then synchronize the proxy object state with the document by calling "context.sync()". */
class ClientObject {
/** The request context associated with the object */
context: ClientRequestContext;
+ /** Returns a boolean value for whether the corresponding object is null. You must call "context.sync()" before reading the isNull property. [Api set: ExcelApi 1.3 (Preview), WordApi 1.3] */
+ isNull: boolean;
}
}
-declare namespace OfficeExtension {
+declare module OfficeExtension {
interface LoadOption {
select?: string | string[];
expand?: string | string[];
@@ -127,18 +130,18 @@ declare namespace OfficeExtension {
load(object: ClientObject, option?: string | string[] | LoadOption): void;
/** Adds a trace message to the queue. If the promise returned by "context.sync()" is rejected due to an error, this adds a ".traceMessages" array to the OfficeExtension.Error object, containing all trace messages that were executed. These messages can help you monitor the program execution sequence and detect the cause of the error. */
trace(message: string): void;
- /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code.�This method returns a promise, which is resolved when the synchronization is complete. */
+ /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code. This method returns a promise, which is resolved when the synchronization is complete. */
sync(passThroughValue?: T): IPromise;
}
}
-declare namespace OfficeExtension {
+declare module OfficeExtension {
/** Contains the result for methods that return primitive types. The object's value property is retrieved from the document after "context.sync()" is invoked. */
class ClientResult {
/** The value of the result that is retrieved from the document after "context.sync()" is invoked. */
value: T;
}
}
-declare namespace OfficeExtension {
+declare module OfficeExtension {
/** The error object returned by "context.sync()", if a promise is rejected due to an error while processing the request. */
class Error {
/** Error name: "OfficeExtension.Error".*/
@@ -158,68 +161,186 @@ declare namespace OfficeExtension {
};
}
}
-declare namespace OfficeExtension {
+declare module OfficeExtension {
class ErrorCodes {
static accessDenied: string;
static generalException: string;
static activityLimitReached: string;
+ static invalidObjectPath: string;
+ static propertyNotLoaded: string;
+ static valueNotLoaded: string;
+ static invalidRequestContext: string;
+ static invalidArgument: string;
+ static runMustReturnPromise: string;
+ static cannotRegisterEvent: string;
}
}
-declare namespace OfficeExtension {
- /** A Promise object that represents a deferred interaction with the host Office application. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. */
+declare module OfficeExtension {
+ /** An IPromise object that represents a deferred interaction with the host Office application. */
interface IPromise {
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => IPromise): IPromise;
+
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => U): IPromise;
+
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => void): IPromise;
+
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => IPromise): IPromise;
+
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): IPromise;
+
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): IPromise;
+
+
/**
* Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack.
* @param onRejected function to be called if or when the promise rejects.
*/
catch(onRejected?: (error: any) => IPromise): IPromise;
+
/**
* Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack.
* @param onRejected function to be called if or when the promise rejects.
*/
catch(onRejected?: (error: any) => U): IPromise;
+
+ /**
+ * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack.
+ * @param onRejected function to be called if or when the promise rejects.
+ */
+ catch(onRejected?: (error: any) => void): IPromise;
+ }
+
+ /** An Promise object that represents a deferred interaction with the host Office application. The publically-consumable OfficeExtension.Promise is available starting in ExcelApi 1.2 and WordApi 1.2. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. When a "native" Promise implementation is available, OfficeExtension.Promise will switch to use the native Promise instead. */
+ export class Promise implements IPromise
+ {
+ /**
+ * Creates a new promise based on a function that accepts resolve and reject handlers.
+ */
+ constructor(func: (resolve : (value?: R | IPromise) => void, reject: (error?: any) => void) => void);
+
+ /**
+ * Creates a promise that resolves when all of the child promises resolve.
+ */
+ static all(promises: OfficeExtension.IPromise[]): IPromise;
+
+ /**
+ * Creates a promise that is resolved.
+ */
+ static resolve(value: U): IPromise;
+
+ /**
+ * Creates a promise that is rejected.
+ */
+ static reject(error: any): IPromise;
+
+ /* This method will be called once the previous promise has been resolved.
+ * Both the onFulfilled on onRejected callbacks are optional.
+ * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
+ * @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
+ */
+ then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => IPromise): IPromise;
+
+ /**
+ * This method will be called once the previous promise has been resolved.
+ * Both the onFulfilled on onRejected callbacks are optional.
+ * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
+ * @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
+ */
+ then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => U): IPromise;
+
+ /**
+ * This method will be called once the previous promise has been resolved.
+ * Both the onFulfilled on onRejected callbacks are optional.
+ * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
+ * @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
+ */
+ then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => void): IPromise;
+
+ /**
+ * This method will be called once the previous promise has been resolved.
+ * Both the onFulfilled on onRejected callbacks are optional.
+ * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
+ * @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
+ */
+ then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => IPromise): IPromise;
+
+ /**
+ * This method will be called once the previous promise has been resolved.
+ * Both the onFulfilled on onRejected callbacks are optional.
+ * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
+ * @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
+ */
+ then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): IPromise;
+
+ /**
+ * This method will be called once the previous promise has been resolved.
+ * Both the onFulfilled on onRejected callbacks are optional.
+ * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
+
+ * @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
+ */
+ then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): IPromise;
+
+
+ /**
+ * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack.
+ * @param onRejected function to be called if or when the promise rejects.
+ */
+ catch(onRejected?: (error: any) => IPromise): IPromise;
+
+ /**
+ * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack.
+ * @param onRejected function to be called if or when the promise rejects.
+ */
+ catch(onRejected?: (error: any) => U): IPromise;
+
/**
* Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack.
* @param onRejected function to be called if or when the promise rejects.
@@ -227,7 +348,8 @@ declare namespace OfficeExtension {
catch(onRejected?: (error: any) => void): IPromise;
}
}
-declare namespace OfficeExtension {
+
+declare module OfficeExtension {
/** Collection of tracked objects, contained within a request context. See "context.trackedObjects" for more information. */
class TrackedObjects {
/** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */
@@ -241,6 +363,26 @@ declare namespace OfficeExtension {
}
}
+declare module OfficeExtension {
+ export class EventHandlers {
+ constructor(context: ClientRequestContext, parentObject: ClientObject, name: string, eventInfo: EventInfo);
+ add(handler: (args: T) => IPromise): EventHandlerResult;
+ remove(handler: (args: T) => IPromise): void;
+ removeAll(): void;
+ }
+
+ export class EventHandlerResult {
+ constructor(context: ClientRequestContext, handlers: EventHandlers, handler: (args: T) => IPromise);
+ remove(): void;
+ }
+
+ export interface EventInfo {
+ registerFunc: (callback: (args: any) => void) => IPromise;
+ unregisterFunc: (callback: (args: any) => void) => IPromise;
+ eventArgsTransformFunc: (args: any) => IPromise;
+ }
+}
+
declare namespace Office {
/**
* Returns a promise of an object described in the expression. Callback is invoked only if method fails.
@@ -467,7 +609,7 @@ declare namespace Office {
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
- setDataAsync(data: TableData|any, options?: any, callback?: (result: AsyncResult) => void): void;
+ setDataAsync(data: TableData | any, options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface Bindings {
document: Document;
@@ -743,7 +885,7 @@ declare namespace Office {
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
- goToByIdAsync(id: string|number, goToType: GoToType, options?: any, callback?: (result: AsyncResult) => void): void;
+ goToByIdAsync(id: string | number, goToType: GoToType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Removes an event handler for the specified event type.
* @param eventType The event type. For document can be 'DocumentSelectionChanged'
@@ -761,7 +903,7 @@ declare namespace Office {
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
- setSelectedDataAsync(data: string|TableData|any[][], options?: any, callback?: (result: AsyncResult) => void): void;
+ setSelectedDataAsync(data: string | TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface File {
size: number;
@@ -853,7 +995,7 @@ declare namespace Office {
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
- addColumnsAsync(tableData: TableData|any[][], options?: any, callback?: (result: AsyncResult) => void): void;
+ addColumnsAsync(tableData: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Adds the specified rows to the table
* @param rows A 2D array with the rows to add
@@ -861,7 +1003,7 @@ declare namespace Office {
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
- addRowsAsync(rows: TableData|any[][], options?: any, callback?: (result: AsyncResult) => void): void;
+ addRowsAsync(rows: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Clears the table
* @param options Syntax example: {asyncContext:context}
@@ -1503,9 +1645,238 @@ declare namespace Office {
getWSSUrlAsync(options?: any, callback?: (result: AsyncResult) => void): void;
}
}
-
-
-declare namespace Excel {
+declare module Excel {
+ interface ThreeArrowsSet {
+ [index: number]: Icon;
+ redDownArrow: Icon;
+ yellowSideArrow: Icon;
+ greenUpArrow: Icon;
+ }
+ interface ThreeArrowsGraySet {
+ [index: number]: Icon;
+ grayDownArrow: Icon;
+ graySideArrow: Icon;
+ grayUpArrow: Icon;
+ }
+ interface ThreeFlagsSet {
+ [index: number]: Icon;
+ redFlag: Icon;
+ yellowFlag: Icon;
+ greenFlag: Icon;
+ }
+ interface ThreeTrafficLights1Set {
+ [index: number]: Icon;
+ redCircleWithBorder: Icon;
+ yellowCircle: Icon;
+ greenCircle: Icon;
+ }
+ interface ThreeTrafficLights2Set {
+ [index: number]: Icon;
+ redTrafficLight: Icon;
+ yellowTrafficLight: Icon;
+ greenTrafficLight: Icon;
+ }
+ interface ThreeSignsSet {
+ [index: number]: Icon;
+ redDiamond: Icon;
+ yellowTriangle: Icon;
+ greenCircle: Icon;
+ }
+ interface ThreeSymbolsSet {
+ [index: number]: Icon;
+ redCrossSymbol: Icon;
+ yellowExclamationSymbol: Icon;
+ greenCheckSymbol: Icon;
+ }
+ interface ThreeSymbols2Set {
+ [index: number]: Icon;
+ redCross: Icon;
+ yellowExclamation: Icon;
+ greenCheck: Icon;
+ }
+ interface FourArrowsSet {
+ [index: number]: Icon;
+ redDownArrow: Icon;
+ yellowDownInclineArrow: Icon;
+ yellowUpInclineArrow: Icon;
+ greenUpArrow: Icon;
+ }
+ interface FourArrowsGraySet {
+ [index: number]: Icon;
+ grayDownArrow: Icon;
+ grayDownInclineArrow: Icon;
+ grayUpInclineArrow: Icon;
+ grayUpArrow: Icon;
+ }
+ interface FourRedToBlackSet {
+ [index: number]: Icon;
+ blackCircle: Icon;
+ grayCircle: Icon;
+ pinkCircle: Icon;
+ redCircle: Icon;
+ }
+ interface FourRatingSet {
+ [index: number]: Icon;
+ oneBar: Icon;
+ twoBars: Icon;
+ threeBars: Icon;
+ fourBars: Icon;
+ }
+ interface FourTrafficLightsSet {
+ [index: number]: Icon;
+ blackCircleWithBorder: Icon;
+ redCircleWithBorder: Icon;
+ yellowCircle: Icon;
+ greenCircle: Icon;
+ }
+ interface FiveArrowsSet {
+ [index: number]: Icon;
+ redDownArrow: Icon;
+ yellowDownInclineArrow: Icon;
+ yellowSideArrow: Icon;
+ yellowUpInclineArrow: Icon;
+ greenUpArrow: Icon;
+ }
+ interface FiveArrowsGraySet {
+ [index: number]: Icon;
+ grayDownArrow: Icon;
+ grayDownInclineArrow: Icon;
+ graySideArrow: Icon;
+ grayUpInclineArrow: Icon;
+ grayUpArrow: Icon;
+ }
+ interface FiveRatingSet {
+ [index: number]: Icon;
+ noBars: Icon;
+ oneBar: Icon;
+ twoBars: Icon;
+ threeBars: Icon;
+ fourBars: Icon;
+ }
+ interface FiveQuartersSet {
+ [index: number]: Icon;
+ whiteCircleAllWhiteQuarters: Icon;
+ circleWithThreeWhiteQuarters: Icon;
+ circleWithTwoWhiteQuarters: Icon;
+ circleWithOneWhiteQuarter: Icon;
+ blackCircle: Icon;
+ }
+ interface ThreeStarsSet {
+ [index: number]: Icon;
+ silverStar: Icon;
+ halfGoldStar: Icon;
+ goldStar: Icon;
+ }
+ interface ThreeTrianglesSet {
+ [index: number]: Icon;
+ redDownTriangle: Icon;
+ yellowDash: Icon;
+ greenUpTriangle: Icon;
+ }
+ interface FiveBoxesSet {
+ [index: number]: Icon;
+ noFilledBoxes: Icon;
+ oneFilledBox: Icon;
+ twoFilledBoxes: Icon;
+ threeFilledBoxes: Icon;
+ fourFilledBoxes: Icon;
+ }
+ interface IconCollections {
+ threeArrows: ThreeArrowsSet;
+ threeArrowsGray: ThreeArrowsGraySet;
+ threeFlags: ThreeFlagsSet;
+ threeTrafficLights1: ThreeTrafficLights1Set;
+ threeTrafficLights2: ThreeTrafficLights2Set;
+ threeSigns: ThreeSignsSet;
+ threeSymbols: ThreeSymbolsSet;
+ threeSymbols2: ThreeSymbols2Set;
+ fourArrows: FourArrowsSet;
+ fourArrowsGray: FourArrowsGraySet;
+ fourRedToBlack: FourRedToBlackSet;
+ fourRating: FourRatingSet;
+ fourTrafficLights: FourTrafficLightsSet;
+ fiveArrows: FiveArrowsSet;
+ fiveArrowsGray: FiveArrowsGraySet;
+ fiveRating: FiveRatingSet;
+ fiveQuarters: FiveQuartersSet;
+ threeStars: ThreeStarsSet;
+ threeTriangles: ThreeTrianglesSet;
+ fiveBoxes: FiveBoxesSet;
+ }
+ var icons: IconCollections;
+ /**
+ *
+ * Provides information about the binding that raised the SelectionChanged event.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ interface BindingSelectionChangedEventArgs {
+ /**
+ *
+ * Gets the Binding object that represents the binding that raised the SelectionChanged event.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ binding: Excel.Binding;
+ /**
+ *
+ * Gets the number of columns selected.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ columnCount: number;
+ /**
+ *
+ * Gets the number of rows selected.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ rowCount: number;
+ /**
+ *
+ * Gets the index of the first column of the selection (zero-based).
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ startColumn: number;
+ /**
+ *
+ * Gets the index of the first row of the selection (zero-based).
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ startRow: number;
+ }
+ /**
+ *
+ * Provides information about the binding that raised the DataChanged event.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ interface BindingDataChangedEventArgs {
+ /**
+ *
+ * Gets the Binding object that represents the binding that raised the DataChanged event.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ binding: Excel.Binding;
+ }
+ /**
+ *
+ * Provides information about the document that raised the SelectionChanged event.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ interface SelectionChangedEventArgs {
+ /**
+ *
+ * Gets the workbook object that raised the SelectionChanged event.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ workbook: Excel.Workbook;
+ }
/**
*
* Represents the Excel application that manages the workbook.
@@ -1546,8 +1917,10 @@ declare namespace Excel {
private m_bindings;
private m_functions;
private m_names;
+ private m_pivotTables;
private m_tables;
private m_worksheets;
+ private m_selectionChanged;
/**
*
* Represents Excel application instance that contains this workbook. Read-only.
@@ -1576,6 +1949,13 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
names: Excel.NamedItemCollection;
+ /**
+ *
+ * Represents a collection of PivotTables associated with the workbook. Read-only.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ pivotTables: Excel.PivotTableCollection;
/**
*
* Represents a collection of tables associated with the workbook. Read-only.
@@ -1601,6 +1981,13 @@ declare namespace Excel {
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Excel.Workbook;
+ /**
+ *
+ * Occurs when the selection in the document is changed.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ onSelectionChanged: OfficeExtension.EventHandlers;
}
/**
*
@@ -1612,6 +1999,7 @@ declare namespace Excel {
private m_charts;
private m_id;
private m_name;
+ private m_pivotTables;
private m_position;
private m_protection;
private m_tables;
@@ -1623,6 +2011,13 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
charts: Excel.ChartCollection;
+ /**
+ *
+ * Collection of PivotTables that are part of the worksheet. Read-only.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ pivotTables: Excel.PivotTableCollection;
/**
*
* Returns sheet protection object for a worksheet.
@@ -1702,7 +2097,7 @@ declare namespace Excel {
*
* The used range is the smallest range that encompasses any cells that have a value or formatting assigned to them. If the worksheet is blank, this function will return the top left cell.
*
- * @param valuesOnly Considers only cells with values as used cells (ignores formatting). [Parameter available: ExcelApi 1.2]
+ * @param valuesOnly Considers only cells with values as used cells (ignores formatting). [Api set: ExcelApi 1.2]
*
* [Api set: ExcelApi 1.1]
*/
@@ -1747,6 +2142,15 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getItem(key: string): Excel.Worksheet;
+ /**
+ *
+ * Gets a worksheet object using its Name or ID. If the worksheet does not exist, the returned object's isNull property will be true.
+ *
+ * @param key The Name or ID of the worksheet.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getItemOrNull(key: string): Excel.Worksheet;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
@@ -1777,7 +2181,7 @@ declare namespace Excel {
protected: boolean;
/**
*
- * Protect a worksheet. It throws if the worksheet has been protected.
+ * Protects a worksheet. Fails if the worksheet has been protected.
*
* @param options sheet protection options.
*
@@ -1786,7 +2190,7 @@ declare namespace Excel {
protect(options?: Excel.WorksheetProtectionOptions): void;
/**
*
- * Unprotect a worksheet
+ * Unprotects a worksheet.
*
* [Api set: ExcelApi 1.2]
*/
@@ -1868,7 +2272,7 @@ declare namespace Excel {
allowInsertRows?: boolean;
/**
*
- * Represents the worksheet protection option of allowing using pivot table feature.
+ * Represents the worksheet protection option of allowing using PivotTable feature.
*
* [Api set: ExcelApi 1.2]
*/
@@ -1909,6 +2313,8 @@ declare namespace Excel {
private m_values;
private m_worksheet;
private m__ReferenceId;
+ private _ensureInteger(num, methodName);
+ private _getAdjacentRange(functionName, count, referenceRange, rowDirection, columnDirection);
/**
*
* Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. Read-only.
@@ -1916,6 +2322,12 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
format: Excel.RangeFormat;
+ /**
+ *
+ * Represents the range sort of the current range.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
sort: Excel.RangeSort;
/**
*
@@ -2089,6 +2501,24 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getColumn(column: number): Excel.Range;
+ /**
+ *
+ * Gets a certain number of columns to the right of the current Range object.
+ *
+ * @param count The number of columns to include in the resulting range. In general, use a positive number to create a range outside the current range. You can also use a negative number to create a range within the current range. The default value is 1.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ getColumnsAfter(count?: number): Excel.Range;
+ /**
+ *
+ * Gets a certain number of columns to the left of the current Range object.
+ *
+ * @param count The number of columns to include in the resulting range. In general, use a positive number to create a range outside the current range. You can also use a negative number to create a range within the current range. The default value is 1.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ getColumnsBefore(count?: number): Excel.Range;
/**
*
* Gets an object that represents the entire column of the range.
@@ -2112,6 +2542,15 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getIntersection(anotherRange: Excel.Range | string): Excel.Range;
+ /**
+ *
+ * Gets the range object that represents the rectangular intersection of the given ranges. If no intersection is found, will return a null object.
+ *
+ * @param anotherRange The range object or range address that will be used to determine the intersection of ranges.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getIntersectionOrNull(anotherRange: Excel.Range | string): Excel.Range;
/**
*
* Gets the last cell within the range. For example, the last cell of "B2:D5" is "D5".
@@ -2143,6 +2582,16 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getOffsetRange(rowOffset: number, columnOffset: number): Excel.Range;
+ /**
+ *
+ * Gets a Range object similar to the current Range object, but with its bottom-right corner expanded (or contracted) by some number of rows and columns.
+ *
+ * @param deltaRows The number of rows by which to expand the bottom-right corner, relative to the current range. Use a positive number to expand the range, or a negative number to decrease it.
+ * @param deltaColumns The number of columnsby which to expand the bottom-right corner, relative to the current range. Use a positive number to expand the range, or a negative number to decrease it.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ getResizedRange(deltaRows: number, deltaColumns: number): Excel.Range;
/**
*
* Gets a row contained in the range.
@@ -2152,15 +2601,40 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getRow(row: number): Excel.Range;
+ /**
+ *
+ * Gets a certain number of rows above the current Range object.
+ *
+ * @param count The number of rows to include in the resulting range. In general, use a positive number to create a range outside the current range. You can also use a negative number to create a range within the current range. The default value is 1.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ getRowsAbove(count?: number): Excel.Range;
+ /**
+ *
+ * Gets a certain number of rows below the current Range object.
+ *
+ * @param count The number of rows to include in the resulting range. In general, use a positive number to create a range outside the current range. You can also use a negative number to create a range within the current range. The default value is 1.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ getRowsBelow(count?: number): Excel.Range;
/**
*
* Returns the used range of the given range object.
*
- * @param valuesOnly Considers only cells with values as used cells. [Parameter available: ExcelApi 1.2]
+ * @param valuesOnly Considers only cells with values as used cells. [Api set: ExcelApi 1.2]
*
* [Api set: ExcelApi 1.1]
*/
getUsedRange(valuesOnly?: boolean): Excel.Range;
+ /**
+ *
+ * Represents the visible rows of the current range.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getVisibleView(): Excel.RangeView;
/**
*
* Inserts a cell or a range of cells into the worksheet in place of this range, and shifts the other cells to make space. Returns a new Range object at the now blank space.
@@ -2207,6 +2681,129 @@ declare namespace Excel {
interface RangeReference {
address: string;
}
+ /**
+ *
+ * RangeView represents a set of visible cells of the parent range.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ class RangeView extends OfficeExtension.ClientObject {
+ private m_columnCount;
+ private m_formulas;
+ private m_formulasLocal;
+ private m_formulasR1C1;
+ private m_numberFormat;
+ private m_rowCount;
+ private m_rows;
+ private m_text;
+ private m_valueTypes;
+ private m_values;
+ /**
+ *
+ * Represents a collection of range views associated with the range. Read-only.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ rows: Excel.RangeViewCollection;
+ /**
+ *
+ * Returns the number of visible columns. Read-only.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ columnCount: number;
+ /**
+ *
+ * Represents the formula in A1-style notation.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ formulas: Array>;
+ /**
+ *
+ * Represents the formula in A1-style notation, in the user's language and number-formatting locale. For example, the English "=SUM(A1, 1.5)" formula would become "=SUMME(A1; 1,5)" in German.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ formulasLocal: Array>;
+ /**
+ *
+ * Represents the formula in R1C1-style notation.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ formulasR1C1: Array>;
+ /**
+ *
+ * Represents Excel's number format code for the given cell. Read-only.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ numberFormat: Array>;
+ /**
+ *
+ * Returns the number of visible rows. Read-only.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ rowCount: number;
+ /**
+ *
+ * Text values of the specified range. The Text value will not depend on the cell width. The # sign substitution that happens in Excel UI will not affect the text value returned by the API. Read-only.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ text: Array>;
+ /**
+ *
+ * Represents the type of data of each cell. Read-only.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ valueTypes: Array>;
+ /**
+ *
+ * Represents the raw values of the specified range view. The data returned could be of type string, number, or a boolean. Cell that contain an error will return the error string.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ values: Array>;
+ /**
+ *
+ * Gets the parent range associated with the current RangeView.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getRange(): Excel.Range;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): Excel.RangeView;
+ }
+ /**
+ *
+ * Represents a collection of worksheet objects that are part of the workbook.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ class RangeViewCollection extends OfficeExtension.ClientObject {
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Gets a RangeView Row via it's index. Zero-Indexed.
+ *
+ * @param index Index of the visible row.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getItem(index: number): Excel.RangeView;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): Excel.RangeViewCollection;
+ }
/**
*
* A collection of all the nameditem objects that are part of the workbook.
@@ -2226,6 +2823,15 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getItem(name: string): Excel.NamedItem;
+ /**
+ *
+ * Gets a nameditem object using its name. If the nameditem object does not exist, the returned object's isNull property will be true.
+ *
+ * @param name nameditem name.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getItemOrNull(name: string): Excel.NamedItem;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
@@ -2292,6 +2898,8 @@ declare namespace Excel {
class Binding extends OfficeExtension.ClientObject {
private m_id;
private m_type;
+ private m_dataChanged;
+ private m_selectionChanged;
/**
*
* Represents binding identifier. Read-only.
@@ -2331,6 +2939,20 @@ declare namespace Excel {
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Excel.Binding;
+ /**
+ *
+ * Occurs when data within the binding is changed.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ onDataChanged: OfficeExtension.EventHandlers;
+ /**
+ *
+ * Occurs when the selection is changed within the binding.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ onSelectionChanged: OfficeExtension.EventHandlers;
}
/**
*
@@ -2350,6 +2972,38 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
count: number;
+ /**
+ *
+ * Add a new binding to a particular Range.
+ *
+ * @param range Range to bind the binding to. May be an Excel Range object, or a string. If string, must contain the full address, including the sheet name
+ * @param bindingType Type of binding. See Excel.BindingType.
+ * @param id Name of binding.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ add(range: Excel.Range | string, bindingType: string, id: string): Excel.Binding;
+ /**
+ *
+ * Add a new binding based on a named item in the workbook.
+ *
+ * @param name Name from which to create binding.
+ * @param bindingType Type of binding. See Excel.BindingType.
+ * @param id Name of binding.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ addFromNamedItem(name: string, bindingType: string, id: string): Excel.Binding;
+ /**
+ *
+ * Add a new binding based on the current selection.
+ *
+ * @param bindingType Type of binding. See Excel.BindingType.
+ * @param id Name of binding.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ addFromSelection(bindingType: string, id: string): Excel.Binding;
/**
*
* Gets a binding object by ID.
@@ -2368,6 +3022,15 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getItemAt(index: number): Excel.Binding;
+ /**
+ *
+ * Gets a binding object by ID. If the binding object does not exist, the return object's isNull property will be true.
+ *
+ * @param id Id of the binding object to be retrieved.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getItemOrNull(id: string): Excel.Binding;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
@@ -2419,6 +3082,15 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getItemAt(index: number): Excel.Table;
+ /**
+ *
+ * Gets a table by Name or ID. If the table does not exist, the return object's isNull property will be true.
+ *
+ * @param key Name or ID of the table to be retrieved.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getItemOrNull(key: number | string): Excel.Table;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
@@ -2432,9 +3104,14 @@ declare namespace Excel {
*/
class Table extends OfficeExtension.ClientObject {
private m_columns;
+ private m_highlightFirstColumn;
+ private m_highlightLastColumn;
private m_id;
private m_name;
private m_rows;
+ private m_showBandedColumns;
+ private m_showBandedRows;
+ private m_showFilterButton;
private m_showHeaders;
private m_showTotals;
private m_sort;
@@ -2468,6 +3145,20 @@ declare namespace Excel {
* [Api set: ExcelApi 1.2]
*/
worksheet: Excel.Worksheet;
+ /**
+ *
+ * Indicates whether the first column contains special formatting.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ highlightFirstColumn: boolean;
+ /**
+ *
+ * Indicates whether the last column contains special formatting.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ highlightLastColumn: boolean;
/**
*
* Returns a value that uniquely identifies the table in a given workbook. The value of the identifier remains the same even when the table is renamed. Read-only.
@@ -2482,6 +3173,27 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
name: string;
+ /**
+ *
+ * Indicates whether the columns show banded formatting in which odd columns are highlighted differently from even ones to make reading the table easier.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ showBandedColumns: boolean;
+ /**
+ *
+ * Indicates whether the rows show banded formatting in which odd rows are highlighted differently from even ones to make reading the table easier.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ showBandedRows: boolean;
+ /**
+ *
+ * Indicates whether the filter buttons are visible at the top of each column header. Setting this is only allowed if the table contains a header row.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ showFilterButton: boolean;
/**
*
* Indicates whether the header row is visible or not. This value can be set to show or remove the header row.
@@ -2610,6 +3322,15 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getItemAt(index: number): Excel.TableColumn;
+ /**
+ *
+ * Gets a column object by Name or ID. If the column does not exist, the returned object's isNull property will be true.
+ *
+ * @param key Column Name or ID.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getItemOrNull(key: number | string): Excel.TableColumn;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
@@ -3131,6 +3852,16 @@ declare namespace Excel {
* [Api set: ExcelApi 1.1]
*/
getItemAt(index: number): Excel.Chart;
+ /**
+ *
+ * Gets a chart using its name. If there are multiple charts with the same name, the first one will be returned.
+ If the chart does not exist, the returned object's isNull property will be true.
+ *
+ * @param name Name of the chart to be retrieved.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getItemOrNull(name: string): Excel.Chart;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
@@ -4380,7 +5111,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]
@@ -4473,10 +5204,85 @@ declare namespace Excel {
*/
set: string;
}
+ /**
+ *
+ * Represents a collection of all the PivotTables that are part of the workbook or worksheet.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ class PivotTableCollection extends OfficeExtension.ClientObject {
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Gets a PivotTable by name.
+ *
+ * @param name Name of the PivotTable to be retrieved.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getItem(name: string): Excel.PivotTable;
+ /**
+ *
+ * Gets a PivotTable by name. If the PivotTable does not exist, the return object's isNull property will be true.
+ *
+ * @param name Name of the PivotTable to be retrieved.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ getItemOrNull(name: string): Excel.PivotTable;
+ /**
+ *
+ * Refreshes all the PivotTables in the collection.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ refreshAll(): void;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): Excel.PivotTableCollection;
+ }
+ /**
+ *
+ * Represents an Excel PivotTable.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ class PivotTable extends OfficeExtension.ClientObject {
+ private m_name;
+ private m_worksheet;
+ /**
+ *
+ * The worksheet containing the current PivotTable. Read-only.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ worksheet: Excel.Worksheet;
+ /**
+ *
+ * Name of the PivotTable.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ name: string;
+ /**
+ *
+ * Refreshes the PivotTable.
+ *
+ * [Api set: ExcelApi 1.3 (Preview)]
+ */
+ refresh(): void;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): Excel.PivotTable;
+ }
/**
* [Api set: ExcelApi 1.1]
*/
- namespace BindingType {
+ module BindingType {
var range: string;
var table: string;
var text: string;
@@ -4484,7 +5290,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace BorderIndex {
+ module BorderIndex {
var edgeTop: string;
var edgeBottom: string;
var edgeLeft: string;
@@ -4497,7 +5303,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace BorderLineStyle {
+ module BorderLineStyle {
var none: string;
var continuous: string;
var dash: string;
@@ -4510,7 +5316,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace BorderWeight {
+ module BorderWeight {
var hairline: string;
var thin: string;
var medium: string;
@@ -4519,7 +5325,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace CalculationMode {
+ module CalculationMode {
var automatic: string;
var automaticExceptTables: string;
var manual: string;
@@ -4527,7 +5333,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace CalculationType {
+ module CalculationType {
var recalculate: string;
var full: string;
var fullRebuild: string;
@@ -4535,7 +5341,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace ClearApplyTo {
+ module ClearApplyTo {
var all: string;
var formats: string;
var contents: string;
@@ -4543,7 +5349,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace ChartDataLabelPosition {
+ module ChartDataLabelPosition {
var invalid: string;
var none: string;
var center: string;
@@ -4560,7 +5366,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace ChartLegendPosition {
+ module ChartLegendPosition {
var invalid: string;
var top: string;
var bottom: string;
@@ -4570,9 +5376,17 @@ declare namespace Excel {
var custom: string;
}
/**
+ *
+ * Specifies whether the series are by rows or by columns. On Desktop, the "auto" option will inspect the source data shape to automatically guess whether the data is by rows or columns; on Excel Online, "auto" will simply default to "columns".
+ *
* [Api set: ExcelApi 1.1]
*/
- namespace ChartSeriesBy {
+ module ChartSeriesBy {
+ /**
+ *
+ * On Desktop, the "auto" option will inspect the source data shape to automatically guess whether the data is by rows or columns; on Excel Online, "auto" will simply default to "columns".
+ *
+ */
var auto: string;
var columns: string;
var rows: string;
@@ -4580,7 +5394,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace ChartType {
+ module ChartType {
var invalid: string;
var columnClustered: string;
var columnStacked: string;
@@ -4659,21 +5473,21 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace ChartUnderlineStyle {
+ module ChartUnderlineStyle {
var none: string;
var single: string;
}
/**
* [Api set: ExcelApi 1.1]
*/
- namespace DeleteShiftDirection {
+ module DeleteShiftDirection {
var up: string;
var left: string;
}
/**
* [Api set: ExcelApi 1.2]
*/
- namespace DynamicFilterCriteria {
+ module DynamicFilterCriteria {
var unknown: string;
var aboveAverage: string;
var allDatesInPeriodApril: string;
@@ -4713,7 +5527,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.2]
*/
- namespace FilterDatetimeSpecificity {
+ module FilterDatetimeSpecificity {
var year: string;
var month: string;
var day: string;
@@ -4724,7 +5538,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.2]
*/
- namespace FilterOn {
+ module FilterOn {
var bottomItems: string;
var bottomPercent: string;
var cellColor: string;
@@ -4739,14 +5553,14 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.2]
*/
- namespace FilterOperator {
+ module FilterOperator {
var and: string;
var or: string;
}
/**
* [Api set: ExcelApi 1.1]
*/
- namespace HorizontalAlignment {
+ module HorizontalAlignment {
var general: string;
var left: string;
var center: string;
@@ -4759,7 +5573,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.2]
*/
- namespace IconSet {
+ module IconSet {
var invalid: string;
var threeArrows: string;
var threeArrowsGray: string;
@@ -4785,7 +5599,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.2]
*/
- namespace ImageFittingMode {
+ module ImageFittingMode {
var fit: string;
var fitAndCenter: string;
var fill: string;
@@ -4793,14 +5607,14 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace InsertShiftDirection {
+ module InsertShiftDirection {
var down: string;
var right: string;
}
/**
* [Api set: ExcelApi 1.1]
*/
- namespace NamedItemType {
+ module NamedItemType {
var string: string;
var integer: string;
var double: string;
@@ -4810,7 +5624,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace RangeUnderlineStyle {
+ module RangeUnderlineStyle {
var none: string;
var single: string;
var double: string;
@@ -4820,7 +5634,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace SheetVisibility {
+ module SheetVisibility {
var visible: string;
var hidden: string;
var veryHidden: string;
@@ -4828,7 +5642,7 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.1]
*/
- namespace RangeValueType {
+ module RangeValueType {
var unknown: string;
var empty: string;
var string: string;
@@ -4840,14 +5654,14 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.2]
*/
- namespace SortOrientation {
+ module SortOrientation {
var rows: string;
var columns: string;
}
/**
* [Api set: ExcelApi 1.2]
*/
- namespace SortOn {
+ module SortOn {
var value: string;
var cellColor: string;
var fontColor: string;
@@ -4856,21 +5670,21 @@ declare namespace Excel {
/**
* [Api set: ExcelApi 1.2]
*/
- namespace SortDataOption {
+ module SortDataOption {
var normal: string;
var textAsNumber: string;
}
/**
* [Api set: ExcelApi 1.2]
*/
- namespace SortMethod {
+ module SortMethod {
var pinYin: string;
var strokeCount: string;
}
/**
* [Api set: ExcelApi 1.1]
*/
- namespace VerticalAlignment {
+ module VerticalAlignment {
var top: string;
var center: string;
var bottom: string;
@@ -8229,6 +9043,57 @@ declare namespace Excel {
* [Api set: ExcelApi 1.2]
*/
tbillYield(settlement: number | string | boolean | Excel.Range | Excel.RangeReference | Excel.FunctionResult, maturity: number | string | boolean | Excel.Range | Excel.RangeReference | Excel.FunctionResult, pr: number | string | boolean | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult;
+ /**
+ *
+ * Returns the left-tailed Student's t-distribution.
+ *
+ * @param x Is the numeric value at which to evaluate the distribution.
+ * @param degFreedom Is an integer indicating the number of degrees of freedom that characterize the distribution.
+ * @param cumulative Is a logical value: for the cumulative distribution function, use TRUE; for the probability density function, use FALSE.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ t_Dist(x: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, cumulative: boolean | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult;
+ /**
+ *
+ * Returns the two-tailed Student's t-distribution.
+ *
+ * @param x Is the numeric value at which to evaluate the distribution.
+ * @param degFreedom Is an integer indicating the number of degrees of freedom that characterize the distribution.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ t_Dist_2T(x: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult;
+ /**
+ *
+ * Returns the right-tailed Student's t-distribution.
+ *
+ * @param x Is the numeric value at which to evaluate the distribution.
+ * @param degFreedom Is an integer indicating the number of degrees of freedom that characterize the distribution.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ t_Dist_RT(x: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult;
+ /**
+ *
+ * Returns the left-tailed inverse of the Student's t-distribution.
+ *
+ * @param probability Is the probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive.
+ * @param degFreedom Is a positive integer indicating the number of degrees of freedom to characterize the distribution.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ t_Inv(probability: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult;
+ /**
+ *
+ * Returns the two-tailed inverse of the Student's t-distribution.
+ *
+ * @param probability Is the probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive.
+ * @param degFreedom Is a positive integer indicating the number of degrees of freedom to characterize the distribution.
+ *
+ * [Api set: ExcelApi 1.2]
+ */
+ t_Inv_2T(probability: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult;
/**
*
* Returns the tangent of an angle.
@@ -8598,7 +9463,7 @@ declare namespace Excel {
*/
z_Test(array: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, x: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, sigma?: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult;
}
- namespace ErrorCodes {
+ module ErrorCodes {
var accessDenied: string;
var generalException: string;
var insertDeleteConflict: string;
@@ -8613,7 +9478,7 @@ declare namespace Excel {
var unsupportedOperation: string;
}
}
-declare namespace Excel {
+declare module Excel {
/**
* The RequestContext object facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the request context is required to get access to the Excel object model from the add-in.
*/
@@ -8646,10 +9511,6 @@ declare namespace Word {
* [Api set: WordApiDesktop 1.3 Beta]
*/
createDocument(base64File?: string): Word.Document;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Create a new instance of Word.Application object
*/
@@ -8751,13 +9612,6 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
type: string;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Clears the contents of the body object. The user can perform the undo operation on the cleared content.
@@ -8905,16 +9759,10 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
select(selectionMode?: string): void;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.Body;
- _initReferenceId(value: string): void;
}
/**
*
@@ -9100,13 +9948,6 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
type: string;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Clears the contents of the content control. The user can perform the undo operation on the cleared content.
@@ -9278,16 +10119,10 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
split(delimiters: Array, multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean): Word.RangeCollection;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.ContentControl;
- _initReferenceId(value: string): void;
}
/**
*
@@ -9308,13 +10143,6 @@ declare namespace Word {
first: Word.ContentControl;
/** Gets the loaded child items in this collection. */
items: Array;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Gets a content control by its identifier.
@@ -9360,16 +10188,10 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
getItem(index: number): Word.ContentControl;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.ContentControlCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -9411,13 +10233,6 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
saved: boolean;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Gets the current selection of the document. Multiple selections are not supported.
@@ -9439,20 +10254,10 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
save(): void;
- _GetObjectByReferenceId(referenceId: string): OfficeExtension.ClientResult;
- _GetObjectTypeNameByReferenceId(referenceId: string): OfficeExtension.ClientResult;
- _KeepReference(): void;
- _RemoveAllReferences(): void;
- _RemoveReference(referenceId: string): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.Document;
- _initReferenceId(value: string): void;
}
/**
*
@@ -9550,23 +10355,10 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
underline: string;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.Font;
- _initReferenceId(value: string): void;
}
/**
*
@@ -9673,20 +10465,6 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
width: number;
- /**
- *
- * ID
- *
- * [Api set: WordApi]
- */
- _Id: number;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Deletes the inline picture from the document.
@@ -9796,16 +10574,10 @@ declare namespace Word {
* [Api set: WordApi 1.2]
*/
select(selectionMode?: string): void;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.InlinePicture;
- _initReferenceId(value: string): void;
}
/**
*
@@ -9826,32 +10598,10 @@ declare namespace Word {
first: Word.InlinePicture;
/** Gets the loaded child items in this collection. */
items: Array;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- /**
- *
- * Gets an inline picture object by its index in the collection.
- *
- * @param index A number that identifies the index location of an inline picture object.
- *
- * [Api set: WordApi 1.1]
- */
- _GetItem(index: number): Word.InlinePicture;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.InlinePictureCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -9877,7 +10627,6 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
id: number;
- _ReferenceId: string;
/**
*
* Gets the paragraphs in the list.
@@ -9897,16 +10646,10 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
insertParagraph(paragraphText: string, insertLocation: string): Word.Paragraph;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.List;
- _initReferenceId(value: string): void;
}
/**
*
@@ -9927,7 +10670,6 @@ declare namespace Word {
first: Word.List;
/** Gets the loaded child items in this collection. */
items: Array;
- _ReferenceId: string;
/**
*
* Gets a list by its identifier.
@@ -9937,25 +10679,10 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
getById(id: number): Word.List;
- /**
- *
- * Gets a list object by its index in the collection.
- *
- * @param index A number that identifies the index location of a list object.
- *
- * [Api set: WordApi 1.3 Beta]
- */
- _GetItem(index: number): Word.List;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.ListCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -9973,17 +10700,10 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
levelTypes: Array;
- _ReferenceId: string;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.ListFormat;
- _initReferenceId(value: string): void;
}
/**
*
@@ -10009,7 +10729,6 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
siblingIndex: number;
- _ReferenceId: string;
/**
*
* Gets the list item parent, or the closest ancestor if the parent does not exist.
@@ -10028,16 +10747,10 @@ declare namespace Word {
* [Api set: WordApiDesktop 1.3 Beta]
*/
getDescendants(directChildrenOnly?: boolean): Word.ParagraphCollection;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.ListItem;
- _initReferenceId(value: string): void;
}
/**
*
@@ -10248,20 +10961,6 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
text: string;
- /**
- *
- * ID
- *
- * [Api set: WordApi]
- */
- _Id: number;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Clears the contents of the paragraph object. The user can perform the undo operation on the cleared content.
@@ -10444,16 +11143,10 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
startNewList(): Word.List;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.Paragraph;
- _initReferenceId(value: string): void;
}
/**
*
@@ -10482,32 +11175,10 @@ declare namespace Word {
last: Word.Paragraph;
/** Gets the loaded child items in this collection. */
items: Array;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- /**
- *
- * Gets a paragraph object by its index in the collection.
- *
- * @param index A number that identifies the index location of a paragraph object.
- *
- * [Api set: WordApi 1.1]
- */
- _GetItem(index: number): Word.Paragraph;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.ParagraphCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -10630,20 +11301,6 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
text: string;
- /**
- *
- * ID
- *
- * [Api set: WordApi]
- */
- _Id: number;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Clears the contents of the range object. The user can perform the undo operation on the cleared content.
@@ -10864,16 +11521,10 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
split(delimiters: Array, multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean): Word.RangeCollection;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.Range;
- _initReferenceId(value: string): void;
}
/**
*
@@ -10894,32 +11545,10 @@ declare namespace Word {
first: Word.Range;
/** Gets the loaded child items in this collection. */
items: Array;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- /**
- *
- * Gets a range object by its index in the collection.
- *
- * @param index A number that identifies the index location of a range object.
- *
- * [Api set: WordApi 1.3 Beta]
- */
- _GetItem(index: number): Word.Range;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.RangeCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -10993,10 +11622,6 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
matchWildcards: boolean;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
@@ -11025,32 +11650,10 @@ declare namespace Word {
first: Word.Range;
/** Gets the loaded child items in this collection. */
items: Array;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- /**
- *
- * Gets a range object by its index in the collection.
- *
- * @param index A number that identifies the index location of a range object.
- *
- * [Api set: WordApi 1.1]
- */
- _GetItem(index: number): Word.Range;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.SearchResultCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -11077,20 +11680,6 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
next: Word.Section;
- /**
- *
- * ID
- *
- * [Api set: WordApi]
- */
- _Id: number;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Gets one of the section's footers.
@@ -11109,16 +11698,10 @@ declare namespace Word {
* [Api set: WordApi 1.1]
*/
getHeader(type: string): Word.Body;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.Section;
- _initReferenceId(value: string): void;
}
/**
*
@@ -11139,32 +11722,10 @@ declare namespace Word {
first: Word.Section;
/** Gets the loaded child items in this collection. */
items: Array;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- /**
- *
- * Gets a section object by its index in the collection.
- *
- * @param index A number that identifies the index location of a section object.
- *
- * [Api set: WordApi 1.1]
- */
- _GetItem(index: number): Word.Section;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.SectionCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -11399,20 +11960,6 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
width: number;
- /**
- *
- * ID
- *
- * [Api set: WordApi]
- */
- _Id: number;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Adds columns to the start or end of the table, using the first or last existing column as a template. This is applicable to uniform tables. The string values, if specified, are set in the newly inserted rows.
@@ -11594,16 +12141,10 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
select(selectionMode?: string): void;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.Table;
- _initReferenceId(value: string): void;
}
/**
*
@@ -11624,32 +12165,10 @@ declare namespace Word {
first: Word.Table;
/** Gets the loaded child items in this collection. */
items: Array;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- /**
- *
- * Gets a table object by its index in the collection.
- *
- * @param index A number that identifies the index location of a table object.
- *
- * [Api set: WordApi 1.3 Beta]
- */
- _GetItem(index: number): Word.Table;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -11780,20 +12299,6 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
verticalAlignment: string;
- /**
- *
- * ID
- *
- * [Api set: WordApi]
- */
- _Id: number;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Clears the contents of the row.
@@ -11863,16 +12368,10 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
select(selectionMode?: string): void;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableRow;
- _initReferenceId(value: string): void;
}
/**
*
@@ -11893,32 +12392,10 @@ declare namespace Word {
first: Word.TableRow;
/** Gets the loaded child items in this collection. */
items: Array;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- /**
- *
- * Gets a table row object by its index in the collection.
- *
- * @param index A number that identifies the index location of a table row object.
- *
- * [Api set: WordApi 1.3 Beta]
- */
- _GetItem(index: number): Word.TableRow;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableRowCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -12049,20 +12526,6 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
width: number;
- /**
- *
- * ID
- *
- * [Api set: WordApi]
- */
- _Id: number;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
/**
*
* Deletes the column containing this cell. This is applicable to uniform tables.
@@ -12118,16 +12581,10 @@ declare namespace Word {
* [Api set: WordApiDesktop 1.3 Beta]
*/
split(rowCount: number, columnCount: number): void;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableCell;
- _initReferenceId(value: string): void;
}
/**
*
@@ -12148,32 +12605,10 @@ declare namespace Word {
first: Word.TableCell;
/** Gets the loaded child items in this collection. */
items: Array;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- /**
- *
- * Gets a table cell object by its index in the collection.
- *
- * @param index A number that identifies the index location of a table cell object.
- *
- * [Api set: WordApi 1.3 Beta]
- */
- _GetItem(index: number): Word.TableCell;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableCellCollection;
- _initReferenceId(value: string): void;
}
/**
*
@@ -12207,23 +12642,10 @@ declare namespace Word {
* [Api set: WordApi 1.3 Beta]
*/
width: number;
- /**
- *
- * ReferenceId
- *
- * [Api set: WordApi]
- */
- _ReferenceId: string;
- _KeepReference(): void;
- /** Handle results returned from the document
- * @private
- */
- _handleResult(value: any): void;
/**
* Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
*/
load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableBorderStyle;
- _initReferenceId(value: string): void;
}
/**
*
@@ -13086,3 +13508,2176 @@ declare namespace Office {
}
}
+declare namespace OneNote {
+ /**
+ *
+ * Represents the top-level object that contains all globally addressable OneNote objects such as notebooks, the active notebook, and the active section.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class Application extends OfficeExtension.ClientObject {
+ private m_notebooks;
+ /**
+ *
+ * Gets the collection of notebooks that are open in the OneNote application instance. In OneNote Online, only one notebook at a time is open in the application instance. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ notebooks: OneNote.NotebookCollection;
+ /**
+ *
+ * Gets the active notebook if one exists. If no notebook is active, throws ItemNotFound.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getActiveNotebook(): OneNote.Notebook;
+ /**
+ *
+ * Gets the active notebook if one exists. If no notebook is active, returns null.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getActiveNotebookOrNull(): OneNote.Notebook;
+ /**
+ *
+ * Gets the active outline if one exists, If no outline is active, throws ItemNotFound.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getActiveOutline(): OneNote.Outline;
+ /**
+ *
+ * Gets the active outline if one exists, otherwise returns null.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getActiveOutlineOrNull(): OneNote.Outline;
+ /**
+ *
+ * Gets the active page if one exists. If no page is active, throws ItemNotFound.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getActivePage(): OneNote.Page;
+ /**
+ *
+ * Gets the active page if one exists. If no page is active, returns null.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getActivePageOrNull(): OneNote.Page;
+ /**
+ *
+ * Gets the active section if one exists. If no section is active, throws ItemNotFound.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getActiveSection(): OneNote.Section;
+ /**
+ *
+ * Gets the active section if one exists. If no section is active, returns null.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getActiveSectionOrNull(): OneNote.Section;
+ /**
+ *
+ * Opens the specified page in the application instance.
+ *
+ * @param page The page to open.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ navigateToPage(page: OneNote.Page): void;
+ /**
+ *
+ * Gets the specified page, and opens it in the application instance.
+ *
+ * @param url The client url of the page to open.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.Application;
+ }
+ /**
+ *
+ * Represents ink analysis data for a given set of ink strokes.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkAnalysis extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_page;
+ private m_paragraphs;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the parent page object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ page: OneNote.Page;
+ /**
+ *
+ * Gets the ink analysis paragraphs in this page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ paragraphs: OneNote.InkAnalysisParagraphCollection;
+ /**
+ *
+ * Gets the ID of the InkAnalysis object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkAnalysis;
+ }
+ /**
+ *
+ * Represents ink analysis data for an identified paragraph formed by ink strokes.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkAnalysisParagraph extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_inkAnalysis;
+ private m_lines;
+ private m__ReferenceId;
+ /**
+ *
+ * Reference to the parent InkAnalysisPage. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ inkAnalysis: OneNote.InkAnalysis;
+ /**
+ *
+ * Gets the ink analysis lines in this ink analysis paragraph. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ lines: OneNote.InkAnalysisLineCollection;
+ /**
+ *
+ * Gets the ID of the InkAnalysisParagraph object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkAnalysisParagraph;
+ }
+ /**
+ *
+ * Represents a collection of InkAnalysisParagraph objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkAnalysisParagraphCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of InkAnalysisParagraphs in the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets a InkAnalysisParagraph object by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the InkAnalysisParagraph object, or the index location of the InkAnalysisParagraph object in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.InkAnalysisParagraph;
+ /**
+ *
+ * Gets a InkAnalysisParagraph on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkAnalysisParagraphCollection;
+ }
+ /**
+ *
+ * Represents ink analysis data for an identified text line formed by ink strokes.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkAnalysisLine extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_paragraph;
+ private m_words;
+ private m__ReferenceId;
+ /**
+ *
+ * Reference to the parent InkAnalysisParagraph. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ paragraph: OneNote.InkAnalysisParagraph;
+ /**
+ *
+ * Gets the ink analysis words in this ink analysis line. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ words: OneNote.InkAnalysisWordCollection;
+ /**
+ *
+ * Gets the ID of the InkAnalysisLine object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkAnalysisLine;
+ }
+ /**
+ *
+ * Represents a collection of InkAnalysisLine objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkAnalysisLineCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of InkAnalysisLines in the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets a InkAnalysisLine object by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the InkAnalysisLine object, or the index location of the InkAnalysisLine object in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.InkAnalysisLine;
+ /**
+ *
+ * Gets a InkAnalysisLine on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkAnalysisLineCollection;
+ }
+ /**
+ *
+ * Represents ink analysis data for an identified word formed by ink strokes.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkAnalysisWord extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_languageId;
+ private m_line;
+ private m_strokePointers;
+ private m_wordAlternates;
+ private m__ReferenceId;
+ /**
+ *
+ * Reference to the parent InkAnalysisLine. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ line: OneNote.InkAnalysisLine;
+ /**
+ *
+ * Gets the ID of the InkAnalysisWord object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * The id of the recognized language in this inkAnalysisWord. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ languageId: string;
+ /**
+ *
+ * Weak references to the ink strokes that were recognized as part of this ink analysis word. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ strokePointers: Array;
+ /**
+ *
+ * The words that were recognized in this ink word, in order of likelihood. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ wordAlternates: Array;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkAnalysisWord;
+ }
+ /**
+ *
+ * Represents a collection of InkAnalysisWord objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkAnalysisWordCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of InkAnalysisWords in the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets a InkAnalysisWord object by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the InkAnalysisWord object, or the index location of the InkAnalysisWord object in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.InkAnalysisWord;
+ /**
+ *
+ * Gets a InkAnalysisWord on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkAnalysisWordCollection;
+ }
+ /**
+ *
+ * Represents a group of ink strokes.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class FloatingInk extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_inkStrokes;
+ private m_pageContent;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the strokes of the FloatingInk object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ inkStrokes: OneNote.InkStrokeCollection;
+ /**
+ *
+ * Gets the PageContent parent of the FloatingInk object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ pageContent: OneNote.PageContent;
+ /**
+ *
+ * Gets the ID of the FloatingInk object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.FloatingInk;
+ }
+ /**
+ *
+ * Represents a single stroke of ink.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkStroke extends OfficeExtension.ClientObject {
+ private m_floatingInk;
+ private m_id;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the ID of the InkStroke object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ floatingInk: OneNote.FloatingInk;
+ /**
+ *
+ * Gets the ID of the InkStroke object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkStroke;
+ }
+ /**
+ *
+ * Represents a collection of InkStroke objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkStrokeCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of InkStrokes in the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets a InkStroke object by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the InkStroke object, or the index location of the InkStroke object in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.InkStroke;
+ /**
+ *
+ * Gets a InkStroke on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkStrokeCollection;
+ }
+ /**
+ *
+ * A container for the ink in a word in a paragraph.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkWord extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_languageId;
+ private m_paragraph;
+ private m_wordAlternates;
+ private m__ReferenceId;
+ /**
+ *
+ * The parent paragraph containing the ink word. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ paragraph: OneNote.Paragraph;
+ /**
+ *
+ * Gets the ID of the InkWord object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * The id of the recognized language in this ink word. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ languageId: string;
+ /**
+ *
+ * The words that were recognized in this ink word, in order of likelihood. Read-only.
+ *
+ * [Api set: OneNoteApi]
+ */
+ wordAlternates: Array;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkWord;
+ }
+ /**
+ *
+ * Represents a collection of InkWord objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class InkWordCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of InkWords in the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets a InkWord object by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the InkWord object, or the index location of the InkWord object in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.InkWord;
+ /**
+ *
+ * Gets a InkWord on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.InkWordCollection;
+ }
+ /**
+ *
+ * Represents a OneNote notebook. Notebooks contain section groups and sections.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class Notebook extends OfficeExtension.ClientObject {
+ private m_clientUrl;
+ private m_id;
+ private m_name;
+ private m_sectionGroups;
+ private m_sections;
+ private m__ReferenceId;
+ /**
+ *
+ * The section groups in the notebook. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ sectionGroups: OneNote.SectionGroupCollection;
+ /**
+ *
+ * The the sections of the notebook. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ sections: OneNote.SectionCollection;
+ /**
+ *
+ * The client url of the notebook. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ clientUrl: string;
+ /**
+ *
+ * Gets the ID of the notebook. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets the name of the notebook. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ name: string;
+ /**
+ *
+ * Adds a new section to the end of the notebook.
+ *
+ * @param name The name of the new section.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ addSection(name: string): OneNote.Section;
+ /**
+ *
+ * Adds a new section group to the end of the notebook.
+ *
+ * @param name The name of the new section.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ addSectionGroup(name: string): OneNote.SectionGroup;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.Notebook;
+ }
+ /**
+ *
+ * Represents a collection of notebooks.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class NotebookCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of notebooks in the collection. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets the collection of notebooks with the specified name that are open in the application instance.
+ *
+ * @param name The name of the notebook.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getByName(name: string): OneNote.NotebookCollection;
+ /**
+ *
+ * Gets a notebook by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the notebook, or the index location of the notebook in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.Notebook;
+ /**
+ *
+ * Gets a notebook on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.NotebookCollection;
+ }
+ /**
+ *
+ * Represents a OneNote section group. Section groups can contain sections and other section groups.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class SectionGroup extends OfficeExtension.ClientObject {
+ private m_clientUrl;
+ private m_id;
+ private m_name;
+ private m_notebook;
+ private m_parentSectionGroup;
+ private m_parentSectionGroupOrNull;
+ private m_sectionGroups;
+ private m_sections;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the notebook that contains the section group. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ notebook: OneNote.Notebook;
+ /**
+ *
+ * Gets the section group that contains the section group. Throws ItemNotFound if the section group is a direct child of the notebook. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentSectionGroup: OneNote.SectionGroup;
+ /**
+ *
+ * Gets the section group that contains the section group. Returns null if the section group is a direct child of the notebook. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentSectionGroupOrNull: OneNote.SectionGroup;
+ /**
+ *
+ * The collection of section groups in the section group. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ sectionGroups: OneNote.SectionGroupCollection;
+ /**
+ *
+ * The collection of sections in the section group. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ sections: OneNote.SectionCollection;
+ /**
+ *
+ * The client url of the section group. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ clientUrl: string;
+ /**
+ *
+ * Gets the ID of the section group. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets the name of the section group. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ name: string;
+ /**
+ *
+ * Adds a new section to the end of the section group.
+ *
+ * @param title The name of the new section.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ addSection(title: string): OneNote.Section;
+ /**
+ *
+ * Adds a new section group to the end of this sectionGroup.
+ *
+ * @param name The name of the new section.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ addSectionGroup(name: string): OneNote.SectionGroup;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.SectionGroup;
+ }
+ /**
+ *
+ * Represents a collection of section groups.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class SectionGroupCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of section groups in the collection. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets the collection of section groups with the specified name.
+ *
+ * @param name The name of the section group.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getByName(name: string): OneNote.SectionGroupCollection;
+ /**
+ *
+ * Gets a section group by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the section group, or the index location of the section group in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.SectionGroup;
+ /**
+ *
+ * Gets a section group on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.SectionGroupCollection;
+ }
+ /**
+ *
+ * Represents a OneNote section. Sections can contain pages.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class Section extends OfficeExtension.ClientObject {
+ private m_clientUrl;
+ private m_id;
+ private m_name;
+ private m_notebook;
+ private m_pages;
+ private m_parentSectionGroup;
+ private m_parentSectionGroupOrNull;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the notebook that contains the section. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ notebook: OneNote.Notebook;
+ /**
+ *
+ * The collection of pages in the section. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ pages: OneNote.PageCollection;
+ /**
+ *
+ * Gets the section group that contains the section. Throws ItemNotFound if the section is a direct child of the notebook. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentSectionGroup: OneNote.SectionGroup;
+ /**
+ *
+ * Gets the section group that contains the section. Returns null if the section is a direct child of the notebook. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentSectionGroupOrNull: OneNote.SectionGroup;
+ /**
+ *
+ * The client url of the section. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ clientUrl: string;
+ /**
+ *
+ * Gets the ID of the section. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets the name of the section. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ name: string;
+ /**
+ *
+ * Adds a new page to the end of the section.
+ *
+ * @param title The title of the new page.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ addPage(title: string): OneNote.Page;
+ /**
+ *
+ * Copies this section to specified notebook.
+ *
+ * @param destinationNotebook The notebook to copy this section to.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ copyToNotebook(destinationNotebook: OneNote.Notebook): OneNote.Section;
+ /**
+ *
+ * Copies this section to specified section group.
+ *
+ * @param destinationSectionGroup The section group to copy this section to.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ copyToSectionGroup(destinationSectionGroup: OneNote.SectionGroup): OneNote.Section;
+ /**
+ *
+ * Inserts a new section before or after the current section.
+ *
+ * @param location The location of the new section relative to the current section.
+ * @param title The name of the new section.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ insertSectionAsSibling(location: string, 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.Section;
+ }
+ /**
+ *
+ * Represents a collection of sections.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class SectionCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of sections in the collection. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets the collection of sections with the specified name.
+ *
+ * @param name The name of the section.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getByName(name: string): OneNote.SectionCollection;
+ /**
+ *
+ * Gets a section by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the section, or the index location of the section in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.Section;
+ /**
+ *
+ * Gets a section on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.SectionCollection;
+ }
+ /**
+ *
+ * Represents a OneNote page.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class Page extends OfficeExtension.ClientObject {
+ private m_clientUrl;
+ private m_contents;
+ private m_id;
+ private m_inkAnalysisOrNull;
+ private m_pageLevel;
+ private m_parentSection;
+ private m_title;
+ private m_webUrl;
+ private m__ReferenceId;
+ /**
+ *
+ * The collection of PageContent objects on the page. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ contents: OneNote.PageContentCollection;
+ /**
+ *
+ * Text interpretation for the ink on the page. Returns null if there is no ink analysis information. Read only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ inkAnalysisOrNull: OneNote.InkAnalysis;
+ /**
+ *
+ * Gets the section that contains the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentSection: OneNote.Section;
+ /**
+ *
+ * The client url of the page. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ clientUrl: string;
+ /**
+ *
+ * Gets the ID of the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets or sets the indentation level of the page.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ pageLevel: number;
+ /**
+ *
+ * Gets or sets the title of the page.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ title: string;
+ /**
+ *
+ * The web url of the page. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ webUrl: string;
+ /**
+ *
+ * Adds an Outline to the page at the specified position.
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ addOutline(left: number, top: number, html: string): OneNote.Outline;
+ /**
+ *
+ * Copies this page to specified section.
+ *
+ * @param destinationSection The section to copy this page to.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ copyToSection(destinationSection: OneNote.Section): OneNote.Page;
+ /**
+ *
+ * Inserts a new page before or after the current page.
+ *
+ * @param location The location of the new page relative to the current page.
+ * @param title The title of the new page.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ insertPageAsSibling(location: string, 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.Page;
+ }
+ /**
+ *
+ * Represents a collection of pages.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class PageCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of pages in the collection. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets the collection of pages with the specified title.
+ *
+ * @param title The title of the page.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getByTitle(title: string): OneNote.PageCollection;
+ /**
+ *
+ * Gets a page by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the page, or the index location of the page in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.Page;
+ /**
+ *
+ * Gets a page on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.PageCollection;
+ }
+ /**
+ *
+ * Represents a region on a page that contains top-level content types such as Outline or Image. A PageContent object can be assigned an XY position.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class PageContent extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_image;
+ private m_ink;
+ private m_left;
+ private m_outline;
+ private m_parentPage;
+ private m_top;
+ private m_type;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the Image in the PageContent object. Throws an exception if PageContentType is not Image.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ image: OneNote.Image;
+ /**
+ *
+ * Gets the ink in the PageContent object. Throws an exception if PageContentType is not Ink.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ ink: OneNote.FloatingInk;
+ /**
+ *
+ * Gets the Outline in the PageContent object. Throws an exception if PageContentType is not Outline.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ outline: OneNote.Outline;
+ /**
+ *
+ * Gets the page that contains the PageContent object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentPage: OneNote.Page;
+ /**
+ *
+ * Gets the ID of the PageContent object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets or sets the left (X-axis) position of the PageContent object.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ left: number;
+ /**
+ *
+ * Gets or sets the top (Y-axis) position of the PageContent object.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ top: number;
+ /**
+ *
+ * Gets the type of the PageContent object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ type: string;
+ /**
+ *
+ * Deletes the PageContent object.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ delete(): void;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.PageContent;
+ }
+ /**
+ *
+ * Represents the contents of a page, as a collection of PageContent objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class PageContentCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of page contents in the collection. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets a PageContent object by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the PageContent object, or the index location of the PageContent object in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.PageContent;
+ /**
+ *
+ * Gets a page content on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.PageContentCollection;
+ }
+ /**
+ *
+ * Represents a container for Paragraph objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class Outline extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_pageContent;
+ private m_paragraphs;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the PageContent object that contains the Outline. This object defines the position of the Outline on the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ pageContent: OneNote.PageContent;
+ /**
+ *
+ * Gets the collection of Paragraph objects in the Outline. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ paragraphs: OneNote.ParagraphCollection;
+ /**
+ *
+ * Gets the ID of the Outline object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Adds the specified HTML to the bottom of the Outline.
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendHtml(html: string): void;
+ /**
+ *
+ * Adds the specified image to the bottom of the Outline.
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendImage(base64EncodedImage: string, width: number, height: number): OneNote.Image;
+ /**
+ *
+ * Adds the specified text to the bottom of the Outline.
+ *
+ * @param paragraphText HTML string to append.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendRichText(paragraphText: string): OneNote.RichText;
+ /**
+ *
+ * Adds a table with the specified number of rows and columns to the bottom of the outline.
+ *
+ * @param rowCount Required. The number of rows in the table.
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendTable(rowCount: number, columnCount: number, values?: Array>): OneNote.Table;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.Outline;
+ }
+ /**
+ *
+ * A container for the visible content on a page. A Paragraph can contain any one ParagraphType type of content.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class Paragraph extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_image;
+ private m_inkWords;
+ private m_outline;
+ private m_paragraphs;
+ private m_parentParagraph;
+ private m_parentParagraphOrNull;
+ private m_parentTableCell;
+ private m_parentTableCellOrNull;
+ private m_richText;
+ private m_table;
+ private m_type;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the Image object in the Paragraph. Throws an exception if ParagraphType is not Image. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ image: OneNote.Image;
+ /**
+ *
+ * Gets the Ink collection in the Paragraph. Throws an exception if ParagraphType is not Ink. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ inkWords: OneNote.InkWordCollection;
+ /**
+ *
+ * Gets the Outline object that contains the Paragraph. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ outline: OneNote.Outline;
+ /**
+ *
+ * The collection of paragraphs under this paragraph. Read only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ paragraphs: OneNote.ParagraphCollection;
+ /**
+ *
+ * Gets the parent paragraph object. Throws if a parent paragraph does not exist. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentParagraph: OneNote.Paragraph;
+ /**
+ *
+ * Gets the parent paragraph object. Returns null if a parent paragraph does not exist. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentParagraphOrNull: OneNote.Paragraph;
+ /**
+ *
+ * Gets the TableCell object that contains the Paragraph if one exists. If parent is not a TableCell, throws ItemNotFound. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentTableCell: OneNote.TableCell;
+ /**
+ *
+ * Gets the TableCell object that contains the Paragraph if one exists. If parent is not a TableCell, returns null. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentTableCellOrNull: OneNote.TableCell;
+ /**
+ *
+ * Gets the RichText object in the Paragraph. Throws an exception if ParagraphType is not RichText. Read-only
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ richText: OneNote.RichText;
+ /**
+ *
+ * Gets the Table object in the Paragraph. Throws an exception if ParagraphType is not Table. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ table: OneNote.Table;
+ /**
+ *
+ * Gets the ID of the Paragraph object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets the type of the Paragraph object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ type: string;
+ /**
+ *
+ * Deletes the paragraph
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ delete(): void;
+ /**
+ *
+ * Inserts the specified HTML content
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ insertHtmlAsSibling(insertLocation: string, html: string): void;
+ /**
+ *
+ * Inserts the image at the specified insert location..
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ insertImageAsSibling(insertLocation: string, base64EncodedImage: string, width: number, height: number): OneNote.Image;
+ /**
+ *
+ * Inserts the paragraph text at the specifiec insert location.
+ *
+ * @param insertLocation The location of the table relative to the current Paragraph.
+ * @param paragraphText HTML string to append.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ insertRichTextAsSibling(insertLocation: string, paragraphText: string): OneNote.RichText;
+ /**
+ *
+ * Adds a table with the specified number of rows and columns before or after the current paragraph.
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ insertTableAsSibling(insertLocation: string, rowCount: number, columnCount: number, values?: Array>): OneNote.Table;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.Paragraph;
+ }
+ /**
+ *
+ * Represents a collection of Paragraph objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class ParagraphCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of paragraphs in the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets a Paragraph object by ID or by its index in the collection. Read-only.
+ *
+ * @param index The ID of the Paragraph object, or the index location of the Paragraph object in the collection.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.Paragraph;
+ /**
+ *
+ * Gets a paragraph on its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.ParagraphCollection;
+ }
+ /**
+ *
+ * Represents a RichText object in a Paragraph.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class RichText extends OfficeExtension.ClientObject {
+ private m_id;
+ private m_paragraph;
+ private m_text;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the Paragraph object that contains the RichText object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ paragraph: OneNote.Paragraph;
+ /**
+ *
+ * Gets the ID of the RichText object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets the text content of the RichText object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ text: string;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.RichText;
+ }
+ /**
+ *
+ * Represents an Image. An Image can be a direct child of a PageContent object or a Paragraph object.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class Image extends OfficeExtension.ClientObject {
+ private m_description;
+ private m_height;
+ private m_hyperlink;
+ private m_id;
+ private m_ocrData;
+ private m_pageContent;
+ private m_paragraph;
+ private m_width;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the PageContent object that contains the Image. Throws if the Image is not a direct child of a PageContent. This object defines the position of the Image on the page. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ pageContent: OneNote.PageContent;
+ /**
+ *
+ * Gets the Paragraph object that contains the Image. Throws if the Image is not a direct child of a Paragraph. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ paragraph: OneNote.Paragraph;
+ /**
+ *
+ * Gets or sets the description of the Image.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ description: string;
+ /**
+ *
+ * Gets or sets the height of the Image layout.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ height: number;
+ /**
+ *
+ * Gets or sets the hyperlink of the Image.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ hyperlink: string;
+ /**
+ *
+ * Gets the ID of the Image object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets the data obtained by OCR (Optical Character Recognition) of this Image, such as OCR text and language.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ ocrData: OneNote.ImageOcrData;
+ /**
+ *
+ * Gets or sets the width of the Image layout.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ width: number;
+ /**
+ *
+ * Gets the base64-encoded binary representation of the Image.
+ Example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getBase64Image(): OfficeExtension.ClientResult;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.Image;
+ }
+ /**
+ *
+ * Represents a table in a OneNote page.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class Table extends OfficeExtension.ClientObject {
+ private m_borderVisible;
+ private m_columnCount;
+ private m_id;
+ private m_paragraph;
+ private m_rowCount;
+ private m_rows;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the Paragraph object that contains the Table object. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ paragraph: OneNote.Paragraph;
+ /**
+ *
+ * Gets all of the table rows. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ rows: OneNote.TableRowCollection;
+ /**
+ *
+ * Gets or sets whether the borders are visible or not. True if they are visible, false if they are hidden.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ borderVisible: boolean;
+ /**
+ *
+ * Gets the number of columns in the table.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ columnCount: number;
+ /**
+ *
+ * Gets the ID of the table. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets the number of rows in the table.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ rowCount: number;
+ /**
+ *
+ * Adds a column to the end of the table. Values, if specified, are set in the new column. Otherwise the column is empty.
+ *
+ * @param values Optional. Strings to insert in the new column, specified as an array. Must not have more values than rows in the table.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendColumn(values?: Array): void;
+ /**
+ *
+ * Adds a row to the end of the table. Values, if specified, are set in the new row. Otherwise the row is empty.
+ *
+ * @param values Optional. Strings to insert in the new row, specified as an array. Must not have more values than columns in the table.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendRow(values?: Array): OneNote.TableRow;
+ /**
+ *
+ * Clears the contents of the table.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ clear(): void;
+ /**
+ *
+ * Gets the table cell at a specified row and column.
+ *
+ * @param rowIndex The index of the row.
+ * @param cellIndex The index of the cell in the row.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getCell(rowIndex: number, cellIndex: number): OneNote.TableCell;
+ /**
+ *
+ * Inserts a column at the given index in the table. Values, if specified, are set in the new column. Otherwise the column is empty.
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ insertColumn(index: number, values?: Array): 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.
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ insertRow(index: number, values?: Array): OneNote.TableRow;
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.Table;
+ }
+ /**
+ *
+ * Represents a row in a table.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class TableRow extends OfficeExtension.ClientObject {
+ private m_cellCount;
+ private m_cells;
+ private m_id;
+ private m_parentTable;
+ private m_rowIndex;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the cells in the row. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ cells: OneNote.TableCellCollection;
+ /**
+ *
+ * Gets the parent table. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentTable: OneNote.Table;
+ /**
+ *
+ * Gets the number of cells in the row. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ cellCount: number;
+ /**
+ *
+ * Gets the ID of the row. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets the index of the row in its parent table. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ rowIndex: number;
+ /**
+ *
+ * Clears the contents of the row.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ clear(): void;
+ /**
+ *
+ * Inserts a row before or after the current row.
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ insertRowAsSibling(insertLocation: string, values?: Array): OneNote.TableRow;
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.TableRow;
+ }
+ /**
+ *
+ * Contains a collection of TableRow objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class TableRowCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of table rows in this collection. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets a table row object by ID or by its index in the collection. Read-only.
+ *
+ * @param index A number that identifies the index location of a table row object.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.TableRow;
+ /**
+ *
+ * Gets a table row at its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.TableRowCollection;
+ }
+ /**
+ *
+ * Represents a cell in a OneNote table.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class TableCell extends OfficeExtension.ClientObject {
+ private m_cellIndex;
+ private m_id;
+ private m_paragraphs;
+ private m_parentRow;
+ private m_rowIndex;
+ private m_shadingColor;
+ private m__ReferenceId;
+ /**
+ *
+ * Gets the collection of Paragraph objects in the TableCell. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ paragraphs: OneNote.ParagraphCollection;
+ /**
+ *
+ * Gets the parent row of the cell. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ parentRow: OneNote.TableRow;
+ /**
+ *
+ * Gets the index of the cell in its row. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ cellIndex: number;
+ /**
+ *
+ * Gets the ID of the cell. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ id: string;
+ /**
+ *
+ * Gets the index of the cell's row in the table. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ rowIndex: number;
+ /**
+ *
+ * Gets and sets the shading color of the cell
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ shadingColor: string;
+ /**
+ *
+ * Adds the specified HTML to the bottom of the TableCell.
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendHtml(html: string): void;
+ /**
+ *
+ * Adds the specified image to table cell.
+ *
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendImage(base64EncodedImage: string, width: number, height: number): OneNote.Image;
+ /**
+ *
+ * Adds the specified text to table cell.
+ *
+ * @param paragraphText HTML string to append.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendRichText(paragraphText: string): OneNote.RichText;
+ /**
+ *
+ * Adds a table with the specified number of rows and columns to table cell.
+ *
+ * @param rowCount Required. The number of rows in the table.
+ * @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.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ appendTable(rowCount: number, columnCount: number, values?: Array>): OneNote.Table;
+ /**
+ *
+ * Clears the contents of the cell.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ clear(): void;
+ /**
+ * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.TableCell;
+ }
+ /**
+ *
+ * Contains a collection of TableCell objects.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ class TableCellCollection extends OfficeExtension.ClientObject {
+ private m_count;
+ private m__ReferenceId;
+ private m__items;
+ /** Gets the loaded child items in this collection. */
+ items: Array;
+ /**
+ *
+ * Returns the number of tablecells in this collection. Read-only.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ count: number;
+ /**
+ *
+ * Gets a table cell object by ID or by its index in the collection. Read-only.
+ *
+ * @param index A number that identifies the index location of a table cell object.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ getItem(index: number | string): OneNote.TableCell;
+ /**
+ *
+ * Gets a tablecell at its position in the collection.
+ *
+ * @param index Index value of the object to be retrieved. Zero-indexed.
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ 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.
+ */
+ load(option?: string | string[] | OfficeExtension.LoadOption): OneNote.TableCellCollection;
+ }
+ /**
+ *
+ * Represents data obtained by OCR (optical character recognition) of an image
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ interface ImageOcrData {
+ /**
+ *
+ * Represents the OCR language, with values such as EN-US
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ ocrLanguageId: string;
+ /**
+ *
+ * Represents the text obtained by OCR of the image
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ ocrText: string;
+ }
+ /**
+ *
+ * Weak reference to an ink stroke object and its content parent
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ interface InkStrokePointer {
+ /**
+ *
+ * Represents the id of the page content object corresponding to this stroke
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ contentId: string;
+ /**
+ *
+ * Represents the id of the ink stroke
+ *
+ * [Api set: OneNoteApi 1.1]
+ */
+ inkStrokeId: string;
+ }
+ /**
+ * [Api set: OneNoteApi]
+ */
+ module InsertLocation {
+ var before: string;
+ var after: string;
+ }
+ /**
+ * [Api set: OneNoteApi]
+ */
+ module Alignment {
+ var left: string;
+ var centered: string;
+ var right: string;
+ var justified: string;
+ }
+ /**
+ * [Api set: OneNoteApi]
+ */
+ module Selected {
+ var notSelected: string;
+ var partialSelected: string;
+ var selected: string;
+ }
+ /**
+ * [Api set: OneNoteApi]
+ */
+ module PageContentType {
+ var outline: string;
+ var image: string;
+ var ink: string;
+ var other: string;
+ }
+ /**
+ * [Api set: OneNoteApi]
+ */
+ module ParagraphType {
+ var richText: string;
+ var image: string;
+ var table: string;
+ var ink: string;
+ var other: string;
+ }
+ module ErrorCodes {
+ var generalException: string;
+ }
+}
+declare namespace OneNote {
+ class RequestContext extends OfficeExtension.ClientRequestContext {
+ private m_onenote;
+ constructor(url?: string);
+ application: Application;
+ }
+ /**
+ * Executes a batch script that performs actions on the OneNote object model. 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 OneNote application. Since the Office add-in and the WoOneNote 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) => OfficeExtension.IPromise): OfficeExtension.IPromise;
+}
diff --git a/pixi.js/pixi.js.d.ts b/pixi.js/pixi.js.d.ts
index dfccd33431..d8e6bf86d7 100644
--- a/pixi.js/pixi.js.d.ts
+++ b/pixi.js/pixi.js.d.ts
@@ -1456,6 +1456,7 @@ declare namespace PIXI {
global: Point;
target: DisplayObject;
originalEvent: Event;
+ identifier: number;
getLocalPosition(displayObject: DisplayObject, point?: Point, globalPos?: Point): Point;
diff --git a/pouchdb-core/pouchdb-core-tests.ts b/pouchdb-core/pouchdb-core-tests.ts
index ac7a6c3e69..b46bce834d 100644
--- a/pouchdb-core/pouchdb-core-tests.ts
+++ b/pouchdb-core/pouchdb-core-tests.ts
@@ -38,6 +38,16 @@ namespace PouchDBCoreTests {
});
}
+ function testCompact() {
+ const db = new PouchDB<{}>();
+ // Promise version
+ db.compact().then( (res: PouchDB.Core.Response) => {});
+ // Promise version with optional options
+ db.compact({interval: 300}).then( (res: PouchDB.Core.Response) => {});
+ // Options with a callback
+ db.compact({interval: 300}, (res: PouchDB.Core.Response) => {});
+ }
+
function testDestroy() {
const db = new PouchDB<{}>();
@@ -75,4 +85,31 @@ namespace PouchDBCoreTests {
db.info({ ajax: { cache: true }}, (error, result) => {
});
}
+
+ function testRemove() {
+ type MyModel = { rev: 'rev', property: 'someProperty '};
+ let model: PouchDB.Core.Document;
+ const id = 'model';
+ const rev = 'rev';
+
+ const db = new PouchDB();
+
+ // Promise version with doc
+ db.remove(model).then( (res: PouchDB.Core.Response) => {});
+
+ // Promise version with doc and options
+ db.remove(model, {}).then( (res: PouchDB.Core.Response) => {});
+
+ // Promise version with docId and rev
+ db.remove(id, rev).then( (res: PouchDB.Core.Response) => {});
+
+ // Promise version with docId and rev and options
+ db.remove(id, rev, {}).then( (res: PouchDB.Core.Response) => {});
+
+ // Callback version with doc
+ db.remove(model, {}, (res: PouchDB.Core.Response) => {});
+
+ // Callback version with docId and rev
+ db.remove(id, rev, {}, (res: PouchDB.Core.Response) => {});
+ }
}
diff --git a/pouchdb-core/pouchdb-core.d.ts b/pouchdb-core/pouchdb-core.d.ts
index a8b6418510..b0498e76af 100644
--- a/pouchdb-core/pouchdb-core.d.ts
+++ b/pouchdb-core/pouchdb-core.d.ts
@@ -164,6 +164,10 @@ declare namespace PouchDB {
interface PostOptions extends PutOptions {
}
+ interface CompactOptions extends Core.Options {
+ interval?: number;
+ }
+
interface InfoOptions extends Options {
}
}
@@ -264,6 +268,11 @@ declare namespace PouchDB {
allDocs(options?: Core.AllDocsOptions):
Promise>;
+ /** Compact the database */
+ compact(options?: Core.CompactOptions): Promise;
+ compact(options: Core.CompactOptions,
+ callback: Core.Callback): void;
+
/** Destroy the database */
destroy(options: Core.DestroyOptions | void,
callback: Core.AnyCallback): void;
@@ -319,6 +328,20 @@ declare namespace PouchDB {
revision?: Core.RevisionId,
options?: Core.PutOptions): Promise;
+ /** Remove a doc from the database */
+ remove(doc: Core.Document,
+ options: Core.Options,
+ callback: Core.Callback): void;
+ remove(docId: Core.DocumentId,
+ revision: Core.RevisionId,
+ options: Core.Options,
+ callback: Core.Callback): void;
+ remove(doc: Core.Document,
+ options?: Core.Options): Promise;
+ remove(docId: Core.DocumentId,
+ revision: Core.RevisionId,
+ options?: Core.Options): Promise;
+
/** Get database information */
info(options: Core.InfoOptions | void,
callback: Core.Callback): void;
diff --git a/pouchdb-upsert/pouchdb-upsert-tests.ts b/pouchdb-upsert/pouchdb-upsert-tests.ts
new file mode 100644
index 0000000000..fa4eb83af3
--- /dev/null
+++ b/pouchdb-upsert/pouchdb-upsert-tests.ts
@@ -0,0 +1,49 @@
+///
+
+import * as pouchdbUpsert from 'pouchdb-upsert';
+PouchDB.plugin(pouchdbUpsert);
+
+namespace PouchDBUpsertTests {
+ type UpsertDocModel = { _id: 'test-doc1', name: 'test' };
+ let docToUpsert: PouchDB.Core.Document;
+ const db = new PouchDB();
+
+ function testUpsert_WithPromise_AndReturnDoc() {
+ db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => {
+ // Make some updates....
+ return doc;
+ }).then((res: PouchDB.Core.Response) => {
+ });
+ }
+
+ function testUpsert_WithPromise_AndReturnBoolean() {
+ db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => {
+ // Make some updates....
+ return false;
+ }).then((res: PouchDB.Core.Response) => {
+ });
+ }
+
+ function testUpsert_WithCallback_AndReturnDoc() {
+ db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => {
+ // Make some updates....
+ return doc;
+ }, (res: PouchDB.Core.Response) => {});
+ }
+
+ function testUpsert_WithCallback_AndReturnBoolean() {
+ // callback return boolean
+ db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => {
+ // Make some updates....
+ return false;
+ }, (res: PouchDB.Core.Response) => {});
+ }
+
+ function testPutIfNotExists_WithPromise() {
+ db.putIfNotExists(docToUpsert).then( (res: PouchDB.Core.Response) => {});
+ }
+
+ function testPutIfNotExists_WithCallback() {
+ db.putIfNotExists(docToUpsert, (res: PouchDB.Core.Response) => {});
+ }
+}
diff --git a/pouchdb-upsert/pouchdb-upsert.d.ts b/pouchdb-upsert/pouchdb-upsert.d.ts
new file mode 100644
index 0000000000..b0a4e760a3
--- /dev/null
+++ b/pouchdb-upsert/pouchdb-upsert.d.ts
@@ -0,0 +1,66 @@
+// Type definitions for pouchdb-upsert v2.0.1
+// Project: https://github.com/pouchdb/upsert
+// Definitions by: Keith D. Moore , Andrew Mitchell
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+
+ interface Database {
+ /**
+ * Perform an upsert (update or insert) operation. Returns a Promise.
+ *
+ * @param docId - the _id of the document.
+ * @param diffFun - function that takes the existing doc as input and returns an updated doc.
+ * If this diffFunc returns falsey, then the update won't be performed (as an optimization).
+ * If the document does not already exist, then {} will be the input to diffFunc.
+ *
+ */
+ upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback): Promise;
+
+ /**
+ * Perform an upsert (update or insert) operation. If a callback is not provided, the Promise based version
+ * of this function will be called.
+ *
+ * @param docId - the _id of the document.
+ * @param diffFun - function that takes the existing doc as input and returns an updated doc.
+ * If this diffFunc returns falsey, then the update won't be performed (as an optimization).
+ * If the document does not already exist, then {} will be the input to diffFunc.
+ * @param callback - called with the results after operation is completed.
+ */
+ upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback,
+ callback: Core.Callback): void;
+
+ /**
+ * Put a new document with the given docId, if it doesn't already exist. Returns a Promise.
+ *
+ * @param doc - the document to insert. Should contain an _id if docId is not specified
+ * If the document already exists, then the Promise will just resolve immediately.
+ */
+ putIfNotExists(doc: Core.Document): Promise;
+
+ //
+ /**
+ * Put a new document with the given docId, if it doesn't already exist. If a callback is not provided,
+ * the Promise based version of this function will be called.
+ *
+ * @param doc - the document to insert. Should contain an _id if docId is not specified
+ * If the document already exists, then the Promise will just resolve immediately.
+ * @param callback - called with the results after operation is completed.
+ * If you don't specify a callback, then the Promise version of this function will be invoked and it
+ * will return a Promise.
+ */
+ putIfNotExists(doc: Core.Document,
+ callback: Core.Callback): void;
+ }
+
+ interface UpsertDiffCallback {
+ (doc: Core.Document): Core.Document|boolean;
+ }
+}
+
+declare module 'pouchdb-upsert' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pusher-js/pusher-js.d.ts b/pusher-js/pusher-js.d.ts
index 0a6dc18d24..76bdb83c0e 100644
--- a/pusher-js/pusher-js.d.ts
+++ b/pusher-js/pusher-js.d.ts
@@ -23,7 +23,7 @@ declare module "pusher-js" {
config: Config; //TODO: add GlobalConfig typings
channels: any; //TODO: Type this
global_emitter: EventsDispatcher;
- sessionId: number;
+ sessionID: number;
timeline: any; //TODO: Type this
connection: ConnectionManager;
}
diff --git a/ramda/ramda-tests.ts b/ramda/ramda-tests.ts
new file mode 100644
index 0000000000..15ec5eb274
--- /dev/null
+++ b/ramda/ramda-tests.ts
@@ -0,0 +1,1952 @@
+import * as R from './ramda';
+
+var double = function(x: number): number {
+ return x + x
+};
+
+var shout = function(x: number): string {
+ return x >= 10
+ ? 'big'
+ : 'small'
+};
+
+class F {
+ x = 'X';
+ y = 'Y';
+}
+class F2 {
+ a = 100;
+ y = 1;
+ x(){};
+ z() {};
+}
+
+(() => {
+ var x: boolean;
+ x = R.isArrayLike('a');
+ x = R.isArrayLike([1,2,3]);
+ x = R.isArrayLike([]);
+});
+
+(() => {
+ R.propIs(Number, 'x', {x: 1, y: 2}); //=> true
+ R.propIs(Number, 'x')({x: 1, y: 2}); //=> true
+ R.propIs(Number)('x', {x: 1, y: 2}); //=> true
+ R.propIs(Number)('x')({x: 1, y: 2}); //=> true
+ R.propIs(Number, 'x', {x: 'foo'}); //=> false
+ R.propIs(Number, 'x', {}); //=> false
+});
+
+(() => {
+ R.type({}); //=> "Object"
+ R.type(1); //=> "Number"
+ R.type(false); //=> "Boolean"
+ R.type('s'); //=> "String"
+ R.type(null); //=> "Null"
+ R.type([]); //=> "Array"
+ R.type(/[A-z]/); //=> "RegExp"
+});
+
+() => {
+ var takesNoArg = function() { return true; };
+ var takesOneArg = function(a: number) { return [a]; };
+ var takesTwoArgs = function(a: number, b: number) { return [a, b]; };
+ var takesThreeArgs = function(a: number, b: number, c: number) { return [a, b, c]; };
+
+ var addFourNumbers = function(a: number, b: number, c: number, d: number): number {
+ return a + b + c + d;
+ };
+
+ var x1: Function = R.curry(addFourNumbers)
+ // because of the current way of currying, the following call results in a type error
+ // var x2: Function = R.curry(addFourNumbers)(1,2,4)
+ var x3: Function = R.curry(addFourNumbers)(1)(2)
+ var x4: Function = R.curry(addFourNumbers)(1)(2)(3)
+ var y1: number = R.curry(addFourNumbers)(1)(2)(3)(4)
+ var y2: number = R.curry(addFourNumbers)(1,2)(3,4)
+ var y3: number = R.curry(addFourNumbers)(1,2,3)(4)
+
+ R.nAry(0, takesNoArg);
+ R.nAry(0, takesOneArg);
+ R.nAry(1, takesTwoArgs);
+ R.nAry(1, takesThreeArgs);
+
+ var u1: {(a: any): any} = R.unary(takesOneArg);
+ var u2: {(a: any): any} = R.unary(takesTwoArgs);
+ var u3: {(a: any): any} = R.unary(takesThreeArgs);
+
+ R.binary(takesTwoArgs);
+ R.binary(takesThreeArgs);
+
+ var addTwoNumbers = function(a:number, b:number) { return a + b; }
+ var addTwoNumbersCurried = R.curry(addTwoNumbers);
+
+ var inc = addTwoNumbersCurried(1);
+ var z1:number = inc(2);
+ var z2:number = addTwoNumbersCurried(2,3);
+}
+
+() => {
+ const addFour = (a:number) => (b:number) => (c:number) => (d:number) => a + b + c + d;
+ const uncurriedAddFour = R.uncurryN(4, addFour);
+ const res: number = uncurriedAddFour(1, 2, 3, 4); //=> 10
+}
+
+() => {
+ // coerceArray :: (a|[a]) -> [a]
+ const coerceArray = R.unless(R.isArrayLike, R.of);
+ const a: number[] = coerceArray([1, 2, 3]); //=> [1, 2, 3]
+ const b: number[] = coerceArray(1); //=> [1]
+}
+
+(() => {
+ R.nthArg(1)('a', 'b', 'c'); //=> 'b'
+ R.nthArg(-1)('a', 'b', 'c'); //=> 'c'
+});
+
+() => {
+ const fn: (...args: string[])=>string = R.unapply(JSON.stringify);
+ const res: string = R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]'
+}
+
+() => {
+ const a: number = R.until(R.flip(R.gt)(100), R.multiply(2))(1) // => 128
+}
+
+() => {
+ const truncate = R.when(
+ R.propSatisfies(R.flip(R.gt)(10), 'length'),
+ R.pipe(R.take(10), R.append('…'), R.join(''))
+ );
+ const a: string = truncate('12345'); //=> '12345'
+ const b: string = truncate('0123456789ABC'); //=> '0123456789…'
+}
+
+/* compose */
+() => {
+ var double = function(x: number): number {
+ return x + x
+ }
+ var limit10 = function(x: number): boolean {
+ return x >= 10
+ }
+ var func: (x: number) => boolean = R.compose(limit10, double)
+ var res: boolean = R.compose(limit10, double)(10)
+
+ const f0 = (s: string) => +s; // string -> number
+ const f1 = (n: number) => n === 1; // number -> boolean
+ const f2 = R.compose(f1, f0); // string -> boolean
+
+ // akward example that bounces types between number and string
+ const g0 = (list: number[]) => R.map(R.inc, list);
+ const g1 = R.dropWhile(R.gt(10));
+ const g2 = R.map((i: number) => i > 5 ? 'bigger' : 'smaller');
+ const g3 = R.all((i: string) => i === 'smaller');
+ const g = R.compose(g3, g2, g1, g0);
+ const g_res: boolean = g([1, 2, 10, 13]);
+}
+
+/* pipe */
+() => {
+ var func: (x: number) => string = R.pipe(double, double, shout)
+ var res: string = R.pipe(double, double, shout)(10);
+
+ const capitalize = (str: string) => R.pipe(
+ R.split(''),
+ R.adjust(R.toUpper, 0),
+ R.join('')
+ )(str);
+
+ var f = R.pipe(Math.pow, R.negate, R.inc);
+ var fr: number = f(3, 4); // -(3^4) + 1
+}
+
+() => {
+ R.invoker('charAt', String.prototype);
+ R.invoker('charAt', String.prototype, 1);
+}
+
+(() => {
+ const range = R.juxt([Math.min, Math.max]);
+ range(3, 4, 9, -3); //=> [-3, 9]
+
+ const chopped = R.juxt([R.head, R.last]);
+ chopped('longstring'); // => ["l", "g"]
+});
+
+var square = function(x: number) { return x * x; };
+var add = function(a: number, b: number) { return a + b; };
+// Adds any number of arguments together
+var addAll = function() {
+ return 0;
+};
+
+// Basic example
+R.useWith(addAll, [ double, square ]);
+
+(() => {
+ var printXPlusFive = function(x: number) { console.log(x + 5); };
+ R.forEach(printXPlusFive, [1, 2, 3]);
+ R.clone([{},{},{}])
+ R.clone([1,2,3]);
+})();
+
+// (() => {
+// var printXPlusFive = function(x, i) { console.log(i + 5); };
+// R.forEach.idx(printXPlusFive, [{name: 1}, {name: 2}, {name: 3}]);
+// })();
+
+var i = function(x: number) {return x;};
+R.times(i, 5);
+
+(() => {
+ var triple = function(x: number): number { return x * 3; };
+ var square = function(x: number): number { return x * x; };
+ var squareThenDoubleThenTriple = R.pipe(square, double, triple);
+ squareThenDoubleThenTriple(5); //=> 150
+
+
+})();
+
+(() => {
+ var multiply = function(a: number, b: number) { return a * b; };
+ var double = R.partial(multiply, 2);
+ double(2); //=> 4
+
+ var greet = function(salutation: string, title: string, firstName: string, lastName: string) {
+ return salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
+ };
+ var sayHello = R.partial(greet, 'Hello');
+ var sayHelloToMs = R.partial(sayHello, 'Ms.');
+ sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!'
+
+ var greetMsJaneJones = R.partialRight(greet, 'Ms.', 'Jane', 'Jones');
+ greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!'
+})();
+
+(() => {
+ var numberOfCalls = 0;
+ var trackedAdd = function(a: number, b: number) {
+ numberOfCalls += 1;
+ return a + b;
+ };
+ var memoTrackedAdd = R.memoize(trackedAdd);
+
+ memoTrackedAdd(1, 2); //=> 3
+ numberOfCalls; //=> 1
+ memoTrackedAdd(1, 2); //=> 3
+ numberOfCalls; //=> 1
+ memoTrackedAdd(2, 3); //=> 5
+ numberOfCalls; //=> 2
+
+ // Note that argument order matters
+ memoTrackedAdd(2, 1); //=> 3
+ numberOfCalls; //=> 3
+})();
+
+(() => {
+ var addOneOnce = R.once(function(x: number){ return x + 1; });
+ addOneOnce(10); //=> 11
+ addOneOnce(addOneOnce(50)); //=> 11
+})();
+
+(() => {
+ var slashify = R.wrap(R.flip(R.add)('/'), function(f: Function, x: string) {
+ return R.match(/\/$/, x) ? x : f(x);
+ });
+
+ slashify('a'); //=> 'a/'
+ slashify('a/'); //=> 'a/'
+})();
+
+
+
+(() => {
+ var numbers = [1, 2, 3];
+ var add = function(a: number, b: number) {
+ return a + b
+ };
+ R.reduce(add, 10, numbers); //=> 16;
+})();
+
+(() => {
+ var plus3 = R.add(3);
+})();
+
+(() => {
+ var pairs = [ ['a', 1], ['b', 2], ['c', 3] ];
+ var flattenPairs = function(acc: [string, number], pair: [string, number]) {
+ return acc.concat(pair);
+ };
+ R.reduceRight(flattenPairs, [], pairs); //=> [ 'c', 3, 'b', 2, 'a', 1 ]
+})();
+
+(() => {
+ var values = { x: 1, y: 2, z: 3 };
+ var prependKeyAndDouble = function(num: number, key: string, obj: any) {
+ return key + (num * 2);
+ };
+ R.mapObjIndexed(prependKeyAndDouble, values); //=> { x: 'x2', y: 'y4', z: 'z6' }
+});
+
+(() => {
+ const a: number[] = R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6]
+ const b: number[][] = R.of([1]); //=> [[1]]
+ const c: number[] = R.of(1);
+
+});
+
+() => {
+ const a1 = R.empty([1,2,3,4,5]); //=> []
+ const a2 = R.empty([1, 2, 3]); //=> []
+ const a3 = R.empty('unicorns'); //=> ''
+ const a4 = R.empty({x: 1, y: 2}); //=> {}
+}
+
+(() => {
+ R.length([1, 2, 3]); //=> 3
+});
+
+(() => {
+ const isEven = function(n: number) {
+ return n % 2 === 0;
+ };
+ const filterIndexed = R.addIndex(R.filter);
+
+ R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4]
+
+ var lastTwo = function(val: number, idx: number, list: number[]) {
+ return list.length - idx <= 2;
+ };
+ filterIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); //=> [0, 9]
+
+ var isOdd = function(n: number) {
+ return n % 2 === 1;
+ };
+ R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4]
+});
+(() => {
+ var isNotFour = function(x: number) {
+ return !(x === 4);
+ };
+ R.takeWhile(isNotFour, [1, 2, 3, 4]); //=> [1, 2, 3]
+ R.take(2, [1, 2, 3, 4]); //=> [1, 2]
+});
+(() => {
+ var f = function(n: number) { return n > 50 ? false : [-n, n + 10] };
+ let a = R.unfold(f, 10); //=> [-10, -20, -30, -40, -50]
+ let b = R.unfold(f); //=> [-10, -20, -30, -40, -50]
+ let c = b(10);
+});
+/*****************************************************************
+ * Function category
+ */
+
+
+ () => {
+ var mergeThree = function(a: number, b: number, c: number): number[] {
+ return ([]).concat(a, b, c);
+ };
+ mergeThree(1, 2, 3); //=> [1, 2, 3]
+ var flipped = R.flip(mergeThree);
+ flipped(1, 2, 3); //=> [2, 1, 3]
+ }
+
+/*********************
+ * List category
+ ********************/
+() => {
+ var lessThan2 = R.flip(R.lt)(2);
+ var lessThan3 = R.flip(R.lt)(3);
+ R.all(lessThan2)([1, 2]); //=> false
+ R.all(lessThan3)([1, 2]); //=> true
+}
+
+() => {
+ var lessThan0 = R.flip(R.lt)(0);
+ var lessThan2 = R.flip(R.lt)(2);
+ R.any(lessThan0)([1, 2]); //=> false
+ R.any(lessThan2)([1, 2]); //=> true
+}
+
+() => {
+ R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]]
+ R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
+ R.aperture(7, [1, 2, 3, 4, 5]); //=> []
+ R.aperture(7)([1, 2, 3, 4, 5]); //=> []
+}
+
+() => {
+ R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests']
+ R.append('tests')(['write', 'more']); //=> ['write', 'more', 'tests']
+ R.append('tests', []); //=> ['tests']
+ R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']]
+ R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']]
+ R.append(['tests'])(['write', 'more']); //=> ['write', 'more', ['tests']]
+ R.append(['tests'])(['write', 'more']); //=> ['write', 'more', ['tests']]
+}
+
+() => {
+ var duplicate = function(n: number) {
+ return [n, n];
+ };
+ R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3]
+ R.chain(duplicate)([1, 2, 3]); //=> [1, 1, 2, 2, 3, 3]
+}
+
+() => {
+ R.clamp(1, 10, -1) // => 1
+ R.clamp(1, 10)(11) // => 10
+ R.clamp(1)(10, 4) // => 4
+ R.clamp('a', 'd', 'e') // => 'd'
+}
+
+() => {
+ R.concat([], []); //=> []
+ R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]
+ R.concat([4, 5, 6])([1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]
+ R.concat('ABC')('DEF'); // 'ABCDEF'
+}
+
+() => {
+ R.contains(3)([1, 2, 3]); //=> true
+ R.contains(3, [1, 2, 3]); //=> true
+ R.contains(4)([1, 2, 3]); //=> false
+ R.contains({})([{}, {}]); //=> false
+ var obj = {};
+ R.contains(obj)([{}, obj, {}]); //=> true
+}
+
+() => {
+ R.drop(3, [1,2,3,4,5,6,7]); //=> [4,5,6,7]
+ R.drop(3)([1,2,3,4,5,6,7]); //=> [4,5,6,7]
+ R.drop(3, 'ramda'); //=> 'ram'
+ R.drop(3)('ramda'); //=> 'ram'
+}
+
+(() => {
+ R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
+ R.dropLast(2)(['foo', 'bar', 'baz']); //=> ['foo']
+ R.dropLast(3, 'ramda'); //=> 'ra'
+ R.dropLast(3)('ramda'); //=> 'ra'
+});
+
+(() => {
+ var lteThree = (x: number) => x <= 3;
+ R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4]
+});
+
+() => {
+ var lteTwo = function(x: number) {
+ return x <= 2;
+ };
+ R.dropWhile(lteTwo, [1, 2, 3, 4]); //=> [3, 4]
+ R.dropWhile(lteTwo)([1, 2, 3, 4]); //=> [3, 4]
+}
+
+() => {
+ var isEven = function(n: number) {
+ return n % 2 === 0;
+ };
+ R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4]
+ var isEvenFn = R.filter(isEven);
+ isEvenFn([1, 2, 3, 4]);
+}
+
+() => {
+ var lastTwo = function(val: number, idx: number, list: number[]) {
+ return list.length - idx <= 2;
+ };
+ var filterIndexed = R.addIndex(R.filter);
+
+ filterIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); //=> [0, 9]
+ var lastTwoFn = filterIndexed(lastTwo);
+ lastTwoFn([8, 6, 7, 5, 3, 0, 9]);
+}
+
+() => {
+ var xs = [{a: 1}, {a: 2}, {a: 3}];
+ R.find(R.propEq('a', 2))(xs); //=> {a: 2}
+ R.find(R.propEq('a', 4))(xs); //=> undefined
+}
+
+() => {
+ var xs = [{a: 1}, {a: 2}, {a: 3}];
+ R.findIndex(R.propEq('a', 2))(xs); //=> 1
+ R.findIndex(R.propEq('a', 4))(xs); //=> -1
+
+ R.findIndex((x: number) => x === 1, [1, 2, 3]);
+}
+
+() => {
+ var xs = [{a: 1, b: 0}, {a:1, b: 1}];
+ R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1}
+ R.findLast(R.propEq('a', 4))(xs); //=> undefined
+}
+
+() => {
+ var xs = [{a: 1, b: 0}, {a:1, b: 1}];
+ R.findLastIndex(R.propEq('a', 1))(xs); //=> 1
+ R.findLastIndex(R.propEq('a', 4))(xs); //=> -1
+ R.findLastIndex((x: number) => x === 1, [1, 2, 3]);
+}
+() => {
+ var user1 = { address: { zipCode: 90210 } };
+ var user2 = { address: { zipCode: 55555 } };
+ var user3 = { name: 'Bob' };
+ var users = [ user1, user2, user3 ];
+ var isFamous = R.pathEq(['address', 'zipCode'], 90210);
+ R.filter(isFamous, users); //=> [ user1 ]
+}
+() => {
+ var xs: {[key:string]: string} = {a: '1', b: '0'};
+ R.propEq('a', '1', xs);//=> true
+ R.propEq('a', '4', xs); //=> false
+}
+() => {
+ var xs: {[key:string]: number} = {a: 1, b: 0};
+ R.propEq('a', 1, xs);//=> true
+ R.propEq('a', 4, xs); //=> false
+}
+() => {
+ var xs = {a: '1', b: '0'};
+ R.propEq('a', '1', xs);//=> true
+ R.propEq('a', '4', xs); //=> false
+}
+() => {
+ var xs = {a: 1, b: 0};
+ R.propEq('a', 1, xs);//=> true
+ R.propEq('a', 4, xs); //=> false
+}
+
+interface Obj { a: number; b: number };
+() => {
+ var xs: Obj = {a: 1, b: 0};
+ R.propEq('a', 1, xs);//=> true
+ R.propEq('a', 4, xs); //=> false
+}
+
+() => {
+ R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]);
+ //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
+}
+
+() => {
+ var printXPlusFive = function(x: number) { console.log(x + 5); };
+ R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3]
+ R.forEach(printXPlusFive)([1, 2, 3]); //=> [1, 2, 3]
+ //-> 6
+ //-> 7
+ //-> 8
+}
+
+() => {
+ var plusFive = function(num: number, idx: number, list: number[]) { list[idx] = num + 5 };
+ R.addIndex(R.forEach)(plusFive)([1, 2, 3]); //=> [6, 7, 8]
+}
+
+() => {
+ var byGrade = R.groupBy(function(student: {score: number; name: string}) {
+ var score = student.score;
+ return score < 65 ? 'F' :
+ score < 70 ? 'D' :
+ score < 80 ? 'C' :
+ score < 90 ? 'B' : 'A';
+ });
+ var students = [{name: 'Abby', score: 84},
+ {name: 'Eddy', score: 58},
+ {name: 'Jack', score: 69}];
+ byGrade(students);
+}
+
+() => {
+ R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21])
+ // [[0], [1, 1], [2, 3, 5, 8, 13, 21]]
+
+ R.groupWith((a: number, b: number) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21])
+ // [[0], [1, 1], [2], [3, 5], [8], [13, 21]]
+
+ const isVowel = (a: string) => R.contains(a, 'aeiou') ? a : '';
+ R.groupWith(R.eqBy