mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
Plugins can now be string arrays rather that just strings
This commit is contained in:
@@ -1,27 +1,48 @@
|
||||
let engine = new ActiveXObject('DAO.DBEngine.120');
|
||||
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
|
||||
const results: T[] = [];
|
||||
const enumerator = new Enumerator<T>(col);
|
||||
enumerator.moveFirst();
|
||||
while (!enumerator.atEnd()) {
|
||||
results.push(enumerator.item());
|
||||
enumerator.moveNext();
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
const dbOpenSnapshot = DAO.RecordsetTypeEnum.dbOpenSnapshot;
|
||||
|
||||
let engine = new ActiveXObject('DAO.DBEngine');
|
||||
let dbsNorthwind = engine.OpenDatabase('c:\\path\\to\\northwind.mdb');
|
||||
|
||||
// adding a record to a recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/add-a-record-to-a-dao-recordset
|
||||
let rstShippers = dbsNorthwind.OpenRecordset('Shippers');
|
||||
rstShippers.AddNew();
|
||||
rstShippers.Fields.Item('CompanyName').Value = 'Global Parcel Service';
|
||||
// Set remaining fields
|
||||
rstShippers.Update();
|
||||
rstShippers.Close();
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/add-a-record-to-a-dao-recordset
|
||||
{
|
||||
// adding a record to a recordset
|
||||
const rstShippers = dbsNorthwind.OpenRecordset('Shippers');
|
||||
rstShippers.AddNew();
|
||||
rstShippers('CompanyName').Value = 'Global Parcel Service';
|
||||
// Set remaining fields
|
||||
rstShippers.Update();
|
||||
rstShippers.Close();
|
||||
}
|
||||
|
||||
// create a QueryDef with the given SQL -- https://msdn.microsoft.com/VBA/Access-VBA/articles/build-sql-statements-that-include-variables-and-controls
|
||||
let sql = 'SELECT * FROM Orders WHERE OrderDate > #3-31-2006#';
|
||||
let qdf = dbsNorthwind.CreateQueryDef('Second quarter', sql);
|
||||
// using parameters
|
||||
sql = `
|
||||
PARAMETERS QuarterStart DATETIME
|
||||
SELECT *
|
||||
FROM Orders
|
||||
WHERE OrderDate > QuarterStart
|
||||
`;
|
||||
qdf = dbsNorthwind.CreateQueryDef('Second quarter (parameters)', sql);
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/build-sql-statements-that-include-variables-and-controls
|
||||
{
|
||||
// create a QueryDef with the given SQL
|
||||
let sql = 'SELECT * FROM Orders WHERE OrderDate > #3-31-2006#';
|
||||
let qdf = dbsNorthwind.CreateQueryDef('Second quarter', sql);
|
||||
// using parameters
|
||||
sql = `
|
||||
PARAMETERS QuarterStart DATETIME
|
||||
SELECT *
|
||||
FROM Orders
|
||||
WHERE OrderDate > QuarterStart
|
||||
`;
|
||||
qdf = dbsNorthwind.CreateQueryDef('Second quarter (parameters)', sql);
|
||||
WScript.Echo(`Field names: ${collectionToArray(qdf.Fields).map(fld => fld.Name).join(', ')}`);
|
||||
}
|
||||
|
||||
// count the number of records in a Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/count-the-number-of-records-in-a-dao-recordset
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/count-the-number-of-records-in-a-dao-recordset
|
||||
/** Count the number of records in a Recordset */
|
||||
const findRecordCount = (dbs: DAO.Database, sql: string) => {
|
||||
let count = 0;
|
||||
const rstRecords = dbs.OpenRecordset(sql);
|
||||
@@ -33,113 +54,119 @@ const findRecordCount = (dbs: DAO.Database, sql: string) => {
|
||||
return count;
|
||||
};
|
||||
|
||||
// delete records from a Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/delete-a-record-from-a-dao-recordset
|
||||
rstShippers = dbsNorthwind.OpenRecordset('SELECT * FROM Shippers ORDER BY CompanyName, ShipperID', DAO.RecordsetTypeEnum.dbOpenDynaset);
|
||||
if (!rstShippers.EOF) {
|
||||
let name = rstShippers.Fields.Item('CompanyName').Value;
|
||||
rstShippers.MoveNext();
|
||||
while (!rstShippers.EOF) {
|
||||
const recordName: string = rstShippers.Fields.Item('CompanyName').Value;
|
||||
if (recordName === name) {
|
||||
rstShippers.Delete();
|
||||
} else {
|
||||
name = recordName;
|
||||
}
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/delete-a-record-from-a-dao-recordset
|
||||
{
|
||||
// delete records from a Recordset
|
||||
const rstShippers = dbsNorthwind.OpenRecordset('SELECT * FROM Shippers ORDER BY CompanyName, ShipperID', DAO.RecordsetTypeEnum.dbOpenDynaset);
|
||||
if (!rstShippers.EOF) {
|
||||
let name = rstShippers('CompanyName').Value;
|
||||
rstShippers.MoveNext();
|
||||
while (!rstShippers.EOF) {
|
||||
const recordName: string = rstShippers('CompanyName').Value;
|
||||
if (recordName === name) {
|
||||
rstShippers.Delete();
|
||||
} else {
|
||||
name = recordName;
|
||||
}
|
||||
rstShippers.MoveNext();
|
||||
}
|
||||
}
|
||||
rstShippers.Close();
|
||||
}
|
||||
rstShippers.Close();
|
||||
|
||||
// copy entire records to an array -- https://msdn.microsoft.com/VBA/Access-VBA/articles/extract-data-from-a-record-in-a-dao-recordset
|
||||
let rstEmployees = dbsNorthwind.OpenRecordset('SELECT FirstName, LastName, Title FROM Employees', DAO.RecordsetTypeEnum.dbOpenSnapshot);
|
||||
let records = new VBArray<string>(rstEmployees.GetRows(3));
|
||||
let recordCount = records.ubound(2) + 1;
|
||||
let columnCount = records.ubound(1) + 1;
|
||||
for (let row = 0; row < recordCount; row += 1) {
|
||||
for (let column = 0; column < columnCount; column += 1) {
|
||||
WScript.Echo(records.getItem(column, row));
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/extract-data-from-a-record-in-a-dao-recordset
|
||||
{
|
||||
// copy entire records to an array
|
||||
const rstEmployees = dbsNorthwind.OpenRecordset('SELECT FirstName, LastName, Title FROM Employees', dbOpenSnapshot);
|
||||
const records = new VBArray<string>(rstEmployees.GetRows(3));
|
||||
const recordCount = records.ubound(2) + 1;
|
||||
const columnCount = records.ubound(1) + 1;
|
||||
for (let row = 0; row < recordCount; row += 1) {
|
||||
for (let column = 0; column < columnCount; column += 1) {
|
||||
WScript.Echo(records.getItem(column, row));
|
||||
}
|
||||
}
|
||||
if (rstEmployees.EOF) { WScript.Echo('At end of recordset'); }
|
||||
rstEmployees.Close();
|
||||
}
|
||||
if (rstEmployees.EOF) { WScript.Echo('At end of recordset'); }
|
||||
rstEmployees.Close();
|
||||
|
||||
// find a record in a dynaset-type or snapshot-type DAO Recordset -- https://msdn.microsoft.com/en-us/vba/access-vba/articles/find-a-record-in-a-dynaset-type-or-snapshot-type-dao-recordset
|
||||
const findOrdersWithoutDetails = () => {
|
||||
{
|
||||
const orders: number[] = [];
|
||||
const rstOrders = dbsNorthwind.OpenRecordset('SELECT * FROM Orders ORDER BY OrderID', DAO.RecordsetTypeEnum.dbOpenSnapshot);
|
||||
const rstOrderDetails = dbsNorthwind.OpenRecordset('SELECT * FROM [Order Details] ORDER BY OrderID', DAO.RecordsetTypeEnum.dbOpenSnapshot);
|
||||
const rstOrders = dbsNorthwind.OpenRecordset('SELECT * FROM Orders ORDER BY OrderID', dbOpenSnapshot);
|
||||
const rstOrderDetails = dbsNorthwind.OpenRecordset('SELECT * FROM [Order Details] ORDER BY OrderID', dbOpenSnapshot);
|
||||
|
||||
const closeRecordsets = () => {
|
||||
rstOrders.Close();
|
||||
rstOrderDetails.Close();
|
||||
};
|
||||
if (rstOrders.EOF || rstOrderDetails.EOF) {
|
||||
closeRecordsets();
|
||||
return;
|
||||
}
|
||||
|
||||
while (!rstOrders.EOF) {
|
||||
const orderID = rstOrders.Fields.Item('OrderID').Value;
|
||||
rstOrderDetails.FindFirst(`OrderID=${orderID}`);
|
||||
if (rstOrderDetails.NoMatch) {
|
||||
orders.push(orderID);
|
||||
if (!rstOrders.EOF && !rstOrderDetails.EOF) {
|
||||
while (!rstOrders.EOF) {
|
||||
const orderID = rstOrders('OrderID').Value;
|
||||
rstOrderDetails.FindFirst(`OrderID=${orderID}`);
|
||||
if (rstOrderDetails.NoMatch) {
|
||||
orders.push(orderID);
|
||||
}
|
||||
rstOrders.MoveNext();
|
||||
}
|
||||
rstOrders.MoveNext();
|
||||
}
|
||||
closeRecordsets();
|
||||
return orders;
|
||||
};
|
||||
|
||||
// find a record in a table-type DAO Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/find-a-record-in-a-table-type-dao-recordset
|
||||
rstOrders.Close();
|
||||
rstOrderDetails.Close();
|
||||
|
||||
WScript.Echo(orders.join('\n'));
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/find-a-record-in-a-table-type-dao-recordset
|
||||
/** Find a record in a table-type DAO Recordset */
|
||||
const getHireDate = (employeeID: number) => {
|
||||
let hireDate: Date | undefined;
|
||||
const rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
rstEmployees.Index = 'PrimaryKey';
|
||||
rstEmployees.Seek('=', employeeID);
|
||||
if (!rstEmployees.NoMatch) {
|
||||
hireDate = new Date(rstEmployees.Fields.Item('HireDate').Value as VarDate);
|
||||
hireDate = new Date(rstEmployees('HireDate').Value as VarDate);
|
||||
}
|
||||
return hireDate;
|
||||
};
|
||||
|
||||
// manipulate multiple fields with DAO -- https://msdn.microsoft.com/VBA/Access-VBA/articles/manipulate-multivalued-fields-with-dao
|
||||
const browseMultiValueField = () => {
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/manipulate-multivalued-fields-with-dao
|
||||
{
|
||||
// manipulate multiple fields with DAO
|
||||
const rs = dbsNorthwind.OpenRecordset('Tasks');
|
||||
rs.MoveFirst();
|
||||
while (!rs.EOF) {
|
||||
WScript.Echo(rs.Fields.Item('TaskName').Value);
|
||||
const childRs = rs.Fields.Item('AssignedTo').Value as DAO.Recordset;
|
||||
WScript.Echo(rs('TaskName').Value);
|
||||
const childRs = rs('AssignedTo').Value as DAO.Recordset;
|
||||
if (childRs.EOF) { continue; }
|
||||
childRs.MoveFirst();
|
||||
while (!childRs.EOF) {
|
||||
WScript.Echo('\t' + childRs.Fields.Item('Value').Value);
|
||||
WScript.Echo('\t' + childRs('Value').Value);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// modifying an existing record in a DAO Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/modify-an-existing-record-in-a-dao-recordset
|
||||
const changeTitleWithoutTransaction = () => {
|
||||
rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/modify-an-existing-record-in-a-dao-recordset
|
||||
{
|
||||
// modifying an existing record in a DAO Recordset
|
||||
const rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
while (!rstEmployees.EOF) {
|
||||
if (rstEmployees.Fields.Item('Title').Value === 'Sales Representative') {
|
||||
if (rstEmployees('Title').Value === 'Sales Representative') {
|
||||
rstEmployees.Edit();
|
||||
rstEmployees.Fields.Item('Title').Value = 'Account Executive';
|
||||
rstEmployees('Title').Value = 'Account Executive';
|
||||
rstEmployees.Update();
|
||||
}
|
||||
rstEmployees.MoveNext();
|
||||
}
|
||||
rstEmployees.Close();
|
||||
};
|
||||
}
|
||||
|
||||
// using transactions in a DAO Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/use-transactions-in-a-dao-recordset
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/use-transactions-in-a-dao-recordset
|
||||
/** using transactions in a DAO Recordset */
|
||||
const changeTitleWithTransaction = (commitTransaction: boolean) => {
|
||||
const currentWorkspace = engine.Workspaces.Item(0);
|
||||
rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
const currentWorkspace = engine.Workspaces(0);
|
||||
const rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
currentWorkspace.BeginTrans();
|
||||
while (!rstEmployees.EOF) {
|
||||
if (rstEmployees.Fields.Item('Title').Value === 'Sales Representative') {
|
||||
if (rstEmployees('Title').Value === 'Sales Representative') {
|
||||
rstEmployees.Edit();
|
||||
rstEmployees.Fields.Item('Title').Value = 'Account Executive';
|
||||
rstEmployees('Title').Value = 'Account Executive';
|
||||
rstEmployees.Update();
|
||||
}
|
||||
rstEmployees.MoveNext();
|
||||
|
||||
Vendored
+197
-207
@@ -1,8 +1,8 @@
|
||||
// Type definitions for Microsoft Office 14.0 Access Database Engine Object Library - DAO 14.0
|
||||
// Type definitions for Microsoft Office 16.0 Access Database Engine Object Library - DAO 16.0
|
||||
// Project: https://msdn.microsoft.com/en-us/library/dn124645.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
declare namespace DAO {
|
||||
const enum _DAOSuppHelp {
|
||||
@@ -56,12 +56,15 @@ declare namespace DAO {
|
||||
}
|
||||
|
||||
const enum DatabaseTypeEnum {
|
||||
/** @deprecated */
|
||||
dbDecrypt = 4,
|
||||
/** @deprecated */
|
||||
dbEncrypt = 2,
|
||||
dbVersion10 = 1,
|
||||
dbVersion11 = 8,
|
||||
dbVersion120 = 128,
|
||||
dbVersion140 = 256,
|
||||
dbVersion150 = 512,
|
||||
dbVersion20 = 16,
|
||||
dbVersion30 = 32,
|
||||
dbVersion40 = 64,
|
||||
@@ -128,6 +131,15 @@ declare namespace DAO {
|
||||
dbRefreshCache = 8,
|
||||
}
|
||||
|
||||
const enum ISAMStatsEnum {
|
||||
DiskReads = 0,
|
||||
DiskWrites = 1,
|
||||
LocksPlaced = 4,
|
||||
LocksReleased = 5,
|
||||
ReadsFromCache = 2,
|
||||
ReadsFromReadAheadCache = 3,
|
||||
}
|
||||
|
||||
const enum LanguageConstants {
|
||||
dbLangArabic = ';LANGID=0x0401;CP=1256;COUNTRY=0',
|
||||
dbLangChineseSimplified = ';LANGID=0x0804;CP=936;COUNTRY=0',
|
||||
@@ -308,18 +320,26 @@ declare namespace DAO {
|
||||
dbUseODBC = 1,
|
||||
}
|
||||
|
||||
type Bookmark = SafeArray<number>;
|
||||
|
||||
class ComplexType {
|
||||
private 'DAO.ComplexType_typekey': ComplexType;
|
||||
private constructor();
|
||||
readonly Fields: Fields;
|
||||
}
|
||||
|
||||
class Connection {
|
||||
private 'DAO.Connection_typekey': Connection;
|
||||
private constructor();
|
||||
Cancel(): void;
|
||||
Close(): void;
|
||||
readonly Connect: string;
|
||||
CreateQueryDef(Name?: any, SQLText?: any): QueryDef;
|
||||
CreateQueryDef(Name?: string, SQLText?: string): QueryDef;
|
||||
readonly Database: Database;
|
||||
Execute(Query: string, Options?: any): void;
|
||||
Execute(Query: string, Options?: RecordsetOptionEnum): void;
|
||||
readonly hDbc: number;
|
||||
readonly Name: string;
|
||||
OpenRecordset(Name: string, Type?: any, Options?: any, LockEdit?: any): Recordset;
|
||||
OpenRecordset(Name: string, Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum, LockEdit?: LockTypeEnum): Recordset;
|
||||
readonly QueryDefs: QueryDefs;
|
||||
QueryTimeout: number;
|
||||
readonly RecordsAffected: number;
|
||||
@@ -329,12 +349,11 @@ declare namespace DAO {
|
||||
readonly Updatable: boolean;
|
||||
}
|
||||
|
||||
class Connections {
|
||||
private 'DAO.Connections_typekey': Connections;
|
||||
private constructor();
|
||||
interface Connections {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Connection;
|
||||
Item(Item: number | string): Connection;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Connection;
|
||||
}
|
||||
|
||||
class Container {
|
||||
@@ -350,12 +369,11 @@ declare namespace DAO {
|
||||
UserName: string;
|
||||
}
|
||||
|
||||
class Containers {
|
||||
private 'DAO.Containers_typekey': Containers;
|
||||
private constructor();
|
||||
interface Containers {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Container;
|
||||
Item(Item: number | string): Container;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Container;
|
||||
}
|
||||
|
||||
class Database {
|
||||
@@ -366,16 +384,16 @@ declare namespace DAO {
|
||||
Connect: string;
|
||||
readonly Connection: Connection;
|
||||
readonly Containers: Containers;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
CreateQueryDef(Name?: any, SQLText?: any): QueryDef;
|
||||
CreateRelation(Name?: any, Table?: any, ForeignTable?: any, Attributes?: any): Relation;
|
||||
CreateTableDef(Name?: any, Attributes?: any, SourceTableName?: any, Connect?: any): TableDef;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
CreateQueryDef(Name?: string, SQLText?: string): QueryDef;
|
||||
CreateRelation(Name?: string, Table?: string, ForeignTable?: string, Attributes?: RelationAttributeEnum): Relation;
|
||||
CreateTableDef(Name?: string, Attributes?: TableDefAttributeEnum, SourceTableName?: string, Connect?: string): TableDef;
|
||||
DesignMasterID: string;
|
||||
Execute(Query: string, Options?: any): void;
|
||||
MakeReplica(PathName: string, Description: string, Options?: any): void;
|
||||
Execute(Query: string, Options?: RecordsetOptionEnum): void;
|
||||
MakeReplica(PathName: string, Description: string, Options?: ReplicaTypeEnum): void;
|
||||
readonly Name: string;
|
||||
NewPassword(bstrOld: string, bstrNew: string): void;
|
||||
OpenRecordset(Name: string, Type?: any, Options?: any, LockEdit?: any): Recordset;
|
||||
OpenRecordset(Name: string, Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum, LockEdit?: LockTypeEnum): Recordset;
|
||||
PopulatePartial(DbPathName: string): void;
|
||||
readonly Properties: Properties;
|
||||
readonly QueryDefs: QueryDefs;
|
||||
@@ -384,19 +402,18 @@ declare namespace DAO {
|
||||
readonly Recordsets: Recordsets;
|
||||
readonly Relations: Relations;
|
||||
readonly ReplicaID: string;
|
||||
Synchronize(DbPathName: string, ExchangeType?: any): void;
|
||||
Synchronize(DbPathName: string, ExchangeType?: SynchronizeTypeEnum): void;
|
||||
readonly TableDefs: TableDefs;
|
||||
readonly Transactions: boolean;
|
||||
readonly Updatable: boolean;
|
||||
readonly Version: string;
|
||||
}
|
||||
|
||||
class Databases {
|
||||
private 'DAO.Databases_typekey': Databases;
|
||||
private constructor();
|
||||
interface Databases {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Database;
|
||||
Item(Item: number | string): Database;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Database;
|
||||
}
|
||||
|
||||
class DBEngine {
|
||||
@@ -404,26 +421,51 @@ declare namespace DAO {
|
||||
private constructor();
|
||||
BeginTrans(): void;
|
||||
|
||||
/** @param number [Option=0] */
|
||||
/** @param Option [Option=0] */
|
||||
CommitTrans(Option?: number): void;
|
||||
CompactDatabase(SrcName: string, DstName: string, DstLocale?: any, Options?: any, SrcLocale?: any): void;
|
||||
CreateDatabase(Name: string, Locale: string, Option?: any): Database;
|
||||
CreateWorkspace(Name: string, UserName: string, Password: string, UseType?: any): Workspace;
|
||||
|
||||
/**
|
||||
* Compact a closed database
|
||||
*
|
||||
* @param DstLocale Specify one of the following:
|
||||
* * the locale, using one of the language constants
|
||||
* * the password, in the form `;pwd=MyNewPassword'`
|
||||
* * both the constant and a password, e.g. `dbLangGreek + ';pwd=MyNewPassword'`
|
||||
*
|
||||
* @param Options `dbEncrypt` and `dbDecrypt` are deprecated, and unsupported for ACCDB
|
||||
* @param password Deprecated, and unsupported for ACCDB
|
||||
*/
|
||||
CompactDatabase(SrcName: string, DstName: string, DstLocale?: LanguageConstants | string, Options?: DatabaseTypeEnum, password?: string): void;
|
||||
|
||||
/**
|
||||
* @param Locale Specify one of the following:
|
||||
* * the locale, using one of the language constants
|
||||
* * the password, in the form `;pwd=MyNewPassword'`
|
||||
* * both the constant and a password, e.g. `dbLangGreek + ';pwd=MyNewPassword'`
|
||||
*/
|
||||
CreateDatabase(Name: string, Locale: LanguageConstants | string, Option?: DatabaseTypeEnum): Database;
|
||||
CreateWorkspace(Name: string, UserName: string, Password: string, UseType?: WorkspaceTypeEnum): Workspace;
|
||||
readonly DefaultPassword: string;
|
||||
DefaultType: number;
|
||||
readonly DefaultUser: string;
|
||||
readonly Errors: Errors;
|
||||
Idle(Action?: any): void;
|
||||
Idle(Action?: IdleEnum): void;
|
||||
IniPath: string;
|
||||
ISAMStats(StatNum: number, Reset?: any): number;
|
||||
|
||||
/** Returns various statistics from the Jet engine */
|
||||
ISAMStats(StatNum: ISAMStatsEnum, Reset?: boolean): number;
|
||||
LoginTimeout: number;
|
||||
OpenConnection(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Connection;
|
||||
OpenDatabase(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Database;
|
||||
|
||||
/**
|
||||
* @param Connect ODBC connection string; prepend with `ODBC;`
|
||||
*/
|
||||
OpenConnection(Name: string, Options?: DriverPromptEnum | RecordsetOptionEnum.dbRunAsync, ReadOnly?: boolean, Connect?: string): Connection;
|
||||
OpenDatabase(Name: string, Exclusive?: boolean, ReadOnly?: boolean, Connect?: string): Database;
|
||||
readonly Properties: Properties;
|
||||
RegisterDatabase(Dsn: string, Driver: string, Silent: boolean, Attributes: string): void;
|
||||
RepairDatabase(Name: string): void;
|
||||
Rollback(): void;
|
||||
SetOption(Option: number, Value: any): void;
|
||||
SetOption(Option: SetOptionEnum, Value: any): void;
|
||||
SystemDB: string;
|
||||
readonly Version: string;
|
||||
readonly Workspaces: Workspaces;
|
||||
@@ -434,9 +476,9 @@ declare namespace DAO {
|
||||
private constructor();
|
||||
readonly AllPermissions: number;
|
||||
readonly Container: string;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
readonly DateCreated: any;
|
||||
readonly LastUpdated: any;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DateCreated: VarDate;
|
||||
readonly LastUpdated: VarDate;
|
||||
readonly Name: string;
|
||||
Owner: string;
|
||||
Permissions: number;
|
||||
@@ -444,12 +486,11 @@ declare namespace DAO {
|
||||
UserName: string;
|
||||
}
|
||||
|
||||
class Documents {
|
||||
private 'DAO.Documents_typekey': Documents;
|
||||
private constructor();
|
||||
interface Documents {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Document;
|
||||
Item(Item: number | string): Document;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Document;
|
||||
}
|
||||
|
||||
class Error {
|
||||
@@ -462,33 +503,38 @@ declare namespace DAO {
|
||||
readonly Source: string;
|
||||
}
|
||||
|
||||
class Errors {
|
||||
private 'DAO.Errors_typekey': Errors;
|
||||
private constructor();
|
||||
interface Errors {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Error;
|
||||
Refresh(): void;
|
||||
(Item: any): Error;
|
||||
}
|
||||
|
||||
class Field {
|
||||
private 'DAO.Field_typekey': Field;
|
||||
private constructor();
|
||||
private 'DAO.Field2_typekey': Field;
|
||||
AllowZeroLength: boolean;
|
||||
AppendChunk(Val: any): void;
|
||||
AppendOnly: boolean;
|
||||
Attributes: number;
|
||||
readonly CollatingOrder: number;
|
||||
readonly CollectionIndex: number;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
readonly ComplexType: ComplexType;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DataUpdatable: boolean;
|
||||
DefaultValue: any;
|
||||
Expression: string;
|
||||
readonly FieldSize: number;
|
||||
ForeignName: string;
|
||||
GetChunk(Offset: number, Bytes: number): any;
|
||||
readonly IsComplex: boolean;
|
||||
LoadFromFile(FileName: string): void;
|
||||
Name: string;
|
||||
OrdinalPosition: number;
|
||||
readonly OriginalValue: any;
|
||||
readonly Properties: Properties;
|
||||
Required: boolean;
|
||||
SaveToFile(FileName: string): void;
|
||||
Size: number;
|
||||
readonly SourceField: string;
|
||||
readonly SourceTable: string;
|
||||
@@ -500,44 +546,42 @@ declare namespace DAO {
|
||||
readonly VisibleValue: any;
|
||||
}
|
||||
|
||||
class Fields {
|
||||
private 'DAO.Fields_typekey': Fields;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Fields {
|
||||
Append(Field: Field): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Field;
|
||||
Item(Item: number | string): Field;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Field;
|
||||
}
|
||||
|
||||
class Group {
|
||||
private 'DAO.Group_typekey': Group;
|
||||
private constructor();
|
||||
CreateUser(Name?: any, PID?: any, Password?: any): User;
|
||||
CreateUser(Name?: string, PID?: string, Password?: string): User;
|
||||
Name: string;
|
||||
readonly PID: string;
|
||||
readonly Properties: Properties;
|
||||
readonly Users: Users;
|
||||
}
|
||||
|
||||
class Groups {
|
||||
private 'DAO.Groups_typekey': Groups;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Groups {
|
||||
Append(Group: Group): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Group;
|
||||
Item(Item: number | string): Group;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Group;
|
||||
}
|
||||
|
||||
class Index {
|
||||
private 'DAO.Index_typekey': Index;
|
||||
private constructor();
|
||||
Clustered: boolean;
|
||||
CreateField(Name?: any, Type?: any, Size?: any): Field;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
CreateField(Name?: string): Field;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DistinctCount: number;
|
||||
Fields: any;
|
||||
Fields: Fields;
|
||||
readonly Foreign: boolean;
|
||||
IgnoreNulls: boolean;
|
||||
Name: string;
|
||||
@@ -547,14 +591,14 @@ declare namespace DAO {
|
||||
Unique: boolean;
|
||||
}
|
||||
|
||||
class Indexes {
|
||||
private 'DAO.Indexes_typekey': Indexes;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface Indexes {
|
||||
Append(Index: Index): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Index;
|
||||
Item(Item: number | string): Index;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Index;
|
||||
}
|
||||
|
||||
class Parameter {
|
||||
@@ -567,53 +611,20 @@ declare namespace DAO {
|
||||
Value: any;
|
||||
}
|
||||
|
||||
class Parameters {
|
||||
private 'DAO.Parameters_typekey': Parameters;
|
||||
private constructor();
|
||||
interface Parameters {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Parameter;
|
||||
Item(Item: number | string): Parameter;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Parameter;
|
||||
}
|
||||
|
||||
/** DAO 3.0 DBEngine (private) */
|
||||
class PrivDBEngine {
|
||||
private 'DAO.PrivDBEngine_typekey': PrivDBEngine;
|
||||
private constructor();
|
||||
BeginTrans(): void;
|
||||
|
||||
/** @param number [Option=0] */
|
||||
CommitTrans(Option?: number): void;
|
||||
CompactDatabase(SrcName: string, DstName: string, DstLocale?: any, Options?: any, SrcLocale?: any): void;
|
||||
CreateDatabase(Name: string, Locale: string, Option?: any): Database;
|
||||
CreateWorkspace(Name: string, UserName: string, Password: string, UseType?: any): Workspace;
|
||||
readonly DefaultPassword: string;
|
||||
DefaultType: number;
|
||||
readonly DefaultUser: string;
|
||||
readonly Errors: Errors;
|
||||
Idle(Action?: any): void;
|
||||
IniPath: string;
|
||||
ISAMStats(StatNum: number, Reset?: any): number;
|
||||
LoginTimeout: number;
|
||||
OpenConnection(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Connection;
|
||||
OpenDatabase(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Database;
|
||||
readonly Properties: Properties;
|
||||
RegisterDatabase(Dsn: string, Driver: string, Silent: boolean, Attributes: string): void;
|
||||
RepairDatabase(Name: string): void;
|
||||
Rollback(): void;
|
||||
SetOption(Option: number, Value: any): void;
|
||||
SystemDB: string;
|
||||
readonly Version: string;
|
||||
readonly Workspaces: Workspaces;
|
||||
}
|
||||
|
||||
class Properties {
|
||||
private 'DAO.Properties_typekey': Properties;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Properties {
|
||||
Append(Property: Property): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Property;
|
||||
Item(Item: number | string): Property;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Property;
|
||||
}
|
||||
|
||||
class Property {
|
||||
@@ -633,81 +644,78 @@ declare namespace DAO {
|
||||
Cancel(): void;
|
||||
Close(): void;
|
||||
Connect: string;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
readonly DateCreated: any;
|
||||
Execute(Options?: any): void;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DateCreated: VarDate;
|
||||
Execute(Options?: RecordsetOptionEnum): void;
|
||||
readonly Fields: Fields;
|
||||
readonly hStmt: number;
|
||||
readonly LastUpdated: any;
|
||||
readonly LastUpdated: VarDate;
|
||||
MaxRecords: number;
|
||||
Name: string;
|
||||
ODBCTimeout: number;
|
||||
OpenRecordset(Type?: any, Options?: any, LockEdit?: any): Recordset;
|
||||
OpenRecordset(Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum, LockEdit?: LockTypeEnum): Recordset;
|
||||
readonly Parameters: Parameters;
|
||||
Prepare: any;
|
||||
Prepare: QueryDefStateEnum;
|
||||
readonly Properties: Properties;
|
||||
readonly RecordsAffected: number;
|
||||
ReturnsRecords: boolean;
|
||||
SQL: string;
|
||||
readonly StillExecuting: boolean;
|
||||
readonly Type: number;
|
||||
readonly Type: QueryDefTypeEnum;
|
||||
readonly Updatable: boolean;
|
||||
}
|
||||
|
||||
class QueryDefs {
|
||||
private 'DAO.QueryDefs_typekey': QueryDefs;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface QueryDefs {
|
||||
Append(QueryDef: QueryDef): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): QueryDef;
|
||||
Item(Item: number | string): QueryDef;
|
||||
Refresh(): void;
|
||||
(Item: number | string): QueryDef;
|
||||
}
|
||||
|
||||
class Recordset {
|
||||
private 'DAO.Recordset_typekey': Recordset;
|
||||
private constructor();
|
||||
interface Recordset {
|
||||
AbsolutePosition: number;
|
||||
AddNew(): void;
|
||||
readonly BatchCollisionCount: number;
|
||||
readonly BatchCollisions: any;
|
||||
readonly BatchCollisions: SafeArray<Bookmark>;
|
||||
BatchSize: number;
|
||||
readonly BOF: boolean;
|
||||
Bookmark: SafeArray<number>;
|
||||
Bookmark: Bookmark;
|
||||
readonly Bookmarkable: boolean;
|
||||
CacheSize: number;
|
||||
CacheStart: SafeArray<number>;
|
||||
CacheStart: Bookmark;
|
||||
Cancel(): void;
|
||||
|
||||
/** @param number [UpdateType=1] */
|
||||
/** @param UpdateType [UpdateType=1] */
|
||||
CancelUpdate(UpdateType?: number): void;
|
||||
Clone(): Recordset;
|
||||
Close(): void;
|
||||
Collect(Item: any): any;
|
||||
Connection: Connection;
|
||||
CopyQueryDef(): QueryDef;
|
||||
readonly DateCreated: any;
|
||||
readonly DateCreated: VarDate;
|
||||
Delete(): void;
|
||||
Edit(): void;
|
||||
readonly EditMode: number;
|
||||
readonly EditMode: EditModeEnum;
|
||||
readonly EOF: boolean;
|
||||
readonly Fields: Fields;
|
||||
FillCache(Rows?: any, StartBookmark?: any): void;
|
||||
FillCache(Rows?: number, StartBookmark?: string): void;
|
||||
Filter: string;
|
||||
FindFirst(Criteria: string): void;
|
||||
FindLast(Criteria: string): void;
|
||||
FindNext(Criteria: string): void;
|
||||
FindPrevious(Criteria: string): void;
|
||||
GetRows(NumRows?: any): any;
|
||||
GetRows(NumRows?: number): any;
|
||||
readonly hStmt: number;
|
||||
Index: string;
|
||||
readonly LastModified: SafeArray<number>;
|
||||
readonly LastUpdated: any;
|
||||
readonly LastModified: Bookmark;
|
||||
readonly LastUpdated: VarDate;
|
||||
LockEdits: boolean;
|
||||
Move(Rows: number, StartBookmark?: any): void;
|
||||
Move(Rows: number, StartBookmark?: Bookmark): void;
|
||||
MoveFirst(): void;
|
||||
|
||||
/** @param number [Options=0] */
|
||||
/** @param Options [Options=0] */
|
||||
MoveLast(Options?: number): void;
|
||||
MoveNext(): void;
|
||||
MovePrevious(): void;
|
||||
@@ -716,45 +724,44 @@ declare namespace DAO {
|
||||
readonly NoMatch: boolean;
|
||||
readonly ODBCFetchCount: number;
|
||||
readonly ODBCFetchDelay: number;
|
||||
OpenRecordset(Type?: any, Options?: any): Recordset;
|
||||
OpenRecordset(Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum): Recordset;
|
||||
readonly Parent: Database;
|
||||
PercentPosition: number;
|
||||
readonly Properties: Properties;
|
||||
readonly RecordCount: number;
|
||||
readonly RecordStatus: number;
|
||||
Requery(NewQueryDef?: any): void;
|
||||
Requery(NewQueryDef?: QueryDef): void;
|
||||
readonly Restartable: boolean;
|
||||
Seek(
|
||||
Comparison: string, Key1: any, Key2?: any, Key3?: any, Key4?: any, Key5?: any, Key6?: any, Key7?: any, Key8?: any, Key9?: any, Key10?: any, Key11?: any, Key12?: any, Key13?: any): void;
|
||||
Seek(Comparison: string, Key1: any, Key2?: any, Key3?: any, Key4?: any, Key5?: any, Key6?: any, Key7?: any, Key8?: any, Key9?: any, Key10?: any, Key11?: any, Key12?: any, Key13?: any): void;
|
||||
Sort: string;
|
||||
readonly StillExecuting: boolean;
|
||||
readonly Transactions: boolean;
|
||||
readonly Type: number;
|
||||
readonly Type: RecordsetTypeEnum;
|
||||
readonly Updatable: boolean;
|
||||
|
||||
/**
|
||||
* @param number [UpdateType=1]
|
||||
* @param boolean [Force=false]
|
||||
* @param UpdateType [UpdateType=1]
|
||||
* @param Force [Force=false]
|
||||
*/
|
||||
Update(UpdateType?: number, Force?: boolean): void;
|
||||
UpdateOptions: number;
|
||||
Update(UpdateType?: UpdateTypeEnum, Force?: boolean): void;
|
||||
UpdateOptions: UpdateCriteriaEnum;
|
||||
readonly ValidationRule: string;
|
||||
readonly ValidationText: string;
|
||||
(FieldIndex: number | string): Field;
|
||||
}
|
||||
|
||||
class Recordsets {
|
||||
private 'DAO.Recordsets_typekey': Recordsets;
|
||||
private constructor();
|
||||
interface Recordsets {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Recordset;
|
||||
Item(Item: number | string): Recordset;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Recordset;
|
||||
}
|
||||
|
||||
class Relation {
|
||||
private 'DAO.Relation_typekey': Relation;
|
||||
private constructor();
|
||||
Attributes: number;
|
||||
CreateField(Name?: any, Type?: any, Size?: any): Field;
|
||||
Attributes: RelationAttributeEnum;
|
||||
CreateField(Name?: string): Field;
|
||||
readonly Fields: Fields;
|
||||
ForeignTable: string;
|
||||
Name: string;
|
||||
@@ -763,55 +770,53 @@ declare namespace DAO {
|
||||
Table: string;
|
||||
}
|
||||
|
||||
class Relations {
|
||||
private 'DAO.Relations_typekey': Relations;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Relations {
|
||||
Append(Relation: Relation): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Relation;
|
||||
Item(Item: number | string): Relation;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Relation;
|
||||
}
|
||||
|
||||
class TableDef {
|
||||
private 'DAO.TableDef_typekey': TableDef;
|
||||
private constructor();
|
||||
Attributes: number;
|
||||
Attributes: TableDefAttributeEnum;
|
||||
readonly ConflictTable: string;
|
||||
Connect: string;
|
||||
CreateField(Name?: any, Type?: any, Size?: any): Field;
|
||||
CreateIndex(Name?: any): Index;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
readonly DateCreated: any;
|
||||
CreateField(Name?: string, Type?: DataTypeEnum, Size?: number): Field;
|
||||
CreateIndex(Name?: string): Index;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DateCreated: VarDate;
|
||||
readonly Fields: Fields;
|
||||
readonly Indexes: Indexes;
|
||||
readonly LastUpdated: any;
|
||||
readonly LastUpdated: VarDate;
|
||||
Name: string;
|
||||
OpenRecordset(Type?: any, Options?: any): Recordset;
|
||||
OpenRecordset(Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum): Recordset;
|
||||
readonly Properties: Properties;
|
||||
readonly RecordCount: number;
|
||||
RefreshLink(): void;
|
||||
ReplicaFilter: any;
|
||||
ReplicaFilter: string | boolean;
|
||||
SourceTableName: string;
|
||||
readonly Updatable: boolean;
|
||||
ValidationRule: string;
|
||||
ValidationText: string;
|
||||
}
|
||||
|
||||
class TableDefs {
|
||||
private 'DAO.TableDefs_typekey': TableDefs;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface TableDefs {
|
||||
Append(TableDef: TableDef): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): TableDef;
|
||||
Item(Item: number | string): TableDef;
|
||||
Refresh(): void;
|
||||
(Item: number | string): TableDef;
|
||||
}
|
||||
|
||||
class User {
|
||||
private 'DAO.User_typekey': User;
|
||||
private constructor();
|
||||
CreateGroup(Name?: any, PID?: any): Group;
|
||||
CreateGroup(Name?: string, PID?: string): Group;
|
||||
readonly Groups: Groups;
|
||||
Name: string;
|
||||
NewPassword(bstrOld: string, bstrNew: string): void;
|
||||
@@ -820,14 +825,13 @@ declare namespace DAO {
|
||||
readonly Properties: Properties;
|
||||
}
|
||||
|
||||
class Users {
|
||||
private 'DAO.Users_typekey': Users;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Users {
|
||||
Append(User: User): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): User;
|
||||
Item(Item: number | string): User;
|
||||
Refresh(): void;
|
||||
(Item: number | string): User;
|
||||
}
|
||||
|
||||
class Workspace {
|
||||
@@ -836,12 +840,19 @@ declare namespace DAO {
|
||||
BeginTrans(): void;
|
||||
Close(): void;
|
||||
|
||||
/** @param number [Options=0] */
|
||||
/** @param Options [Options=0] */
|
||||
CommitTrans(Options?: number): void;
|
||||
readonly Connections: Connections;
|
||||
CreateDatabase(Name: string, Connect: string, Option?: any): Database;
|
||||
CreateGroup(Name?: any, PID?: any): Group;
|
||||
CreateUser(Name?: any, PID?: any, Password?: any): User;
|
||||
|
||||
/**
|
||||
* @param Connect Specify one of the following:
|
||||
* * the locale, using one of the language constants
|
||||
* * the password, in the form `;pwd=MyNewPassword'`
|
||||
* * both the constant and a password, e.g. `dbLangGreek + ';pwd=MyNewPassword'`
|
||||
*/
|
||||
CreateDatabase(Name: string, Connect: string, Option?: DatabaseTypeEnum): Database;
|
||||
CreateGroup(Name?: string, PID?: string): Group;
|
||||
CreateUser(Name?: string, PID?: string, Password?: string): User;
|
||||
readonly Databases: Databases;
|
||||
DefaultCursorDriver: number;
|
||||
readonly Groups: Groups;
|
||||
@@ -849,8 +860,12 @@ declare namespace DAO {
|
||||
IsolateODBCTrans: number;
|
||||
LoginTimeout: number;
|
||||
Name: string;
|
||||
OpenConnection(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Connection;
|
||||
OpenDatabase(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Database;
|
||||
|
||||
/**
|
||||
* @param Connect ODBC connection string; prepend with `ODBC;`
|
||||
*/
|
||||
OpenConnection(Name: string, Options?: DriverPromptEnum | RecordsetOptionEnum.dbRunAsync, ReadOnly?: boolean, Connect?: string): Connection;
|
||||
OpenDatabase(Name: string, Exclusive?: boolean, ReadOnly?: boolean, Connect?: string): Database;
|
||||
readonly Properties: Properties;
|
||||
Rollback(): void;
|
||||
readonly Type: number;
|
||||
@@ -858,14 +873,13 @@ declare namespace DAO {
|
||||
readonly Users: Users;
|
||||
}
|
||||
|
||||
class Workspaces {
|
||||
private 'DAO.Workspaces_typekey': Workspaces;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Workspaces {
|
||||
Append(Workspace: Workspace): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Workspace;
|
||||
Item(Item: number | string): Workspace;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Workspace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -875,36 +889,12 @@ interface ActiveXObject {
|
||||
|
||||
interface ActiveXObjectNameMap {
|
||||
'DAO.DBEngine': DAO.DBEngine;
|
||||
'DAO.DBEngine.120': DAO.DBEngine;
|
||||
'DAO.Field': DAO.Field;
|
||||
'DAO.Group': DAO.Group;
|
||||
'DAO.Index': DAO.Index;
|
||||
'DAO.PrivateDBEngine': DAO.PrivDBEngine;
|
||||
'DAO.PrivateDBEngine': DAO.DBEngine;
|
||||
'DAO.QueryDef': DAO.QueryDef;
|
||||
'DAO.Relation': DAO.Relation;
|
||||
'DAO.TableDef': DAO.TableDef;
|
||||
'DAO.User': DAO.User;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new(col: DAO.Connections): Enumerator<DAO.Connection>;
|
||||
new(col: DAO.Containers): Enumerator<DAO.Container>;
|
||||
new(col: DAO.Databases): Enumerator<DAO.Database>;
|
||||
new(col: DAO.Documents): Enumerator<DAO.Document>;
|
||||
new(col: DAO.Errors): Enumerator<DAO.Error>;
|
||||
new(col: DAO.Fields): Enumerator<DAO.Field>;
|
||||
new(col: DAO.Groups): Enumerator<DAO.Group>;
|
||||
new(col: DAO.Indexes): Enumerator<DAO.Index>;
|
||||
new(col: DAO.Parameters): Enumerator<DAO.Parameter>;
|
||||
new(col: DAO.Properties): Enumerator<DAO.Property>;
|
||||
new(col: DAO.QueryDefs): Enumerator<DAO.QueryDef>;
|
||||
new(col: DAO.Recordsets): Enumerator<DAO.Recordset>;
|
||||
new(col: DAO.Relations): Enumerator<DAO.Relation>;
|
||||
new(col: DAO.TableDefs): Enumerator<DAO.TableDef>;
|
||||
new(col: DAO.Users): Enumerator<DAO.User>;
|
||||
new(col: DAO.Workspaces): Enumerator<DAO.Workspace>;
|
||||
}
|
||||
|
||||
interface SafeArray<T = any> {
|
||||
_brand: SafeArray<T>;
|
||||
}
|
||||
|
||||
+5
-5
@@ -26,10 +26,10 @@ interface Context {
|
||||
}
|
||||
|
||||
interface Options {
|
||||
region: string;
|
||||
account: string;
|
||||
functionName: string;
|
||||
functionVersion: string;
|
||||
memoryLimitInMB: string;
|
||||
region?: string;
|
||||
account?: string;
|
||||
functionName?: string;
|
||||
functionVersion?: string;
|
||||
memoryLimitInMB?: string;
|
||||
alias?: string;
|
||||
}
|
||||
|
||||
@@ -191,6 +191,18 @@ function within() {
|
||||
expect(10).to.be.within(50, 100, 'blah');
|
||||
(10).should.be.within(50, 100, 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.within(new Date('December 17, 1995 03:24:20'), new Date('December 17, 1995 03:24:40'));
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.within(new Date('December 17, 1995 03:24:20'), new Date('December 17, 1995 03:24:40'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.within(new Date('December 17, 1995 03:24:20'), new Date('December 17, 1995 03:24:40'));
|
||||
new Date('December 17, 1995 03:24:30').should.be.within(new Date('December 17, 1995 03:24:20'), new Date('December 17, 1995 03:24:40'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.within(new Date('December 17, 1995 03:24:20'), new Date('December 17, 1995 03:24:40'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.within(new Date('December 17, 1995 03:24:20'), new Date('December 17, 1995 03:24:40'), 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.within(new Date('December 17, 1995 03:24:20'), new Date('December 17, 1995 03:24:40'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.be.within(new Date('December 17, 1995 03:24:20'), new Date('December 17, 1995 03:24:40'), 'blah');
|
||||
|
||||
expect('foo').to.have.length.within(5, 7, 'blah');
|
||||
'foo'.should.have.length.within(5, 7, 'blah');
|
||||
|
||||
@@ -218,6 +230,18 @@ function above() {
|
||||
expect(10).to.not.be.above(6, 'blah');
|
||||
(10).should.not.be.above(6, 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.above(new Date('December 17, 1995 03:24:20'));
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.above(new Date('December 17, 1995 03:24:20'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.above(new Date('December 17, 1995 03:24:20'));
|
||||
new Date('December 17, 1995 03:24:30').should.be.above(new Date('December 17, 1995 03:24:20'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.above(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.above(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.above(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.be.above(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
|
||||
expect('foo').to.have.length.above(4, 'blah');
|
||||
'foo'.should.have.length.above(4, 'blah');
|
||||
|
||||
@@ -243,6 +267,18 @@ function least() {
|
||||
expect(10).to.not.be.at.least(6, 'blah');
|
||||
(10).should.not.be.at.least(6, 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.least(new Date('December 17, 1995 03:24:20'));
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.least(new Date('December 17, 1995 03:24:20'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.least(new Date('December 17, 1995 03:24:20'));
|
||||
new Date('December 17, 1995 03:24:30').should.be.least(new Date('December 17, 1995 03:24:20'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.least(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.least(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.least(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.be.least(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
|
||||
expect('foo').to.have.length.of.at.least(4, 'blah');
|
||||
'foo'.should.have.length.of.at.least(4, 'blah');
|
||||
|
||||
@@ -273,6 +309,18 @@ function below() {
|
||||
expect(6).to.not.be.below(10, 'blah');
|
||||
(6).should.not.be.below(10, 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.below(new Date('December 17, 1995 03:24:20'));
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.below(new Date('December 17, 1995 03:24:20'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.below(new Date('December 17, 1995 03:24:20'));
|
||||
new Date('December 17, 1995 03:24:30').should.be.below(new Date('December 17, 1995 03:24:20'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.below(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.below(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.below(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.be.below(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
|
||||
expect('foo').to.have.length.below(2, 'blah');
|
||||
'foo'.should.have.length.below(2, 'blah');
|
||||
|
||||
@@ -300,6 +348,18 @@ function most() {
|
||||
expect(6).to.not.be.at.most(10, 'blah');
|
||||
(6).should.not.be.at.most(10, 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.most(new Date('December 17, 1995 03:24:20'));
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.most(new Date('December 17, 1995 03:24:20'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.most(new Date('December 17, 1995 03:24:20'));
|
||||
new Date('December 17, 1995 03:24:30').should.be.most(new Date('December 17, 1995 03:24:20'));
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.not.be.most(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.not.be.most(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
|
||||
expect(new Date('December 17, 1995 03:24:30')).to.be.most(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
new Date('December 17, 1995 03:24:30').should.be.most(new Date('December 17, 1995 03:24:20'), 'blah');
|
||||
|
||||
expect('foo').to.have.length.of.at.most(2, 'blah');
|
||||
'foo'.should.have.length.of.at.most(2, 'blah');
|
||||
|
||||
|
||||
Vendored
+3
-1
@@ -9,6 +9,7 @@
|
||||
// Shaun Luttin <https://github.com/shaunluttin>
|
||||
// Gintautas Miselis <https://github.com/Naktibalda>
|
||||
// Satana Charuwichitratana <https://github.com/micksatana>
|
||||
// Erik Schierboom <https://github.com/ErikSchierboom>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Chai {
|
||||
@@ -150,10 +151,11 @@ declare namespace Chai {
|
||||
most: NumberComparer;
|
||||
lte: NumberComparer;
|
||||
within(start: number, finish: number, message?: string): Assertion;
|
||||
within(start: Date, finish: Date, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface NumberComparer {
|
||||
(value: number, message?: string): Assertion;
|
||||
(value: number | Date, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import * as errors from 'node-common-errors';
|
||||
import * as errors from 'common-errors';
|
||||
|
||||
errors.log(new Error()); // $ExpectType Error
|
||||
errors.log(new Error(), ''); // $ExpectType Error
|
||||
@@ -1,5 +1,5 @@
|
||||
// Type definitions for node-common-errors 0.4
|
||||
// Project: https://github.com/shutterstock/node-errors
|
||||
// Type definitions for common-errors 1.0
|
||||
// Project: https://github.com/shutterstock/node-common-errors
|
||||
// Definitions by: Ian Copp <https://github.com/icopp>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
@@ -18,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-common-errors-tests.ts"
|
||||
"common-errors-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -43,7 +43,7 @@ declare module 'ember-data' {
|
||||
isRelationship: true;
|
||||
}
|
||||
|
||||
namespace DS {
|
||||
export namespace DS {
|
||||
/**
|
||||
* Convert an hash of errors into an array with errors in JSON-API format.
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ const eventSource = new EventSource("http://foobar");
|
||||
eventSource.onmessage = (x: any) => {};
|
||||
eventSource.onerror = (x: any) => {};
|
||||
eventSource.onopen = (x: any) => {};
|
||||
eventSource.addEventListener = (type: string, x: any) => {};
|
||||
eventSource.close();
|
||||
|
||||
import EventSourcePolyfill = require("eventsource/lib/eventsource-polyfill");
|
||||
@@ -12,4 +13,5 @@ const eventSourcePolyfill = new EventSourcePolyfill("http://foobar");
|
||||
eventSourcePolyfill.onmessage = (x: any) => {};
|
||||
eventSourcePolyfill.onerror = (x: any) => {};
|
||||
eventSourcePolyfill.onopen = (x: any) => {};
|
||||
eventSourcePolyfill.addEventListener = (type: string, x: any) => {};
|
||||
eventSourcePolyfill.close();
|
||||
|
||||
Vendored
+1
@@ -16,6 +16,7 @@ declare class EventSource {
|
||||
onopen: EventListener;
|
||||
onmessage: EventListener;
|
||||
onerror: EventListener;
|
||||
addEventListener(type: string, listener: EventListener): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ declare class EventSource {
|
||||
onopen: EventListener;
|
||||
onmessage: EventListener;
|
||||
onerror: EventListener;
|
||||
addEventListener(type: string, listener: EventListener): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,33 @@ import { Transform } from "stream";
|
||||
mustache({ // $ExpectType Transform
|
||||
msg: "Hello Gulp!"
|
||||
});
|
||||
mustache({
|
||||
name: "Chris",
|
||||
value: 10000,
|
||||
taxed_value: 10000 - (10000 * 0.4),
|
||||
in_ca: true
|
||||
});
|
||||
mustache({
|
||||
repo: [
|
||||
{ name: "resque" },
|
||||
{ name: "hub" },
|
||||
{ name: "rip" }
|
||||
]
|
||||
});
|
||||
mustache({
|
||||
name: "Willy",
|
||||
wrapped: () => {
|
||||
return (text: string, render: (arg: string) => string) => {
|
||||
return `<b>${render(text)}</b>`;
|
||||
};
|
||||
}
|
||||
});
|
||||
mustache({
|
||||
"person?": { name: "Jon" }
|
||||
});
|
||||
mustache({
|
||||
repo: []
|
||||
});
|
||||
|
||||
mustache({ // $ExpectType Transform
|
||||
msg: "Hello Gulp!",
|
||||
|
||||
Vendored
+1
-1
@@ -11,7 +11,7 @@ declare namespace GulpMustache {
|
||||
type View = Hash | string | undefined;
|
||||
|
||||
interface Hash {
|
||||
[key: string]: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
|
||||
Vendored
+15
@@ -8,6 +8,7 @@
|
||||
// Rytis Alekna <https://github.com/ralekna>
|
||||
// Pavel Ivanov <https://github.com/schfkt>
|
||||
// Youngrok Kim <https://github.com/rokoroku>
|
||||
// Conan Lai <https://github.com/aconanlai>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -142,6 +143,17 @@ export interface WhenOptions {
|
||||
otherwise?: SchemaLike;
|
||||
}
|
||||
|
||||
export interface WhenSchemaOptions {
|
||||
/**
|
||||
* the alternative schema type if the condition is true. Required if otherwise is missing.
|
||||
*/
|
||||
then?: SchemaLike;
|
||||
/**
|
||||
* the alternative schema type if the condition is false. Required if then is missing
|
||||
*/
|
||||
otherwise?: SchemaLike;
|
||||
}
|
||||
|
||||
export interface ReferenceOptions {
|
||||
separator?: string;
|
||||
contextPrefix?: string;
|
||||
@@ -327,6 +339,7 @@ export interface AnySchema extends JoiObject {
|
||||
*/
|
||||
when(ref: string, options: WhenOptions): AlternativesSchema;
|
||||
when(ref: Reference, options: WhenOptions): AlternativesSchema;
|
||||
when(ref: Schema, options: WhenSchemaOptions): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Overrides the key name in error messages.
|
||||
@@ -878,6 +891,7 @@ export interface AlternativesSchema extends AnySchema {
|
||||
try(...types: SchemaLike[]): this;
|
||||
when(ref: string, options: WhenOptions): this;
|
||||
when(ref: Reference, options: WhenOptions): this;
|
||||
when(ref: Schema, options: WhenSchemaOptions): this;
|
||||
}
|
||||
|
||||
export interface LazySchema extends AnySchema {
|
||||
@@ -1160,6 +1174,7 @@ export function concat<T>(schema: T): T;
|
||||
*/
|
||||
export function when(ref: string, options: WhenOptions): AlternativesSchema;
|
||||
export function when(ref: Reference, options: WhenOptions): AlternativesSchema;
|
||||
export function when(ref: Schema, options: WhenSchemaOptions): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Overrides the key name in error messages.
|
||||
|
||||
@@ -122,6 +122,14 @@ whenOpts = { is: schemaLike, then: schemaLike, otherwise: schemaLike };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var whenSchemaOpts: Joi.WhenSchemaOptions = null;
|
||||
|
||||
whenSchemaOpts = { then: schema };
|
||||
whenSchemaOpts = { otherwise: schema };
|
||||
whenSchemaOpts = { then: schemaLike, otherwise: schemaLike };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var refOpts: Joi.ReferenceOptions = null;
|
||||
|
||||
refOpts = { separator: str };
|
||||
@@ -263,6 +271,7 @@ namespace common {
|
||||
|
||||
altSchema = anySchema.when(str, whenOpts);
|
||||
altSchema = anySchema.when(ref, whenOpts);
|
||||
altSchema = anySchema.when(schema, whenSchemaOpts);
|
||||
|
||||
anySchema = anySchema.label(str);
|
||||
anySchema = anySchema.raw();
|
||||
@@ -350,6 +359,7 @@ namespace common_copy_paste {
|
||||
|
||||
altSchema = arrSchema.when(str, whenOpts);
|
||||
altSchema = arrSchema.when(ref, whenOpts);
|
||||
altSchema = arrSchema.when(schema, whenSchemaOpts);
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
@@ -420,6 +430,7 @@ namespace common_copy_paste {
|
||||
|
||||
altSchema = boolSchema.when(str, whenOpts);
|
||||
altSchema = boolSchema.when(ref, whenOpts);
|
||||
altSchema = boolSchema.when(schema, whenSchemaOpts);
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
@@ -476,6 +487,7 @@ namespace common {
|
||||
|
||||
altSchema = binSchema.when(str, whenOpts);
|
||||
altSchema = binSchema.when(ref, whenOpts);
|
||||
altSchema = binSchema.when(schema, whenSchemaOpts);
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
@@ -548,6 +560,7 @@ namespace common {
|
||||
|
||||
altSchema = dateSchema.when(str, whenOpts);
|
||||
altSchema = dateSchema.when(ref, whenOpts);
|
||||
altSchema = dateSchema.when(schema, whenSchemaOpts);
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
@@ -622,6 +635,7 @@ namespace common {
|
||||
|
||||
altSchema = numSchema.when(str, whenOpts);
|
||||
altSchema = numSchema.when(ref, whenOpts);
|
||||
altSchema = numSchema.when(schema, whenSchemaOpts);
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
@@ -732,6 +746,7 @@ namespace common {
|
||||
|
||||
altSchema = objSchema.when(str, whenOpts);
|
||||
altSchema = objSchema.when(ref, whenOpts);
|
||||
altSchema = objSchema.when(schema, whenSchemaOpts);
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
@@ -823,6 +838,7 @@ namespace common {
|
||||
|
||||
altSchema = strSchema.when(str, whenOpts);
|
||||
altSchema = strSchema.when(ref, whenOpts);
|
||||
altSchema = strSchema.when(schema, whenSchemaOpts);
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
@@ -1007,6 +1023,7 @@ schema = Joi.concat(x);
|
||||
|
||||
schema = Joi.when(str, whenOpts);
|
||||
schema = Joi.when(ref, whenOpts);
|
||||
schema = Joi.when(schema, whenSchemaOpts);
|
||||
|
||||
schema = Joi.label(str);
|
||||
schema = Joi.raw();
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for jpegtran-bin 3.2
|
||||
// Project: https://github.com/imagemin/jpegtran-bin#readme
|
||||
// Definitions by: Hirotaka Ikoma <https://github.com/hikoma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare const jpegtran: string;
|
||||
export = jpegtran;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { execFile } from "child_process";
|
||||
import * as jpegtran from "jpegtran-bin";
|
||||
|
||||
execFile(jpegtran, ["-outfile", "output.jpg", "input.jpg"], { encoding: "utf-8" }, (err: Error | null) => {
|
||||
console.log("Image minified!");
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jpegtran-bin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
@@ -873,6 +873,7 @@ declare namespace mapboxgl {
|
||||
speed?: number;
|
||||
screenSpeed?: number;
|
||||
easing?: Function;
|
||||
maxDuration?: number;
|
||||
}
|
||||
|
||||
export interface FitBoundsOptions extends mapboxgl.FlyToOptions {
|
||||
|
||||
@@ -150,7 +150,8 @@ map.flyTo({
|
||||
screenSpeed: 1,
|
||||
easing: function(t: any) {
|
||||
return t;
|
||||
}
|
||||
},
|
||||
maxDuration: 1
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for mozjpeg 5.0
|
||||
// Project: https://github.com/imagemin/mozjpeg-bin#readme
|
||||
// Definitions by: Hirotaka Ikoma <https://github.com/hikoma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare const mozjpeg: string;
|
||||
export = mozjpeg;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { execFile } from "child_process";
|
||||
import * as mozjpeg from "mozjpeg";
|
||||
|
||||
execFile(mozjpeg, ["-outfile", "output.jpg", "input.jpg"], {encoding: "utf-8"}, (err: Error | null) => {
|
||||
console.log("Image minified!");
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mozjpeg-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for pngquant-bin 4.0
|
||||
// Project: https://github.com/imagemin/pngquant-bin#readme
|
||||
// Definitions by: Hirotaka Ikoma <https://github.com/hikoma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare const pngquant: string;
|
||||
export = pngquant;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { execFile } from "child_process";
|
||||
import * as pngquant from "pngquant-bin";
|
||||
|
||||
execFile(pngquant, ["-o", "output.png", "input.png"], { encoding: "utf-8" }, (err: Error | null) => {
|
||||
console.log("Image minified!");
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"pngquant-bin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+20
-8
@@ -3,13 +3,11 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Schema } from 'prosemirror-model';
|
||||
import { EditorState, Plugin, Transaction } from 'prosemirror-state';
|
||||
import { Step } from 'prosemirror-transform';
|
||||
|
||||
@@ -17,13 +15,20 @@ import { Step } from 'prosemirror-transform';
|
||||
* Creates a plugin that enables the collaborative editing framework
|
||||
* for the editor.
|
||||
*/
|
||||
export function collab(config?: { version?: number | null, clientID?: number | string | null }): Plugin;
|
||||
export function collab(config?: {
|
||||
version?: number | null;
|
||||
clientID?: number | string | null;
|
||||
}): Plugin;
|
||||
/**
|
||||
* Create a transaction that represents a set of new steps received from
|
||||
* the authority. Applying this transaction moves the state forward to
|
||||
* adjust to the authority's view of the document.
|
||||
*/
|
||||
export function receiveTransaction(state: EditorState, steps: Step[], clientIDs: Array<number | string>): Transaction;
|
||||
export function receiveTransaction<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
steps: Array<Step<S>>,
|
||||
clientIDs: Array<number | string>
|
||||
): Transaction<S>;
|
||||
/**
|
||||
* Provides data describing the editor's unconfirmed steps, which need
|
||||
* to be sent to the central authority. Returns null when there is
|
||||
@@ -35,7 +40,14 @@ export function receiveTransaction(state: EditorState, steps: Step[], clientIDs:
|
||||
* rebased, whereas the origin transactions are still the old,
|
||||
* unchanged objects.
|
||||
*/
|
||||
export function sendableSteps(state: EditorState): { version: number, steps: Step[], clientID: number | string, origins: Transaction[] } | null | void;
|
||||
export function sendableSteps<S extends Schema = any>(
|
||||
state: EditorState<S>
|
||||
): {
|
||||
version: number;
|
||||
steps: Array<Step<S>>;
|
||||
clientID: number | string;
|
||||
origins: Array<Transaction<S>>;
|
||||
} | null | void;
|
||||
/**
|
||||
* Get the version up to which the collab plugin has synced with the
|
||||
* central authority.
|
||||
|
||||
+92
-32
@@ -3,21 +3,21 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
|
||||
import { MarkType, Node as ProsemirrorNode, NodeType } from 'prosemirror-model';
|
||||
import { MarkType, Node as ProsemirrorNode, NodeType, Schema } from 'prosemirror-model';
|
||||
import { EditorState, Transaction } from 'prosemirror-state';
|
||||
import { EditorView } from 'prosemirror-view';
|
||||
|
||||
/**
|
||||
* Delete the selection, if there is one.
|
||||
*/
|
||||
export function deleteSelection(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function deleteSelection<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* If the selection is empty and at the start of a textblock, try to
|
||||
* reduce the distance between that block and the one before it—if
|
||||
@@ -27,7 +27,11 @@ export function deleteSelection(state: EditorState, dispatch?: (tr: Transaction)
|
||||
* into a parent of the previous block. Will use the view for accurate
|
||||
* (bidi-aware) start-of-textblock detection if given.
|
||||
*/
|
||||
export function joinBackward(state: EditorState, dispatch?: (tr: Transaction) => void, view?: EditorView): boolean;
|
||||
export function joinBackward<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void,
|
||||
view?: EditorView<S>
|
||||
): boolean;
|
||||
/**
|
||||
* When the selection is empty and at the start of a textblock, select
|
||||
* the node before that textblock, if possible. This is intended to be
|
||||
@@ -36,7 +40,11 @@ export function joinBackward(state: EditorState, dispatch?: (tr: Transaction) =>
|
||||
* commands, as a fall-back behavior when the schema doesn't allow
|
||||
* deletion at the selected point.
|
||||
*/
|
||||
export function selectNodeBackward(state: EditorState, dispatch?: (tr: Transaction) => void, view?: EditorView): boolean;
|
||||
export function selectNodeBackward<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void,
|
||||
view?: EditorView<S>
|
||||
): boolean;
|
||||
/**
|
||||
* If the selection is empty and the cursor is at the end of a
|
||||
* textblock, try to reduce or remove the boundary between that block
|
||||
@@ -44,7 +52,11 @@ export function selectNodeBackward(state: EditorState, dispatch?: (tr: Transacti
|
||||
* block closer to this one in the tree structure. Will use the view
|
||||
* for accurate start-of-textblock detection if given.
|
||||
*/
|
||||
export function joinForward(state: EditorState, dispatch?: (tr: Transaction) => void, view?: EditorView): boolean;
|
||||
export function joinForward<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void,
|
||||
view?: EditorView<S>
|
||||
): boolean;
|
||||
/**
|
||||
* When the selection is empty and at the end of a textblock, select
|
||||
* the node coming after that textblock, if possible. This is intended
|
||||
@@ -53,74 +65,117 @@ export function joinForward(state: EditorState, dispatch?: (tr: Transaction) =>
|
||||
* commands, to provide a fall-back behavior when the schema doesn't
|
||||
* allow deletion at the selected point.
|
||||
*/
|
||||
export function selectNodeForward(state: EditorState, dispatch?: (tr: Transaction) => void, view?: EditorView): boolean;
|
||||
export function selectNodeForward<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void,
|
||||
view?: EditorView<S>
|
||||
): boolean;
|
||||
/**
|
||||
* Join the selected block or, if there is a text selection, the
|
||||
* closest ancestor block of the selection that can be joined, with
|
||||
* the sibling above it.
|
||||
*/
|
||||
export function joinUp(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function joinUp<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* Join the selected block, or the closest ancestor of the selection
|
||||
* that can be joined, with the sibling after it.
|
||||
*/
|
||||
export function joinDown(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function joinDown<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* Lift the selected block, or the closest ancestor block of the
|
||||
* selection that can be lifted, out of its parent node.
|
||||
*/
|
||||
export function lift(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function lift<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* If the selection is in a node whose type has a truthy
|
||||
* [`code`](#model.NodeSpec.code) property in its spec, replace the
|
||||
* selection with a newline character.
|
||||
*/
|
||||
export function newlineInCode(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function newlineInCode<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* When the selection is in a node with a truthy
|
||||
* [`code`](#model.NodeSpec.code) property in its spec, create a
|
||||
* default block after the code block, and move the cursor there.
|
||||
*/
|
||||
export function exitCode(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function exitCode<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* If a block node is selected, create an empty paragraph before (if
|
||||
* it is its parent's first child) or after it.
|
||||
*/
|
||||
export function createParagraphNear(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function createParagraphNear<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* If the cursor is in an empty textblock that can be lifted, lift the
|
||||
* block.
|
||||
*/
|
||||
export function liftEmptyBlock(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function liftEmptyBlock<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* Split the parent block of the selection. If the selection is a text
|
||||
* selection, also delete its content.
|
||||
*/
|
||||
export function splitBlock(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function splitBlock<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* Acts like [`splitBlock`](#commands.splitBlock), but without
|
||||
* resetting the set of active marks at the cursor.
|
||||
*/
|
||||
export function splitBlockKeepMarks(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function splitBlockKeepMarks<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* Move the selection to the node wrapping the current selection, if
|
||||
* any. (Will not select the document node.)
|
||||
*/
|
||||
export function selectParentNode(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function selectParentNode<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* Select the whole document.
|
||||
*/
|
||||
export function selectAll(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function selectAll<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* Wrap the selection in a node of the given type with the given
|
||||
* attributes.
|
||||
*/
|
||||
export function wrapIn(nodeType: NodeType, attrs?: { [key: string]: any }): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
||||
export function wrapIn<S extends Schema = any>(
|
||||
nodeType: NodeType<S>,
|
||||
attrs?: { [key: string]: any }
|
||||
): (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void) => boolean;
|
||||
/**
|
||||
* Returns a command that tries to set the textblock around the
|
||||
* selection to the given node type with the given attributes.
|
||||
*/
|
||||
export function setBlockType(nodeType: NodeType, attrs?: { [key: string]: any }): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
||||
export function setBlockType<S extends Schema = any>(
|
||||
nodeType: NodeType<S>,
|
||||
attrs?: { [key: string]: any }
|
||||
): (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void) => boolean;
|
||||
/**
|
||||
* Create a command function that toggles the given mark with the
|
||||
* given attributes. Will return `false` when the current selection
|
||||
@@ -130,7 +185,10 @@ export function setBlockType(nodeType: NodeType, attrs?: { [key: string]: any })
|
||||
* marks](#state.EditorState.storedMarks) instead of a range of the
|
||||
* document.
|
||||
*/
|
||||
export function toggleMark(markType: MarkType, attrs?: { [key: string]: any }): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
||||
export function toggleMark<S extends Schema = any>(
|
||||
markType: MarkType<S>,
|
||||
attrs?: { [key: string]: any }
|
||||
): (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void) => boolean;
|
||||
/**
|
||||
* Wrap a command so that, when it produces a transform that causes
|
||||
* two joinable nodes to end up next to each other, those are joined.
|
||||
@@ -139,17 +197,19 @@ export function toggleMark(markType: MarkType, attrs?: { [key: string]: any }):
|
||||
* array of strings was passed, if their node type name is in that
|
||||
* array.
|
||||
*/
|
||||
export function autoJoin(
|
||||
command: (state: EditorState, p1?: (tr: Transaction) => void) => boolean,
|
||||
isJoinable: ((before: ProsemirrorNode, after: ProsemirrorNode) => boolean) | string[]
|
||||
): (state: EditorState, p1?: (tr: Transaction) => void) => boolean;
|
||||
export function autoJoin<S extends Schema = any>(
|
||||
command: (state: EditorState<S>, p1?: (tr: Transaction<S>) => void) => boolean,
|
||||
isJoinable: ((before: ProsemirrorNode<S>, after: ProsemirrorNode<S>) => boolean) | string[]
|
||||
): (state: EditorState<S>, p1?: (tr: Transaction<S>) => void) => boolean;
|
||||
/**
|
||||
* Combine a number of command functions into a single function (which
|
||||
* calls them one by one until one returns true).
|
||||
*/
|
||||
export function chainCommands(
|
||||
...commands: Array<(p1: EditorState, p2?: (tr: Transaction) => void, p3?: EditorView) => boolean>
|
||||
): (p1: EditorState, p2?: (tr: Transaction) => void, p3?: EditorView) => boolean;
|
||||
export function chainCommands<S extends Schema = any>(
|
||||
...commands: Array<
|
||||
(p1: EditorState<S>, p2?: (tr: Transaction<S>) => void, p3?: EditorView<S>) => boolean
|
||||
>
|
||||
): (p1: EditorState<S>, p2?: (tr: Transaction<S>) => void, p3?: EditorView<S>) => boolean;
|
||||
/**
|
||||
* A basic keymap containing bindings not specific to any schema.
|
||||
* Binds the following keys (when multiple commands are listed, they
|
||||
|
||||
+3
-7
@@ -3,12 +3,9 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin, Selection } from 'prosemirror-state';
|
||||
|
||||
@@ -16,8 +13,7 @@ import { Plugin, Selection } from 'prosemirror-state';
|
||||
* Gap cursor selections are represented using this class. Its
|
||||
* `$anchor` and `$head` properties both point at the cursor position.
|
||||
*/
|
||||
export class GapCursor extends Selection {
|
||||
}
|
||||
export class GapCursor extends Selection { }
|
||||
/**
|
||||
* Create a gap cursor plugin. When enabled, this will capture clicks
|
||||
* near and arrow-key-motion past places that don't have a normally
|
||||
|
||||
Vendored
+13
-9
@@ -3,13 +3,11 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Schema } from 'prosemirror-model';
|
||||
import { EditorState, Plugin, Transaction } from 'prosemirror-state';
|
||||
|
||||
/**
|
||||
@@ -17,7 +15,7 @@ import { EditorState, Plugin, Transaction } from 'prosemirror-state';
|
||||
* from being appended to an existing history event (so that they
|
||||
* require a separate undo command to undo).
|
||||
*/
|
||||
export function closeHistory(tr: Transaction): Transaction;
|
||||
export function closeHistory<S extends Schema = any>(tr: Transaction<S>): Transaction<S>;
|
||||
/**
|
||||
* Returns a plugin that enables the undo history for an editor. The
|
||||
* plugin will track undo and redo stacks, which can be used with the
|
||||
@@ -27,15 +25,21 @@ export function closeHistory(tr: Transaction): Transaction;
|
||||
* property](#state.Transaction.setMeta) of `false` on a transaction
|
||||
* to prevent it from being rolled back by undo.
|
||||
*/
|
||||
export function history(config?: { depth?: number | null, newGroupDelay?: number | null }): Plugin;
|
||||
export function history(config?: { depth?: number | null; newGroupDelay?: number | null }): Plugin;
|
||||
/**
|
||||
* A command function that undoes the last change, if any.
|
||||
*/
|
||||
export function undo(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function undo<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* A command function that redoes the last undone change, if any.
|
||||
*/
|
||||
export function redo(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function redo<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* The amount of undoable events available in a given state.
|
||||
*/
|
||||
|
||||
+31
-15
@@ -3,14 +3,11 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
|
||||
import { Node as ProsemirrorNode, NodeType } from 'prosemirror-model';
|
||||
import { Node as ProsemirrorNode, NodeType, Schema } from 'prosemirror-model';
|
||||
import { EditorState, Plugin, Transaction } from 'prosemirror-state';
|
||||
|
||||
/**
|
||||
@@ -19,7 +16,7 @@ import { EditorState, Plugin, Transaction } from 'prosemirror-state';
|
||||
* changing two dashes into an emdash, wrapping a paragraph starting
|
||||
* with `"> "` into a blockquote, or something entirely different.
|
||||
*/
|
||||
export class InputRule {
|
||||
export class InputRule<S extends Schema = any> {
|
||||
/**
|
||||
* Create an input rule. The rule applies when the user typed
|
||||
* something and the text directly in front of the cursor matches
|
||||
@@ -36,19 +33,34 @@ export class InputRule {
|
||||
* return a [transaction](#state.Transaction) that describes the
|
||||
* rule's effect, or null to indicate the input was not handled.
|
||||
*/
|
||||
constructor(match: RegExp, handler: string | ((state: EditorState, match: string[], start: number, end: number) => Transaction | null | void));
|
||||
constructor(
|
||||
match: RegExp,
|
||||
handler:
|
||||
| string
|
||||
| ((
|
||||
state: EditorState<S>,
|
||||
match: string[],
|
||||
start: number,
|
||||
end: number
|
||||
) => Transaction<S> | null | void)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Create an input rules plugin. When enabled, it will cause text
|
||||
* input that matches any of the given rules to trigger the rule's
|
||||
* action.
|
||||
*/
|
||||
export function inputRules(config: { rules: InputRule[] }): Plugin;
|
||||
export function inputRules<S extends Schema = any>(config: {
|
||||
rules: Array<InputRule<S>>;
|
||||
}): Plugin<S>;
|
||||
/**
|
||||
* This is a command that will undo an input rule, if applying such a
|
||||
* rule was the last thing that the user did.
|
||||
*/
|
||||
export function undoInputRule(state: EditorState, dispatch?: (p: Transaction) => void): boolean;
|
||||
export function undoInputRule<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (p: Transaction<S>) => void
|
||||
): boolean;
|
||||
/**
|
||||
* Build an input rule for automatically wrapping a textblock when a
|
||||
* given string is typed. The `regexp` argument is
|
||||
@@ -66,12 +78,12 @@ export function undoInputRule(state: EditorState, dispatch?: (p: Transaction) =>
|
||||
* expression match and the node before the wrapped node, and can
|
||||
* return a boolean to indicate whether a join should happen.
|
||||
*/
|
||||
export function wrappingInputRule(
|
||||
export function wrappingInputRule<S extends Schema = any>(
|
||||
regexp: RegExp,
|
||||
nodeType: NodeType,
|
||||
nodeType: NodeType<S>,
|
||||
getAttrs?: { [key: string]: any } | ((p: string[]) => { [key: string]: any } | null | void),
|
||||
joinPredicate?: (p1: string[], p2: ProsemirrorNode) => boolean
|
||||
): InputRule;
|
||||
joinPredicate?: (p1: string[], p2: ProsemirrorNode<S>) => boolean
|
||||
): InputRule<S>;
|
||||
/**
|
||||
* Build an input rule that changes the type of a textblock when the
|
||||
* matched text is typed into it. You'll usually want to start your
|
||||
@@ -80,7 +92,11 @@ export function wrappingInputRule(
|
||||
* the new node's attributes, and works the same as in the
|
||||
* `wrappingInputRule` function.
|
||||
*/
|
||||
export function textblockTypeInputRule(regexp: RegExp, nodeType: NodeType, getAttrs?: { [key: string]: any } | ((p: string[]) => { [key: string]: any } | null | void)): InputRule;
|
||||
export function textblockTypeInputRule<S extends Schema = any>(
|
||||
regexp: RegExp,
|
||||
nodeType: NodeType<S>,
|
||||
getAttrs?: { [key: string]: any } | ((p: string[]) => { [key: string]: any } | null | void)
|
||||
): InputRule<S>;
|
||||
/**
|
||||
* Converts double dashes to an emdash.
|
||||
*/
|
||||
|
||||
Vendored
+5
-6
@@ -3,12 +3,9 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'prosemirror-state';
|
||||
import { EditorView } from 'prosemirror-view';
|
||||
@@ -50,4 +47,6 @@ export function keymap(bindings: { [key: string]: any }): Plugin;
|
||||
* [`keymap`](#keymap.keymap), return a [keydown
|
||||
* handler](#view.EditorProps.handleKeyDown) handles them.
|
||||
*/
|
||||
export function keydownHandler(bindings: { [key: string]: any }): (view: EditorView, event: Event) => boolean;
|
||||
export function keydownHandler(bindings: {
|
||||
[key: string]: any;
|
||||
}): (view: EditorView, event: Event) => boolean;
|
||||
|
||||
+32
-20
@@ -3,12 +3,9 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { MarkdownIt } from 'markdown-it';
|
||||
import { Node as ProsemirrorNode, Schema } from 'prosemirror-model';
|
||||
@@ -19,7 +16,7 @@ import { Node as ProsemirrorNode, Schema } from 'prosemirror-model';
|
||||
* tokenize a file, and then runs the custom rules it is given over
|
||||
* the tokens to create a ProseMirror document tree.
|
||||
*/
|
||||
export class MarkdownParser {
|
||||
export class MarkdownParser<S extends Schema = any> {
|
||||
/**
|
||||
* Create a parser with the given configuration. You can configure
|
||||
* the markdown-it parser to parse the dialect you want, and provide
|
||||
@@ -58,7 +55,7 @@ export class MarkdownParser {
|
||||
* **`ignore`**`: ?bool`
|
||||
* : When true, ignore content for the matched token.
|
||||
*/
|
||||
constructor(schema: Schema, tokenizer: MarkdownIt, tokens: { [key: string]: any });
|
||||
constructor(schema: S, tokenizer: MarkdownIt, tokens: { [key: string]: any });
|
||||
/**
|
||||
* The value of the `tokens` object used to construct
|
||||
* this parser. Can be useful to copy and modify to base other
|
||||
@@ -70,7 +67,7 @@ export class MarkdownParser {
|
||||
* and create a ProseMirror document as prescribed by this parser's
|
||||
* rules.
|
||||
*/
|
||||
parse(text: string): ProsemirrorNode;
|
||||
parse(text: string): ProsemirrorNode<S>;
|
||||
}
|
||||
/**
|
||||
* A parser parsing unextended [CommonMark](http://commonmark.org/),
|
||||
@@ -81,13 +78,23 @@ export let defaultMarkdownParser: MarkdownParser;
|
||||
* A specification for serializing a ProseMirror document as
|
||||
* Markdown/CommonMark text.
|
||||
*/
|
||||
export class MarkdownSerializer {
|
||||
constructor(nodes: { [name: string]: (state: MarkdownSerializerState, node: ProsemirrorNode, parent: ProsemirrorNode, index: number) => void }, marks: { [key: string]: any });
|
||||
export class MarkdownSerializer<S extends Schema = any> {
|
||||
constructor(
|
||||
nodes: {
|
||||
[name: string]: (
|
||||
state: MarkdownSerializerState<S>,
|
||||
node: ProsemirrorNode<S>,
|
||||
parent: ProsemirrorNode<S>,
|
||||
index: number
|
||||
) => void;
|
||||
},
|
||||
marks: { [key: string]: any }
|
||||
);
|
||||
/**
|
||||
* The node serializer
|
||||
* functions for this serializer.
|
||||
*/
|
||||
nodes: { [name: string]: (p1: MarkdownSerializerState, p2: ProsemirrorNode) => void };
|
||||
nodes: { [name: string]: (p1: MarkdownSerializerState<S>, p2: ProsemirrorNode<S>) => void };
|
||||
/**
|
||||
* The mark serializer info.
|
||||
*/
|
||||
@@ -96,7 +103,7 @@ export class MarkdownSerializer {
|
||||
* Serialize the content of the given node to
|
||||
* [CommonMark](http://commonmark.org/).
|
||||
*/
|
||||
serialize(content: ProsemirrorNode, options?: { [key: string]: any }): string;
|
||||
serialize(content: ProsemirrorNode<S>, options?: { [key: string]: any }): string;
|
||||
}
|
||||
/**
|
||||
* A serializer for the [basic schema](#schema).
|
||||
@@ -107,7 +114,7 @@ export let defaultMarkdownSerializer: MarkdownSerializer;
|
||||
* methods related to markdown serialization. Instances are passed to
|
||||
* node and mark serialization methods (see `toMarkdown`).
|
||||
*/
|
||||
export class MarkdownSerializerState {
|
||||
export class MarkdownSerializerState<S extends Schema = any> {
|
||||
/**
|
||||
* The options passed to the serializer.
|
||||
*/
|
||||
@@ -118,7 +125,12 @@ export class MarkdownSerializerState {
|
||||
* the end of the block, and `f` is a function that renders the
|
||||
* content of the block.
|
||||
*/
|
||||
wrapBlock(delim: string, firstDelim: string | undefined, node: ProsemirrorNode, f: () => void): void;
|
||||
wrapBlock(
|
||||
delim: string,
|
||||
firstDelim: string | undefined,
|
||||
node: ProsemirrorNode<S>,
|
||||
f: () => void
|
||||
): void;
|
||||
/**
|
||||
* Ensure the current content ends with a newline.
|
||||
*/
|
||||
@@ -132,7 +144,7 @@ export class MarkdownSerializerState {
|
||||
/**
|
||||
* Close the block for the given node.
|
||||
*/
|
||||
closeBlock(node: ProsemirrorNode): void;
|
||||
closeBlock(node: ProsemirrorNode<S>): void;
|
||||
/**
|
||||
* Add the given text to the document. When escape is not `false`,
|
||||
* it will be escaped.
|
||||
@@ -141,22 +153,22 @@ export class MarkdownSerializerState {
|
||||
/**
|
||||
* Render the given node as a block.
|
||||
*/
|
||||
render(node: ProsemirrorNode): void;
|
||||
render(node: ProsemirrorNode<S>): void;
|
||||
/**
|
||||
* Render the contents of `parent` as block nodes.
|
||||
*/
|
||||
renderContent(parent: ProsemirrorNode): void;
|
||||
renderContent(parent: ProsemirrorNode<S>): void;
|
||||
/**
|
||||
* Render the contents of `parent` as inline content.
|
||||
*/
|
||||
renderInline(parent: ProsemirrorNode): void;
|
||||
renderInline(parent: ProsemirrorNode<S>): void;
|
||||
/**
|
||||
* Render a node's content as a list. `delim` should be the extra
|
||||
* indentation added to all lines except the first in an item,
|
||||
* `firstDelim` is a function going from an item index to a
|
||||
* delimiter for the first line of the item.
|
||||
*/
|
||||
renderList(node: ProsemirrorNode, delim: string, firstDelim: (p: number) => string): void;
|
||||
renderList(node: ProsemirrorNode<S>, delim: string, firstDelim: (p: number) => string): void;
|
||||
/**
|
||||
* Escape the given string so that it can safely appear in Markdown
|
||||
* content. If `startOfLine` is true, also escape characters that
|
||||
@@ -172,5 +184,5 @@ export class MarkdownSerializerState {
|
||||
* leading or trailing property of the return object will be undefined
|
||||
* if there is no match.
|
||||
*/
|
||||
getEnclosingWhitespace(text: string): { leading?: string | null, trailing?: string | null };
|
||||
getEnclosingWhitespace(text: string): { leading?: string | null; trailing?: string | null };
|
||||
}
|
||||
|
||||
Vendored
+38
-29
@@ -3,14 +3,11 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
|
||||
import { NodeType } from 'prosemirror-model';
|
||||
import { NodeType, Schema } from 'prosemirror-model';
|
||||
import { EditorState, Plugin, Transaction } from 'prosemirror-state';
|
||||
import { EditorView } from 'prosemirror-view';
|
||||
|
||||
@@ -19,61 +16,61 @@ import { EditorView } from 'prosemirror-view';
|
||||
* display in your menu. Anything that conforms to this interface can
|
||||
* be put into a menu structure.
|
||||
*/
|
||||
export interface MenuElement {
|
||||
export interface MenuElement<S extends Schema = any> {
|
||||
/**
|
||||
* Render the element for display in the menu. Must return a DOM
|
||||
* element and a function that can be used to update the element to
|
||||
* a new state. The `update` function will return false if the
|
||||
* update hid the entire element.
|
||||
*/
|
||||
render(pm: EditorView): { dom: Node, update(p: EditorState): boolean };
|
||||
render(pm: EditorView<S>): { dom: Node; update(p: EditorState<S>): boolean };
|
||||
}
|
||||
/**
|
||||
* An icon or label that, when clicked, executes a command.
|
||||
*/
|
||||
export class MenuItem {
|
||||
constructor(spec: MenuItemSpec);
|
||||
export class MenuItem<S extends Schema = any> {
|
||||
constructor(spec: MenuItemSpec<S>);
|
||||
/**
|
||||
* The spec used to create the menu item.
|
||||
*/
|
||||
spec: MenuItemSpec;
|
||||
spec: MenuItemSpec<S>;
|
||||
/**
|
||||
* Renders the icon according to its [display
|
||||
* spec](#menu.MenuItemSpec.display), and adds an event handler which
|
||||
* executes the command when the representation is clicked.
|
||||
*/
|
||||
render(view: EditorView): { dom: Node, update(p: EditorState): boolean };
|
||||
render(view: EditorView<S>): { dom: Node; update(p: EditorState<S>): boolean };
|
||||
}
|
||||
/**
|
||||
* The configuration object passed to the `MenuItem` constructor.
|
||||
*/
|
||||
export interface MenuItemSpec {
|
||||
export interface MenuItemSpec<S extends Schema = any> {
|
||||
/**
|
||||
* The function to execute when the menu item is activated.
|
||||
*/
|
||||
run(p1: EditorState, p2: (p: Transaction) => void, p3: EditorView, p4: Event): void;
|
||||
run(p1: EditorState<S>, p2: (p: Transaction<S>) => void, p3: EditorView<S>, p4: Event): void;
|
||||
/**
|
||||
* Optional function that is used to determine whether the item is
|
||||
* appropriate at the moment. Deselected items will be hidden.
|
||||
*/
|
||||
select?: ((p: EditorState) => boolean) | null;
|
||||
select?: ((p: EditorState<S>) => boolean) | null;
|
||||
/**
|
||||
* Function that is used to determine if the item is enabled. If
|
||||
* given and returning false, the item will be given a disabled
|
||||
* styling.
|
||||
*/
|
||||
enable?: ((p: EditorState) => boolean) | null;
|
||||
enable?: ((p: EditorState<S>) => boolean) | null;
|
||||
/**
|
||||
* A predicate function to determine whether the item is 'active' (for
|
||||
* example, the item for toggling the strong mark might be active then
|
||||
* the cursor is in strong text).
|
||||
*/
|
||||
active?: ((p: EditorState) => boolean) | null;
|
||||
active?: ((p: EditorState<S>) => boolean) | null;
|
||||
/**
|
||||
* A function that renders the item. You must provide either this,
|
||||
* [`icon`](#menu.MenuItemSpec.icon), or [`label`](#MenuItemSpec.label).
|
||||
*/
|
||||
render?: ((p: EditorView) => Node) | null;
|
||||
render?: ((p: EditorView<S>) => Node) | null;
|
||||
/**
|
||||
* Describes an icon to show for this item. The object may specify
|
||||
* an SVG icon, in which case its `path` property should be an [SVG
|
||||
@@ -95,7 +92,7 @@ export interface MenuItemSpec {
|
||||
/**
|
||||
* Defines DOM title (mouseover) text for the item.
|
||||
*/
|
||||
title?: string | ((p: EditorState) => string) | null;
|
||||
title?: string | ((p: EditorState<S>) => string) | null;
|
||||
/**
|
||||
* Optionally adds a CSS class to the item's DOM representation.
|
||||
*/
|
||||
@@ -115,7 +112,7 @@ export interface MenuItemSpec {
|
||||
* A drop-down menu, displayed as a label with a downwards-pointing
|
||||
* triangle to the right of it.
|
||||
*/
|
||||
export class Dropdown {
|
||||
export class Dropdown<S extends Schema = any> {
|
||||
/**
|
||||
* Create a dropdown wrapping the elements. Options may include
|
||||
* the following properties:
|
||||
@@ -134,17 +131,17 @@ export class Dropdown {
|
||||
* **`css`**`: string`
|
||||
* : When given, adds an extra set of CSS styles to the menu control.
|
||||
*/
|
||||
constructor(content: MenuElement[], options?: { [key: string]: any });
|
||||
constructor(content: Array<MenuElement<S>>, options?: { [key: string]: any });
|
||||
/**
|
||||
* Render the dropdown menu and sub-items.
|
||||
*/
|
||||
render(view: EditorView): { dom: Node, update(p: EditorState): void };
|
||||
render(view: EditorView<S>): { dom: Node; update(p: EditorState<S>): void };
|
||||
}
|
||||
/**
|
||||
* Represents a submenu wrapping a group of elements that start
|
||||
* hidden and expand to the right when hovered over or tapped.
|
||||
*/
|
||||
export class DropdownSubmenu {
|
||||
export class DropdownSubmenu<S extends Schema = any> {
|
||||
/**
|
||||
* Creates a submenu for the given group of menu elements. The
|
||||
* following options are recognized:
|
||||
@@ -152,11 +149,11 @@ export class DropdownSubmenu {
|
||||
* **`label`**`: string`
|
||||
* : The label to show on the submenu.
|
||||
*/
|
||||
constructor(content: MenuElement[], options?: { [key: string]: any });
|
||||
constructor(content: Array<MenuElement<S>>, options?: { [key: string]: any });
|
||||
/**
|
||||
* Renders the submenu.
|
||||
*/
|
||||
render(view: EditorView): { dom: Node, update(p: EditorState): boolean };
|
||||
render(view: EditorView<S>): { dom: Node; update(p: EditorState<S>): boolean };
|
||||
}
|
||||
/**
|
||||
* Render the given, possibly nested, array of menu elements into a
|
||||
@@ -164,7 +161,10 @@ export class DropdownSubmenu {
|
||||
* superfluous separators appear when some of the groups turn out to
|
||||
* be empty).
|
||||
*/
|
||||
export function renderGrouped(view: EditorView, content: Array<MenuElement | MenuElement[]>): { dom?: DocumentFragment | null, update(p: EditorState): boolean };
|
||||
export function renderGrouped<S extends Schema = any>(
|
||||
view: EditorView<S>,
|
||||
content: Array<MenuElement<S> | Array<MenuElement<S>>>
|
||||
): { dom?: DocumentFragment | null; update(p: EditorState<S>): boolean };
|
||||
/**
|
||||
* A set of basic editor-related icons. Contains the properties
|
||||
* `join`, `lift`, `selectParentNode`, `undo`, `redo`, `strong`, `em`,
|
||||
@@ -199,16 +199,25 @@ export function redoItem(p: { [key: string]: any }): MenuItem;
|
||||
* `options`. `options.attrs` may be an object or a function, as in
|
||||
* `toggleMarkItem`.
|
||||
*/
|
||||
export function wrapItem(nodeType: NodeType, options: { [key: string]: any }): MenuItem;
|
||||
export function wrapItem<S extends Schema = any>(
|
||||
nodeType: NodeType<S>,
|
||||
options: { [key: string]: any }
|
||||
): MenuItem<S>;
|
||||
/**
|
||||
* Build a menu item for changing the type of the textblock around the
|
||||
* selection to the given type. Provides `run`, `active`, and `select`
|
||||
* properties. Others must be given in `options`. `options.attrs` may
|
||||
* be an object to provide the attributes for the textblock node.
|
||||
*/
|
||||
export function blockTypeItem(nodeType: NodeType, options: { [key: string]: any }): MenuItem;
|
||||
export function blockTypeItem<S extends Schema = any>(
|
||||
nodeType: NodeType<S>,
|
||||
options: { [key: string]: any }
|
||||
): MenuItem<S>;
|
||||
/**
|
||||
* A plugin that will place a menu bar above the editor. Note that
|
||||
* this involves wrapping the editor in an additional `<div>`.
|
||||
*/
|
||||
export function menuBar(options: { content: MenuElement[][], floating?: boolean | null }): Plugin;
|
||||
export function menuBar<S extends Schema = any>(options: {
|
||||
content: Array<Array<MenuElement<S>>>;
|
||||
floating?: boolean | null;
|
||||
}): Plugin<S>;
|
||||
|
||||
Vendored
+234
-148
File diff suppressed because it is too large
Load Diff
@@ -13,26 +13,28 @@ domOutputSpec = ['div', ['div', { class: 'foo' }]];
|
||||
domOutputSpec = ['div', ['div', { class: 'foo' }, 0]];
|
||||
|
||||
export const nodeSpec: model.NodeSpec = {
|
||||
attrs: {
|
||||
name: { default: '' },
|
||||
},
|
||||
parseDOM: [{
|
||||
tag: 'span[data-name]',
|
||||
getAttrs(dom) {
|
||||
if (dom instanceof HTMLElement) {
|
||||
return {
|
||||
name: dom.getAttribute('data-name')!
|
||||
attrs: {
|
||||
name: { default: '' }
|
||||
},
|
||||
parseDOM: [
|
||||
{
|
||||
tag: 'span[data-name]',
|
||||
getAttrs(dom) {
|
||||
if (dom instanceof HTMLElement) {
|
||||
return {
|
||||
name: dom.getAttribute('data-name')!
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
toDOM(node) {
|
||||
const { name } = node.attrs;
|
||||
const attrs = {
|
||||
'data-emoji-name': name
|
||||
};
|
||||
}
|
||||
return ['span', attrs, 0];
|
||||
}
|
||||
}],
|
||||
toDOM(node) {
|
||||
const { name } = node.attrs;
|
||||
const attrs = {
|
||||
'data-emoji-name': name,
|
||||
};
|
||||
return ['span', attrs, 0];
|
||||
}
|
||||
};
|
||||
|
||||
const node = new model.Node();
|
||||
|
||||
+18
-16
@@ -3,12 +3,9 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { MarkSpec, NodeSpec, Schema } from 'prosemirror-model';
|
||||
|
||||
@@ -16,20 +13,25 @@ import { MarkSpec, NodeSpec, Schema } from 'prosemirror-model';
|
||||
* [Specs](#model.NodeSpec) for the nodes defined in this schema.
|
||||
*/
|
||||
export let nodes: {
|
||||
doc: NodeSpec,
|
||||
paragraph: NodeSpec,
|
||||
blockquote: NodeSpec,
|
||||
horizontal_rule: NodeSpec,
|
||||
heading: NodeSpec,
|
||||
code_block: NodeSpec,
|
||||
text: NodeSpec,
|
||||
image: NodeSpec,
|
||||
hard_break: NodeSpec
|
||||
doc: NodeSpec;
|
||||
paragraph: NodeSpec;
|
||||
blockquote: NodeSpec;
|
||||
horizontal_rule: NodeSpec;
|
||||
heading: NodeSpec;
|
||||
code_block: NodeSpec;
|
||||
text: NodeSpec;
|
||||
image: NodeSpec;
|
||||
hard_break: NodeSpec;
|
||||
};
|
||||
/**
|
||||
* [Specs](#model.MarkSpec) for the marks in the schema.
|
||||
*/
|
||||
export let marks: { link: MarkSpec, em: MarkSpec, strong: MarkSpec, code: MarkSpec };
|
||||
export let marks: {
|
||||
link: MarkSpec;
|
||||
em: MarkSpec;
|
||||
strong: MarkSpec;
|
||||
code: MarkSpec;
|
||||
};
|
||||
/**
|
||||
* This schema rougly corresponds to the document schema used by
|
||||
* [CommonMark](http://commonmark.org/), minus the list elements,
|
||||
@@ -39,4 +41,4 @@ export let marks: { link: MarkSpec, em: MarkSpec, strong: MarkSpec, code: MarkSp
|
||||
* To reuse elements from this schema, extend or read from its
|
||||
* `spec.nodes` and `spec.marks` [properties](#model.Schema.spec).
|
||||
*/
|
||||
export let schema: Schema;
|
||||
export let schema: Schema<keyof typeof nodes, keyof typeof marks>;
|
||||
|
||||
+21
-11
@@ -3,15 +3,12 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import OrderedMap = require('orderedmap');
|
||||
import { NodeSpec, NodeType } from 'prosemirror-model';
|
||||
import { NodeSpec, NodeType, Schema } from 'prosemirror-model';
|
||||
import { EditorState, Transaction } from 'prosemirror-state';
|
||||
|
||||
/**
|
||||
@@ -43,26 +40,39 @@ export let listItem: NodeSpec;
|
||||
* given to assign a group name to the list node types, for example
|
||||
* `"block"`.
|
||||
*/
|
||||
export function addListNodes(nodes: OrderedMap<NodeSpec>, itemContent: string, listGroup?: string): OrderedMap<NodeSpec>;
|
||||
export function addListNodes(
|
||||
nodes: OrderedMap<NodeSpec>,
|
||||
itemContent: string,
|
||||
listGroup?: string
|
||||
): OrderedMap<NodeSpec>;
|
||||
/**
|
||||
* Returns a command function that wraps the selection in a list with
|
||||
* the given type an attributes. If `dispatch` is null, only return a
|
||||
* value to indicate whether this is possible, but don't actually
|
||||
* perform the change.
|
||||
*/
|
||||
export function wrapInList(listType: NodeType, attrs?: { [key: string]: any }): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
||||
export function wrapInList<S extends Schema = any>(
|
||||
listType: NodeType<S>,
|
||||
attrs?: { [key: string]: any }
|
||||
): (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void) => boolean;
|
||||
/**
|
||||
* Build a command that splits a non-empty textblock at the top level
|
||||
* of a list item by also splitting that list item.
|
||||
*/
|
||||
export function splitListItem(itemType: NodeType): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
||||
export function splitListItem<S extends Schema = any>(
|
||||
itemType: NodeType<S>
|
||||
): (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void) => boolean;
|
||||
/**
|
||||
* Create a command to lift the list item around the selection up into
|
||||
* a wrapping list.
|
||||
*/
|
||||
export function liftListItem(itemType: NodeType): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
||||
export function liftListItem<S extends Schema = any>(
|
||||
itemType: NodeType<S>
|
||||
): (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void) => boolean;
|
||||
/**
|
||||
* Create a command to sink the list item around the selection down
|
||||
* into an inner list.
|
||||
*/
|
||||
export function sinkListItem(itemType: NodeType): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
||||
export function sinkListItem<S extends Schema = any>(
|
||||
itemType: NodeType<S>
|
||||
): (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void) => boolean;
|
||||
|
||||
Vendored
+117
-73
@@ -1,16 +1,20 @@
|
||||
// Type definitions for prosemirror-state 1.0
|
||||
// Type definitions for prosemirror-state 1.1
|
||||
// Project: https://github.com/ProseMirror/prosemirror-state
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
|
||||
import { Mark, MarkType, Node as ProsemirrorNode, ResolvedPos, Schema, Slice } from 'prosemirror-model';
|
||||
import {
|
||||
Mark,
|
||||
MarkType,
|
||||
Node as ProsemirrorNode,
|
||||
ResolvedPos,
|
||||
Schema,
|
||||
Slice
|
||||
} from 'prosemirror-model';
|
||||
import { Mappable, Mapping, Transform } from 'prosemirror-transform';
|
||||
import { EditorProps, EditorView } from 'prosemirror-view';
|
||||
|
||||
@@ -18,13 +22,13 @@ import { EditorProps, EditorView } from 'prosemirror-view';
|
||||
* This is the type passed to the [`Plugin`](#state.Plugin)
|
||||
* constructor. It provides a definition for a plugin.
|
||||
*/
|
||||
export interface PluginSpec {
|
||||
export interface PluginSpec<S extends Schema = any> {
|
||||
/**
|
||||
* The [view props](#view.EditorProps) added by this plugin. Props
|
||||
* that are functions will be bound to have the plugin instance as
|
||||
* their `this` binding.
|
||||
*/
|
||||
props?: EditorProps | null;
|
||||
props?: EditorProps<S> | null;
|
||||
/**
|
||||
* Allows a plugin to define a [state field](#state.StateField), an
|
||||
* extra slot in the state object in which it can keep its own data.
|
||||
@@ -36,20 +40,27 @@ export interface PluginSpec {
|
||||
* access the plugin's configuration and state through the key,
|
||||
* without having access to the plugin instance object.
|
||||
*/
|
||||
key?: PluginKey | null;
|
||||
key?: PluginKey<S> | null;
|
||||
/**
|
||||
* When the plugin needs to interact with the editor view, or
|
||||
* set something up in the DOM, use this field. The function
|
||||
* will be called when the plugin's state is associated with an
|
||||
* editor view.
|
||||
*/
|
||||
view?: ((p: EditorView) => { update?: ((view: EditorView, prevState: EditorState) => void) | null, destroy?: (() => void) | null }) | null;
|
||||
view?:
|
||||
| ((
|
||||
p: EditorView<S>
|
||||
) => {
|
||||
update?: ((view: EditorView<S>, prevState: EditorState<S>) => void) | null;
|
||||
destroy?: (() => void) | null;
|
||||
})
|
||||
| null;
|
||||
/**
|
||||
* When present, this will be called before a transaction is
|
||||
* applied by the state, allowing the plugin to cancel it (by
|
||||
* returning false).
|
||||
*/
|
||||
filterTransaction?: ((p1: Transaction, p2: EditorState) => boolean) | null;
|
||||
filterTransaction?: ((p1: Transaction, p2: EditorState<S>) => boolean) | null;
|
||||
/**
|
||||
* Allows the plugin to append another transaction to be applied
|
||||
* after the given array of transactions. When another plugin
|
||||
@@ -58,22 +69,28 @@ export interface PluginSpec {
|
||||
* transactions, i.e. it won't be passed transactions that it
|
||||
* already saw.
|
||||
*/
|
||||
appendTransaction?: ((transactions: Transaction[], oldState: EditorState, newState: EditorState) => Transaction | null | void) | null;
|
||||
appendTransaction?:
|
||||
| ((
|
||||
transactions: Transaction[],
|
||||
oldState: EditorState<S>,
|
||||
newState: EditorState<S>
|
||||
) => Transaction | null | void)
|
||||
| null;
|
||||
}
|
||||
/**
|
||||
* Plugins bundle functionality that can be added to an editor.
|
||||
* They are part of the [editor state](#state.EditorState) and
|
||||
* may influence that state and the view that contains it.
|
||||
*/
|
||||
export class Plugin {
|
||||
export class Plugin<S extends Schema = any> {
|
||||
/**
|
||||
* Create a plugin.
|
||||
*/
|
||||
constructor(spec: PluginSpec);
|
||||
constructor(spec: PluginSpec<S>);
|
||||
/**
|
||||
* The [props](#view.EditorProps) exported by this plugin.
|
||||
*/
|
||||
props: EditorProps;
|
||||
props: EditorProps<S>;
|
||||
/**
|
||||
* The plugin's [spec object](#state.PluginSpec).
|
||||
*/
|
||||
@@ -81,7 +98,7 @@ export class Plugin {
|
||||
/**
|
||||
* Extract the plugin's state field from an editor state.
|
||||
*/
|
||||
getState(state: EditorState): any;
|
||||
getState(state: EditorState<S>): any;
|
||||
}
|
||||
/**
|
||||
* A plugin spec may provide a state field (under its
|
||||
@@ -89,21 +106,21 @@ export class Plugin {
|
||||
* describes the state it wants to keep. Functions provided here are
|
||||
* always called with the plugin instance as their `this` binding.
|
||||
*/
|
||||
export interface StateField<T> {
|
||||
export interface StateField<T, S extends Schema = Schema> {
|
||||
/**
|
||||
* Initialize the value of the field. `config` will be the object
|
||||
* passed to [`EditorState.create`](#state.EditorState^create). Note
|
||||
* that `instance` is a half-initialized state instance, and will
|
||||
* not have values for plugin fields initialized after this one.
|
||||
*/
|
||||
init(config: { [key: string]: any }, instance: EditorState): T;
|
||||
init(config: { [key: string]: any }, instance: EditorState<S>): T;
|
||||
/**
|
||||
* Apply the given transaction to this state field, producing a new
|
||||
* field value. Note that the `newState` argument is again a partially
|
||||
* constructed state does not yet contain the state from plugins
|
||||
* coming after this one.
|
||||
*/
|
||||
apply(tr: Transaction, value: T, oldState: EditorState, newState: EditorState): T;
|
||||
apply(tr: Transaction, value: T, oldState: EditorState<S>, newState: EditorState<S>): T;
|
||||
/**
|
||||
* Convert this field to JSON. Optional, can be left off to disable
|
||||
* JSON serialization for the field.
|
||||
@@ -113,7 +130,7 @@ export interface StateField<T> {
|
||||
* Deserialize the JSON representation of this field. Note that the
|
||||
* `state` argument is again a half-initialized state.
|
||||
*/
|
||||
fromJSON?: ((config: { [key: string]: any }, value: any, state: EditorState) => T) | null;
|
||||
fromJSON?: ((config: { [key: string]: any }, value: any, state: EditorState<S>) => T) | null;
|
||||
}
|
||||
/**
|
||||
* A key is used to [tag](#state.PluginSpec.key)
|
||||
@@ -121,7 +138,7 @@ export interface StateField<T> {
|
||||
* editor state. Assigning a key does mean only one plugin of that
|
||||
* type can be active in a state.
|
||||
*/
|
||||
export class PluginKey {
|
||||
export class PluginKey<S extends Schema = any> {
|
||||
/**
|
||||
* Create a plugin key.
|
||||
*/
|
||||
@@ -130,37 +147,37 @@ export class PluginKey {
|
||||
* Get the active plugin with this key, if any, from an editor
|
||||
* state.
|
||||
*/
|
||||
get(state: EditorState): Plugin | null | void;
|
||||
get(state: EditorState<S>): Plugin<S> | null | void;
|
||||
/**
|
||||
* Get the plugin's state from an editor state.
|
||||
*/
|
||||
getState(state: EditorState): any | null | void;
|
||||
getState(state: EditorState<S>): any | null | void;
|
||||
}
|
||||
/**
|
||||
* Superclass for editor selections. Every selection type should
|
||||
* extend this. Should not be instantiated directly.
|
||||
*/
|
||||
export class Selection {
|
||||
export class Selection<S extends Schema = any> {
|
||||
/**
|
||||
* Initialize a selection with the head and anchor and ranges. If no
|
||||
* ranges are given, constructs a single range across `$anchor` and
|
||||
* `$head`.
|
||||
*/
|
||||
constructor($anchor: ResolvedPos, $head: ResolvedPos, ranges?: SelectionRange[]);
|
||||
constructor($anchor: ResolvedPos<S>, $head: ResolvedPos<S>, ranges?: Array<SelectionRange<S>>);
|
||||
/**
|
||||
* The ranges covered by the selection.
|
||||
*/
|
||||
ranges: SelectionRange[];
|
||||
ranges: Array<SelectionRange<S>>;
|
||||
/**
|
||||
* The resolved anchor of the selection (the side that stays in
|
||||
* place when the selection is modified).
|
||||
*/
|
||||
$anchor: ResolvedPos;
|
||||
$anchor: ResolvedPos<S>;
|
||||
/**
|
||||
* The resolved head of the selection (the side that moves when
|
||||
* the selection is modified).
|
||||
*/
|
||||
$head: ResolvedPos;
|
||||
$head: ResolvedPos<S>;
|
||||
/**
|
||||
* The selection's anchor, as an unresolved position.
|
||||
*/
|
||||
@@ -180,11 +197,11 @@ export class Selection {
|
||||
/**
|
||||
* The resolved lower bound of the selection's main range.
|
||||
*/
|
||||
$from: ResolvedPos;
|
||||
$from: ResolvedPos<S>;
|
||||
/**
|
||||
* The resolved upper bound of the selection's main range.
|
||||
*/
|
||||
$to: ResolvedPos;
|
||||
$to: ResolvedPos<S>;
|
||||
/**
|
||||
* Indicates whether the selection contains any content.
|
||||
*/
|
||||
@@ -192,26 +209,26 @@ export class Selection {
|
||||
/**
|
||||
* Test whether the selection is the same as another selection.
|
||||
*/
|
||||
eq(p: Selection): boolean;
|
||||
eq(p: Selection<S>): boolean;
|
||||
/**
|
||||
* Map this selection through a [mappable](#transform.Mappable) thing. `doc`
|
||||
* should be the new document to which we are mapping.
|
||||
*/
|
||||
map(doc: ProsemirrorNode, mapping: Mappable): Selection;
|
||||
map(doc: ProsemirrorNode<S>, mapping: Mappable): Selection<S>;
|
||||
/**
|
||||
* Get the content of this selection as a slice.
|
||||
*/
|
||||
content(): Slice;
|
||||
content(): Slice<S>;
|
||||
/**
|
||||
* Replace the selection with a slice or, if no slice is given,
|
||||
* delete the selection. Will append to the given transaction.
|
||||
*/
|
||||
replace(tr: Transaction, content?: Slice): void;
|
||||
replace(tr: Transaction, content?: Slice<S>): void;
|
||||
/**
|
||||
* Replace the selection with the given node, appending the changes
|
||||
* to the given transaction.
|
||||
*/
|
||||
replaceWith(tr: Transaction, node: ProsemirrorNode): void;
|
||||
replaceWith(tr: Transaction, node: ProsemirrorNode<S>): void;
|
||||
/**
|
||||
* Convert the selection to a JSON representation. When implementing
|
||||
* this for a custom selection class, make sure to give the object a
|
||||
@@ -228,7 +245,7 @@ export class Selection {
|
||||
* this method just converts the selection to a text selection and
|
||||
* returns the bookmark for that.
|
||||
*/
|
||||
getBookmark(): SelectionBookmark;
|
||||
getBookmark(): SelectionBookmark<S>;
|
||||
/**
|
||||
* Controls whether, when a selection of this type is active in the
|
||||
* browser, the selected range should be visible to the user. Defaults
|
||||
@@ -242,30 +259,37 @@ export class Selection {
|
||||
* selections. Will return null when no valid selection position is
|
||||
* found.
|
||||
*/
|
||||
static findFrom($pos: ResolvedPos, dir: number, textOnly?: boolean): Selection | null | void;
|
||||
static findFrom<S extends Schema = any>(
|
||||
$pos: ResolvedPos<S>,
|
||||
dir: number,
|
||||
textOnly?: boolean
|
||||
): Selection<S> | null | void;
|
||||
/**
|
||||
* Find a valid cursor or leaf node selection near the given
|
||||
* position. Searches forward first by default, but if `bias` is
|
||||
* negative, it will search backwards first.
|
||||
*/
|
||||
static near($pos: ResolvedPos, bias?: number): Selection;
|
||||
static near<S extends Schema = any>($pos: ResolvedPos<S>, bias?: number): Selection<S>;
|
||||
/**
|
||||
* Find the cursor or leaf node selection closest to the start of
|
||||
* the given document. Will return an
|
||||
* [`AllSelection`](#state.AllSelection) if no valid position
|
||||
* exists.
|
||||
*/
|
||||
static atStart(doc: ProsemirrorNode): Selection;
|
||||
static atStart<S extends Schema = any>(doc: ProsemirrorNode<S>): Selection<S>;
|
||||
/**
|
||||
* Find the cursor or leaf node selection closest to the end of the
|
||||
* given document.
|
||||
*/
|
||||
static atEnd(doc: ProsemirrorNode): Selection;
|
||||
static atEnd<S extends Schema = any>(doc: ProsemirrorNode<S>): Selection<S>;
|
||||
/**
|
||||
* Deserialize the JSON representation of a selection. Must be
|
||||
* implemented for custom classes (as a static class method).
|
||||
*/
|
||||
static fromJSON(doc: ProsemirrorNode, json: { [key: string]: any }): Selection;
|
||||
static fromJSON<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
json: { [key: string]: any }
|
||||
): Selection<S>;
|
||||
/**
|
||||
* To be able to deserialize selections from JSON, custom selection
|
||||
* classes must register themselves with an ID string, so that they
|
||||
@@ -279,32 +303,32 @@ export class Selection {
|
||||
* You can define a custom bookmark type for a custom selection class
|
||||
* to make the history handle it well.
|
||||
*/
|
||||
export interface SelectionBookmark {
|
||||
export interface SelectionBookmark<S extends Schema = any> {
|
||||
/**
|
||||
* Map the bookmark through a set of changes.
|
||||
*/
|
||||
map(mapping: Mapping): SelectionBookmark;
|
||||
map(mapping: Mapping): SelectionBookmark<S>;
|
||||
/**
|
||||
* Resolve the bookmark to a real selection again. This may need to
|
||||
* do some error checking and may fall back to a default (usually
|
||||
* [`TextSelection.between`](#state.TextSelection^between)) if
|
||||
* mapping made the bookmark invalid.
|
||||
*/
|
||||
resolve(doc: ProsemirrorNode): Selection;
|
||||
resolve(doc: ProsemirrorNode<S>): Selection<S>;
|
||||
}
|
||||
/**
|
||||
* Represents a selected range in a document.
|
||||
*/
|
||||
export class SelectionRange {
|
||||
constructor($from: ResolvedPos, $to: ResolvedPos);
|
||||
export class SelectionRange<S extends Schema = any> {
|
||||
constructor($from: ResolvedPos<S>, $to: ResolvedPos<S>);
|
||||
/**
|
||||
* The lower bound of the range.
|
||||
*/
|
||||
$from: ResolvedPos;
|
||||
$from: ResolvedPos<S>;
|
||||
/**
|
||||
* The upper bound of the range.
|
||||
*/
|
||||
$to: ResolvedPos;
|
||||
$to: ResolvedPos<S>;
|
||||
}
|
||||
/**
|
||||
* A text selection represents a classical editor selection, with
|
||||
@@ -312,20 +336,24 @@ export class SelectionRange {
|
||||
* point into textblock nodes. It can be empty (a regular cursor
|
||||
* position).
|
||||
*/
|
||||
export class TextSelection extends Selection {
|
||||
export class TextSelection<S extends Schema = any> extends Selection<S> {
|
||||
/**
|
||||
* Construct a text selection between the given points.
|
||||
*/
|
||||
constructor($anchor: ResolvedPos, $head?: ResolvedPos);
|
||||
constructor($anchor: ResolvedPos<S>, $head?: ResolvedPos<S>);
|
||||
/**
|
||||
* Returns a resolved position if this is a cursor selection (an
|
||||
* empty text selection), and null otherwise.
|
||||
*/
|
||||
$cursor?: ResolvedPos | null;
|
||||
$cursor?: ResolvedPos<S> | null;
|
||||
/**
|
||||
* Create a text selection from non-resolved positions.
|
||||
*/
|
||||
static create(doc: ProsemirrorNode, anchor: number, head?: number): TextSelection;
|
||||
static create<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
anchor: number,
|
||||
head?: number
|
||||
): TextSelection<S>;
|
||||
/**
|
||||
* Return a text selection that spans the given positions or, if
|
||||
* they aren't text positions, find a text selection near them.
|
||||
@@ -334,7 +362,11 @@ export class TextSelection extends Selection {
|
||||
* [`Selection.near`](#state.Selection^near) when the document
|
||||
* doesn't contain a valid text position.
|
||||
*/
|
||||
static between($anchor: ResolvedPos, $head: ResolvedPos, bias?: number): Selection;
|
||||
static between<S extends Schema = any>(
|
||||
$anchor: ResolvedPos<S>,
|
||||
$head: ResolvedPos<S>,
|
||||
bias?: number
|
||||
): Selection<S>;
|
||||
}
|
||||
/**
|
||||
* A node selection is a selection that points at a single node.
|
||||
@@ -343,20 +375,23 @@ export class TextSelection extends Selection {
|
||||
* `to` point directly before and after the selected node, `anchor`
|
||||
* equals `from`, and `head` equals `to`..
|
||||
*/
|
||||
export class NodeSelection extends Selection {
|
||||
export class NodeSelection<S extends Schema = any> extends Selection<S> {
|
||||
/**
|
||||
* Create a node selection. Does not verify the validity of its
|
||||
* argument.
|
||||
*/
|
||||
constructor($pos: ResolvedPos);
|
||||
constructor($pos: ResolvedPos<S>);
|
||||
/**
|
||||
* The selected node.
|
||||
*/
|
||||
node: ProsemirrorNode;
|
||||
node: ProsemirrorNode<S>;
|
||||
/**
|
||||
* Create a node selection from non-resolved positions.
|
||||
*/
|
||||
static create(doc: ProsemirrorNode, from: number): NodeSelection;
|
||||
static create<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
from: number
|
||||
): NodeSelection<S>;
|
||||
/**
|
||||
* Determines whether the given node may be selected as a node
|
||||
* selection.
|
||||
@@ -369,11 +404,11 @@ export class NodeSelection extends Selection {
|
||||
* there are for example leaf block nodes at the start or end of the
|
||||
* document).
|
||||
*/
|
||||
export class AllSelection extends Selection {
|
||||
export class AllSelection<S extends Schema = any> extends Selection<S> {
|
||||
/**
|
||||
* Create an all-selection over the given document.
|
||||
*/
|
||||
constructor(doc: ProsemirrorNode);
|
||||
constructor(doc: ProsemirrorNode<S>);
|
||||
}
|
||||
/**
|
||||
* The state of a ProseMirror editor is represented by an object
|
||||
@@ -384,32 +419,32 @@ export class AllSelection extends Selection {
|
||||
* A state holds a number of built-in fields, and plugins can
|
||||
* [define](#state.PluginSpec.state) additional fields.
|
||||
*/
|
||||
export class EditorState {
|
||||
export class EditorState<S extends Schema = any> {
|
||||
/**
|
||||
* The current document.
|
||||
*/
|
||||
doc: ProsemirrorNode;
|
||||
doc: ProsemirrorNode<S>;
|
||||
/**
|
||||
* The selection.
|
||||
*/
|
||||
selection: Selection;
|
||||
selection: Selection<S>;
|
||||
/**
|
||||
* A set of marks to apply to the next input. Will be null when
|
||||
* no explicit marks have been set.
|
||||
*/
|
||||
storedMarks?: Mark[] | null;
|
||||
storedMarks?: Array<Mark<S>> | null;
|
||||
/**
|
||||
* The schema of the state's document.
|
||||
*/
|
||||
schema: Schema;
|
||||
schema: S;
|
||||
/**
|
||||
* The plugins that are active in this state.
|
||||
*/
|
||||
plugins: Plugin[];
|
||||
plugins: Array<Plugin<S>>;
|
||||
/**
|
||||
* Apply the given transaction to produce a new state.
|
||||
*/
|
||||
apply(tr: Transaction): EditorState;
|
||||
apply(tr: Transaction): EditorState<S>;
|
||||
/**
|
||||
* Verbose variant of [`apply`](#state.EditorState.apply) that
|
||||
* returns the precise transactions that were applied (which might
|
||||
@@ -417,7 +452,7 @@ export class EditorState {
|
||||
* hooks](#state.PluginSpec.filterTransaction) of
|
||||
* plugins) along with the new state.
|
||||
*/
|
||||
applyTransaction(tr: Transaction): { state: EditorState, transactions: Transaction[] };
|
||||
applyTransaction(tr: Transaction): { state: EditorState<S>; transactions: Transaction[] };
|
||||
/**
|
||||
* Start a [transaction](#state.Transaction) from this state.
|
||||
*/
|
||||
@@ -430,17 +465,22 @@ export class EditorState {
|
||||
* [`init`](#state.StateField.init) method, passing in the new
|
||||
* configuration object..
|
||||
*/
|
||||
reconfigure(config: { schema?: Schema | null, plugins?: Plugin[] | null }): EditorState;
|
||||
reconfigure(config: { schema?: S | null; plugins?: Array<Plugin<S>> | null }): EditorState<S>;
|
||||
/**
|
||||
* Serialize this state to JSON. If you want to serialize the state
|
||||
* of plugins, pass an object mapping property names to use in the
|
||||
* resulting JSON object to plugin objects.
|
||||
*/
|
||||
toJSON(pluginFields?: { [name: string]: Plugin }): { [key: string]: any };
|
||||
toJSON(pluginFields?: { [name: string]: Plugin<S> } | string | number): { [key: string]: any };
|
||||
/**
|
||||
* Create a new state.
|
||||
*/
|
||||
static create(config: { schema?: Schema | null, doc?: ProsemirrorNode | null, selection?: Selection | null, plugins?: Plugin[] | null }): EditorState;
|
||||
static create<S extends Schema = any>(config: {
|
||||
schema?: S | null;
|
||||
doc?: ProsemirrorNode<S> | null;
|
||||
selection?: Selection<S> | null;
|
||||
plugins?: Array<Plugin<S>> | null;
|
||||
}): EditorState<S>;
|
||||
/**
|
||||
* Deserialize a JSON representation of a state. `config` should
|
||||
* have at least a `schema` field, and should contain array of
|
||||
@@ -448,7 +488,11 @@ export class EditorState {
|
||||
* to deserialize the state of plugins, by associating plugin
|
||||
* instances with the property names they use in the JSON object.
|
||||
*/
|
||||
static fromJSON(config: { schema: Schema, plugins?: Plugin[] | null }, json: { [key: string]: any }, pluginFields?: { [name: string]: Plugin }): EditorState;
|
||||
static fromJSON<S extends Schema = any>(
|
||||
config: { schema: S; plugins?: Array<Plugin<S>> | null },
|
||||
json: { [key: string]: any },
|
||||
pluginFields?: { [name: string]: Plugin<S> }
|
||||
): EditorState<S>;
|
||||
}
|
||||
/**
|
||||
* An editor state transaction, which can be applied to a state to
|
||||
@@ -469,7 +513,7 @@ export class EditorState {
|
||||
* selection transactions directly caused by mouse or touch input, and
|
||||
* a `"paste"` property of true to transactions caused by a paste..
|
||||
*/
|
||||
export class Transaction extends Transform {
|
||||
export class Transaction<S extends Schema = any> extends Transform<S> {
|
||||
/**
|
||||
* The timestamp associated with this transaction, in the same
|
||||
* format as `Date.now()`.
|
||||
|
||||
Vendored
+120
-42
@@ -2,10 +2,12 @@
|
||||
// Project: https://github.com/ProseMirror/prosemirror-tables
|
||||
// Definitions by: Oscar Wallhult <https://github.com/superchu>
|
||||
// Eduard Shvedai <https://github.com/eshvedai>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { EditorState, Plugin, SelectionRange, Transaction, PluginKey } from 'prosemirror-state';
|
||||
import { Node as ProsemirrorNode, NodeSpec, Slice, ResolvedPos } from 'prosemirror-model';
|
||||
import { Node as ProsemirrorNode, NodeSpec, Slice, ResolvedPos, Schema } from 'prosemirror-model';
|
||||
import { NodeView } from 'prosemirror-view';
|
||||
|
||||
export interface TableNodesOptions {
|
||||
@@ -38,37 +40,50 @@ export interface CellSelectionJSON {
|
||||
head: number;
|
||||
}
|
||||
|
||||
export class CellSelection {
|
||||
constructor($anchorCell: ResolvedPos, $headCell?: ResolvedPos);
|
||||
export class CellSelection<S extends Schema = any> {
|
||||
constructor($anchorCell: ResolvedPos<S>, $headCell?: ResolvedPos<S>);
|
||||
|
||||
from: number;
|
||||
to: number;
|
||||
$from: ResolvedPos;
|
||||
$to: ResolvedPos;
|
||||
$from: ResolvedPos<S>;
|
||||
$to: ResolvedPos<S>;
|
||||
anchor: number;
|
||||
head: number;
|
||||
$anchor: ResolvedPos;
|
||||
$head: ResolvedPos;
|
||||
$anchorCell: ResolvedPos;
|
||||
$headCell: ResolvedPos;
|
||||
$anchor: ResolvedPos<S>;
|
||||
$head: ResolvedPos<S>;
|
||||
$anchorCell: ResolvedPos<S>;
|
||||
$headCell: ResolvedPos<S>;
|
||||
empty: boolean;
|
||||
ranges: SelectionRange[];
|
||||
ranges: Array<SelectionRange<S>>;
|
||||
|
||||
map(doc: ProsemirrorNode, mapping: any): any;
|
||||
content(): Slice;
|
||||
replace(tr: Transaction, content: Slice): void;
|
||||
replaceWith(tr: Transaction, node: ProsemirrorNode): void;
|
||||
forEachCell(f: (node: ProsemirrorNode, pos: number) => void): void;
|
||||
map(doc: ProsemirrorNode<S>, mapping: any): any;
|
||||
content(): Slice<S>;
|
||||
replace(tr: Transaction<S>, content: Slice<S>): void;
|
||||
replaceWith(tr: Transaction<S>, node: ProsemirrorNode<S>): void;
|
||||
forEachCell(f: (node: ProsemirrorNode<S>, pos: number) => void): void;
|
||||
isRowSelection(): boolean;
|
||||
isColSelection(): boolean;
|
||||
eq(other: any): boolean;
|
||||
toJSON(): CellSelectionJSON;
|
||||
getBookmark(): {anchor: number, head: number};
|
||||
getBookmark(): { anchor: number; head: number };
|
||||
|
||||
static colSelection(anchorCell: ResolvedPos, headCell?: ResolvedPos): CellSelection;
|
||||
static rowSelection(anchorCell: ResolvedPos, headCell?: ResolvedPos): CellSelection;
|
||||
static create(doc: ProsemirrorNode, anchorCell: number, headCell?: number): CellSelection;
|
||||
static fromJSON(doc: ProsemirrorNode, json: CellSelectionJSON): CellSelection;
|
||||
static colSelection<S extends Schema = any>(
|
||||
anchorCell: ResolvedPos<S>,
|
||||
headCell?: ResolvedPos<S>
|
||||
): CellSelection<S>;
|
||||
static rowSelection<S extends Schema = any>(
|
||||
anchorCell: ResolvedPos<S>,
|
||||
headCell?: ResolvedPos<S>
|
||||
): CellSelection<S>;
|
||||
static create<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
anchorCell: number,
|
||||
headCell?: number
|
||||
): CellSelection<S>;
|
||||
static fromJSON<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
json: CellSelectionJSON
|
||||
): CellSelection<S>;
|
||||
}
|
||||
|
||||
export interface Rect {
|
||||
@@ -96,52 +111,115 @@ export class TableMap {
|
||||
|
||||
export function tableEditing(): Plugin;
|
||||
|
||||
export function deleteTable(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function deleteTable<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function goToNextCell(direction: number): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
||||
export function goToNextCell<S extends Schema = any>(
|
||||
direction: number
|
||||
): (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void) => boolean;
|
||||
|
||||
export function toggleHeaderCell(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function toggleHeaderCell<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function toggleHeaderColumn(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function toggleHeaderColumn<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function toggleHeaderRow(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function toggleHeaderRow<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function setCellAttr(name: string, value: any): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
||||
export function setCellAttr<S extends Schema = any>(
|
||||
name: string,
|
||||
value: any
|
||||
): (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void) => boolean;
|
||||
|
||||
export function splitCell(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function splitCell<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function mergeCells(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function mergeCells<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function deleteRow(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function deleteRow<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function addRowAfter(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function addRowAfter<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function addRowBefore(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function addRowBefore<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function deleteColumn(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function deleteColumn<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function addColumnAfter(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function addColumnAfter<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function addColumnBefore(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
||||
export function addColumnBefore<S extends Schema = any>(
|
||||
state: EditorState<S>,
|
||||
dispatch?: (tr: Transaction<S>) => void
|
||||
): boolean;
|
||||
|
||||
export function columnResizing(props: { handleWidth?: number, cellMinWidth?: number, View?: NodeView }): Plugin;
|
||||
export function columnResizing<S extends Schema = any>(props: {
|
||||
handleWidth?: number;
|
||||
cellMinWidth?: number;
|
||||
View?: NodeView<S>;
|
||||
}): Plugin<S>;
|
||||
|
||||
export const columnResizingPluginKey: PluginKey;
|
||||
|
||||
export function updateColumnsOnResize(node: ProsemirrorNode, colgroup: Element, table: Element, cellMinWidth: number, overrideCol?: number, overrideValue?: number): void;
|
||||
export function updateColumnsOnResize(
|
||||
node: ProsemirrorNode,
|
||||
colgroup: Element,
|
||||
table: Element,
|
||||
cellMinWidth: number,
|
||||
overrideCol?: number,
|
||||
overrideValue?: number
|
||||
): void;
|
||||
|
||||
export function cellAround(pos: ResolvedPos): ResolvedPos | null;
|
||||
export function cellAround<S extends Schema = any>(pos: ResolvedPos<S>): ResolvedPos<S> | null;
|
||||
|
||||
export function isInTable(state: EditorState): boolean;
|
||||
|
||||
export function selectionCell(state: EditorState): ResolvedPos | null | undefined;
|
||||
export function selectionCell<S extends Schema = any>(
|
||||
state: EditorState<S>
|
||||
): ResolvedPos<S> | null | undefined;
|
||||
|
||||
export function moveCellForward(pos: ResolvedPos): ResolvedPos;
|
||||
export function moveCellForward<S extends Schema = any>(pos: ResolvedPos<S>): ResolvedPos<S>;
|
||||
|
||||
export function inSameTable($a: ResolvedPos, $b: ResolvedPos): boolean;
|
||||
export function inSameTable<S extends Schema = any>(
|
||||
$a: ResolvedPos<S>,
|
||||
$b: ResolvedPos<S>
|
||||
): boolean;
|
||||
|
||||
export function findCell(pos: ResolvedPos): {top: number, left: number, right: number, buttom: number};
|
||||
export function findCell(
|
||||
pos: ResolvedPos
|
||||
): { top: number; left: number; right: number; buttom: number };
|
||||
|
||||
export function colCount(pos: ResolvedPos): number;
|
||||
|
||||
export function nextCell(pos: ResolvedPos, axis: string, dir: number): null | ResolvedPos;
|
||||
export function nextCell<S extends Schema = any>(
|
||||
pos: ResolvedPos<S>,
|
||||
axis: string,
|
||||
dir: number
|
||||
): null | ResolvedPos<S>;
|
||||
|
||||
+111
-49
@@ -3,14 +3,21 @@
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
|
||||
import { ContentMatch, Fragment, Mark, MarkType, Node as ProsemirrorNode, NodeRange, NodeType, Schema, Slice } from 'prosemirror-model';
|
||||
import {
|
||||
ContentMatch,
|
||||
Fragment,
|
||||
Mark,
|
||||
MarkType,
|
||||
Node as ProsemirrorNode,
|
||||
NodeRange,
|
||||
NodeType,
|
||||
Schema,
|
||||
Slice
|
||||
} from 'prosemirror-model';
|
||||
|
||||
/**
|
||||
* There are several things that positions can be mapped through.
|
||||
@@ -160,14 +167,14 @@ export class Mapping implements Mappable {
|
||||
/**
|
||||
* Add a mark to all inline content between two positions.
|
||||
*/
|
||||
export class AddMarkStep extends Step {
|
||||
constructor(from: number, to: number, mark: Mark);
|
||||
export class AddMarkStep<S extends Schema = any> extends Step<S> {
|
||||
constructor(from: number, to: number, mark: Mark<S>);
|
||||
}
|
||||
/**
|
||||
* Remove a mark from all inline content between two positions.
|
||||
*/
|
||||
export class RemoveMarkStep extends Step {
|
||||
constructor(from: number, to: number, mark: Mark);
|
||||
export class RemoveMarkStep<S extends Schema = any> extends Step<S> {
|
||||
constructor(from: number, to: number, mark: Mark<S>);
|
||||
}
|
||||
/**
|
||||
* Abstraction to build up and track an array of
|
||||
@@ -176,39 +183,43 @@ export class RemoveMarkStep extends Step {
|
||||
* Most transforming methods return the `Transform` object itself, so
|
||||
* that they can be chained.
|
||||
*/
|
||||
export class Transform {
|
||||
export class Transform<S extends Schema = any> {
|
||||
/**
|
||||
* Create a transform that starts with the given document.
|
||||
*/
|
||||
constructor(doc: ProsemirrorNode);
|
||||
constructor(doc: ProsemirrorNode<S>);
|
||||
/**
|
||||
* Add the given mark to the inline content between `from` and `to`.
|
||||
*/
|
||||
addMark(from: number, to: number, mark: Mark): this;
|
||||
addMark(from: number, to: number, mark: Mark<S>): this;
|
||||
/**
|
||||
* Remove marks from inline nodes between `from` and `to`. When `mark`
|
||||
* is a single mark, remove precisely that mark. When it is a mark type,
|
||||
* remove all marks of that type. When it is null, remove all marks of
|
||||
* any type.
|
||||
*/
|
||||
removeMark(from: number, to: number, mark?: Mark | MarkType): this;
|
||||
removeMark(from: number, to: number, mark?: Mark<S> | MarkType<S>): this;
|
||||
/**
|
||||
* Removes all marks and nodes from the content of the node at `pos`
|
||||
* that don't match the given new parent node type. Accepts an
|
||||
* optional starting [content match](#model.ContentMatch) as third
|
||||
* argument.
|
||||
*/
|
||||
clearIncompatible(pos: number, parentType: NodeType, match?: ContentMatch): this;
|
||||
clearIncompatible(pos: number, parentType: NodeType<S>, match?: ContentMatch<S>): this;
|
||||
/**
|
||||
* Replace the part of the document between `from` and `to` with the
|
||||
* given `slice`.
|
||||
*/
|
||||
replace(from: number, to?: number, slice?: Slice): this;
|
||||
replace(from: number, to?: number, slice?: Slice<S>): this;
|
||||
/**
|
||||
* Replace the given range with the given content, which may be a
|
||||
* fragment, node, or array of nodes.
|
||||
*/
|
||||
replaceWith(from: number, to: number, content: Fragment | ProsemirrorNode | ProsemirrorNode[]): this;
|
||||
replaceWith(
|
||||
from: number,
|
||||
to: number,
|
||||
content: Fragment<S> | ProsemirrorNode<S> | Array<ProsemirrorNode<S>>
|
||||
): this;
|
||||
/**
|
||||
* Delete the content between the given positions.
|
||||
*/
|
||||
@@ -216,7 +227,10 @@ export class Transform {
|
||||
/**
|
||||
* Insert the given content at the given position.
|
||||
*/
|
||||
insert(pos: number, content: Fragment | ProsemirrorNode | ProsemirrorNode[]): this;
|
||||
insert(
|
||||
pos: number,
|
||||
content: Fragment<S> | ProsemirrorNode<S> | Array<ProsemirrorNode<S>>
|
||||
): this;
|
||||
/**
|
||||
* Replace a range of the document with a given slice, using `from`,
|
||||
* `to`, and the slice's [`openStart`](#model.Slice.openStart) property
|
||||
@@ -234,7 +248,7 @@ export class Transform {
|
||||
* range, and is useful in situations where you need more precise
|
||||
* control over what happens.
|
||||
*/
|
||||
replaceRange(from: number, to: number, slice: Slice): this;
|
||||
replaceRange(from: number, to: number, slice: Slice<S>): this;
|
||||
/**
|
||||
* Replace the given range with a node, but use `from` and `to` as
|
||||
* hints, rather than precise positions. When from and to are the same
|
||||
@@ -244,7 +258,7 @@ export class Transform {
|
||||
* completely covers a parent node, this method may completely replace
|
||||
* that parent node.
|
||||
*/
|
||||
replaceRangeWith(from: number, to: number, node: ProsemirrorNode): this;
|
||||
replaceRangeWith(from: number, to: number, node: ProsemirrorNode<S>): this;
|
||||
/**
|
||||
* Delete the given range, expanding it to cover fully covered
|
||||
* parent nodes until a valid replace is found.
|
||||
@@ -257,23 +271,36 @@ export class Transform {
|
||||
* [`liftTarget`](#transform.liftTarget) to compute `target`, to make
|
||||
* sure the lift is valid.
|
||||
*/
|
||||
lift(range: NodeRange, target: number): this;
|
||||
lift(range: NodeRange<S>, target: number): this;
|
||||
/**
|
||||
* Wrap the given [range](#model.NodeRange) in the given set of wrappers.
|
||||
* The wrappers are assumed to be valid in this position, and should
|
||||
* probably be computed with [`findWrapping`](#transform.findWrapping).
|
||||
*/
|
||||
wrap(range: NodeRange, wrappers: Array<{ type: NodeType, attrs?: { [key: string]: any } | null }>): this;
|
||||
wrap(
|
||||
range: NodeRange<S>,
|
||||
wrappers: Array<{ type: NodeType<S>; attrs?: { [key: string]: any } | null }>
|
||||
): this;
|
||||
/**
|
||||
* Set the type of all textblocks (partly) between `from` and `to` to
|
||||
* the given node type with the given attributes.
|
||||
*/
|
||||
setBlockType(from: number, to: number | undefined, type: NodeType, attrs?: { [key: string]: any }): this;
|
||||
setBlockType(
|
||||
from: number,
|
||||
to: number | undefined,
|
||||
type: NodeType<S>,
|
||||
attrs?: { [key: string]: any }
|
||||
): this;
|
||||
/**
|
||||
* Change the type, attributes, and/or marks of the node at `pos`.
|
||||
* When `nodeType` is null, the existing node type is preserved,
|
||||
*/
|
||||
setNodeMarkup(pos: number, type?: NodeType, attrs?: { [key: string]: any }, marks?: Mark[]): this;
|
||||
setNodeMarkup(
|
||||
pos: number,
|
||||
type?: NodeType<S>,
|
||||
attrs?: { [key: string]: any },
|
||||
marks?: Array<Mark<S>>
|
||||
): this;
|
||||
/**
|
||||
* Split the node at the given position, and optionally, if `depth` is
|
||||
* greater than one, any number of nodes above that. By default, the
|
||||
@@ -281,7 +308,11 @@ export class Transform {
|
||||
* This can be changed by passing an array of types and attributes to
|
||||
* use after the split.
|
||||
*/
|
||||
split(pos: number, depth?: number, typesAfter?: Array<{ type: NodeType, attrs?: { [key: string]: any } | null }>): this;
|
||||
split(
|
||||
pos: number,
|
||||
depth?: number,
|
||||
typesAfter?: Array<{ type: NodeType<S>; attrs?: { [key: string]: any } | null }>
|
||||
): this;
|
||||
/**
|
||||
* Join the blocks around the given position. If depth is 2, their
|
||||
* last and first siblings are also joined, and so on.
|
||||
@@ -291,15 +322,15 @@ export class Transform {
|
||||
* The current document (the result of applying the steps in the
|
||||
* transform).
|
||||
*/
|
||||
doc: ProsemirrorNode;
|
||||
doc: ProsemirrorNode<S>;
|
||||
/**
|
||||
* The steps in this transform.
|
||||
*/
|
||||
steps: Step[];
|
||||
steps: Array<Step<S>>;
|
||||
/**
|
||||
* The documents before each of the steps.
|
||||
*/
|
||||
docs: ProsemirrorNode[];
|
||||
docs: Array<ProsemirrorNode<S>>;
|
||||
/**
|
||||
* A mapping with the maps for each of the steps in this transform.
|
||||
*/
|
||||
@@ -307,17 +338,17 @@ export class Transform {
|
||||
/**
|
||||
* The starting document.
|
||||
*/
|
||||
before: ProsemirrorNode;
|
||||
before: ProsemirrorNode<S>;
|
||||
/**
|
||||
* Apply a new step in this transform, saving the result. Throws an
|
||||
* error when the step fails.
|
||||
*/
|
||||
step(step: Step): this;
|
||||
step(step: Step<S>): this;
|
||||
/**
|
||||
* Try to apply a step in this transformation, ignoring it if it
|
||||
* fails. Returns the step result.
|
||||
*/
|
||||
maybeStep(step: Step): StepResult;
|
||||
maybeStep(step: Step<S>): StepResult<S>;
|
||||
/**
|
||||
* True when the document has been changed (when there are any
|
||||
* steps).
|
||||
@@ -327,7 +358,7 @@ export class Transform {
|
||||
/**
|
||||
* Replace a part of the document with a slice of new content.
|
||||
*/
|
||||
export class ReplaceStep extends Step {
|
||||
export class ReplaceStep<S extends Schema = any> extends Step<S> {
|
||||
/**
|
||||
* The given `slice` should fit the 'gap' between `from` and
|
||||
* `to`—the depths must line up, and the surrounding nodes must be
|
||||
@@ -337,21 +368,29 @@ export class ReplaceStep extends Step {
|
||||
* tokens (this is to guard against rebased replace steps
|
||||
* overwriting something they weren't supposed to).
|
||||
*/
|
||||
constructor(from: number, to: number, slice: Slice, structure?: boolean);
|
||||
constructor(from: number, to: number, slice: Slice<S>, structure?: boolean);
|
||||
}
|
||||
/**
|
||||
* Replace a part of the document with a slice of content, but
|
||||
* preserve a range of the replaced content by moving it into the
|
||||
* slice.
|
||||
*/
|
||||
export class ReplaceAroundStep extends Step {
|
||||
export class ReplaceAroundStep<S extends Schema = any> extends Step<S> {
|
||||
/**
|
||||
* Create a replace-around step with the given range and gap.
|
||||
* `insert` should be the point in the slice into which the content
|
||||
* of the gap should be moved. `structure` has the same meaning as
|
||||
* it has in the [`ReplaceStep`](#transform.ReplaceStep) class.
|
||||
*/
|
||||
constructor(from: number, to: number, gapFrom: number, gapTo: number, slice: Slice, insert: number, structure?: boolean);
|
||||
constructor(
|
||||
from: number,
|
||||
to: number,
|
||||
gapFrom: number,
|
||||
gapTo: number,
|
||||
slice: Slice<S>,
|
||||
insert: number,
|
||||
structure?: boolean
|
||||
);
|
||||
}
|
||||
/**
|
||||
* ‘Fit’ a slice into a given position in the document, producing a
|
||||
@@ -359,7 +398,12 @@ export class ReplaceAroundStep extends Step {
|
||||
* there's no meaningful way to insert the slice here, or inserting it
|
||||
* would be a no-op (an empty slice over an empty range).
|
||||
*/
|
||||
export function replaceStep(doc: ProsemirrorNode, from: number, to?: number, slice?: Slice): Step | null | void;
|
||||
export function replaceStep<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
from: number,
|
||||
to?: number,
|
||||
slice?: Slice<S>
|
||||
): Step<S> | null | void;
|
||||
/**
|
||||
* A step object represents an atomic change. It generally applies
|
||||
* only to the document it was created for, since the positions
|
||||
@@ -371,14 +415,14 @@ export function replaceStep(doc: ProsemirrorNode, from: number, to?: number, sli
|
||||
* JSON-serialization identifier using
|
||||
* [`Step.jsonID`](#transform.Step^jsonID).
|
||||
*/
|
||||
export class Step {
|
||||
export class Step<S extends Schema = any> {
|
||||
/**
|
||||
* Applies this step to the given document, returning a result
|
||||
* object that either indicates failure, if the step can not be
|
||||
* applied to this document, or indicates success by containing a
|
||||
* transformed document.
|
||||
*/
|
||||
apply(doc: ProsemirrorNode): StepResult;
|
||||
apply(doc: ProsemirrorNode<S>): StepResult<S>;
|
||||
/**
|
||||
* Get the step map that represents the changes made by this step,
|
||||
* and which can be used to transform between positions in the old
|
||||
@@ -389,19 +433,19 @@ export class Step {
|
||||
* Create an inverted version of this step. Needs the document as it
|
||||
* was before the step as argument.
|
||||
*/
|
||||
invert(doc: ProsemirrorNode): Step;
|
||||
invert(doc: ProsemirrorNode<S>): Step<S>;
|
||||
/**
|
||||
* Map this step through a mappable thing, returning either a
|
||||
* version of that step with its positions adjusted, or `null` if
|
||||
* the step was entirely deleted by the mapping.
|
||||
*/
|
||||
map(mapping: Mappable): Step | null | void;
|
||||
map(mapping: Mappable): Step<S> | null | void;
|
||||
/**
|
||||
* Try to merge this step with another one, to be applied directly
|
||||
* after it. Returns the merged step when possible, null if the
|
||||
* steps can't be merged.
|
||||
*/
|
||||
merge(other: Step): Step | null | void;
|
||||
merge(other: Step<S>): Step<S> | null | void;
|
||||
/**
|
||||
* Create a JSON-serializeable representation of this step. When
|
||||
* defining this for a custom subclass, make sure the result object
|
||||
@@ -413,7 +457,7 @@ export class Step {
|
||||
* Deserialize a step from its JSON representation. Will call
|
||||
* through to the step class' own implementation of this method.
|
||||
*/
|
||||
static fromJSON(schema: Schema, json: { [key: string]: any }): Step;
|
||||
static fromJSON<S extends Schema = any>(schema: S, json: { [key: string]: any }): Step<S>;
|
||||
/**
|
||||
* To be able to serialize steps to JSON, each step needs a string
|
||||
* ID to attach to its JSON representation. Use this method to
|
||||
@@ -426,11 +470,11 @@ export class Step {
|
||||
* The result of [applying](#transform.Step.apply) a step. Contains either a
|
||||
* new document or a failure value.
|
||||
*/
|
||||
export class StepResult {
|
||||
export class StepResult<S extends Schema = any> {
|
||||
/**
|
||||
* The transformed document.
|
||||
*/
|
||||
doc?: ProsemirrorNode | null;
|
||||
doc?: ProsemirrorNode<S> | null;
|
||||
/**
|
||||
* Text providing information about a failed step.
|
||||
*/
|
||||
@@ -438,7 +482,7 @@ export class StepResult {
|
||||
/**
|
||||
* Create a successful step result.
|
||||
*/
|
||||
static ok(doc: ProsemirrorNode): StepResult;
|
||||
static ok<S extends Schema = any>(doc: ProsemirrorNode<S>): StepResult<S>;
|
||||
/**
|
||||
* Create a failed step result.
|
||||
*/
|
||||
@@ -448,7 +492,12 @@ export class StepResult {
|
||||
* arguments. Create a successful result if it succeeds, and a
|
||||
* failed one if it throws a `ReplaceError`.
|
||||
*/
|
||||
static fromReplace(doc: ProsemirrorNode, from: number, to: number, slice: Slice): StepResult;
|
||||
static fromReplace<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
from: number,
|
||||
to: number,
|
||||
slice: Slice<S>
|
||||
): StepResult<S>;
|
||||
}
|
||||
/**
|
||||
* Try to find a target depth to which the content in the given range
|
||||
@@ -462,11 +511,20 @@ export function liftTarget(range: NodeRange): number | null | void;
|
||||
* the wrapper node, if necessary. Returns null if no valid wrapping
|
||||
* could be found.
|
||||
*/
|
||||
export function findWrapping(range: NodeRange, nodeType: NodeType, attrs?: { [key: string]: any }): Array<{ type: NodeType, attrs?: { [key: string]: any } | null }> | null | void;
|
||||
export function findWrapping<S extends Schema = any>(
|
||||
range: NodeRange<S>,
|
||||
nodeType: NodeType<S>,
|
||||
attrs?: { [key: string]: any }
|
||||
): Array<{ type: NodeType<S>; attrs?: { [key: string]: any } | null }> | null | void;
|
||||
/**
|
||||
* Check whether splitting at the given position is allowed.
|
||||
*/
|
||||
export function canSplit(doc: ProsemirrorNode, pos: number, depth?: number, typesAfter?: Array<{ type: NodeType, attrs?: { [key: string]: any } | null }>): boolean;
|
||||
export function canSplit<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
pos: number,
|
||||
depth?: number,
|
||||
typesAfter?: Array<{ type: NodeType<S>; attrs?: { [key: string]: any } | null }>
|
||||
): boolean;
|
||||
/**
|
||||
* Test whether the blocks before and after a given position can be
|
||||
* joined.
|
||||
@@ -484,4 +542,8 @@ export function joinPoint(doc: ProsemirrorNode, pos: number, dir?: number): numb
|
||||
* isn't a valid place but is at the start or end of a node. Return
|
||||
* null if no position was found.
|
||||
*/
|
||||
export function insertPoint(doc: ProsemirrorNode, pos: number, nodeType: NodeType): number | null | void;
|
||||
export function insertPoint<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
pos: number,
|
||||
nodeType: NodeType<S>
|
||||
): number | null | void;
|
||||
|
||||
@@ -1,24 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"prosemirror-transform-tests.ts"
|
||||
]
|
||||
}
|
||||
"files": ["index.d.ts", "prosemirror-transform-tests.ts"]
|
||||
}
|
||||
|
||||
Vendored
+150
-59
@@ -1,16 +1,21 @@
|
||||
// Type definitions for prosemirror-view 1.0
|
||||
// Type definitions for prosemirror-view 1.2
|
||||
// Project: https://github.com/ProseMirror/prosemirror-view
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// David Hahn <https://github.com/davidka>
|
||||
// Tim Baumann <https://github.com/timjb>
|
||||
// Patrick Simmelbauer <https://github.com/patsimm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// IMPORTANT
|
||||
// This file was generated by https://github.com/bradleyayers/getdocs2ts. Please do not edit manually.
|
||||
// When you find an error in these declarations, fix the getdocs comment upstream or 'getdocs2ts', then regenerate.
|
||||
|
||||
import { DOMParser, DOMSerializer, Node as ProsemirrorNode, ResolvedPos, Slice } from 'prosemirror-model';
|
||||
import {
|
||||
DOMParser,
|
||||
DOMSerializer,
|
||||
Node as ProsemirrorNode,
|
||||
ResolvedPos,
|
||||
Slice,
|
||||
Schema,
|
||||
Mark
|
||||
} from 'prosemirror-model';
|
||||
import { EditorState, Selection, Transaction } from 'prosemirror-state';
|
||||
import { Mapping } from 'prosemirror-transform';
|
||||
|
||||
@@ -38,18 +43,37 @@ export class Decoration {
|
||||
* Creates a widget decoration, which is a DOM node that's shown in
|
||||
* the document at the given position.
|
||||
*/
|
||||
static widget(pos: number, dom: Node, spec?: { side?: number | null, stopEvent?: ((event: Event) => boolean) | null, key?: string | null }): Decoration;
|
||||
static widget(
|
||||
pos: number,
|
||||
dom: Node,
|
||||
spec?: {
|
||||
side?: number | null;
|
||||
marks?: Mark[];
|
||||
stopEvent?: ((event: Event) => boolean) | null;
|
||||
key?: string | null;
|
||||
}
|
||||
): Decoration;
|
||||
/**
|
||||
* Creates an inline decoration, which adds the given attributes to
|
||||
* each inline node between `from` and `to`.
|
||||
*/
|
||||
static inline(from: number, to: number, attrs: DecorationAttrs, spec?: { inclusiveStart?: boolean | null, inclusiveEnd?: boolean | null }): Decoration;
|
||||
static inline(
|
||||
from: number,
|
||||
to: number,
|
||||
attrs: DecorationAttrs,
|
||||
spec?: { inclusiveStart?: boolean | null; inclusiveEnd?: boolean | null }
|
||||
): Decoration;
|
||||
/**
|
||||
* Creates a node decoration. `from` and `to` should point precisely
|
||||
* before and after a node in the document. That node, and only that
|
||||
* node, will receive the given attributes.
|
||||
*/
|
||||
static node(from: number, to: number, attrs: DecorationAttrs, spec?: { [key: string]: any }): Decoration;
|
||||
static node(
|
||||
from: number,
|
||||
to: number,
|
||||
attrs: DecorationAttrs,
|
||||
spec?: { [key: string]: any }
|
||||
): Decoration;
|
||||
}
|
||||
/**
|
||||
* A set of attributes to add to a decorated node. Most properties
|
||||
@@ -78,7 +102,7 @@ export interface DecorationAttrs {
|
||||
* compare them. This is a persistent data structure—it is not
|
||||
* modified, updates create a new value.
|
||||
*/
|
||||
export class DecorationSet {
|
||||
export class DecorationSet<S extends Schema = any> {
|
||||
/**
|
||||
* Find all decorations in this set which touch the given range
|
||||
* (including decorations that start or end directly at the
|
||||
@@ -87,28 +111,39 @@ export class DecorationSet {
|
||||
* considered. When `predicate` isn't given, all decorations are
|
||||
* asssumed to match.
|
||||
*/
|
||||
find(start?: number, end?: number, predicate?: (spec: { [key: string]: any }) => boolean): Decoration[];
|
||||
find(
|
||||
start?: number,
|
||||
end?: number,
|
||||
predicate?: (spec: { [key: string]: any }) => boolean
|
||||
): Decoration[];
|
||||
/**
|
||||
* Map the set of decorations in response to a change in the
|
||||
* document.
|
||||
*/
|
||||
map(mapping: Mapping, doc: ProsemirrorNode, options?: { onRemove?: ((decorationSpec: { [key: string]: any }) => void) | null }): DecorationSet;
|
||||
map(
|
||||
mapping: Mapping,
|
||||
doc: ProsemirrorNode<S>,
|
||||
options?: { onRemove?: ((decorationSpec: { [key: string]: any }) => void) | null }
|
||||
): DecorationSet<S>;
|
||||
/**
|
||||
* Add the given array of decorations to the ones in the set,
|
||||
* producing a new set. Needs access to the current document to
|
||||
* create the appropriate tree structure.
|
||||
*/
|
||||
add(doc: ProsemirrorNode, decorations: Decoration[]): DecorationSet;
|
||||
add(doc: ProsemirrorNode<S>, decorations: Decoration[]): DecorationSet<S>;
|
||||
/**
|
||||
* Create a new set that contains the decorations in this set, minus
|
||||
* the ones in the given array.
|
||||
*/
|
||||
remove(decorations: Decoration[]): DecorationSet;
|
||||
remove(decorations: Decoration[]): DecorationSet<S>;
|
||||
/**
|
||||
* Create a set of decorations, using the structure of the given
|
||||
* document.
|
||||
*/
|
||||
static create(doc: ProsemirrorNode, decorations: Decoration[]): DecorationSet;
|
||||
static create<S extends Schema = any>(
|
||||
doc: ProsemirrorNode<S>,
|
||||
decorations: Decoration[]
|
||||
): DecorationSet<S>;
|
||||
/**
|
||||
* The empty set of decorations.
|
||||
*/
|
||||
@@ -119,7 +154,7 @@ export class DecorationSet {
|
||||
* editable document. Its state and behavior are determined by its
|
||||
* [props](#view.DirectEditorProps).
|
||||
*/
|
||||
export class EditorView {
|
||||
export class EditorView<S extends Schema = any> {
|
||||
/**
|
||||
* Create a view. `place` may be a DOM node that the editor should
|
||||
* be appended to, a function that will place it into the document,
|
||||
@@ -127,11 +162,14 @@ export class EditorView {
|
||||
* document container. If it is `null`, the editor will not be added
|
||||
* to the document.
|
||||
*/
|
||||
constructor(place: Node | ((p: Node) => void) | { mount: Node } | undefined, props: DirectEditorProps);
|
||||
constructor(
|
||||
place: Node | ((p: Node) => void) | { mount: Node } | undefined,
|
||||
props: DirectEditorProps<S>
|
||||
);
|
||||
/**
|
||||
* The view's current [state](#state.EditorState).
|
||||
*/
|
||||
state: EditorState;
|
||||
state: EditorState<S>;
|
||||
/**
|
||||
* An editable DOM node containing the document. (You probably
|
||||
* should not directly interfere with its content.)
|
||||
@@ -142,27 +180,27 @@ export class EditorView {
|
||||
* information about the dragged slice and whether it is being
|
||||
* copied or moved. At any other time, it is null.
|
||||
*/
|
||||
dragging?: { slice: Slice, move: boolean } | null;
|
||||
dragging?: { slice: Slice<S>; move: boolean } | null;
|
||||
/**
|
||||
* The view's current [props](#view.EditorProps).
|
||||
*/
|
||||
props: DirectEditorProps;
|
||||
props: DirectEditorProps<S>;
|
||||
/**
|
||||
* Update the view's props. Will immediately cause an update to
|
||||
* the DOM.
|
||||
*/
|
||||
update(props: DirectEditorProps): void;
|
||||
update(props: DirectEditorProps<S>): void;
|
||||
/**
|
||||
* Update the view by updating existing props object with the object
|
||||
* given as argument. Equivalent to `view.update(Object.assign({},
|
||||
* view.props, props))`.
|
||||
*/
|
||||
setProps(props: DirectEditorProps): void;
|
||||
setProps(props: DirectEditorProps<S>): void;
|
||||
/**
|
||||
* Update the editor's `state` prop, without touching any of the
|
||||
* other props.
|
||||
*/
|
||||
updateState(state: EditorState): void;
|
||||
updateState(state: EditorState<S>): void;
|
||||
/**
|
||||
* Goes over the values of a prop, first those provided directly,
|
||||
* then those from plugins (in order), and calls `f` every time a
|
||||
@@ -196,20 +234,23 @@ export class EditorView {
|
||||
* inner node that the position falls inside of, or -1 if it is at
|
||||
* the top level, not in any node.
|
||||
*/
|
||||
posAtCoords(coords: { left: number, top: number }): { pos: number, inside: number } | null | void;
|
||||
posAtCoords(coords: {
|
||||
left: number;
|
||||
top: number;
|
||||
}): { pos: number; inside: number } | null | void;
|
||||
/**
|
||||
* Returns the viewport rectangle at a given document position. `left`
|
||||
* and `right` will be the same number, as this returns a flat
|
||||
* cursor-ish rectangle.
|
||||
*/
|
||||
coordsAtPos(pos: number): { left: number, right: number, top: number, bottom: number };
|
||||
coordsAtPos(pos: number): { left: number; right: number; top: number; bottom: number };
|
||||
/**
|
||||
* Find the DOM position that corresponds to the given document
|
||||
* position. Note that you should **not** mutate the editor's
|
||||
* internal DOM, only inspect it (and even that is usually not
|
||||
* necessary).
|
||||
*/
|
||||
domAtPos(pos: number): { node: Node, offset: number };
|
||||
domAtPos(pos: number): { node: Node; offset: number };
|
||||
/**
|
||||
* Find out whether the selection is at the end of a textblock when
|
||||
* moving in a given direction. When, for example, given `"left"`,
|
||||
@@ -218,7 +259,10 @@ export class EditorView {
|
||||
* to the view's current state by default, but it is possible to
|
||||
* pass a different state.
|
||||
*/
|
||||
endOfTextblock(dir: "up" | "down" | "left" | "right" | "forward" | "backward", state?: EditorState): boolean;
|
||||
endOfTextblock(
|
||||
dir: 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward',
|
||||
state?: EditorState<S>
|
||||
): boolean;
|
||||
/**
|
||||
* Removes the editor from the DOM and destroys all [node
|
||||
* views](#view.NodeView).
|
||||
@@ -233,7 +277,7 @@ export class EditorView {
|
||||
* This method is bound to the view instance, so that it can be
|
||||
* easily passed around.
|
||||
*/
|
||||
dispatch(tr: Transaction): void;
|
||||
dispatch(tr: Transaction<S>): void;
|
||||
}
|
||||
/**
|
||||
* Props are configuration values that can be passed to an editor view
|
||||
@@ -250,7 +294,7 @@ export class EditorView {
|
||||
* them returns true. For some props, the first plugin that yields a
|
||||
* value gets precedence.
|
||||
*/
|
||||
export interface EditorProps {
|
||||
export interface EditorProps<S extends Schema = any> {
|
||||
/**
|
||||
* Can be an object mapping DOM event type names to functions that
|
||||
* handle them. Such functions will be called before any handling
|
||||
@@ -260,78 +304,115 @@ export interface EditorProps {
|
||||
* `preventDefault` yourself (or not, if you want to allow the
|
||||
* default behavior).
|
||||
*/
|
||||
handleDOMEvents?: { [name: string]: (view: EditorView, event: Event) => boolean } | null;
|
||||
handleDOMEvents?: { [name: string]: (view: EditorView<S>, event: Event) => boolean } | null;
|
||||
/**
|
||||
* Called when the editor receives a `keydown` event.
|
||||
*/
|
||||
handleKeyDown?: ((view: EditorView, event: KeyboardEvent) => boolean) | null;
|
||||
handleKeyDown?: ((view: EditorView<S>, event: KeyboardEvent) => boolean) | null;
|
||||
/**
|
||||
* Handler for `keypress` events.
|
||||
*/
|
||||
handleKeyPress?: ((view: EditorView, event: KeyboardEvent) => boolean) | null;
|
||||
handleKeyPress?: ((view: EditorView<S>, event: KeyboardEvent) => boolean) | null;
|
||||
/**
|
||||
* Whenever the user directly input text, this handler is called
|
||||
* before the input is applied. If it returns `true`, the default
|
||||
* behavior of actually inserting the text is suppressed.
|
||||
*/
|
||||
handleTextInput?: ((view: EditorView, from: number, to: number, text: string) => boolean) | null;
|
||||
handleTextInput?:
|
||||
| ((view: EditorView<S>, from: number, to: number, text: string) => boolean)
|
||||
| null;
|
||||
/**
|
||||
* Called for each node around a click, from the inside out. The
|
||||
* `direct` flag will be true for the inner node.
|
||||
*/
|
||||
handleClickOn?: ((view: EditorView, pos: number, node: ProsemirrorNode, nodePos: number, event: MouseEvent, direct: boolean) => boolean) | null;
|
||||
handleClickOn?:
|
||||
| ((
|
||||
view: EditorView<S>,
|
||||
pos: number,
|
||||
node: ProsemirrorNode<S>,
|
||||
nodePos: number,
|
||||
event: MouseEvent,
|
||||
direct: boolean
|
||||
) => boolean)
|
||||
| null;
|
||||
/**
|
||||
* Called when the editor is clicked, after `handleClickOn` handlers
|
||||
* have been called.
|
||||
*/
|
||||
handleClick?: ((view: EditorView, pos: number, event: MouseEvent) => boolean) | null;
|
||||
handleClick?: ((view: EditorView<S>, pos: number, event: MouseEvent) => boolean) | null;
|
||||
/**
|
||||
* Called for each node around a double click.
|
||||
*/
|
||||
handleDoubleClickOn?: ((view: EditorView, pos: number, node: ProsemirrorNode, nodePos: number, event: MouseEvent, direct: boolean) => boolean) | null;
|
||||
handleDoubleClickOn?:
|
||||
| ((
|
||||
view: EditorView<S>,
|
||||
pos: number,
|
||||
node: ProsemirrorNode<S>,
|
||||
nodePos: number,
|
||||
event: MouseEvent,
|
||||
direct: boolean
|
||||
) => boolean)
|
||||
| null;
|
||||
/**
|
||||
* Called when the editor is double-clicked, after `handleDoubleClickOn`.
|
||||
*/
|
||||
handleDoubleClick?: ((view: EditorView, pos: number, event: MouseEvent) => boolean) | null;
|
||||
handleDoubleClick?: ((view: EditorView<S>, pos: number, event: MouseEvent) => boolean) | null;
|
||||
/**
|
||||
* Called for each node around a triple click.
|
||||
*/
|
||||
handleTripleClickOn?: ((view: EditorView, pos: number, node: ProsemirrorNode, nodePos: number, event: MouseEvent, direct: boolean) => boolean) | null;
|
||||
handleTripleClickOn?:
|
||||
| ((
|
||||
view: EditorView<S>,
|
||||
pos: number,
|
||||
node: ProsemirrorNode<S>,
|
||||
nodePos: number,
|
||||
event: MouseEvent,
|
||||
direct: boolean
|
||||
) => boolean)
|
||||
| null;
|
||||
/**
|
||||
* Called when the editor is triple-clicked, after `handleTripleClickOn`.
|
||||
*/
|
||||
handleTripleClick?: ((view: EditorView, pos: number, event: MouseEvent) => boolean) | null;
|
||||
handleTripleClick?: ((view: EditorView<S>, pos: number, event: MouseEvent) => boolean) | null;
|
||||
/**
|
||||
* Can be used to override the behavior of pasting. `slice` is the
|
||||
* pasted content parsed by the editor, but you can directly access
|
||||
* the event to get at the raw content.
|
||||
*/
|
||||
handlePaste?: ((view: EditorView, event: Event, slice: Slice) => boolean) | null;
|
||||
handlePaste?: ((view: EditorView<S>, event: Event, slice: Slice<S>) => boolean) | null;
|
||||
/**
|
||||
* Called when something is dropped on the editor. `moved` will be
|
||||
* true if this drop moves from the current selection (which should
|
||||
* thus be deleted).
|
||||
*/
|
||||
handleDrop?: ((view: EditorView, event: Event, slice: Slice, moved: boolean) => boolean) | null;
|
||||
handleDrop?:
|
||||
| ((view: EditorView<S>, event: Event, slice: Slice<S>, moved: boolean) => boolean)
|
||||
| null;
|
||||
/**
|
||||
* Called when the view, after updating its state, tries to scroll
|
||||
* the selection into view. A handler function may return false to
|
||||
* indicate that it did not handle the scrolling and further
|
||||
* handlers or the default behavior should be tried.
|
||||
*/
|
||||
handleScrollToSelection?: ((view: EditorView) => boolean) | null;
|
||||
handleScrollToSelection?: ((view: EditorView<S>) => boolean) | null;
|
||||
/**
|
||||
* Can be used to override the way a selection is created when
|
||||
* reading a DOM selection between the given anchor and head.
|
||||
*/
|
||||
createSelectionBetween?: ((view: EditorView, anchor: ResolvedPos, head: ResolvedPos) => Selection | null | void) | null;
|
||||
createSelectionBetween?:
|
||||
| ((
|
||||
view: EditorView<S>,
|
||||
anchor: ResolvedPos<S>,
|
||||
head: ResolvedPos<S>
|
||||
) => Selection<S> | null | void)
|
||||
| null;
|
||||
/**
|
||||
* The [parser](#model.DOMParser) to use when reading editor changes
|
||||
* from the DOM. Defaults to calling
|
||||
* [`DOMParser.fromSchema`](#model.DOMParser^fromSchema) on the
|
||||
* editor's schema.
|
||||
*/
|
||||
domParser?: DOMParser | null;
|
||||
domParser?: DOMParser<S> | null;
|
||||
/**
|
||||
* Can be used to transform pasted HTML text, _before_ it is parsed,
|
||||
* for example to clean it up.
|
||||
@@ -342,7 +423,7 @@ export interface EditorProps {
|
||||
* the clipboard. When not given, the value of the
|
||||
* [`domParser`](#view.EditorProps.domParser) prop is used.
|
||||
*/
|
||||
clipboardParser?: DOMParser | null;
|
||||
clipboardParser?: DOMParser<S> | null;
|
||||
/**
|
||||
* Transform pasted plain text.
|
||||
*/
|
||||
@@ -355,12 +436,12 @@ export interface EditorProps {
|
||||
* in `<p>` tags, and call
|
||||
* [`clipboardParser`](#view.EditorProps.clipboardParser) on it.
|
||||
*/
|
||||
clipboardTextParser?: ((text: string, $context: ResolvedPos) => Slice) | null;
|
||||
clipboardTextParser?: ((text: string, $context: ResolvedPos<S>) => Slice<S>) | null;
|
||||
/**
|
||||
* Can be used to transform pasted content before it is applied to
|
||||
* the document.
|
||||
*/
|
||||
transformPasted?: ((p: Slice) => Slice) | null;
|
||||
transformPasted?: ((p: Slice<S>) => Slice<S>) | null;
|
||||
/**
|
||||
* Allows you to pass custom rendering and behavior logic for nodes
|
||||
* and marks. Should map node and mark names to constructor
|
||||
@@ -375,31 +456,38 @@ export interface EditorProps {
|
||||
* they can also be used as a way to provide context information to
|
||||
* the node view without adding it to the document itself.
|
||||
*/
|
||||
nodeViews?: { [name: string]: (node: ProsemirrorNode, view: EditorView, getPos: () => number, decorations: Decoration[]) => NodeView } | null;
|
||||
nodeViews?: {
|
||||
[name: string]: (
|
||||
node: ProsemirrorNode<S>,
|
||||
view: EditorView<S>,
|
||||
getPos: () => number,
|
||||
decorations: Decoration[]
|
||||
) => NodeView<S>;
|
||||
} | null;
|
||||
/**
|
||||
* The DOM serializer to use when putting content onto the
|
||||
* clipboard. If not given, the result of
|
||||
* [`DOMSerializer.fromSchema`](#model.DOMSerializer^fromSchema)
|
||||
* will be used.
|
||||
*/
|
||||
clipboardSerializer?: DOMSerializer | null;
|
||||
clipboardSerializer?: DOMSerializer<S> | null;
|
||||
/**
|
||||
* A function that will be called to get the text for the current
|
||||
* selection when copying text to the clipboard. By default, the
|
||||
* editor will use [`textBetween`](#model.Node.textBetween) on the
|
||||
* selected range.
|
||||
*/
|
||||
clipboardTextSerializer?: ((p: Slice) => string) | null;
|
||||
clipboardTextSerializer?: ((p: Slice<S>) => string) | null;
|
||||
/**
|
||||
* A set of [document decorations](#view.Decoration) to show in the
|
||||
* view.
|
||||
*/
|
||||
decorations?: ((state: EditorState) => DecorationSet | null | void) | null;
|
||||
decorations?: ((state: EditorState<S>) => DecorationSet<S> | null | void) | null;
|
||||
/**
|
||||
* When this returns false, the content of the view is not directly
|
||||
* editable.
|
||||
*/
|
||||
editable?: ((state: EditorState) => boolean) | null;
|
||||
editable?: ((state: EditorState<S>) => boolean) | null;
|
||||
/**
|
||||
* Control the DOM attributes of the editable element. May be either
|
||||
* an object or a function going from an editor state to an object.
|
||||
@@ -410,7 +498,10 @@ export interface EditorProps {
|
||||
* the value provided first (as in
|
||||
* [`someProp`](#view.EditorView.someProp)) will be used.
|
||||
*/
|
||||
attributes?: { [name: string]: string } | ((p: EditorState) => { [name: string]: string } | null | void) | null;
|
||||
attributes?:
|
||||
| { [name: string]: string }
|
||||
| ((p: EditorState<S>) => { [name: string]: string } | null | void)
|
||||
| null;
|
||||
/**
|
||||
* Determines the distance (in pixels) between the cursor and the
|
||||
* end of the visible viewport at which point, when scrolling the
|
||||
@@ -427,11 +518,11 @@ export interface EditorProps {
|
||||
* The props object given directly to the editor view supports two
|
||||
* fields that can't be used in plugins:
|
||||
*/
|
||||
export interface DirectEditorProps extends EditorProps {
|
||||
export interface DirectEditorProps<S extends Schema = any> extends EditorProps<S> {
|
||||
/**
|
||||
* The current state of the editor.
|
||||
*/
|
||||
state: EditorState;
|
||||
state: EditorState<S>;
|
||||
/**
|
||||
* The callback over which to send transactions (state updates)
|
||||
* produced by the view. If you specify this, you probably want to
|
||||
@@ -440,7 +531,7 @@ export interface DirectEditorProps extends EditorProps {
|
||||
* state that has the transaction
|
||||
* [applied](#state.EditorState.apply).
|
||||
*/
|
||||
dispatchTransaction?: ((tr: Transaction) => void) | null;
|
||||
dispatchTransaction?: ((tr: Transaction<S>) => void) | null;
|
||||
}
|
||||
/**
|
||||
* By default, document nodes are rendered using the result of the
|
||||
@@ -452,7 +543,7 @@ export interface DirectEditorProps extends EditorProps {
|
||||
*
|
||||
* Objects returned as node views must conform to this interface.
|
||||
*/
|
||||
export interface NodeView {
|
||||
export interface NodeView<S extends Schema = any> {
|
||||
/**
|
||||
* The outer DOM node that represents the document node. When not
|
||||
* given, the default strategy is used to create a DOM node.
|
||||
@@ -477,7 +568,7 @@ export interface NodeView {
|
||||
* no `dom` property), updating its child nodes will be handled by
|
||||
* ProseMirror.
|
||||
*/
|
||||
update?: ((node: ProsemirrorNode, decorations: Decoration[]) => boolean) | null;
|
||||
update?: ((node: ProsemirrorNode<S>, decorations: Decoration[]) => boolean) | null;
|
||||
/**
|
||||
* Can be used to override the way the node's selected status (as a
|
||||
* node selection) is displayed.
|
||||
|
||||
Vendored
+8
@@ -17,6 +17,7 @@
|
||||
// Ethan Resnick <https://github.com/ethanresnick>
|
||||
// Jack Leigh <https://github.com/leighman>
|
||||
// Keagan McClelland <https://github.com/CaptJakk>
|
||||
// Tomas Szabo <https://github.com/deftomat>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@@ -1027,6 +1028,13 @@ declare namespace R {
|
||||
*/
|
||||
memoize<T = any>(fn: (...a: any[]) => T): (...a: any[]) => T;
|
||||
|
||||
/**
|
||||
* A customisable version of R.memoize. memoizeWith takes an additional function that will be applied to a given
|
||||
* argument set and used to create the cache key under which the results of the function to be memoized will be stored.
|
||||
* Care must be taken when implementing key generation to avoid clashes that may overwrite previous entries erroneously.
|
||||
*/
|
||||
memoizeWith<T extends (...args: any[]) => any>(keyFn: (...v: any[]) => string, fn: T): T;
|
||||
|
||||
/**
|
||||
* Create a new object with the own properties of a
|
||||
* merged with the own properties of object b.
|
||||
|
||||
@@ -309,6 +309,36 @@ R.times(i, 5);
|
||||
const isLong = memoStringLength('short') > 10; // false
|
||||
})();
|
||||
|
||||
(() => {
|
||||
interface Vector {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
let numberOfCalls = 0;
|
||||
|
||||
function vectorSum(a: Vector, b: Vector): Vector {
|
||||
numberOfCalls += 1;
|
||||
return {
|
||||
x: a.x + b.x,
|
||||
y: a.y + b.y
|
||||
};
|
||||
}
|
||||
|
||||
const memoVectorSum = R.memoizeWith(JSON.stringify, vectorSum);
|
||||
|
||||
memoVectorSum({ x: 1, y: 1 }, { x: 2, y: 2 }); // => { x: 3, y: 3 }
|
||||
numberOfCalls; // => 1
|
||||
memoVectorSum({ x: 1, y: 1 }, { x: 2, y: 2 }); // => { x: 3, y: 3 }
|
||||
numberOfCalls; // => 1
|
||||
memoVectorSum({ x: 1, y: 2 }, { x: 2, y: 3 }); // => { x: 3, y: 5 }
|
||||
numberOfCalls; // => 2
|
||||
|
||||
// Note that argument order matters
|
||||
memoVectorSum({ x: 2, y: 3 }, { x: 1, y: 2 }); // => { x: 3, y: 5 }
|
||||
numberOfCalls; // => 3
|
||||
})();
|
||||
|
||||
(() => {
|
||||
const addOneOnce = R.once((x: number) => x + 1);
|
||||
addOneOnce(10); // => 11
|
||||
|
||||
Vendored
+2
@@ -158,4 +158,6 @@ export namespace transports {
|
||||
}
|
||||
class HTTPSTransport extends HTTPTransport {
|
||||
}
|
||||
const https: HTTPSTransport;
|
||||
const http: HTTPTransport;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ Raven.config({
|
||||
release: 'foobar',
|
||||
transport
|
||||
});
|
||||
|
||||
Raven.config({
|
||||
transport: Raven.transports.https
|
||||
});
|
||||
|
||||
client.setContext({});
|
||||
client.on('logged', () => { });
|
||||
client.process({});
|
||||
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for react-is 16.3
|
||||
// Project: https://reactjs.org/
|
||||
// Definitions by: Avi Vahl <https://github.com/AviVahl>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
export as namespace ReactIs;
|
||||
|
||||
import { ReactElement, ReactType } from 'react';
|
||||
|
||||
export function typeOf(value: any): symbol | undefined;
|
||||
export function isValidElementType(value: any): value is ReactType;
|
||||
|
||||
export function isContextConsumer(value: any): value is ReactElement<any>;
|
||||
export function isContextProvider(value: any): value is ReactElement<any>;
|
||||
export function isElement(value: any): value is ReactElement<any>;
|
||||
export function isFragment(value: any): value is ReactElement<any>;
|
||||
export function isPortal(value: any): value is ReactElement<any>;
|
||||
export function isStrictMode(value: any): value is ReactElement<any>;
|
||||
|
||||
export const ContextProvider: symbol;
|
||||
export const ContextConsumer: symbol;
|
||||
export const Element: symbol;
|
||||
export const Fragment: symbol;
|
||||
export const Portal: symbol;
|
||||
export const StrictMode: symbol;
|
||||
@@ -0,0 +1,74 @@
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import * as ReactIs from 'react-is';
|
||||
|
||||
// Below is taken from README of react-is
|
||||
// Determining if a Component is Valid
|
||||
|
||||
interface CompProps {
|
||||
forwardedRef?: React.Ref<any>;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
class ClassComponent extends React.Component<CompProps> {
|
||||
render() {
|
||||
return React.createElement('div');
|
||||
}
|
||||
}
|
||||
|
||||
const StatelessComponent = () => React.createElement('div');
|
||||
|
||||
const ForwardRefComponent = React.forwardRef((props, ref) =>
|
||||
React.createElement(ClassComponent, { forwardedRef: ref, ...props })
|
||||
);
|
||||
|
||||
const Context = React.createContext(false);
|
||||
|
||||
ReactIs.isValidElementType('div'); // true
|
||||
ReactIs.isValidElementType(ClassComponent); // true
|
||||
ReactIs.isValidElementType(StatelessComponent); // true
|
||||
ReactIs.isValidElementType(ForwardRefComponent); // true
|
||||
ReactIs.isValidElementType(Context.Provider); // true
|
||||
ReactIs.isValidElementType(Context.Consumer); // true
|
||||
ReactIs.isValidElementType(React.createFactory('div')); // true
|
||||
|
||||
// Determining an Element's Type
|
||||
|
||||
// AsyncMode - unstable_AsyncMode is not implemented in @types/react yet
|
||||
// ReactIs.isAsyncMode(<React.unstable_AsyncMode />); // true
|
||||
// ReactIs.typeOf(<React.unstable_AsyncMode />) === ReactIs.AsyncMode; // true
|
||||
|
||||
// Context
|
||||
const ThemeContext = React.createContext('blue');
|
||||
|
||||
ReactIs.isContextConsumer(<ThemeContext.Consumer children={StatelessComponent} />); // true
|
||||
ReactIs.isContextProvider(<ThemeContext.Provider children={StatelessComponent} value='black' />); // true
|
||||
ReactIs.typeOf(<ThemeContext.Consumer children={StatelessComponent} />) === ReactIs.ContextConsumer; // true
|
||||
ReactIs.typeOf(<ThemeContext.Provider children={StatelessComponent} value='black' />) === ReactIs.ContextProvider; // true
|
||||
|
||||
// Element
|
||||
ReactIs.isElement(<div />); // true
|
||||
ReactIs.typeOf(<div />) === ReactIs.Element; // true
|
||||
|
||||
// Fragment
|
||||
ReactIs.isFragment(<></>); // true
|
||||
ReactIs.typeOf(<></>) === ReactIs.Fragment; // true
|
||||
|
||||
// Portal
|
||||
const div = document.createElement('div');
|
||||
const portal = ReactDOM.createPortal(<div />, div);
|
||||
|
||||
ReactIs.isPortal(portal); // true
|
||||
ReactIs.typeOf(portal) === ReactIs.Portal; // true
|
||||
|
||||
// StrictMode
|
||||
ReactIs.isStrictMode(<React.StrictMode />); // true
|
||||
ReactIs.typeOf(<React.StrictMode />) === ReactIs.StrictMode; // true
|
||||
|
||||
// Verify typeOf accepts any type of value (taken from tests of react-is)
|
||||
ReactIs.typeOf('abc') === undefined;
|
||||
ReactIs.typeOf(true) === undefined;
|
||||
ReactIs.typeOf(123) === undefined;
|
||||
ReactIs.typeOf({}) === undefined;
|
||||
ReactIs.typeOf(null) === undefined;
|
||||
ReactIs.typeOf(undefined) === undefined;
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": false,
|
||||
"jsx": "preserve"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-is-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+414
@@ -0,0 +1,414 @@
|
||||
// Type definitions for react-owl-carousel 2.2
|
||||
// Project: https://github.com/seal789ie/react-owl-carousel
|
||||
// Definitions by: T Bounsiar <https://github.com/tbounsiar>, Ismael Gorissen <https://github.com/igorissen>, Kenneth Ceyer <https://github.com/KennethanCeyer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
export type HandlerCallback = (...args: any[]) => void;
|
||||
|
||||
export interface Options {
|
||||
// OPTIONS
|
||||
/**
|
||||
* Default:
|
||||
* Adding a -striped className to OwlCarousel.
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* Default: 3
|
||||
* The number of items you want to see on the screen.
|
||||
*/
|
||||
items?: number;
|
||||
/**
|
||||
* Default: 0
|
||||
* margin-right(px) on item.
|
||||
*/
|
||||
margin?: number;
|
||||
/**
|
||||
* Default: false
|
||||
* Infinity loop. Duplicate last and first items to get loop illusion.
|
||||
*/
|
||||
loop?: boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Center item. Works well with even an odd number of items.
|
||||
*/
|
||||
center?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Mouse drag enabled.
|
||||
*/
|
||||
mouseDrag?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Touch drag enabled.
|
||||
*/
|
||||
touchDrag?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Stage pull to edge.
|
||||
*/
|
||||
pullDrag?: boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Item pull to edge.
|
||||
*/
|
||||
freeDrag?: boolean;
|
||||
/**
|
||||
* Default: 0
|
||||
* Padding left and right on stage (can see neighbours).
|
||||
*/
|
||||
stagePadding?: number;
|
||||
/**
|
||||
* Default: false
|
||||
* Merge items. Looking for data-merge='{number}' inside item.
|
||||
*/
|
||||
merge?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Fit merged items if screen is smaller than items value.
|
||||
*/
|
||||
mergeFit?: boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Set non grid content. Try using width style on divs.
|
||||
*/
|
||||
autoWidth?: boolean;
|
||||
/**
|
||||
* Default: 0
|
||||
* Start position or URL Hash string like '#id'.
|
||||
*/
|
||||
startPosition?: number | string;
|
||||
/**
|
||||
* Default: false
|
||||
* Listen to url hash changes. data-hash on items is required.
|
||||
*/
|
||||
URLhashListener?: boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Show next/prev buttons.
|
||||
*/
|
||||
nav?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Go backwards when the boundary has reached.
|
||||
*/
|
||||
rewind?: boolean;
|
||||
/**
|
||||
* Default: ['next','prev']
|
||||
* HTML allowed.
|
||||
*/
|
||||
navText?: string[];
|
||||
/**
|
||||
* Default: div
|
||||
* DOM element type for a single directional navigation link.
|
||||
*/
|
||||
navElement?: string;
|
||||
/**
|
||||
* Default: 1
|
||||
* Navigation slide by x. 'page' string can be set to slide by page.
|
||||
*/
|
||||
slideBy?: number | string;
|
||||
/**
|
||||
* Default: true
|
||||
* Show dots navigation.
|
||||
*/
|
||||
dots?: boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Show dots each x item.
|
||||
*/
|
||||
dotsEach?: number | boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Used by data-dot content.
|
||||
*/
|
||||
dotData?: boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Lazy load images. data-src and data-src-retina for highres.
|
||||
* Also load images into background inline style if element is not <img>.
|
||||
*/
|
||||
lazyLoad?: boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* lazyContent was introduced during beta tests but i removed it from the final release due to bad implementation.
|
||||
* It is a nice options so i will work on it in the nearest feature.
|
||||
*/
|
||||
lazyContent?: boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Autoplay.
|
||||
*/
|
||||
autoplay?: boolean;
|
||||
/**
|
||||
* Default: 5000
|
||||
* Autoplay interval timeout.
|
||||
*/
|
||||
autoplayTimeout?: number;
|
||||
/**
|
||||
* Default: false
|
||||
* Pause on mouse hover.
|
||||
*/
|
||||
autoplayHoverPause?: boolean;
|
||||
/**
|
||||
* Default: 250
|
||||
* Speed Calculate. More info to come..
|
||||
*/
|
||||
smartSpeed?: number | boolean;
|
||||
/**
|
||||
* Default: Number
|
||||
* Speed Calculate. More info to come..
|
||||
*/
|
||||
fluidSpeed?: number | boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* autoplay speed.
|
||||
*/
|
||||
autoplaySpeed?: number | boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Navigation speed.
|
||||
*/
|
||||
navSpeed?: number | boolean;
|
||||
/**
|
||||
* Default: Number/Boolean
|
||||
* Pagination speed.
|
||||
*/
|
||||
dotsSpeed?: number | boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Drag end speed.
|
||||
*/
|
||||
dragEndSpeed?: number | boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Enable callback events.
|
||||
*/
|
||||
callbacks?: boolean;
|
||||
/**
|
||||
* Default: empty object
|
||||
* Object containing responsive options. Can be set to false to remove responsive capabilities..
|
||||
*/
|
||||
responsive?: { [breakpoint: string]: Options };
|
||||
/**
|
||||
* Default: 200
|
||||
* Responsive refresh rate.
|
||||
*/
|
||||
responsiveRefreshRate?: number;
|
||||
/**
|
||||
* Default: window
|
||||
* Set on any DOM element.
|
||||
* If you care about non responsive browser (like ie8) then use it on main wrapper. This will prevent from crazy resizing.
|
||||
*/
|
||||
responsiveBaseElement?: Element;
|
||||
/**
|
||||
* Default: false
|
||||
* Enable fetching YouTube/Vimeo/Vzaar videos.
|
||||
*/
|
||||
video?: boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Set height for videos.
|
||||
*/
|
||||
videoHeight?: number | boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Set width for videos.
|
||||
*/
|
||||
videoWidth?: number | boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Class for CSS3 animation out.
|
||||
*/
|
||||
animateOut?: string | boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Class for CSS3 animation in.
|
||||
*/
|
||||
animateIn?: string | boolean;
|
||||
/**
|
||||
* Default: swing
|
||||
* Easing for CSS2 $.animate.
|
||||
*/
|
||||
fallbackEasing?: string;
|
||||
/**
|
||||
* Default: false
|
||||
* Callback to retrieve basic information (current item/pages/widths).
|
||||
* Info function second parameter is Owl DOM object reference.
|
||||
*/
|
||||
info?: HandlerCallback;
|
||||
/**
|
||||
* Default: false
|
||||
* Use it if owl items are deep nested inside some generated content. E.g 'youritem'. Dont use dot before class name.
|
||||
*/
|
||||
nestedItemSelector?: string;
|
||||
/**
|
||||
* Default: div
|
||||
* DOM element type for owl-item.
|
||||
*/
|
||||
itemElement?: string;
|
||||
/**
|
||||
* Default: div
|
||||
* DOM element type for owl-stage.
|
||||
*/
|
||||
stageElement?: string;
|
||||
/**
|
||||
* Default: false
|
||||
* Set your own container for nav.
|
||||
*/
|
||||
navContainer?: string | boolean;
|
||||
/**
|
||||
* Default: false
|
||||
* Set your own container for nav.
|
||||
*/
|
||||
dotsContainer?: string | boolean;
|
||||
|
||||
// CLASSES
|
||||
/**
|
||||
* Default: owl-refresh
|
||||
* Class during refresh.
|
||||
*/
|
||||
refreshClass?: string;
|
||||
/**
|
||||
* Default: owl-loading
|
||||
* Class during load.
|
||||
*/
|
||||
loadingClass?: string;
|
||||
/**
|
||||
* Default: owl-loaded
|
||||
* Class after load.
|
||||
*/
|
||||
loadedClass?: string;
|
||||
/**
|
||||
* Default: owl-rtl
|
||||
* Class for right to left mode.
|
||||
*/
|
||||
rtlClass?: string;
|
||||
/**
|
||||
* Default: owl-drag
|
||||
* Class for mouse drag mode.
|
||||
*/
|
||||
dragClass?: string;
|
||||
/**
|
||||
* Default: owl-grab
|
||||
* Class during mouse drag.
|
||||
*/
|
||||
grabClass?: string;
|
||||
/**
|
||||
* Default: owl-stage
|
||||
* Stage class.
|
||||
*/
|
||||
stageClass?: string;
|
||||
/**
|
||||
* Default: owl-stage-outer
|
||||
* Stage outer class.
|
||||
*/
|
||||
stageOuterClass?: string;
|
||||
/**
|
||||
* Default: owl-nav
|
||||
* Navigation container class.
|
||||
*/
|
||||
navContainerClass?: string;
|
||||
/**
|
||||
* Default: ['owl-prev','owl-next']
|
||||
* Navigation buttons classes.
|
||||
*/
|
||||
navClass?: string[];
|
||||
/**
|
||||
* Default: owl-controls
|
||||
* Controls container class - wrapper for navs and dots.
|
||||
*/
|
||||
controlsClass?: string;
|
||||
/**
|
||||
* Default: owl-dot
|
||||
* Dot Class.
|
||||
*/
|
||||
dotClass?: string;
|
||||
/**
|
||||
* Default: owl-dots
|
||||
* Dots container class.
|
||||
*/
|
||||
dotsClass?: string;
|
||||
/**
|
||||
* Default: owl-height
|
||||
* Auto height class.
|
||||
*/
|
||||
autoHeightClass?: string;
|
||||
/**
|
||||
* Default: false
|
||||
* Optional helper class.
|
||||
* Add '<responsiveClass>-<breakpoint>' class to main element. Can be used to stylize content on given breakpoint.
|
||||
*/
|
||||
responsiveClass?: string | boolean;
|
||||
|
||||
// EVENTS
|
||||
/**
|
||||
* When the plugin initializes.
|
||||
*/
|
||||
onInitialize?: HandlerCallback;
|
||||
/**
|
||||
* When the plugin has initialized.
|
||||
*/
|
||||
onInitialized?: HandlerCallback;
|
||||
/**
|
||||
* When the plugin gets resized.
|
||||
*/
|
||||
onResize?: HandlerCallback;
|
||||
/**
|
||||
* When the plugin has resized.
|
||||
*/
|
||||
onResized?: HandlerCallback;
|
||||
/**
|
||||
* When the internal state of the plugin needs update.
|
||||
*/
|
||||
onRefresh?: HandlerCallback;
|
||||
/**
|
||||
* When the internal state of the plugin has updated.
|
||||
*/
|
||||
onRefreshed?: HandlerCallback;
|
||||
/**
|
||||
* When the dragging of an item is started.
|
||||
*/
|
||||
onDrag?: HandlerCallback;
|
||||
/**
|
||||
* When the dragging of an item has finished.
|
||||
*/
|
||||
onDragged?: HandlerCallback;
|
||||
/**
|
||||
* When the translation of the stage starts.
|
||||
*/
|
||||
onTranslate?: HandlerCallback;
|
||||
/**
|
||||
* When the translation of the stage has finished.
|
||||
*/
|
||||
onTranslated?: HandlerCallback;
|
||||
/**
|
||||
* When a property is going to change its value.
|
||||
*/
|
||||
onChange?: HandlerCallback;
|
||||
/**
|
||||
* When a property has changed its value.
|
||||
*/
|
||||
onChanged?: HandlerCallback;
|
||||
/**
|
||||
* When lazy image loads.
|
||||
*/
|
||||
onLoadLazy?: HandlerCallback;
|
||||
/**
|
||||
* When lazy image has loaded.
|
||||
*/
|
||||
onLoadedLazy?: HandlerCallback;
|
||||
/**
|
||||
* When video has unloaded.
|
||||
*/
|
||||
onStopVideo?: HandlerCallback;
|
||||
/**
|
||||
* When video has loaded.
|
||||
*/
|
||||
onPlayVideo?: HandlerCallback;
|
||||
}
|
||||
|
||||
export default class OwlCarousel extends React.Component<Options, any> {
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from 'react-dom';
|
||||
|
||||
// Import React Owl Carousel
|
||||
import OwlCarousel from "react-owl-carousel";
|
||||
|
||||
export class ReactOwlCarouselTest extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<OwlCarousel className={"owl-theme"} loop={false} margin={10} nav={false} dots={false}>
|
||||
<div className="item"><h4>1</h4></div>
|
||||
<div className="item"><h4>2</h4></div>
|
||||
<div className="item"><h4>3</h4></div>
|
||||
<div className="item"><h4>4</h4></div>
|
||||
<div className="item"><h4>5</h4></div>
|
||||
<div className="item"><h4>6</h4></div>
|
||||
<div className="item"><h4>7</h4></div>
|
||||
<div className="item"><h4>8</h4></div>
|
||||
<div className="item"><h4>9</h4></div>
|
||||
<div className="item"><h4>10</h4></div>
|
||||
<div className="item"><h4>11</h4></div>
|
||||
<div className="item"><h4>12</h4></div>
|
||||
</OwlCarousel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<ReactOwlCarouselTest/>, document.getElementById("root"));
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"jsx": "react",
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-owl-carousel-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Type definitions for react-popover 0.5
|
||||
// Project: https://github.com/littlebits/react-popover
|
||||
// Definitions by: Jakub Řičař <https://github.com/jacoporicare>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export type PopoverPlace =
|
||||
| 'above'
|
||||
| 'right'
|
||||
| 'below'
|
||||
| 'left'
|
||||
| 'row'
|
||||
| 'column'
|
||||
| 'start'
|
||||
| 'end';
|
||||
|
||||
export interface PopoverProps {
|
||||
body: React.ReactNode;
|
||||
isOpen?: boolean;
|
||||
preferPlace?: PopoverPlace;
|
||||
place?: PopoverPlace;
|
||||
onOuterAction?: (event: Event) => void;
|
||||
refreshIntervalMs?: number;
|
||||
enterExitTransitionDurationMs?: number;
|
||||
tipSize?: number;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
target?: React.ReactElement<any>;
|
||||
appendTarget?: Element;
|
||||
}
|
||||
|
||||
declare class Popover extends React.Component<PopoverProps> {}
|
||||
export default Popover;
|
||||
@@ -0,0 +1,23 @@
|
||||
import * as React from 'react';
|
||||
import Popover from 'react-popover';
|
||||
|
||||
class Test extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<Popover
|
||||
body={<div>body</div>}
|
||||
isOpen
|
||||
preferPlace="above"
|
||||
place="below"
|
||||
onOuterAction={event => console.log(event)}
|
||||
refreshIntervalMs={10}
|
||||
enterExitTransitionDurationMs={10}
|
||||
tipSize={10}
|
||||
className="xxx"
|
||||
style={{ display: 'block' }}
|
||||
target={<div>target</div>}
|
||||
appendTarget={document.createElement('div')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-popover-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+3
-2
@@ -16,6 +16,8 @@ export namespace ReactStripeElements {
|
||||
import ElementsOptions = stripe.elements.ElementsOptions;
|
||||
import TokenOptions = stripe.TokenOptions;
|
||||
import TokenResponse = stripe.TokenResponse;
|
||||
import SourceResponse = stripe.SourceResponse;
|
||||
import SourceOptions = stripe.SourceOptions;
|
||||
|
||||
/**
|
||||
* There's a bug in @types/stripe which defines the property as
|
||||
@@ -28,8 +30,7 @@ export namespace ReactStripeElements {
|
||||
type StripeProviderProps = { apiKey: string; stripe?: never; } | { apiKey?: never; stripe: StripeProps | null; };
|
||||
|
||||
interface StripeProps {
|
||||
// I'm not sure what the definition for this is
|
||||
createSource(): void;
|
||||
createSource(sourceData?: SourceOptions): Promise<SourceResponse>;
|
||||
|
||||
createToken(options?: TokenOptions): Promise<PatchedTokenResponse>;
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,6 +29,6 @@ export interface Options {
|
||||
maxPropStringLength?: number;
|
||||
}
|
||||
|
||||
export function withInfo(textOrOptions: string | Options): (storyFn: RenderFunction) => () => React.ReactElement<WrapStoryProps>;
|
||||
export function withInfo(textOrOptions: string | Options): (storyFn: RenderFunction) => (context?: object) => React.ReactElement<WrapStoryProps>;
|
||||
|
||||
export function setDefaults(newDefaults: Options): Options;
|
||||
|
||||
Vendored
+50
-3
@@ -1833,19 +1833,66 @@ export interface RaycasterParameters {
|
||||
}
|
||||
|
||||
export class Raycaster {
|
||||
/**
|
||||
* This creates a new raycaster object.
|
||||
* @param origin The origin vector where the ray casts from.
|
||||
* @param direction The direction vector that gives direction to the ray. Should be normalized.
|
||||
* @param near All results returned are further away than near. Near can't be negative. Default value is 0.
|
||||
* @param far All results returned are closer then far. Far can't be lower then near . Default value is Infinity.
|
||||
*/
|
||||
constructor(origin?: Vector3, direction?: Vector3, near?: number, far?: number);
|
||||
|
||||
/** The Ray used for the raycasting. */
|
||||
ray: Ray;
|
||||
|
||||
/**
|
||||
* The near factor of the raycaster. This value indicates which objects can be discarded based on the
|
||||
* distance. This value shouldn't be negative and should be smaller than the far property.
|
||||
*/
|
||||
near: number;
|
||||
|
||||
/**
|
||||
* The far factor of the raycaster. This value indicates which objects can be discarded based on the
|
||||
* distance. This value shouldn't be negative and should be larger than the near property.
|
||||
*/
|
||||
far: number;
|
||||
|
||||
params: RaycasterParameters;
|
||||
precision: number;
|
||||
|
||||
/**
|
||||
* The precision factor of the raycaster when intersecting Line objects.
|
||||
*/
|
||||
linePrecision: number;
|
||||
|
||||
/**
|
||||
* Updates the ray with a new origin and direction.
|
||||
* @param origin The origin vector where the ray casts from.
|
||||
* @param direction The normalized direction vector that gives direction to the ray.
|
||||
*/
|
||||
set(origin: Vector3, direction: Vector3): void;
|
||||
|
||||
/**
|
||||
* Updates the ray with a new origin and direction.
|
||||
* @param coords 2D coordinates of the mouse, in normalized device coordinates (NDC)---X and Y components should be between -1 and 1.
|
||||
* @param camera camera from which the ray should originate
|
||||
*/
|
||||
setFromCamera(coords: { x: number; y: number; }, camera: Camera ): void;
|
||||
intersectObject(object: Object3D, recursive?: boolean): Intersection[];
|
||||
intersectObjects(objects: Object3D[], recursive?: boolean): Intersection[];
|
||||
|
||||
/**
|
||||
* Checks all intersection between the ray and the object with or without the descendants. Intersections are returned sorted by distance, closest first.
|
||||
* @param object The object to check for intersection with the ray.
|
||||
* @param recursive If true, it also checks all descendants. Otherwise it only checks intersecton with the object. Default is false.
|
||||
* @param optionalTarget (optional) target to set the result. Otherwise a new Array is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;).
|
||||
*/
|
||||
intersectObject(object: Object3D, recursive?: boolean, optionalTarget?: Intersection[]): Intersection[];
|
||||
|
||||
/**
|
||||
* Checks all intersection between the ray and the objects with or without the descendants. Intersections are returned sorted by distance, closest first. Intersections are of the same form as those returned by .intersectObject.
|
||||
* @param objects The objects to check for intersection with the ray.
|
||||
* @param recursive If true, it also checks all descendants of the objects. Otherwise it only checks intersecton with the objects. Default is false.
|
||||
* @param optionalTarget (optional) target to set the result. Otherwise a new Array is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;).
|
||||
*/
|
||||
intersectObjects(objects: Object3D[], recursive?: boolean, optionalTarget?: Intersection[]): Intersection[];
|
||||
}
|
||||
|
||||
export class Layers {
|
||||
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for zopflipng-bin 4.1
|
||||
// Project: https://github.com/imagemin/zopflipng-bin#readme
|
||||
// Definitions by: Hirotaka Ikoma <https://github.com/hikoma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
declare const zopflipng: string;
|
||||
export = zopflipng;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"zopflipng-bin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,6 @@
|
||||
import { execFile } from "child_process";
|
||||
import * as zopflipng from "zopflipng-bin";
|
||||
|
||||
execFile(zopflipng, ["-m", "--lossy_8bit", "input.png", "outout.png"], { encoding: "utf-8" }, (err: Error | null) => {
|
||||
console.log("Image minified!");
|
||||
});
|
||||
Reference in New Issue
Block a user