From 53cb2ca2928aaa65c25734b8a974c9c336bfdfa6 Mon Sep 17 00:00:00 2001 From: Luke Venn Date: Thu, 21 Apr 2016 10:39:10 +0100 Subject: [PATCH 001/242] Added RegExp typing to 'path' argument descriptions --- nock/nock.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nock/nock.d.ts b/nock/nock.d.ts index 208aac9b31..3319456a5e 100644 --- a/nock/nock.d.ts +++ b/nock/nock.d.ts @@ -22,28 +22,45 @@ declare module "nock" { export interface Scope { get(path: string, data?: string): Scope; + get(path: RegExp, data?: string): Scope; post(path: string, data?: string): Scope; post(path: string, data?: Object): Scope; post(path: string, regex?: RegExp): Scope; + post(path: RegExp, data?: string): Scope; + post(path: RegExp, data?: Object): Scope; + post(path: RegExp, regex?: RegExp): Scope; patch(path: string, data?: string): Scope; patch(path: string, data?: Object): Scope; patch(path: string, regex?: RegExp): Scope; + patch(path: RegExp, data?: string): Scope; + patch(path: RegExp, data?: Object): Scope; + patch(path: RegExp, regex?: RegExp): Scope; put(path: string, data?: string): Scope; put(path: string, data?: Object): Scope; put(path: string, regex?: RegExp): Scope; + put(path: RegExp, data?: string): Scope; + put(path: RegExp, data?: Object): Scope; + put(path: RegExp, regex?: RegExp): Scope; head(path: string): Scope; + head(path: RegExp): Scope; delete(path: string, data?: string): Scope; delete(path: string, data?: Object): Scope; delete(path: string, regex?: RegExp): Scope; + delete(path: RegExp, data?: string): Scope; + delete(path: RegExp, data?: Object): Scope; + delete(path: RegExp, regex?: RegExp): Scope; merge(path: string, data?: string): Scope; merge(path: string, data?: Object): Scope; merge(path: string, regex?: RegExp): Scope; + merge(path: RegExp, data?: string): Scope; + merge(path: RegExp, data?: Object): Scope; + merge(path: RegExp, regex?: RegExp): Scope; query(params: any): Scope; query(acceptAnyParams: boolean): Scope; @@ -51,6 +68,9 @@ declare module "nock" { intercept(path: string, verb: string, body?: string, options?: any): Scope; intercept(path: string, verb: string, body?: Object, options?: any): Scope; intercept(path: string, verb: string, body?: RegExp, options?: any): Scope; + intercept(path: RegExp, verb: string, body?: string, options?: any): Scope; + intercept(path: RegExp, verb: string, body?: Object, options?: any): Scope; + intercept(path: RegExp, verb: string, body?: RegExp, options?: any): Scope; reply(responseCode: number, body?: string, headers?: Object): Scope; reply(responseCode: number, body?: Object, headers?: Object): Scope; From 634752a79ec35f607ecfd66b09bbf44470f174f1 Mon Sep 17 00:00:00 2001 From: microshine Date: Fri, 6 May 2016 02:00:31 +0300 Subject: [PATCH 002/242] xadesjs beta --- xadesjs/promise.d.ts | 14 + xadesjs/xadesjs.d.ts | 1075 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1089 insertions(+) create mode 100644 xadesjs/promise.d.ts create mode 100644 xadesjs/xadesjs.d.ts diff --git a/xadesjs/promise.d.ts b/xadesjs/promise.d.ts new file mode 100644 index 0000000000..96b926633b --- /dev/null +++ b/xadesjs/promise.d.ts @@ -0,0 +1,14 @@ +interface PromiseFunc { + (resolve: (...args: any[]) => void, reject: (...args: any[]) => void): void; +} + +declare class Promise { + constructor(func: PromiseFunc); + + then(resolve: (...args: any[]) => any): Promise; + then(resolve: (...args: any[]) => any, reject: (...args: any[]) => any): Promise; + catch(reject: (...args: any[]) => any): void; + + static resolve(...args: any[]): Promise; + static reject(...args: any[]): Promise; +} \ No newline at end of file diff --git a/xadesjs/xadesjs.d.ts b/xadesjs/xadesjs.d.ts new file mode 100644 index 0000000000..4eb7b6a1c5 --- /dev/null +++ b/xadesjs/xadesjs.d.ts @@ -0,0 +1,1075 @@ +/// + +declare namespace xadesjs { + + const APPLICATION_XML: string; + + class XmlError extends Error { + stack: any; + constructor(code: XE, ...args: any[]); + } + + enum XE { + NONE = 0, + NULL_REFERENCE = 1, + METHOD_NOT_IMPLEMENTED = 2, + METHOD_NOT_SUPPORTED = 3, + PARAM_REQUIRED = 4, + CONVERTER_UNSUPPORTED = 5, + ELEMENT_MALFORMED = 6, + CRYPTOGRAPHIC = 7, + CRYPTOGRAPHIC_NO_MODULE = 8, + CRYPTOGRAPHIC_UNKNOWN_TRANSFORM = 9, + ALGORITHM_NOT_SUPPORTED = 10, + ALGORITHM_WRONG_NAME = 11, + XML_EXCEPTION = 12, + } + + interface CryptoEx extends Crypto { + name: string; + } + + class Application { + /** + * Sets crypto engine for the current Application + * @param {string} name + * @param {Crypto} crypto + * @returns void + */ + static setEngine(name: string, crypto: Crypto): void; + /** + * Gets the crypto module from the Application + */ + static crypto: CryptoEx; + static isNodePlugin(): boolean; + } + + enum XmlNodeType { + None = 0, + Element = 1, + Attribute = 2, + Text = 3, + CDATA = 4, + EntityReference = 5, + Entity = 6, + ProcessingInstruction = 7, + Comment = 8, + Document = 9, + DocumentType = 10, + DocumentFragment = 11, + Notation = 12, + Whitespace = 13, + SignificantWhitespace = 14, + EndElement = 15, + EndEntity = 16, + XmlDeclaration = 17, + } + + interface IXmlSerializable { + Prefix: string; + /** + * Writes object to XML node + * @returns Node + */ + GetXml(): Node; + /** + * Reads XML from string + * @param {Node} node + * @returns void + */ + LoadXml(node: Node): void; + } + + abstract class XmlObject implements IXmlSerializable { + protected m_prefix: string; + Prefix: string; + protected GetPrefix(): string; + GetXml(): Node; + GetXml(document: Document): Node; + LoadXml(node: Node): void; + toString(): string; + protected getAttribute(xel: Element, attribute: string): string; + } + + const DEFAULT_ROOT_NAME: string; + function IsEqualsEmptyStrings(s1: string, s2: string): boolean; + /** + * Creates new instance of XmlDocument with given name of root element + * @param {string} root Name of root element + * @param {string} namespaceUri + * @param {string} prefix + * @returns Document + */ + function CreateDocument(root?: string, namespaceUri?: string, prefix?: string): Document; + /** + * Returns signle Node from given Node + * @param {Node} node + * @param {string} path + * @returns Node + */ + function SelectSingleNode(node: Node, path: string): Node; + + function findAttr(node: Node, localName: string, nameSpace?: string): Attr; + function findFirst(doc: Node, xpath: string): Node; + function findChilds(node: Node, localName: string, nameSpace?: string): Node[]; + interface IAssocArray { + [index: string]: string; + } + function encodeSpecialCharactersInAttribute(attributeValue: string): string; + function encodeSpecialCharactersInText(text: string): string; + function SelectNamespaces(node: Element): Node[]; + + class Convert { + static ToBase64UrlString(text: string): string; + static FromBase64UrlString(base64UrlText: string): string; + static ToBase64String(text: string): string; + static FromBase64String(base64Text: string): string; + static Base64UrlToBase64(base64url: string): string; + static Base64ToBase64Url(base64: string): string; + static ToBufferUtf8String(text: string): Uint8Array; + static FromBufferUtf8String(buffer: Uint8Array): string; + static ToBufferString(text: string): Uint8Array; + static FromBufferString(buffer: ArrayBuffer): string; + static FromBufferString(buffer: Uint8Array): string; + } + + interface IAlgorithm { + algorithm: Algorithm; + xmlNamespace: string; + getAlgorithmName(): string; + } + interface IHashAlgorithm extends IAlgorithm { + getHash(xml: string): Promise; + } + interface IHashAlgorithmConstructable { + new (): IHashAlgorithm; + } + abstract class XmlAlgorithm implements IAlgorithm { + algorithm: Algorithm; + xmlNamespace: string; + getAlgorithmName(): string; + } + abstract class HashAlgorithm extends XmlAlgorithm implements IHashAlgorithm { + getHash(xml: string): Promise; + } + interface ISignatureAlgorithm extends IAlgorithm { + getSignature(signedInfo: string, signingKey: CryptoKey, algorithm: Algorithm): Promise; + verifySignature(signedInfo: string, key: CryptoKey, signatureValue: string, algorithm?: Algorithm): Promise; + } + interface ISignatureAlgorithmConstructable { + new (): ISignatureAlgorithm; + } + abstract class SignatureAlgorithm extends XmlAlgorithm implements ISignatureAlgorithm { + /** + * Sign the given string using the given key + */ + getSignature(signedInfo: string, signingKey: CryptoKey, algorithm: Algorithm): Promise; + /** + * Verify the given signature of the given string using key + */ + verifySignature(signedInfo: string, key: CryptoKey, signatureValue: string, algorithm?: Algorithm): Promise; + } + + const SHA1: string; + const SHA224: string; + const SHA256: string; + const SHA384: string; + const SHA512: string; + const SHA1_NAMESPACE: string; + const SHA224_NAMESPACE: string; + const SHA256_NAMESPACE: string; + const SHA384_NAMESPACE: string; + const SHA512_NAMESPACE: string; + class Sha1 extends HashAlgorithm { + algorithm: { + name: string; + }; + xmlNamespace: string; + } + class Sha224 extends HashAlgorithm { + algorithm: { + name: string; + }; + xmlNamespace: string; + } + class Sha256 extends HashAlgorithm { + algorithm: { + name: string; + }; + xmlNamespace: string; + } + class Sha384 extends HashAlgorithm { + algorithm: { + name: string; + }; + xmlNamespace: string; + } + class Sha512 extends HashAlgorithm { + algorithm: { + name: string; + }; + xmlNamespace: string; + } + + // RSA PKCS1 + + const RSA_PKCS1: string; + const RSA_PKCS1_SHA1_NAMESPACE: string; + const RSA_PKCS1_SHA224_NAMESPACE: string; + const RSA_PKCS1_SHA256_NAMESPACE: string; + const RSA_PKCS1_SHA384_NAMESPACE: string; + const RSA_PKCS1_SHA512_NAMESPACE: string; + + class RsaPkcs1Sha1 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class RsaPkcs1Sha224 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class RsaPkcs1Sha256 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class RsaPkcs1Sha384 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class RsaPkcs1Sha512 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + + // RSA PSS + + const RSA_PSS: string; + const RSA_PSS_WITH_PARAMS_NAMESPACE: string; + const RSA_PSS_WITH_PARAMS_MGF1_NAMESPACE: string; + + class RsaPssSha1 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class RsaPssSha224 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class RsaPssSha256 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class RsaPssSha384 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class RsaPssSha512 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class PssAlgorithmParams extends XmlObject { + private m_digest_method; + private m_salt_length; + private m_mgf; + private element; + dsPrefix: string; + DigestMethod: string; + SaltLength: number; + MGF: string; + GetXml(): Element; + LoadXml(value: Element): void; + } + + // HMAC + + const HMAC_ALGORITHM: string; + const HMAC_SHA1_NAMESPACE: string; + const HMAC_SHA256_NAMESPACE: string; + const HMAC_SHA384_NAMESPACE: string; + const HMAC_SHA512_NAMESPACE: string; + + class HmacSha1 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class HmacSha256 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class HmacSha384 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class HmacSha512 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + + // ECDSA + + const ECDSA_SIGN_ALGORITHM: string; + const ECDSA_SHA1_NAMESPACE: string; + const ECDSA_SHA224_NAMESPACE: string; + const ECDSA_SHA256_NAMESPACE: string; + const ECDSA_SHA384_NAMESPACE: string; + const ECDSA_SHA512_NAMESPACE: string; + class EcdsaSha1 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class EcdsaSha224 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class EcdsaSha256 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class EcdsaSha384 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + class EcdsaSha512 extends SignatureAlgorithm { + algorithm: any; + xmlNamespace: string; + } + + /** + * Represents an element. + */ + class X509Certificate { + protected raw: Uint8Array; + protected cert_simpl: any; + protected publicKey: CryptoKey; + constructor(rawData?: Uint8Array); + /** + * Loads X509Certificate from DER data + * @param {Uint8Array} rawData + */ + protected LoadFromRawData(rawData: Uint8Array): void; + /** + * Gets the public key from the X509Certificate + */ + PublicKey: CryptoKey; + /** + * Returns DER raw of X509Certificate + */ + GetRawCertData(): Uint8Array; + /** + * Returns public key from X509Certificate + * @param {Algorithm} algorithm + * @returns Promise + */ + exportKey(algorithm: Algorithm): Promise; + } + + enum X509IncludeOption { + None = 0, + EndCertOnly = 1, + ExcludeRoot = 2, + WholeChain = 3, + } + interface X509IssuerSerial { + issuerName: string; + serialNumber: string; + } + /** + * Represents an subelement of an XMLDSIG or XML Encryption element. + */ + class KeyInfoX509Data extends XmlObject implements KeyInfoClause { + + constructor(); + constructor(rgbCert: Uint8Array); + constructor(cert: X509Certificate); + /** + * Gets public key of the X509Data + */ + Key: CryptoKey; + importKey(key: CryptoKey): Promise; + /** + * Exports key from X509Data object + * @param {Algorithm} alg + * @returns Promise + */ + exportKey(alg: Algorithm): Promise; + /** + * Gets a list of the X.509v3 certificates contained in the KeyInfoX509Data object. + */ + Certificates: X509Certificate[]; + /** + * Gets or sets the Certificate Revocation List (CRL) contained within the KeyInfoX509Data object. + */ + CRL: Uint8Array; + /** + * Gets a list of X509IssuerSerial structures that represent an issuer name and serial number pair. + */ + IssuerSerials: X509IssuerSerial[]; + /** + * Gets a list of the subject key identifiers (SKIs) contained in the KeyInfoX509Data object. + */ + SubjectKeyIds: Uint8Array[]; + /** + * Gets a list of the subject names of the entities contained in the KeyInfoX509Data object. + */ + SubjectNames: string[]; + /** + * Adds the specified X.509v3 certificate to the KeyInfoX509Data. + * @param {X509Certificate} certificate + * @returns void + */ + AddCertificate(certificate: X509Certificate): void; + /** + * Adds the specified issuer name and serial number pair to the KeyInfoX509Data object. + * @param {string} issuerName + * @param {string} serialNumber + * @returns void + */ + AddIssuerSerial(issuerName: string, serialNumber: string): void; + /** + * Adds the specified subject key identifier (SKI) to the KeyInfoX509Data object. + * @param {string | Uint8Array} subjectKeyId + * @returns void + */ + AddSubjectKeyId(subjectKeyId: string): void; + AddSubjectKeyId(subjectKeyId: Uint8Array): void; + /** + * Adds the subject name of the entity that was issued an X.509v3 certificate to the KeyInfoX509Data object. + * @param {string} subjectName + * @returns void + */ + AddSubjectName(subjectName: string): void; + /** + * Returns an XML representation of the KeyInfoX509Data object. + * @returns Element + */ + GetXml(): Element; + /** + * Parses the input XmlElement object and configures the internal state of the KeyInfoX509Data object to match. + * @param {Element} element + * @returns void + */ + LoadXml(element: Element): void; + } + + interface IJwkRsa { + alg: string; + kty: string; + e: string; + n: string; + ext: boolean; + } + /** + * Represents the element of an XML signature. + */ + class RsaKeyValue extends XmlObject implements KeyInfoClause { + /** + * Gets or sets the instance of RSA that holds the public key. + */ + Key: CryptoKey; + /** + * Gets the algorithm of the public key + */ + Algorithm: ISignatureAlgorithm; + /** + * Gets the Modulus of the public key + */ + Modulus: Uint8Array; + /** + * Gets the Exponent of the public key + */ + Exponent: Uint8Array; + constructor(); + /** + * Imports key to the RSAKeyValue object + * @param {CryptoKey} key + * @returns Promise + */ + importKey(key: CryptoKey): Promise; + /** + * Exports key from the RSAKeyValue object + * @param {Algorithm} alg + * @returns Promise + */ + exportKey(alg: Algorithm): Promise; + /** + * Returns the XML representation of the RSA key clause. + * @returns Element + */ + GetXml(): Element; + /** + * Loads an RSA key clause from an XML element. + * @param {Element} element + * @returns void + */ + LoadXml(element: Element): void; + } + + type NamedCurve = "P-256" | "P-384" | "P-521"; + + interface IJwkEcdsa { + crv: NamedCurve; + kty: "EC"; + x: string; + y: string; + ext: boolean; + } + + /** + * Represents the element of an XML signature. + */ + class EcdsaKeyValue extends XmlObject implements KeyInfoClause { + /** + * Gets or sets the instance of ECDSA that holds the public key. + */ + Key: CryptoKey; + /** + * Gets the algorithm of the public key + */ + Algorithm: ISignatureAlgorithm; + /** + * Gets the X point value of then public key + */ + X: Uint8Array; + /** + * Gets the Y point value of then public key + */ + Y: Uint8Array; + /** + * Gets the NamedCurve value of then public key + */ + NamedCurve: NamedCurve; + constructor(); + /** + * Imports key to the ECKeyValue object + * @param {CryptoKey} key + * @returns Promise + */ + importKey(key: CryptoKey): Promise; + /** + * Exports key from the ECKeyValue object + * @param {Algorithm} alg + * @returns Promise + */ + exportKey(alg: Algorithm): Promise; + /** + * Returns the XML representation of the ECDSA key clause. + * @returns Element + */ + GetXml(): Element; + /** + * Loads an ECDSA key clause from an XML element. + * @param {Element} element + * @returns void + */ + LoadXml(element: Element): void; + } + + type XmlNamespace = { + prefix: string; + namespace: string; + }; + + enum XmlCanonicalizerState { + BeforeDocElement = 0, + InsideDocElement = 1, + AfterDocElement = 2, + } + + class XmlCanonicalizer { + constructor(withComments: boolean, excC14N: boolean, propagatedNamespaces?: XmlNamespace[]); + InclusiveNamespacesPrefixList: string; + Canonicalize(node: Node): string; + } + + interface Transform extends IXmlSerializable { + Algorithm: string; + LoadInnerXml(node: Node): void; + GetInnerXml(): Node; + GetOutput(): string; + } + + interface ICanonicalizationAlgorithmConstructable { + new (): Transform; + } + /** + * Represents the abstract base class from which all elements + * that can be used in an XML digital signature derive. + */ + abstract class Transform extends XmlObject implements Transform { + protected innerXml: Node; + LoadXml(value: Node): void; + /** + * Returns the XML representation of the current Transform object. + * @returns Element + */ + GetXml(): Element; + } + + /** + * Represents the enveloped signature transform for an XML digital signature as defined by the W3C. + */ + class XmlDsigEnvelopedSignatureTransform extends Transform { + Algorithm: string; + /** + * Returns the output of the current XmlDsigEnvelopedSignatureTransform object. + * @returns string + */ + GetOutput(): string; + } + + /** + * Represents the C14N XML canonicalization transform for a digital signature + * as defined by the World Wide Web Consortium (W3C), without comments. + */ + class XmlDsigC14NTransform extends Transform { + protected xmlCanonicalizer: XmlCanonicalizer; + Algorithm: string; + /** + * Returns the output of the current XmlDsigC14NTransform object. + * @returns string + */ + GetOutput(): string; + } + /** + * Represents the C14N XML canonicalization transform for a digital signature + * as defined by the World Wide Web Consortium (W3C), with comments. + */ + class XmlDsigC14NWithCommentsTransform extends XmlDsigC14NTransform { + Algorithm: string; + protected xmlCanonicalizer: XmlCanonicalizer; + } + + /** + * Represents the exclusive C14N XML canonicalization transform for a digital signature + * as defined by the World Wide Web Consortium (W3C), without comments. + */ + class XmlDsigExcC14NTransform extends Transform { + protected xmlCanonicalizer: XmlCanonicalizer; + Algorithm: string; + /** + * Gets or sets a string that contains namespace prefixes to canonicalize + * using the standard canonicalization algorithm. + */ + InclusiveNamespacesPrefixList: string; + /** + * Returns the output of the current XmlDsigExcC14NTransform object + */ + GetOutput(): string; + } + /** + * Represents the exclusive C14N XML canonicalization transform for a digital signature + * as defined by the World Wide Web Consortium (W3C), with comments. + */ + class XmlDsigExcC14NWithCommentsTransform extends XmlDsigExcC14NTransform { + Algorithm: string; + protected xmlCanonicalizer: XmlCanonicalizer; + } + + class CryptoConfig { + static CreateFromName(name: string): Transform; + static CreateSignatureAlgorithm(namespace: string): SignatureAlgorithm; + static CreateHashAlgorithm(namespace: string): HashAlgorithm; + } + + /** + * Represents the object element of an XML signature that holds data to be signed. + */ + class DataObject extends XmlObject { + constructor(); + constructor(id?: string, mimeType?: string, encoding?: string, data?: Element); + /** + * Gets or sets the data value of the current DataObject object. + */ + Data: NodeList; + /** + * Gets or sets the encoding of the current DataObject object. + */ + Encoding: string; + /** + * Gets or sets the identification of the current DataObject object. + */ + Id: string; + /** + * Gets or sets the MIME type of the current DataObject object. + */ + MimeType: string; + /** + * Returns the XML representation of the DataObject object. + * @returns Element + */ + GetXml(): Element; + /** + * Loads a DataObject state from an XML element. + * @param {Element} value + * @returns void + */ + LoadXml(value: Element): void; + } + + /** + * Represents the element of an XML signature. + */ + class Reference extends XmlObject { + + constructor(p?: string); + /** + * Gets or sets the digest method Uniform Resource Identifier (URI) of the current + */ + DigestMethod: string; + /** + * Gets or sets the digest value of the current Reference. + */ + DigestValue: ArrayBuffer; + /** + * Gets or sets the ID of the current Reference. + */ + Id: string; + /** + * Gets the transform chain of the current Reference. + */ + TransformChain: Transform[]; + /** + * Gets or sets the type of the object being signed. + */ + Type: string; + /** + * Gets or sets the Uri of the current Reference. + */ + Uri: string; + /** + * Adds a Transform object to the list of transforms to be performed + * on the data before passing it to the digest algorithm. + * @param {Transform} transform The transform to be added to the list of transforms. + * @returns void + */ + AddTransform(transform: Transform): void; + /** + * Returns the XML representation of the Reference. + * @returns Element + */ + GetXml(): Element; + /** + * Loads a Reference state from an XML element. + * @param {Element} value + */ + LoadXml(value: Element): void; + } + + /** + * Represents an XML digital signature or XML encryption element. + */ + class KeyInfo extends XmlObject { + constructor(); + /** + * Gets the number of KeyInfoClause objects contained in the KeyInfo object. + */ + length: number; + /** + * Gets or sets the key information identity. + */ + Id: string; + /** + * Returns an enumerator of the KeyInfoClause objects in the KeyInfo object. + * @param {any} requestedObjectType? + */ + GetEnumerator(): Array; + GetEnumerator(requestedObjectType: any): Array; + /** + * Returns an enumerator of the KeyInfoClause objects in the KeyInfo object. + * @param {KeyInfoClause} clause The KeyInfoClause to add to the KeyInfo object. + * @returns void + */ + AddClause(clause: KeyInfoClause): void; + /** + * Returns the XML representation of the KeyInfo object. + * @returns Node + */ + GetXml(): Node; + /** + * Loads a KeyInfo state from an XML element. + * @param {Element} value + * @returns void + */ + LoadXml(value: Element): void; + } + interface KeyInfoClause extends IXmlSerializable { + Key: CryptoKey; + importKey(key: CryptoKey): Promise; + exportKey(alg: Algorithm): Promise; + } + + /** + * Represents the element of an XML signature. + */ + class Signature extends XmlObject { + + constructor(); + /** + * Gets or sets the ID of the current Signature. + */ + Id: string; + /** + * Gets or sets the KeyInfo of the current Signature. + */ + KeyInfo: KeyInfo; + /** + * Gets or sets a list of objects to be signed. + */ + ObjectList: Array; + /** + * Gets or sets the value of the digital signature. + */ + SignatureValue: Uint8Array; + /** + * Gets or sets the SignedInfo of the current Signature. + */ + SignedInfo: SignedInfo; + /** + * Adds a DataObject to the list of objects to be signed. + * @param {DataObject} dataObject The DataObject to be added to the list of objects to be signed. + * @returns void + */ + AddObject(dataObject: DataObject): void; + /** + * Returns the XML representation of the Signature. + * @returns Element + */ + GetXml(): Element; + /** + * Loads a Signature state from an XML element. + * @param {Element} value + * @returns void + */ + LoadXml(value: Element): void; + } + const XmlSignature: { + ElementNames: { + CanonicalizationMethod: string; + DigestMethod: string; + DigestValue: string; + DSAKeyValue: string; + EncryptedKey: string; + HMACOutputLength: string; + RSAPSSParams: string; + MaskGenerationFunction: string; + SaltLength: string; + KeyInfo: string; + KeyName: string; + KeyValue: string; + Modulus: string; + Exponent: string; + Manifest: string; + Object: string; + Reference: string; + RetrievalMethod: string; + RSAKeyValue: string; + ECKeyValue: string; + NamedCurve: string; + PublicKey: string; + Signature: string; + SignatureMethod: string; + SignatureValue: string; + SignedInfo: string; + Transform: string; + Transforms: string; + X509Data: string; + X509IssuerSerial: string; + X509IssuerName: string; + X509SerialNumber: string; + X509SKI: string; + X509SubjectName: string; + X509Certificate: string; + X509CRL: string; + }; + AttributeNames: { + Algorithm: string; + Encoding: string; + Id: string; + MimeType: string; + Type: string; + URI: string; + }; + AlgorithmNamespaces: { + XmlDsigBase64Transform: string; + XmlDsigC14NTransform: string; + XmlDsigC14NWithCommentsTransform: string; + XmlDsigEnvelopedSignatureTransform: string; + XmlDsigXPathTransform: string; + XmlDsigXsltTransform: string; + XmlDsigExcC14NTransform: string; + XmlDsigExcC14NWithCommentsTransform: string; + XmlDecryptionTransform: string; + XmlLicenseTransform: string; + }; + Uri: { + Manifest: string; + }; + NamespaceURI: string; + NamespaceURIMore: string; + NamespaceURIPss: string; + Prefix: string; + GetChildElement: (xel: Node, element: string, ns: string) => Element; + GetAttributeFromElement: (xel: Element, attribute: string, element: string) => string; + GetChildElements: (xel: Element, element: string) => Element[]; + }; + + /** + * The SignedInfo class represents the element + * of an XML signature defined by the XML digital signature specification + */ + class SignedInfo extends XmlObject { + + constructor(signedXml?: SignedXml); + /** + * Gets or sets the canonicalization algorithm that is used before signing + * for the current SignedInfo object. + */ + CanonicalizationMethod: string; + /** + * Gets a Transform object used for canonicalization. + * @returns Transform + */ + CanonicalizationMethodObject: Transform; + /** + * Gets the number of references in the current SignedInfo object. + */ + Count: number; + /** + * Gets or sets the ID of the current SignedInfo object. + */ + Id: string; + /** + * Gets a value that indicates whether the collection is read-only. + * @returns boolean + */ + IsReadOnly: boolean; + /** + * Gets a value that indicates whether the collection is synchronized. + * @returns boolean + */ + IsSynchronized: boolean; + /** + * Gets a list of the Reference objects of the current SignedInfo object. + */ + References: Reference[]; + /** + * Gets or sets the length of the signature for the current SignedInfo object. + */ + SignatureLength: string; + /** + * Gets or sets the name of the algorithm used for signature generation + * and validation for the current SignedInfo object. + */ + SignatureMethod: string; + SignatureParams: XmlObject; + /** + * Gets an object to use for synchronization. + */ + SyncRoot: any; + /** + * Adds a Reference object to the list of references to digest and sign. + * @param {Reference} reference The reference to add to the list of references. + * @returns void + */ + AddReference(reference: Reference): void; + /** + * Copies the elements of this instance into an Array object, starting at a specified index in the array. + * @param {any[]} array + * @param {number} index + * @returns void + */ + CopyTo(array: any[], index: number): void; + /** + * Returns the XML representation of the SignedInfo object. + * @returns Node + */ + GetXml(): Node; + /** + * Loads a SignedInfo state from an XML element. + * @param {Element} value + * @returns void + */ + LoadXml(value: Element): void; + } + + /** + * Provides a wrapper on a core XML signature object to facilitate creating XML signatures. + */ + class SignedXml extends XmlObject { + /** + * Gets or sets the KeyInfo object of the current SignedXml object. + */ + KeyInfo: KeyInfo; + /** + * Gets the Signature object of the current SignedXml object. + */ + Signature: Signature; + /** + * Gets or sets the prefix for the current SignedXml object. + */ + Prefix: string; + /** + * Gets the length of the signature for the current SignedXml object. + */ + SignatureLength: number; + SignatureMethod: string; + /** + * Gets the signature value of the current SignedXml object. + */ + SignatureValue: ArrayBuffer; + /** + * Gets the CanonicalizationMethod of the current SignedXml object. + */ + CanonicalizationMethod: string; + /** + * Gets the SignedInfo object of the current SignedXml object. + */ + SignedInfo: SignedInfo; + /** + * Gets or sets the asymmetric algorithm key used for signing a SignedXml object. + */ + SigningKey: CryptoKey; + /** + * Gets or sets the name of the installed key to be used for signing the SignedXml object. + */ + SigningKeyName: string; + /** + * @param {string} idMode. Value of "wssecurity" will create/validate id's with the ws-security namespace + */ + constructor(); + constructor(node: Document); + constructor(node: Element); + /** + * Adds a Reference object to the SignedXml object that describes a digest method, + * digest value, and transform to use for creating an XML digital signature. + * @param {Reference} reference The Reference object that describes a digest method, digest value, + * and transform to use for creating an XML digital signature. + * @returns void + */ + AddReference(reference: Reference): void; + /** + * Computes an XML digital signature using the specified algorithm. + * @param {Algorithm} algorithm Specified WebCrypto Algoriithm + * @returns Promise + */ + ComputeSignature(algorithm: Algorithm): Promise; + /** + * Determines whether the SignedXml.Signature property verifies using the public key in the signature. + * @returns Promise + */ + CheckSignature(): Promise; + CheckSignature(key: CryptoKey): Promise; + CheckSignature(cert: X509Certificate): Promise; + /** + * Loads a SignedXml state from an XML element. + * @param {Element} value The XML element to load the SignedXml state from. + * @returns void + */ + LoadXml(value: Element): void; + /** + * Returns the XML representation of a SignedXml object. + * @returns Element + */ + GetXml(): Element; + } +} From df611346ddf7a2a600e23fcd1e9fd3814769981a Mon Sep 17 00:00:00 2001 From: microshine Date: Mon, 9 May 2016 12:28:15 +0300 Subject: [PATCH 003/242] Add test & set version --- xadesjs/xadesjs-tests.ts | 47 ++++++++++++++++++++++++++++++++++++++++ xadesjs/xadesjs.d.ts | 10 +++++++++ 2 files changed, 57 insertions(+) create mode 100644 xadesjs/xadesjs-tests.ts diff --git a/xadesjs/xadesjs-tests.ts b/xadesjs/xadesjs-tests.ts new file mode 100644 index 0000000000..e83cb0cf6a --- /dev/null +++ b/xadesjs/xadesjs-tests.ts @@ -0,0 +1,47 @@ +/// + +let xmlString = ""; +let xmlDoc = new DOMParser().parseFromString(xmlString, "application/xml"); +let signedXml = new xadesjs.SignedXml(xmlDoc); + +let alg = { + name: "ECDSA", + namedCurve: "P-256" +}; +xadesjs.Application.crypto.subtle.generateKey( + alg, + false, + ["sign", "verify"] +) + .then((keys: CryptoKeyPair) => { + signedXml.SigningKey = keys.privateKey; + + // Add the key to the SignedXml document. + // Create a reference to be signed. + let reference = new xadesjs.Reference(); + reference.Uri = ""; + // Add an enveloped transformation to the reference. + reference.AddTransform(new xadesjs.XmlDsigEnvelopedSignatureTransform()); + // Add the reference to the SignedXml object. + signedXml.AddReference(reference); + // Set prefix for Signature namespace + signedXml.Prefix = "ds"; + + // Compute the signature. + return signedXml.ComputeSignature({ name: "ECDSA", hash: { name: "SHA-256" } } as any); + }) + .then(function () { + // Append signature + let xmlDigitalSignature = signedXml.GetXml(); + xmlDoc.documentElement.appendChild(xmlDigitalSignature); + + // Serialize XML document + let signedDocument = new XMLSerializer().serializeToString(xmlDoc); + return Promise.resolve(signedDocument); + }) + .then((doc: string) => { + console.log("Signed document:", doc); + }) + .catch((e) => { + console.error("Error", e); + }) \ No newline at end of file diff --git a/xadesjs/xadesjs.d.ts b/xadesjs/xadesjs.d.ts index 4eb7b6a1c5..9f89cab9f1 100644 --- a/xadesjs/xadesjs.d.ts +++ b/xadesjs/xadesjs.d.ts @@ -1,5 +1,15 @@ +// Type definitions for graphene-pk11 v2.0.0 +// Project: https://github.com/PeculiarVentures/graphene +// Definitions by: Stepan Miroshin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + /// +/** + * A pure Javascript implementation of XMLDSIG and XAdES based on Web Crypto https://xadesjs.com + * v1.0.0 + */ + declare namespace xadesjs { const APPLICATION_XML: string; From 7be1ff7f9e8a36bb368d580e018d4dafe47d0fa0 Mon Sep 17 00:00:00 2001 From: microshine Date: Mon, 9 May 2016 12:29:26 +0300 Subject: [PATCH 004/242] Fix def errors --- xadesjs/xadesjs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xadesjs/xadesjs.d.ts b/xadesjs/xadesjs.d.ts index 9f89cab9f1..fc7d1b4bd6 100644 --- a/xadesjs/xadesjs.d.ts +++ b/xadesjs/xadesjs.d.ts @@ -1,5 +1,5 @@ -// Type definitions for graphene-pk11 v2.0.0 -// Project: https://github.com/PeculiarVentures/graphene +// Type definitions for xadesjs v1.0.0 +// Project: https://github.com/PeculiarVentures/xadesjs // Definitions by: Stepan Miroshin // Definitions: https://github.com/borisyankov/DefinitelyTyped From 420c0d7ab551c4a938a32fabb11636d569c8a3d9 Mon Sep 17 00:00:00 2001 From: microshine Date: Mon, 9 May 2016 14:51:31 +0300 Subject: [PATCH 005/242] Change Promise to PromiseType --- xadesjs/promise.d.ts | 14 ----------- xadesjs/xadesjs.d.ts | 58 ++++++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 43 deletions(-) delete mode 100644 xadesjs/promise.d.ts diff --git a/xadesjs/promise.d.ts b/xadesjs/promise.d.ts deleted file mode 100644 index 96b926633b..0000000000 --- a/xadesjs/promise.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -interface PromiseFunc { - (resolve: (...args: any[]) => void, reject: (...args: any[]) => void): void; -} - -declare class Promise { - constructor(func: PromiseFunc); - - then(resolve: (...args: any[]) => any): Promise; - then(resolve: (...args: any[]) => any, reject: (...args: any[]) => any): Promise; - catch(reject: (...args: any[]) => any): void; - - static resolve(...args: any[]): Promise; - static reject(...args: any[]): Promise; -} \ No newline at end of file diff --git a/xadesjs/xadesjs.d.ts b/xadesjs/xadesjs.d.ts index fc7d1b4bd6..cad137db05 100644 --- a/xadesjs/xadesjs.d.ts +++ b/xadesjs/xadesjs.d.ts @@ -3,8 +3,6 @@ // Definitions by: Stepan Miroshin // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// - /** * A pure Javascript implementation of XMLDSIG and XAdES based on Web Crypto https://xadesjs.com * v1.0.0 @@ -12,6 +10,8 @@ declare namespace xadesjs { + type PromiseType = any; + const APPLICATION_XML: string; class XmlError extends Error { @@ -149,7 +149,7 @@ declare namespace xadesjs { getAlgorithmName(): string; } interface IHashAlgorithm extends IAlgorithm { - getHash(xml: string): Promise; + getHash(xml: string): PromiseType; } interface IHashAlgorithmConstructable { new (): IHashAlgorithm; @@ -160,11 +160,11 @@ declare namespace xadesjs { getAlgorithmName(): string; } abstract class HashAlgorithm extends XmlAlgorithm implements IHashAlgorithm { - getHash(xml: string): Promise; + getHash(xml: string): PromiseType; } interface ISignatureAlgorithm extends IAlgorithm { - getSignature(signedInfo: string, signingKey: CryptoKey, algorithm: Algorithm): Promise; - verifySignature(signedInfo: string, key: CryptoKey, signatureValue: string, algorithm?: Algorithm): Promise; + getSignature(signedInfo: string, signingKey: CryptoKey, algorithm: Algorithm): PromiseType; + verifySignature(signedInfo: string, key: CryptoKey, signatureValue: string, algorithm?: Algorithm): PromiseType; } interface ISignatureAlgorithmConstructable { new (): ISignatureAlgorithm; @@ -173,11 +173,11 @@ declare namespace xadesjs { /** * Sign the given string using the given key */ - getSignature(signedInfo: string, signingKey: CryptoKey, algorithm: Algorithm): Promise; + getSignature(signedInfo: string, signingKey: CryptoKey, algorithm: Algorithm): PromiseType; /** * Verify the given signature of the given string using key */ - verifySignature(signedInfo: string, key: CryptoKey, signatureValue: string, algorithm?: Algorithm): Promise; + verifySignature(signedInfo: string, key: CryptoKey, signatureValue: string, algorithm?: Algorithm): PromiseType; } const SHA1: string; @@ -368,9 +368,9 @@ declare namespace xadesjs { /** * Returns public key from X509Certificate * @param {Algorithm} algorithm - * @returns Promise + * @returns PromiseType */ - exportKey(algorithm: Algorithm): Promise; + exportKey(algorithm: Algorithm): PromiseType; } enum X509IncludeOption { @@ -395,13 +395,13 @@ declare namespace xadesjs { * Gets public key of the X509Data */ Key: CryptoKey; - importKey(key: CryptoKey): Promise; + importKey(key: CryptoKey): PromiseType; /** * Exports key from X509Data object * @param {Algorithm} alg - * @returns Promise + * @returns PromiseType */ - exportKey(alg: Algorithm): Promise; + exportKey(alg: Algorithm): PromiseType; /** * Gets a list of the X.509v3 certificates contained in the KeyInfoX509Data object. */ @@ -492,15 +492,15 @@ declare namespace xadesjs { /** * Imports key to the RSAKeyValue object * @param {CryptoKey} key - * @returns Promise + * @returns PromiseType */ - importKey(key: CryptoKey): Promise; + importKey(key: CryptoKey): PromiseType; /** * Exports key from the RSAKeyValue object * @param {Algorithm} alg - * @returns Promise + * @returns PromiseType */ - exportKey(alg: Algorithm): Promise; + exportKey(alg: Algorithm): PromiseType; /** * Returns the XML representation of the RSA key clause. * @returns Element @@ -552,15 +552,15 @@ declare namespace xadesjs { /** * Imports key to the ECKeyValue object * @param {CryptoKey} key - * @returns Promise + * @returns PromiseType */ - importKey(key: CryptoKey): Promise; + importKey(key: CryptoKey): PromiseType; /** * Exports key from the ECKeyValue object * @param {Algorithm} alg - * @returns Promise + * @returns PromiseType */ - exportKey(alg: Algorithm): Promise; + exportKey(alg: Algorithm): PromiseType; /** * Returns the XML representation of the ECDSA key clause. * @returns Element @@ -804,8 +804,8 @@ declare namespace xadesjs { } interface KeyInfoClause extends IXmlSerializable { Key: CryptoKey; - importKey(key: CryptoKey): Promise; - exportKey(alg: Algorithm): Promise; + importKey(key: CryptoKey): PromiseType; + exportKey(alg: Algorithm): PromiseType; } /** @@ -1060,16 +1060,16 @@ declare namespace xadesjs { /** * Computes an XML digital signature using the specified algorithm. * @param {Algorithm} algorithm Specified WebCrypto Algoriithm - * @returns Promise + * @returns PromiseType */ - ComputeSignature(algorithm: Algorithm): Promise; + ComputeSignature(algorithm: Algorithm): PromiseType; /** * Determines whether the SignedXml.Signature property verifies using the public key in the signature. - * @returns Promise + * @returns PromiseType */ - CheckSignature(): Promise; - CheckSignature(key: CryptoKey): Promise; - CheckSignature(cert: X509Certificate): Promise; + CheckSignature(): PromiseType; + CheckSignature(key: CryptoKey): PromiseType; + CheckSignature(cert: X509Certificate): PromiseType; /** * Loads a SignedXml state from an XML element. * @param {Element} value The XML element to load the SignedXml state from. From 2847bd521629b85a94dca5d74a8c74ea49952a3f Mon Sep 17 00:00:00 2001 From: microshine Date: Mon, 9 May 2016 15:29:18 +0300 Subject: [PATCH 006/242] Fix test error --- xadesjs/xadesjs-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xadesjs/xadesjs-tests.ts b/xadesjs/xadesjs-tests.ts index e83cb0cf6a..e36f903945 100644 --- a/xadesjs/xadesjs-tests.ts +++ b/xadesjs/xadesjs-tests.ts @@ -42,6 +42,6 @@ xadesjs.Application.crypto.subtle.generateKey( .then((doc: string) => { console.log("Signed document:", doc); }) - .catch((e) => { + .catch((e: any) => { console.error("Error", e); - }) \ No newline at end of file + }); \ No newline at end of file From 3af3aec1c295cbb9887820caa07573651d841985 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 8 Jul 2016 23:57:09 -0700 Subject: [PATCH 007/242] reduce() returns Bezier[] --- bezier-js/bezier-js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bezier-js/bezier-js.d.ts b/bezier-js/bezier-js.d.ts index dfc699bc15..8ee85790b1 100644 --- a/bezier-js/bezier-js.d.ts +++ b/bezier-js/bezier-js.d.ts @@ -125,7 +125,7 @@ declare module BezierJs { overlaps(curve: Bezier): boolean; offset(t: number, d?: number): Offset | Bezier[]; simple(): boolean; - reduce(): any[]; + reduce(): Bezier[]; scale(d: Function): Bezier; scale(d: number): Bezier; outline(d1: number, d2?: number, d3?: number, d4?: number): PolyBezier; From 65836b3ed7e704d57005cdd5e12b5e6e09afede5 Mon Sep 17 00:00:00 2001 From: ersimont Date: Sat, 16 Jul 2016 22:06:03 -0400 Subject: [PATCH 008/242] Update rosie.d.ts --- rosie/rosie.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rosie/rosie.d.ts b/rosie/rosie.d.ts index a92359c3d9..f7f679ebb2 100644 --- a/rosie/rosie.d.ts +++ b/rosie/rosie.d.ts @@ -134,11 +134,11 @@ declare namespace rosie { * Factory.define('Person').sequence('id'); * * @param {string} attr - * @param {Array.=} dependencies + * @param {Array.=} | Function dependencies or builder * @param {function(number): *=} builder * @return {Factory} */ - sequence(name: string, dependencies?: string[], builder?: Function) : IFactory; + sequence(name: string, dependenciesOrBuilder?: Function | string[], builder?: Function) : IFactory; /** * Sets a post-processor callback that will receive built objects and the From 8a33d5322850ef83ba0c68fb3a9e34cb95d52277 Mon Sep 17 00:00:00 2001 From: Mattijs Kneppers Date: Mon, 18 Jul 2016 17:17:27 +0200 Subject: [PATCH 009/242] Add stronger typed version of gl-matrix definitions. Also contains all methods of gl-matrix available on 18 july 2016. No tests yet. --- gl-matrix/gl-matrix-typed.d.ts | 3063 ++++++++++++++++++++++++++++++++ 1 file changed, 3063 insertions(+) create mode 100644 gl-matrix/gl-matrix-typed.d.ts diff --git a/gl-matrix/gl-matrix-typed.d.ts b/gl-matrix/gl-matrix-typed.d.ts new file mode 100644 index 0000000000..f64225c6f7 --- /dev/null +++ b/gl-matrix/gl-matrix-typed.d.ts @@ -0,0 +1,3063 @@ +// Type definitions for gl-matrix 2.2.2 +// Project: https://github.com/toji/gl-matrix +// Definitions by: Tat +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Common +declare namespace glMatrix { + /** + * Convert Degree To Radian + * + * @param a Angle in Degrees + */ + export function toRadian(a: number): number; +} + +// vec2 +export class vec2 extends Float32Array { + private typeVec2:number; + + /** + * Creates a new, empty vec2 + * + * @returns a new 2D vector + */ + public static create(): vec2; + + /** + * Creates a new vec2 initialized with values from an existing vector + * + * @param a a vector to clone + * @returns a new 2D vector + */ + public static clone(a: vec2): vec2; + + /** + * Creates a new vec2 initialized with the given values + * + * @param x X component + * @param y Y component + * @returns a new 2D vector + */ + public static fromValues(x: number, y: number): vec2; + + /** + * Copy the values from one vec2 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + public static copy(out: vec2, a: vec2): vec2; + + /** + * Set the components of a vec2 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @returns out + */ + public static set(out: vec2, x: number, y: number): vec2; + + /** + * Adds two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static add(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static subtract(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static sub(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Multiplies two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Multiplies two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Divides two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static divide(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Divides two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static div(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Math.ceil the components of a vec2 + * + * @param {vec2} out the receiving vector + * @param {vec2} a vector to ceil + * @returns {vec2} out + */ + public static ceil(out:vec2, a:vec2):vec2; + + /** + * Math.floor the components of a vec2 + * + * @param {vec2} out the receiving vector + * @param {vec2} a vector to floor + * @returns {vec2} out + */ + public static floor (out:vec2, a:vec2):vec2; + + /** + * Returns the minimum of two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static min(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Returns the maximum of two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static max(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Math.round the components of a vec2 + * + * @param {vec2} out the receiving vector + * @param {vec2} a vector to round + * @returns {vec2} out + */ + public static round(out:vec2, a:vec2):vec2; + + + /** + * Scales a vec2 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ + public static scale(out: vec2, a: vec2, b: number): vec2; + + /** + * Adds two vec2's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ + public static scaleAndAdd(out: vec2, a: vec2, b: vec2, scale: number): vec2; + + /** + * Calculates the euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static distance(a: vec2, b: vec2): number; + + /** + * Calculates the euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static dist(a: vec2, b: vec2): number; + + /** + * Calculates the squared euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static squaredDistance(a: vec2, b: vec2): number; + + /** + * Calculates the squared euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static sqrDist(a: vec2, b: vec2): number; + + /** + * Calculates the length of a vec2 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static length(a: vec2): number; + + /** + * Calculates the length of a vec2 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static len(a: vec2): number; + + /** + * Calculates the squared length of a vec2 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static squaredLength(a: vec2): number; + + /** + * Calculates the squared length of a vec2 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static sqrLen(a: vec2): number; + + /** + * Negates the components of a vec2 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ + public static negate(out: vec2, a: vec2): vec2; + + /** + * Returns the inverse of the components of a vec2 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ + public static inverse(out: vec2, a: vec2): vec2; + + /** + * Normalize a vec2 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ + public static normalize(out: vec2, a: vec2): vec2; + + /** + * Calculates the dot product of two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + public static dot(a: vec2, b: vec2): number; + + /** + * Computes the cross product of two vec2's + * Note that the cross product must by definition produce a 3D vector + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static cross(out: vec2, a: vec2, b: vec2): vec2; + + /** + * Performs a linear interpolation between two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + public static lerp(out: vec2, a: vec2, b: vec2, t: number): vec2; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ + public static random(out: vec2): vec2; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param scale Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ + public static random(out: vec2, scale: number): vec2; + + /** + * Transforms the vec2 with a mat2 + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat2(out: vec2, a: vec2, m: mat2): vec2; + + /** + * Transforms the vec2 with a mat2d + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat2d(out: vec2, a: vec2, m: mat2d): vec2; + + /** + * Transforms the vec2 with a mat3 + * 3rd vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat3(out: vec2, a: vec2, m: mat3): vec2; + + /** + * Transforms the vec2 with a mat4 + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat4(out: vec2, a: vec2, m: mat4): vec2; + + /** + * Perform some operation over an array of vec2s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec2s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + */ + public static forEach(a: vec2, stride: number, offset: number, count: number, + fn: (a: vec2, b: vec2, arg: any) => void, arg: any): vec2; + + /** + * Perform some operation over an array of vec2s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec2s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + */ + public static forEach(a: vec2, stride: number, offset: number, count: number, + fn: (a: vec2, b: vec2) => void): vec2; + + /** + * Returns a string representation of a vector + * + * @param a vector to represent as a string + * @returns string representation of the vector + */ + public static str(a: vec2): string; + + /** + * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) + * + * @param {vec2} a The first vector. + * @param {vec2} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static exactEquals (a:vec2, b:vec2): boolean; + + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {vec2} a The first vector. + * @param {vec2} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static equals (a:vec2, b:vec2) : boolean; +} + +// vec3 +export class vec3 extends Float32Array { + private typeVec3:number; + + /** + * Creates a new, empty vec3 + * + * @returns a new 3D vector + */ + public static create(): vec3; + + /** + * Creates a new vec3 initialized with values from an existing vector + * + * @param a vector to clone + * @returns a new 3D vector + */ + public static clone(a: vec3): vec3; + + /** + * Creates a new vec3 initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @returns a new 3D vector + */ + public static fromValues(x: number, y: number, z: number): vec3; + + /** + * Copy the values from one vec3 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + public static copy(out: vec3, a: vec3): vec3; + + /** + * Set the components of a vec3 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @param z Z component + * @returns out + */ + public static set(out: vec3, x: number, y: number, z: number): vec3; + + /** + * Adds two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static add(out: vec3, a: vec3, b: vec3): vec3; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static subtract(out: vec3, a: vec3, b: vec3): vec3; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static sub(out: vec3, a: vec3, b: vec3): vec3 + + /** + * Multiplies two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: vec3, a: vec3, b: vec3): vec3; + + /** + * Multiplies two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: vec3, a: vec3, b: vec3): vec3; + + /** + * Divides two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static divide(out: vec3, a: vec3, b: vec3): vec3; + + /** + * Divides two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static div(out: vec3, a: vec3, b: vec3): vec3; + + /** + * Math.ceil the components of a vec3 + * + * @param {vec3} out the receiving vector + * @param {vec3} a vector to ceil + * @returns {vec3} out + */ + public static ceil (out:vec3, a:vec3) : vec3; + + /** + * Math.floor the components of a vec3 + * + * @param {vec3} out the receiving vector + * @param {vec3} a vector to floor + * @returns {vec3} out + */ + public static floor (out:vec3, a:vec3) :vec3; + + /** + * Returns the minimum of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static min(out: vec3, a: vec3, b: vec3): vec3; + + /** + * Returns the maximum of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static max(out: vec3, a: vec3, b: vec3): vec3; + + /** + * Math.round the components of a vec3 + * + * @param {vec3} out the receiving vector + * @param {vec3} a vector to round + * @returns {vec3} out + */ + public static round (out:vec3, a:vec3) : vec3 + + /** + * Scales a vec3 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ + public static scale(out: vec3, a: vec3, b: number): vec3; + + /** + * Adds two vec3's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ + public static scaleAndAdd(out: vec3, a: vec3, b: vec3, scale: number): vec3; + + /** + * Calculates the euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static distance(a: vec3, b: vec3): number; + + /** + * Calculates the euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static dist(a: vec3, b: vec3): number; + + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static squaredDistance(a: vec3, b: vec3): number; + + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static sqrDist(a: vec3, b: vec3): number; + + /** + * Calculates the length of a vec3 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static length(a: vec3): number; + + /** + * Calculates the length of a vec3 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static len(a: vec3): number; + + /** + * Calculates the squared length of a vec3 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static squaredLength(a: vec3): number; + + /** + * Calculates the squared length of a vec3 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static sqrLen(a: vec3): number; + + /** + * Negates the components of a vec3 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ + public static negate(out: vec3, a: vec3): vec3; + + /** + * Returns the inverse of the components of a vec3 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ + public static inverse(out: vec3, a: vec3): vec3; + + /** + * Normalize a vec3 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ + public static normalize(out: vec3, a: vec3): vec3; + + /** + * Calculates the dot product of two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + public static dot(a: vec3, b: vec3): number; + + /** + * Computes the cross product of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static cross(out: vec3, a: vec3, b: vec3): vec3; + + /** + * Performs a linear interpolation between two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + public static lerp(out: vec3, a: vec3, b: vec3, t: number): vec3; + + /** + * Performs a hermite interpolation with two control points + * + * @param {vec3} out the receiving vector + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @param {vec3} c the third operand + * @param {vec3} d the fourth operand + * @param {number} t interpolation amount between the two inputs + * @returns {vec3} out + */ + public static hermite (out:vec3, a:vec3, b:vec3, c:vec3, d:vec3, t:number) : vec3; + + /** + * Performs a bezier interpolation with two control points + * + * @param {vec3} out the receiving vector + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @param {vec3} c the third operand + * @param {vec3} d the fourth operand + * @param {number} t interpolation amount between the two inputs + * @returns {vec3} out + */ + public static bezier (out:vec3, a:vec3, b:vec3, c:vec3, d:vec3, t:number) :vec3; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ + public static random(out: vec3): vec3; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns out + */ + public static random(out: vec3, scale: number): vec3; + + /** + * Transforms the vec3 with a mat3. + * + * @param out the receiving vector + * @param a the vector to transform + * @param m the 3x3 matrix to transform with + * @returns out + */ + public static transformMat3(out: vec3, a: vec3, m: mat3): vec3; + + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat4(out: vec3, a: vec3, m: mat4): vec3; + + /** + * Transforms the vec3 with a quat + * + * @param out the receiving vector + * @param a the vector to transform + * @param q quaternion to transform with + * @returns out + */ + public static transformQuat(out: vec3, a: vec3, q: quat): vec3; + + + /** + * Rotate a 3D vector around the x-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + public static rotateX(out: vec3, a: vec3, b: vec3, c: number): vec3; + + /** + * Rotate a 3D vector around the y-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + public static rotateY(out: vec3, a: vec3, b: vec3, c: number): vec3; + + /** + * Rotate a 3D vector around the z-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + public static rotateZ(out: vec3, a: vec3, b: vec3, c: number): vec3; + + /** + * Perform some operation over an array of vec3s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec3s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + * @function + */ + public static forEach(a: vec3, stride: number, offset: number, count: number, + fn: (a: vec3, b: vec3, arg: any) => void, arg: any): vec3; + + /** + * Perform some operation over an array of vec3s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec3s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + * @function + */ + public static forEach(a: vec3, stride: number, offset: number, count: number, + fn: (a: vec3, b: vec3) => void): vec3; + + /** + * Get the angle between two 3D vectors + * @param a The first operand + * @param b The second operand + * @returns The angle in radians + */ + public static angle(a: vec3, b: vec3): number; + + /** + * Returns a string representation of a vector + * + * @param a vector to represent as a string + * @returns string representation of the vector + */ + public static str(a: vec3): string; + + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {vec3} a The first vector. + * @param {vec3} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static exactEquals (a, b): boolean + + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {vec3} a The first vector. + * @param {vec3} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static equals (a, b) : boolean +} + +// vec4 +export class vec4 extends Float32Array { + private typeVec3:number; + + /** + * Creates a new, empty vec4 + * + * @returns a new 4D vector + */ + public static create(): vec4; + + /** + * Creates a new vec4 initialized with values from an existing vector + * + * @param a vector to clone + * @returns a new 4D vector + */ + public static clone(a: vec4): vec4; + + /** + * Creates a new vec4 initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns a new 4D vector + */ + public static fromValues(x: number, y: number, z: number, w: number): vec4; + + /** + * Copy the values from one vec4 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + public static copy(out: vec4, a: vec4): vec4; + + /** + * Set the components of a vec4 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns out + */ + public static set(out: vec4, x: number, y: number, z: number, w: number): vec4; + + /** + * Adds two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static add(out: vec4, a: vec4, b: vec4): vec4; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static subtract(out: vec4, a: vec4, b: vec4): vec4; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static sub(out: vec4, a: vec4, b: vec4): vec4; + + /** + * Multiplies two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: vec4, a: vec4, b: vec4): vec4; + + /** + * Multiplies two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: vec4, a: vec4, b: vec4): vec4; + + /** + * Divides two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static divide(out: vec4, a: vec4, b: vec4): vec4; + + /** + * Divides two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static div(out: vec4, a: vec4, b: vec4): vec4; + + /** + * Math.ceil the components of a vec4 + * + * @param {vec4} out the receiving vector + * @param {vec4} a vector to ceil + * @returns {vec4} out + */ + public static ceil (out:vec4, a:vec4) : vec4; + + /** + * Math.floor the components of a vec4 + * + * @param {vec4} out the receiving vector + * @param {vec4} a vector to floor + * @returns {vec4} out + */ + public static floor (out:vec4, a:vec4) : vec4; + + /** + * Returns the minimum of two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static min(out: vec4, a: vec4, b: vec4): vec4; + + /** + * Returns the maximum of two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static max(out: vec4, a: vec4, b: vec4): vec4; + + /** + * Math.round the components of a vec4 + * + * @param {vec4} out the receiving vector + * @param {vec4} a vector to round + * @returns {vec4} out + */ + public static round (out:vec4, a:vec4): vec4; + + /** + * Scales a vec4 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ + public static scale(out: vec4, a: vec4, b: number): vec4; + + /** + * Adds two vec4's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ + public static scaleAndAdd(out: vec4, a: vec4, b: vec4, scale: number): vec4; + + /** + * Calculates the euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static distance(a: vec4, b: vec4): number; + + /** + * Calculates the euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static dist(a: vec4, b: vec4): number; + + /** + * Calculates the squared euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static squaredDistance(a: vec4, b: vec4): number; + + /** + * Calculates the squared euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static sqrDist(a: vec4, b: vec4): number; + + /** + * Calculates the length of a vec4 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static length(a: vec4): number; + + /** + * Calculates the length of a vec4 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static len(a: vec4): number; + + /** + * Calculates the squared length of a vec4 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static squaredLength(a: vec4): number; + + /** + * Calculates the squared length of a vec4 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static sqrLen(a: vec4): number; + + /** + * Negates the components of a vec4 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ + public static negate(out: vec4, a: vec4): vec4; + + /** + * Returns the inverse of the components of a vec4 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ + public static inverse(out: vec4, a: vec4): vec4; + + /** + * Normalize a vec4 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ + public static normalize(out: vec4, a: vec4): vec4; + + /** + * Calculates the dot product of two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + public static dot(a: vec4, b: vec4): number; + + /** + * Performs a linear interpolation between two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + public static lerp(out: vec4, a: vec4, b: vec4, t: number): vec4; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ + public static random(out: vec4): vec4; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param scale length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ + public static random(out: vec4, scale: number): vec4; + + /** + * Transforms the vec4 with a mat4. + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat4(out: vec4, a: vec4, m: mat4): vec4; + + /** + * Transforms the vec4 with a quat + * + * @param out the receiving vector + * @param a the vector to transform + * @param q quaternion to transform with + * @returns out + */ + + public static transformQuat(out: vec4, a: vec4, q: quat): vec4; + + /** + * Perform some operation over an array of vec4s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec4s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + * @function + */ + public static forEach(a: vec4, stride: number, offset: number, count: number, + fn: (a: vec4, b: vec4, arg: any) => void, arg: any): vec4; + + /** + * Perform some operation over an array of vec4s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec4s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + * @function + */ + public static forEach(a: vec4, stride: number, offset: number, count: number, + fn: (a: vec4, b: vec4) => void): vec4; + + /** + * Returns a string representation of a vector + * + * @param a vector to represent as a string + * @returns string representation of the vector + */ + public static str(a: vec4): string; + + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {vec4} a The first vector. + * @param {vec4} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static exactEquals (a:vec4, b:vec4) : boolean; + + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {vec4} a The first vector. + * @param {vec4} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static equals (a:vec4, b:vec4) : boolean; +} + +// mat2 +export class mat2 extends Float32Array { + private typeMat2:number; + + /** + * Creates a new identity mat2 + * + * @returns a new 2x2 matrix + */ + public static create():mat2; + + /** + * Creates a new mat2 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 2x2 matrix + */ + public static clone(a:mat2):mat2; + + /** + * Copy the values from one mat2 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static copy(out:mat2, a:mat2):mat2; + + /** + * Set a mat2 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + public static identity(out:mat2):mat2; + + /** + * Create a new mat2 with the given values + * + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m10 Component in column 1, row 0 position (index 2) + * @param {number} m11 Component in column 1, row 1 position (index 3) + * @returns {mat2} out A new 2x2 matrix + */ + public static fromValues(m00:number, m01:number, m10:number, m11:number):mat2; + + /** + * Set the components of a mat2 to the given values + * + * @param {mat2} out the receiving matrix + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m10 Component in column 1, row 0 position (index 2) + * @param {number} m11 Component in column 1, row 1 position (index 3) + * @returns {mat2} out + */ + public static set(out:mat2, m00:number, m01:number, m10:number, m11:number):mat2; + + /** + * Transpose the values of a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static transpose(out:mat2, a:mat2):mat2; + + /** + * Inverts a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static invert(out:mat2, a:mat2):mat2; + + /** + * Calculates the adjugate of a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static adjoint(out:mat2, a:mat2):mat2; + + /** + * Calculates the determinant of a mat2 + * + * @param a the source matrix + * @returns determinant of a + */ + public static determinant(a:mat2):number; + + /** + * Multiplies two mat2's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out:mat2, a:mat2, b:mat2):mat2; + + /** + * Multiplies two mat2's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out:mat2, a:mat2, b:mat2):mat2; + + /** + * Rotates a mat2 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotate(out:mat2, a:mat2, rad:number):mat2; + + /** + * Scales the mat2 by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param v the vec2 to scale the matrix by + * @returns out + **/ + public static scale(out:mat2, a:mat2, v:vec2):mat2; + + /** + * Creates a matrix from a given angle + * This is equivalent to (but much faster than): + * + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * + * @param {mat2} out mat2 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat2} out + */ + public static fromRotation(out:mat2, rad:number):mat2; + + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * + * @param {mat2} out mat2 receiving operation result + * @param {vec2} v Scaling vector + * @returns {mat2} out + */ + public static fromScaling(out:mat2, v:vec2); + + /** + * Returns a string representation of a mat2 + * + * @param a matrix to represent as a string + * @returns string representation of the matrix + */ + public static str(a:mat2):string; + + /** + * Returns Frobenius norm of a mat2 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + public static frob(a:mat2):number; + + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @param L the lower triangular matrix + * @param D the diagonal matrix + * @param U the upper triangular matrix + * @param a the input matrix to factorize + */ + public static LDU(L:mat2, D:mat2, U:mat2, a:mat2):mat2; + + /** + * Adds two mat2's + * + * @param {mat2} out the receiving matrix + * @param {mat2} a the first operand + * @param {mat2} b the second operand + * @returns {mat2} out + */ + public static add(out:mat2, a:mat2, b:mat2):mat2; + + /** + * Subtracts matrix b from matrix a + * + * @param {mat2} out the receiving matrix + * @param {mat2} a the first operand + * @param {mat2} b the second operand + * @returns {mat2} out + */ + public static subtract (out:mat2, a:mat2, b:mat2):mat2; + + /** + * Subtracts matrix b from matrix a + * + * @param {mat2} out the receiving matrix + * @param {mat2} a the first operand + * @param {mat2} b the second operand + * @returns {mat2} out + */ + public static sub (out:mat2, a:mat2, b:mat2):mat2; + + /** + * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) + * + * @param {mat2} a The first matrix. + * @param {mat2} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static exactEquals (a:mat2, b:mat2):boolean; + + /** + * Returns whether or not the matrices have approximately the same elements in the same position. + * + * @param {mat2} a The first matrix. + * @param {mat2} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static equals (a:mat2, b:mat2) :boolean; + + /** + * Multiply each element of the matrix by a scalar. + * + * @param {mat2} out the receiving matrix + * @param {mat2} a the matrix to scale + * @param {number} b amount to scale the matrix's elements by + * @returns {mat2} out + */ + public static multiplyScalar (out:mat2, a:mat2, b:number) :mat2 + + /** + * Adds two mat2's after multiplying each element of the second operand by a scalar value. + * + * @param {mat2} out the receiving vector + * @param {mat2} a the first operand + * @param {mat2} b the second operand + * @param {number} scale the amount to scale b's elements by before adding + * @returns {mat2} out + */ + public static multiplyScalarAndAdd (out:mat2, a:mat2, b:mat2, scale:number): mat2 + + + +} + +// mat2d +export class mat2d extends Float32Array { + private typeMat2d:number; + + /** + * Creates a new identity mat2d + * + * @returns a new 2x3 matrix + */ + public static create(): mat2d; + + /** + * Creates a new mat2d initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 2x3 matrix + */ + public static clone(a: mat2d): mat2d; + + /** + * Copy the values from one mat2d to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static copy(out: mat2d, a: mat2d): mat2d; + + /** + * Set a mat2d to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + public static identity(out: mat2d): mat2d; + + /** + * Create a new mat2d with the given values + * + * @param {number} a Component A (index 0) + * @param {number} b Component B (index 1) + * @param {number} c Component C (index 2) + * @param {number} d Component D (index 3) + * @param {number} tx Component TX (index 4) + * @param {number} ty Component TY (index 5) + * @returns {mat2d} A new mat2d + */ + public static fromValues (a:number, b:number, c:number, d:number, tx:number, ty:number) : mat2d + + + /** + * Set the components of a mat2d to the given values + * + * @param {mat2d} out the receiving matrix + * @param {number} a Component A (index 0) + * @param {number} b Component B (index 1) + * @param {number} c Component C (index 2) + * @param {number} d Component D (index 3) + * @param {number} tx Component TX (index 4) + * @param {number} ty Component TY (index 5) + * @returns {mat2d} out + */ + public static set (out:mat2d, a:number, b:number, c:number, d:number, tx:number, ty:number) :mat2d + + /** + * Inverts a mat2d + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static invert(out: mat2d, a: mat2d): mat2d; + + /** + * Calculates the determinant of a mat2d + * + * @param a the source matrix + * @returns determinant of a + */ + public static determinant(a: mat2d): number; + + /** + * Multiplies two mat2d's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: mat2d, a: mat2d, b: mat2d): mat2d; + + /** + * Multiplies two mat2d's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: mat2d, a: mat2d, b: mat2d): mat2d; + + /** + * Rotates a mat2d by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotate(out: mat2d, a: mat2d, rad: number): mat2d; + + /** + * Scales the mat2d by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v the vec2 to scale the matrix by + * @returns out + **/ + public static scale(out: mat2d, a: mat2d, v: vec2): mat2d; + + /** + * Translates the mat2d by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v the vec2 to translate the matrix by + * @returns out + **/ + public static translate(out: mat2d, a: mat2d, v: vec2): mat2d; + + /** + * Creates a matrix from a given angle + * This is equivalent to (but much faster than): + * + * mat2d.identity(dest); + * mat2d.rotate(dest, dest, rad); + * + * @param {mat2d} out mat2d receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat2d} out + */ + public static fromRotation (out:mat2d, rad:number): mat2d; + + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat2d.identity(dest); + * mat2d.scale(dest, dest, vec); + * + * @param {mat2d} out mat2d receiving operation result + * @param {vec2} v Scaling vector + * @returns {mat2d} out + */ + public static fromScaling (out:mat2d, v:vec2):mat2d; + + /** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat2d.identity(dest); + * mat2d.translate(dest, dest, vec); + * + * @param {mat2d} out mat2d receiving operation result + * @param {vec2} v Translation vector + * @returns {mat2d} out + */ + public static fromTranslation (out:mat2d, v:vec2):mat2d + + /** + * Returns a string representation of a mat2d + * + * @param a matrix to represent as a string + * @returns string representation of the matrix + */ + public static str(a: mat2d): string; + + /** + * Returns Frobenius norm of a mat2d + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + public static frob(a: mat2d): number; + + /** + * Adds two mat2d's + * + * @param {mat2d} out the receiving matrix + * @param {mat2d} a the first operand + * @param {mat2d} b the second operand + * @returns {mat2d} out + */ + public static add (out: mat2d, a: mat2d, b: mat2d): mat2d + + /** + * Subtracts matrix b from matrix a + * + * @param {mat2d} out the receiving matrix + * @param {mat2d} a the first operand + * @param {mat2d} b the second operand + * @returns {mat2d} out + */ + public static subtract(out: mat2d, a: mat2d, b: mat2d): mat2d + + /** + * Subtracts matrix b from matrix a + * + * @param {mat2d} out the receiving matrix + * @param {mat2d} a the first operand + * @param {mat2d} b the second operand + * @returns {mat2d} out + */ + public static sub(out: mat2d, a: mat2d, b: mat2d): mat2d + + /** + * Multiply each element of the matrix by a scalar. + * + * @param {mat2d} out the receiving matrix + * @param {mat2d} a the matrix to scale + * @param {number} b amount to scale the matrix's elements by + * @returns {mat2d} out + */ + public static multiplyScalar (out: mat2d, a: mat2d, b: mat2d): mat2d; + + /** + * Adds two mat2d's after multiplying each element of the second operand by a scalar value. + * + * @param {mat2d} out the receiving vector + * @param {mat2d} a the first operand + * @param {mat2d} b the second operand + * @param {number} scale the amount to scale b's elements by before adding + * @returns {mat2d} out + */ + public static multiplyScalarAndAdd (out: mat2d, a: mat2d, b: mat2d, scale:number) : mat2d + + /** + * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) + * + * @param {mat2d} a The first matrix. + * @param {mat2d} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static exactEquals (a: mat2d, b: mat2d): boolean; + + /** + * Returns whether or not the matrices have approximately the same elements in the same position. + * + * @param {mat2d} a The first matrix. + * @param {mat2d} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static equals (a: mat2d, b: mat2d): boolean +} + +// mat3 +export class mat3 extends Float32Array { + private typeMat3:number; + + /** + * Creates a new identity mat3 + * + * @returns a new 3x3 matrix + */ + public static create():mat3; + + /** + * Copies the upper-left 3x3 values into the given mat3. + * + * @param {mat3} out the receiving 3x3 matrix + * @param {mat4} a the source 4x4 matrix + * @returns {mat3} out + */ + public static fromMat4(out:mat3, a:mat4):mat3 + + /** + * Creates a new mat3 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 3x3 matrix + */ + public static clone(a:mat3):mat3; + + /** + * Copy the values from one mat3 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static copy(out:mat3, a:mat3):mat3; + + /** + * Create a new mat3 with the given values + * + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m02 Component in column 0, row 2 position (index 2) + * @param {number} m10 Component in column 1, row 0 position (index 3) + * @param {number} m11 Component in column 1, row 1 position (index 4) + * @param {number} m12 Component in column 1, row 2 position (index 5) + * @param {number} m20 Component in column 2, row 0 position (index 6) + * @param {number} m21 Component in column 2, row 1 position (index 7) + * @param {number} m22 Component in column 2, row 2 position (index 8) + * @returns {mat3} A new mat3 + */ + public static fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22):mat3; + + + /** + * Set the components of a mat3 to the given values + * + * @param {mat3} out the receiving matrix + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m02 Component in column 0, row 2 position (index 2) + * @param {number} m10 Component in column 1, row 0 position (index 3) + * @param {number} m11 Component in column 1, row 1 position (index 4) + * @param {number} m12 Component in column 1, row 2 position (index 5) + * @param {number} m20 Component in column 2, row 0 position (index 6) + * @param {number} m21 Component in column 2, row 1 position (index 7) + * @param {number} m22 Component in column 2, row 2 position (index 8) + * @returns {mat3} out + */ + public static set(out:mat3, m00:number, m01:number, m02:number, m10:number, m11:number, m12:number, m20:number, m21:number, m22:number):mat3 + + /** + * Set a mat3 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + public static identity(out:mat3):mat3; + + /** + * Transpose the values of a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static transpose(out:mat3, a:mat3):mat3; + + /** + * Inverts a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static invert(out:mat3, a:mat3):mat3; + + /** + * Calculates the adjugate of a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static adjoint(out:mat3, a:mat3):mat3; + + /** + * Calculates the determinant of a mat3 + * + * @param a the source matrix + * @returns determinant of a + */ + public static determinant(a:mat3):number; + + /** + * Multiplies two mat3's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out:mat3, a:mat3, b:mat3):mat3; + + /** + * Multiplies two mat3's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out:mat3, a:mat3, b:mat3):mat3; + + + /** + * Translate a mat3 by the given vector + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v vector to translate by + * @returns out + */ + public static translate(out:mat3, a:mat3, v:vec3):mat3; + + /** + * Rotates a mat3 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotate(out:mat3, a:mat3, rad:number):mat3; + + /** + * Scales the mat3 by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param v the vec2 to scale the matrix by + * @returns out + **/ + public static scale(out:mat3, a:mat3, v:vec2):mat3; + + /** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * + * @param {mat3} out mat3 receiving operation result + * @param {vec2} v Translation vector + * @returns {mat3} out + */ + public static fromTranslation(out:mat3, v:vec2):mat3 + + /** + * Creates a matrix from a given angle + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * + * @param {mat3} out mat3 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat3} out + */ + public static fromRotation(out:mat3, rad:number):mat3 + + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * + * @param {mat3} out mat3 receiving operation result + * @param {vec2} v Scaling vector + * @returns {mat3} out + */ + public static fromScaling(out:mat3, v:vec2):mat3 + + /** + * Copies the values from a mat2d into a mat3 + * + * @param out the receiving matrix + * @param {mat2d} a the matrix to copy + * @returns out + **/ + public static fromMat2d(out:mat3, a:mat2d):mat3; + + /** + * Copies the upper-left 3x3 values into the given mat3. + * + * @param out the receiving 3x3 matrix + * @param a the source 4x4 matrix + * @returns out + */ + public static fromMat4(out:mat3, a:mat4):mat3; + + /** + * Calculates a 3x3 matrix from the given quaternion + * + * @param out mat3 receiving operation result + * @param q Quaternion to create matrix from + * + * @returns out + */ + public static fromQuat(out:mat3, q:quat):mat3; + + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * + * @param out mat3 receiving operation result + * @param a Mat4 to derive the normal matrix from + * + * @returns out + */ + public static normalFromMat4(out:mat3, a:mat3):mat3; + + /** + * Returns a string representation of a mat3 + * + * @param mat matrix to represent as a string + * @returns string representation of the matrix + */ + public static str(mat:mat3):string; + + /** + * Returns Frobenius norm of a mat3 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + public static frob(a:mat3):number; + + /** + * Adds two mat3's + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the first operand + * @param {mat3} b the second operand + * @returns {mat3} out + */ + public static add(out:mat3, a:mat3, b:mat3):mat3 + + /** + * Subtracts matrix b from matrix a + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the first operand + * @param {mat3} b the second operand + * @returns {mat3} out + */ + public static subtract(out:mat3, a:mat3, b:mat3):mat3 + + /** + * Subtracts matrix b from matrix a + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the first operand + * @param {mat3} b the second operand + * @returns {mat3} out + */ + public static sub(out:mat3, a:mat3, b:mat3):mat3 + + /** + * Multiply each element of the matrix by a scalar. + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the matrix to scale + * @param {number} b amount to scale the matrix's elements by + * @returns {mat3} out + */ + public static multiplyScalar(out:mat3, a:mat3, b:number):mat3 + + /** + * Adds two mat3's after multiplying each element of the second operand by a scalar value. + * + * @param {mat3} out the receiving vector + * @param {mat3} a the first operand + * @param {mat3} b the second operand + * @param {number} scale the amount to scale b's elements by before adding + * @returns {mat3} out + */ + public static multiplyScalarAndAdd(out:mat3, a:mat3, b:mat3, scale:number):mat3 + + /** + * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) + * + * @param {mat3} a The first matrix. + * @param {mat3} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static exactEquals(a:mat3, b:mat3):boolean; + + /** + * Returns whether or not the matrices have approximately the same elements in the same position. + * + * @param {mat3} a The first matrix. + * @param {mat3} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static equals(a:mat3, b:mat3):boolean +} + +// mat4 +export class mat4 extends Float32Array { + private typeMat4:number; + + /** + * Creates a new identity mat4 + * + * @returns a new 4x4 matrix + */ + public static create():mat4; + + /** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 4x4 matrix + */ + public static clone(a:mat4):mat4; + + /** + * Copy the values from one mat4 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static copy(out:mat4, a:mat4):mat4; + + + /** + * Create a new mat4 with the given values + * + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m02 Component in column 0, row 2 position (index 2) + * @param {number} m03 Component in column 0, row 3 position (index 3) + * @param {number} m10 Component in column 1, row 0 position (index 4) + * @param {number} m11 Component in column 1, row 1 position (index 5) + * @param {number} m12 Component in column 1, row 2 position (index 6) + * @param {number} m13 Component in column 1, row 3 position (index 7) + * @param {number} m20 Component in column 2, row 0 position (index 8) + * @param {number} m21 Component in column 2, row 1 position (index 9) + * @param {number} m22 Component in column 2, row 2 position (index 10) + * @param {number} m23 Component in column 2, row 3 position (index 11) + * @param {number} m30 Component in column 3, row 0 position (index 12) + * @param {number} m31 Component in column 3, row 1 position (index 13) + * @param {number} m32 Component in column 3, row 2 position (index 14) + * @param {number} m33 Component in column 3, row 3 position (index 15) + * @returns {mat4} A new mat4 + */ + public static fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33):mat4; + + /** + * Set the components of a mat4 to the given values + * + * @param {mat4} out the receiving matrix + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m02 Component in column 0, row 2 position (index 2) + * @param {number} m03 Component in column 0, row 3 position (index 3) + * @param {number} m10 Component in column 1, row 0 position (index 4) + * @param {number} m11 Component in column 1, row 1 position (index 5) + * @param {number} m12 Component in column 1, row 2 position (index 6) + * @param {number} m13 Component in column 1, row 3 position (index 7) + * @param {number} m20 Component in column 2, row 0 position (index 8) + * @param {number} m21 Component in column 2, row 1 position (index 9) + * @param {number} m22 Component in column 2, row 2 position (index 10) + * @param {number} m23 Component in column 2, row 3 position (index 11) + * @param {number} m30 Component in column 3, row 0 position (index 12) + * @param {number} m31 Component in column 3, row 1 position (index 13) + * @param {number} m32 Component in column 3, row 2 position (index 14) + * @param {number} m33 Component in column 3, row 3 position (index 15) + * @returns {mat4} out + */ + public static set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33):mat4; + + /** + * Set a mat4 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + public static identity(out:mat4):mat4; + + /** + * Transpose the values of a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static transpose(out:mat4, a:mat4):mat4; + + /** + * Inverts a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static invert(out:mat4, a:mat4):mat4; + + /** + * Calculates the adjugate of a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static adjoint(out:mat4, a:mat4):mat4; + + /** + * Calculates the determinant of a mat4 + * + * @param a the source matrix + * @returns determinant of a + */ + public static determinant(a:mat4):number; + + /** + * Multiplies two mat4's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out:mat4, a:mat4, b:mat4):mat4; + + /** + * Multiplies two mat4's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out:mat4, a:mat4, b:mat4):mat4; + + /** + * Translate a mat4 by the given vector + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v vector to translate by + * @returns out + */ + public static translate(out:mat4, a:mat4, v:vec3):mat4; + + /** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param out the receiving matrix + * @param a the matrix to scale + * @param v the vec3 to scale the matrix by + * @returns out + **/ + public static scale(out:mat4, a:mat4, v:vec3):mat4; + + /** + * Rotates a mat4 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @param axis the axis to rotate around + * @returns out + */ + public static rotate(out:mat4, a:mat4, rad:number, axis:vec3):mat4; + + /** + * Rotates a matrix by the given angle around the X axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotateX(out:mat4, a:mat4, rad:number):mat4; + + /** + * Rotates a matrix by the given angle around the Y axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotateY(out:mat4, a:mat4, rad:number):mat4; + + /** + * Rotates a matrix by the given angle around the Z axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotateZ(out:mat4, a:mat4, rad:number):mat4; + + /** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ + public static fromTranslation(out:mat4, v:vec3):mat4 + + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ + public static fromScaling(out:mat4, v:vec3):mat4 + + /** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * + * @param {mat4} out mat4 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ + public static fromRotation(out:mat4, rad:number, axis:vec3):mat4 + + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * + * @param {mat4} out mat4 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + public static fromXRotation(out:mat4, rad:number):mat4 + + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * + * @param {mat4} out mat4 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + public static fromYRotation(out:mat4, rad:number):mat4 + + + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * + * @param {mat4} out mat4 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + public static fromZRotation(out:mat4, rad:number):mat4 + + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @param v Translation vector + * @returns out + */ + public static fromRotationTranslation(out:mat4, q:quat, v:vec3):mat4; + + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @param {vec3} out Vector to receive translation component + * @param {mat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + public static getTranslation(out:vec3, mat:mat4):vec3; + + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @param {quat} out Quaternion to receive the rotation component + * @param {mat4} mat Matrix to be decomposed (input) + * @return {quat} out + */ + public static getRotation(out:quat, mat:mat4):quat; + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @param v Translation vector + * @param s Scaling vector + * @returns out + */ + public static fromRotationTranslationScale(out:mat4, q:quat, v:vec3, s:vec3):mat4; + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Rotation quaternion + * @param {vec3} v Translation vector + * @param {vec3} s Scaling vector + * @param {vec3} o The origin vector around which to scale and rotate + * @returns {mat4} out + */ + public static fromRotationTranslationScaleOrigin(out:mat4, q:quat, v:vec3, s:vec3, o:vec3):mat4 + + /** + * Calculates a 4x4 matrix from the given quaternion + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Quaternion to create matrix from + * + * @returns {mat4} out + */ + public static fromQuat(out:mat4, q:quat):mat4 + + /** + * Generates a frustum matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param left Left bound of the frustum + * @param right Right bound of the frustum + * @param bottom Bottom bound of the frustum + * @param top Top bound of the frustum + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + public static frustum(out:mat4, left:number, right:number, + bottom:number, top:number, near:number, far:number):mat4; + + /** + * Generates a perspective projection matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param fovy Vertical field of view in radians + * @param aspect Aspect ratio. typically viewport width/height + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + public static perspective(out:mat4, fovy:number, aspect:number, + near:number, far:number):mat4; + + /** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experimental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ + public static perspectiveFromFieldOfView(out:mat4, + fov:{upDegrees:number, downDegrees:number, leftDegrees:number, rightDegrees:number}, + near, far):mat4 + + /** + * Generates a orthogonal projection matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param left Left bound of the frustum + * @param right Right bound of the frustum + * @param bottom Bottom bound of the frustum + * @param top Top bound of the frustum + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + public static ortho(out:mat4, left:number, right:number, + bottom:number, top:number, near:number, far:number):mat4; + + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param out mat4 frustum matrix will be written into + * @param eye Position of the viewer + * @param center Point the viewer is looking at + * @param up vec3 pointing up + * @returns out + */ + public static lookAt(out:mat4, eye:vec3, center:vec3, up:vec3):mat4; + + /** + * Returns a string representation of a mat4 + * + * @param mat matrix to represent as a string + * @returns string representation of the matrix + */ + public static str(mat:mat4):string; + + /** + * Returns Frobenius norm of a mat4 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + public static frob(a:mat4):number; + + /** + * Adds two mat4's + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ + public static add(out:mat4, a:mat4, b:mat4):mat4 + + /** + * Subtracts matrix b from matrix a + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ + public static subtract(out:mat4, a:mat4, b:mat4):mat4 + + /** + * Subtracts matrix b from matrix a + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ + public static sub(out:mat4, a:mat4, b:mat4):mat4 + + /** + * Multiply each element of the matrix by a scalar. + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to scale + * @param {number} b amount to scale the matrix's elements by + * @returns {mat4} out + */ + public static multiplyScalar(out:mat4, a:mat4, b:mat4):mat4 + + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * + * @param {mat4} out the receiving vector + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @param {number} scale the amount to scale b's elements by before adding + * @returns {mat4} out + */ + public static multiplyScalarAndAdd (out:mat4, a:mat4, b:mat4, scale:number):mat4 + + /** + * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) + * + * @param {mat4} a The first matrix. + * @param {mat4} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static exactEquals (a:mat4, b:mat4) :boolean + + /** + * Returns whether or not the matrices have approximately the same elements in the same position. + * + * @param {mat4} a The first matrix. + * @param {mat4} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static equals (a:mat4, b:mat4): boolean + +} + +// quat +export class quat extends Float32Array { + private typeQuat:number; + + /** + * Creates a new identity quat + * + * @returns a new quaternion + */ + public static create(): quat; + + /** + * Creates a new quat initialized with values from an existing quaternion + * + * @param a quaternion to clone + * @returns a new quaternion + * @function + */ + public static clone(a: quat): quat; + + /** + * Creates a new quat initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns a new quaternion + * @function + */ + public static fromValues(x: number, y: number, z: number, w: number): quat; + + /** + * Copy the values from one quat to another + * + * @param out the receiving quaternion + * @param a the source quaternion + * @returns out + * @function + */ + public static copy(out: quat, a: quat): quat; + + /** + * Set the components of a quat to the given values + * + * @param out the receiving quaternion + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns out + * @function + */ + public static set(out: quat, x: number, y: number, z: number, w: number): quat; + + /** + * Set a quat to the identity quaternion + * + * @param out the receiving quaternion + * @returns out + */ + public static identity(out: quat): quat; + + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param {quat} out the receiving quaternion. + * @param {vec3} a the initial vector + * @param {vec3} b the destination vector + * @returns {quat} out + */ + public static rotationTo (out:quat, a:vec3, b:vec3): quat; + + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * + * @param {vec3} view the vector representing the viewing direction + * @param {vec3} right the vector representing the local "right" direction + * @param {vec3} up the vector representing the local "up" direction + * @returns {quat} out + */ + public static setAxes (out:quat, view:vec3, right:vec3, up:vec3):quat + + + + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * + * @param out the receiving quaternion + * @param axis the axis around which to rotate + * @param rad the angle in radians + * @returns out + **/ + public static setAxisAngle(out: quat, axis: vec3, rad: number): quat; + + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as providied in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @param {vec3} out_axis Vector receiving the axis of rotation + * @param {quat} q Quaternion to be decomposed + * @return {number} Angle, in radians, of the rotation + */ + public static getAxisAngle (out_axis:vec3, q:quat) :number + + /** + * Adds two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + * @function + */ + public static add(out: quat, a: quat, b: quat): quat; + + /** + * Multiplies two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: quat, a: quat, b: quat): quat; + + /** + * Multiplies two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: quat, a: quat, b: quat): quat; + + /** + * Scales a quat by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + * @function + */ + public static scale(out: quat, a: quat, b: number): quat; + + /** + * Calculates the length of a quat + * + * @param a vector to calculate length of + * @returns length of a + * @function + */ + public static length(a: quat): number; + + /** + * Calculates the length of a quat + * + * @param a vector to calculate length of + * @returns length of a + * @function + */ + public static len(a: quat): number; + + /** + * Calculates the squared length of a quat + * + * @param a vector to calculate squared length of + * @returns squared length of a + * @function + */ + public static squaredLength(a: quat): number; + + /** + * Calculates the squared length of a quat + * + * @param a vector to calculate squared length of + * @returns squared length of a + * @function + */ + public static sqrLen(a: quat): number; + + /** + * Normalize a quat + * + * @param out the receiving quaternion + * @param a quaternion to normalize + * @returns out + * @function + */ + public static normalize(out: quat, a: quat): quat; + + /** + * Calculates the dot product of two quat's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + * @function + */ + public static dot(a: quat, b: quat): number; + + /** + * Performs a linear interpolation between two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + * @function + */ + public static lerp(out: quat, a: quat, b: quat, t: number): quat; + + /** + * Performs a spherical linear interpolation between two quat + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + public static slerp(out:quat, a:quat, b:quat, t:number): quat; + + /** + * Performs a spherical linear interpolation with two control points + * + * @param {quat} out the receiving quaternion + * @param {quat} a the first operand + * @param {quat} b the second operand + * @param {quat} c the third operand + * @param {quat} d the fourth operand + * @param {number} t interpolation amount + * @returns {quat} out + */ + public static sqlerp(out: quat, a: quat, b: quat, c: quat, d: quat, t: number): quat; + + /** + * Calculates the inverse of a quat + * + * @param out the receiving quaternion + * @param a quat to calculate inverse of + * @returns out + */ + public static invert(out: quat, a: quat): quat; + + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. + * + * @param out the receiving quaternion + * @param a quat to calculate conjugate of + * @returns out + */ + public static conjugate(out: quat, a: quat): quat; + + /** + * Returns a string representation of a quaternion + * + * @param a quat to represent as a string + * @returns string representation of the quat + */ + public static str(a: quat): string; + + /** + * Rotates a quaternion by the given angle about the X axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ + public static rotateX(out: quat, a: quat, rad: number): quat; + + /** + * Rotates a quaternion by the given angle about the Y axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ + public static rotateY(out: quat, a: quat, rad: number): quat; + + /** + * Rotates a quaternion by the given angle about the Z axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ + public static rotateZ(out: quat, a: quat, rad: number): quat; + + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to renormalize the quaternion yourself where necessary. + * + * @param out the receiving quaternion + * @param m rotation matrix + * @returns out + * @function + */ + public static fromMat3(out: quat, m: mat3): quat; + + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * + * @param out the receiving quat + * @param view the vector representing the viewing direction + * @param right the vector representing the local "right" direction + * @param up the vector representing the local "up" direction + * @returns out + */ + public static setAxes(out: quat, view: vec3, right: vec3, up: vec3): quat; + + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param out the receiving quaternion. + * @param a the initial vector + * @param b the destination vector + * @returns out + */ + public static rotationTo(out: quat, a: vec3, b: vec3): quat; + + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * + * @param out the receiving quaternion + * @param a quat to calculate W component of + * @returns out + */ + public static calculateW(out: quat, a: quat): quat; + + /** + * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===) + * + * @param {quat} a The first vector. + * @param {quat} b The second vector. + * @returns {boolean} True if the quaternions are equal, false otherwise. + */ + public static exactEquals (a:quat, b:quat) : boolean; + + /** + * Returns whether or not the quaternions have approximately the same elements in the same position. + * + * @param {quat} a The first vector. + * @param {quat} b The second vector. + * @returns {boolean} True if the quaternions are equal, false otherwise. + */ + public static equals (a:quat, b:quat) : boolean; +} From 9d33ed7f26cd37bf99bae074b6ddca5c4b0b8aef Mon Sep 17 00:00:00 2001 From: Mattijs Kneppers Date: Mon, 18 Jul 2016 19:29:05 +0200 Subject: [PATCH 010/242] Add gl-matrix-typed tests and fix gl-matrix-typed --- gl-matrix/gl-matrix-typed-tests.ts | 346 +++++++++++++++++++++++++++++ gl-matrix/gl-matrix-typed.d.ts | 71 +++--- 2 files changed, 377 insertions(+), 40 deletions(-) create mode 100644 gl-matrix/gl-matrix-typed-tests.ts diff --git a/gl-matrix/gl-matrix-typed-tests.ts b/gl-matrix/gl-matrix-typed-tests.ts new file mode 100644 index 0000000000..7364ec0a83 --- /dev/null +++ b/gl-matrix/gl-matrix-typed-tests.ts @@ -0,0 +1,346 @@ +/// + +// common +import {vec2, mat2, mat3, mat4, vec3, vec4, glMatrix, mat2d, quat} from "./gl-matrix-typed"; +var result: number = glMatrix.toRadian(180); + +var outVal: number; +var outBool: boolean; +var outStr: string; + +let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); + +let vec2A = vec2.fromValues(1, 2); +let vec2B = vec2.fromValues(3, 4); +let vec3A = vec3.fromValues(1, 2, 3); +let vec3B = vec3.fromValues(3, 4, 5); +let vec4A = vec4.fromValues(1, 2, 3, 4); +let vec4B = vec4.fromValues(3, 4, 5, 6); +let mat2A = mat2.fromValues(1, 2, 3, 4); +let mat2B = mat2.fromValues(1, 2, 3, 4); +let mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6); +let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6); +let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); +let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); +let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +let quatA = quat.fromValues(1, 2, 3, 4); +let quatB = quat.fromValues(5, 6, 7, 8); + +let outVec2 = vec2.create(); +let outVec3 = vec3.create(); +let outVec4 = vec4.create(); +let outMat2 = mat2.create(); +let outMat2d = mat2d.create(); +let outMat3 = mat3.create(); +let outMat4 = mat4.create(); +let outQuat = quat.create(); + +// vec2 +outVec2 = vec2.create(); +outVec2 = vec2.clone(vec2A); +outVec2 = vec2.fromValues(1, 2); +outVec2 = vec2.copy(outVec2, vec2A); +outVec2 = vec2.set(outVec2, 1, 2); +outVec2 = vec2.add(outVec2, vec2A, vec2B); +outVec2 = vec2.subtract(outVec2, vec2A, vec2B); +outVec2 = vec2.sub(outVec2, vec2A, vec2B); +outVec2 = vec2.multiply(outVec2, vec2A, vec2B); +outVec2 = vec2.mul(outVec2, vec2A, vec2B); +outVec2 = vec2.divide(outVec2, vec2A, vec2B); +outVec2 = vec2.div(outVec2, vec2A, vec2B); +outVec2 = vec2.ceil(outVec2, vec2A); +outVec2 = vec2.floor(outVec2, vec2A); +outVec2 = vec2.min(outVec2, vec2A, vec2B); +outVec2 = vec2.max(outVec2, vec2A, vec2B); +outVec2 = vec2.round(outVec2, vec2A); +outVec2 = vec2.scale(outVec2, vec2A, 2); +outVec2 = vec2.scaleAndAdd(outVec2, vec2A, vec2B, 0.5); +outVal = vec2.distance(vec2A, vec2B); +outVal = vec2.dist(vec2A, vec2B); +outVal = vec2.squaredDistance(vec2A, vec2B); +outVal = vec2.sqrDist(vec2A, vec2B); +outVal = vec2.length(vec2A); +outVal = vec2.len(vec2A); +outVal = vec2.squaredLength(vec2A); +outVal = vec2.sqrLen(vec2A); +outVec2 = vec2.negate(outVec2, vec2A); +outVec2 = vec2.inverse(outVec2, vec2A); +outVec2 = vec2.normalize(outVec2, vec2A); +outVal = vec2.dot(vec2A, vec2B); +outVec2 = vec2.cross(outVec2, vec2A, vec2B); +outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5); +outVec2 = vec2.random(outVec2); +outVec2 = vec2.random(outVec2, 5.0); +outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A); +outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA); +outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A); +outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A); +vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize); +outStr = vec2.str(vec2A); +outBool = vec2.exactEquals(vec2A, vec2B); +outBool = vec2.equals(vec2A, vec2B); + +// vec3 +outVec3 = vec3.create(); +outVec3 = vec3.clone(vec3A); +outVec3 = vec3.fromValues(1, 2, 3); +outVec3 = vec3.copy(outVec3, vec3A); +outVec3 = vec3.set(outVec3, 1, 2, 3); +outVec3 = vec3.add(outVec3, vec3A, vec3B); +outVec3 = vec3.subtract(outVec3, vec3A, vec3B); +outVec3 = vec3.sub(outVec3, vec3A, vec3B); +outVec3 = vec3.multiply(outVec3, vec3A, vec3B); +outVec3 = vec3.mul(outVec3, vec3A, vec3B); +outVec3 = vec3.divide(outVec3, vec3A, vec3B); +outVec3 = vec3.div(outVec3, vec3A, vec3B); +outVec3 = vec3.ceil(outVec3, vec3A); +outVec3 = vec3.floor(outVec3, vec3A); +outVec3 = vec3.min(outVec3, vec3A, vec3B); +outVec3 = vec3.max(outVec3, vec3A, vec3B); +outVec3 = vec3.round(outVec3, vec3A); +outVec3 = vec3.scale(outVec3, vec3A, 2); +outVec3 = vec3.scaleAndAdd(outVec3, vec3A, vec3B, 0.5); +outVal = vec3.distance(vec3A, vec3B); +outVal = vec3.dist(vec3A, vec3B); +outVal = vec3.squaredDistance(vec3A, vec3B); +outVal = vec3.sqrDist(vec3A, vec3B); +outVal = vec3.length(vec3A); +outVal = vec3.len(vec3A); +outVal = vec3.squaredLength(vec3A); +outVal = vec3.sqrLen(vec3A); +outVec3 = vec3.negate(outVec3, vec3A); +outVec3 = vec3.inverse(outVec3, vec3A); +outVec3 = vec3.normalize(outVec3, vec3A); +outVal = vec3.dot(vec3A, vec3B); +outVec3 = vec3.cross(outVec3, vec3A, vec3B); +outVec3 = vec3.lerp(outVec3, vec3A, vec3B, 0.5); +outVec3 = vec3.hermite(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5); +outVec3 = vec3.bezier(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5); +outVec3 = vec3.random(outVec3); +outVec3 = vec3.random(outVec3, 5.0); +outVec3 = vec3.transformMat3(outVec3, vec3A, mat3A); +outVec3 = vec3.transformMat4(outVec3, vec3A, mat4A); +outVec3 = vec3.transformQuat(outVec3, vec3A, quatA); +outVec3 = vec3.rotateX(outVec3, vec3A, vec3B, Math.PI); +outVec3 = vec3.rotateY(outVec3, vec3A, vec3B, Math.PI); +outVec3 = vec3.rotateZ(outVec3, vec3A, vec3B, Math.PI); +vecArray = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize); +outVal = vec3.angle(vec3A, vec3B); +outStr = vec3.str(vec3A); +outBool = vec3.exactEquals(vec3A, vec3B); +outBool = vec3.equals(vec3A, vec3B); + +// vec4 +outVec4 = vec4.create(); +outVec4 = vec4.clone(vec4A); +outVec4 = vec4.fromValues(1, 2, 3, 4); +outVec4 = vec4.copy(outVec4, vec4A); +outVec4 = vec4.set(outVec4, 1, 2, 3, 4); +outVec4 = vec4.add(outVec4, vec4A, vec4B); +outVec4 = vec4.subtract(outVec4, vec4A, vec4B); +outVec4 = vec4.sub(outVec4, vec4A, vec4B); +outVec4 = vec4.multiply(outVec4, vec4A, vec4B); +outVec4 = vec4.mul(outVec4, vec4A, vec4B); +outVec4 = vec4.divide(outVec4, vec4A, vec4B); +outVec4 = vec4.div(outVec4, vec4A, vec4B); +outVec4 = vec4.ceil(outVec4, vec4A); +outVec4 = vec4.floor(outVec4, vec4A); +outVec4 = vec4.min(outVec4, vec4A, vec4B); +outVec4 = vec4.max(outVec4, vec4A, vec4B); +outVec4 = vec4.scale(outVec4, vec4A, 2); +outVec4 = vec4.scaleAndAdd(outVec4, vec4A, vec4B, 0.5); +outVal = vec4.distance(vec4A, vec4B); +outVal = vec4.dist(vec4A, vec4B); +outVal = vec4.squaredDistance(vec4A, vec4B); +outVal = vec4.sqrDist(vec4A, vec4B); +outVal = vec4.length(vec4A); +outVal = vec4.len(vec4A); +outVal = vec4.squaredLength(vec4A); +outVal = vec4.sqrLen(vec4A); +outVec4 = vec4.negate(outVec4, vec4A); +outVec4 = vec4.inverse(outVec4, vec4A); +outVec4 = vec4.normalize(outVec4, vec4A); +outVal = vec4.dot(vec4A, vec4B); +outVec4 = vec4.lerp(outVec4, vec4A, vec4B, 0.5); +outVec4 = vec4.random(outVec4); +outVec4 = vec4.random(outVec4, 5.0); +outVec4 = vec4.transformMat4(outVec4, vec4A, mat4A); +outVec4 = vec4.transformQuat(outVec4, vec4A, quatA); +vecArray = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize); +outStr = vec4.str(vec4A); +outBool = vec4.exactEquals(vec4A, vec4B); +outBool = vec4.equals(vec4A, vec4B); + +// mat2 +outMat2 = mat2.create(); +outMat2 = mat2.clone(mat2A); +outMat2 = mat2.copy(outMat2, mat2A); +outMat2 = mat2.identity(outMat2); +outMat2 = mat2.fromValues(1, 2, 3, 4); +outMat2 = mat2.set(outMat2, 1, 2, 3, 4); +outMat2 = mat2.transpose(outMat2, mat2A); +outMat2 = mat2.invert(outMat2, mat2A); +outMat2 = mat2.adjoint(outMat2, mat2A); +outVal = mat2.determinant(mat2A); +outMat2 = mat2.multiply(outMat2, mat2A, mat2B); +outMat2 = mat2.mul(outMat2, mat2A, mat2B); +outMat2 = mat2.rotate(outMat2, mat2A, Math.PI * 0.5); +outMat2 = mat2.scale(outMat2, mat2A, vec2A); +outMat2 = mat2.fromRotation(outMat2, 0.5); +outMat2 = mat2.fromScaling(outMat2, vec2A); +outStr = mat2.str(mat2A); +outVal = mat2.frob(mat2A); +var L = mat2.create(); +var D = mat2.create(); +var U = mat2.create(); +outMat2 = mat2.LDU(L, D, U, mat2A); +outMat2 = mat2.add(outMat2, mat2A, mat2B); +outMat2 = mat2.subtract(outMat2, mat2A, mat2B); +outMat2 = mat2.sub(outMat2, mat2A, mat2B); +outBool = mat2.exactEquals(mat2A, mat2B); +outBool = mat2.equals(mat2A, mat2B); +outMat2 = mat2.multiplyScalar (outMat2, mat2A, 2); +outMat2 = mat2.multiplyScalarAndAdd (outMat2, mat2A, mat2B, 2); + +// mat2d +outMat2d = mat2d.create(); +outMat2d = mat2d.clone(mat2dA); +outMat2d = mat2d.copy(outMat2d, mat2dA); +outMat2d = mat2d.identity(outMat2d); +outMat2d = mat2d.fromValues(1, 2, 3, 4, 5, 6); +outMat2d = mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6); +outMat2d = mat2d.invert(outMat2d, mat2dA); +outVal = mat2d.determinant(mat2dA); +outMat2d = mat2d.multiply(outMat2d, mat2dA, mat2dB); +outMat2d = mat2d.mul(outMat2d, mat2dA, mat2dB); +outMat2d = mat2d.rotate(outMat2d, mat2dA, Math.PI * 0.5); +outMat2d = mat2d.scale(outMat2d, mat2dA, vec2A); +outMat2d = mat2d.translate(outMat2d, mat2dA, vec2A); +outMat2d = mat2d.fromRotation(outMat2d, 0.5); +outMat2d = mat2d.fromScaling(outMat2d, vec2A); +outMat2d = mat2d.fromTranslation(outMat2d, vec2A); +outStr = mat2d.str(mat2dA); +outVal = mat2d.frob(mat2dA); +outMat2d = mat2d.add(outMat2d, mat2dA, mat2dB); +outMat2d = mat2d.subtract(outMat2d, mat2dA, mat2dB); +outMat2d = mat2d.sub(outMat2d, mat2dA, mat2dB); +outMat2d = mat2d.multiplyScalar (outMat2d, mat2dA, 2); +outMat2d = mat2d.multiplyScalarAndAdd (outMat2d, mat2dA, mat2dB, 2); +outBool = mat2d.exactEquals(mat2dA, mat2dB); +outBool = mat2d.equals(mat2dA, mat2dB); + + +// mat3 +outMat3 = mat3.create(); +outMat3 = mat3.fromMat4(outMat3, mat4A); +outMat3 = mat3.clone(mat3A); +outMat3 = mat3.copy(outMat3, mat3A); +outMat3 = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); +outMat3 = mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9); +outMat3 = mat3.identity(outMat3); +outMat3 = mat3.transpose(outMat3, mat3A); +outMat3 = mat3.invert(outMat3, mat3A); +outMat3 = mat3.adjoint(outMat3, mat3A); +outVal = mat3.determinant(mat3A); +outMat3 = mat3.multiply(outMat3, mat3A, mat3B); +outMat3 = mat3.mul(outMat3, mat3A, mat3B); +outMat3 = mat3.translate(outMat3, mat3A, vec3A); +outMat3 = mat3.rotate(outMat3, mat3A, Math.PI/2); +outMat3 = mat3.scale(outMat3, mat3A, vec2A); +outMat3 = mat3.fromTranslation(outMat3, vec2A); +outMat3 = mat3.fromRotation(outMat3, Math.PI); +outMat3 = mat3.fromScaling(outMat3, vec2A); +outMat3 = mat3.fromMat2d(outMat3, mat2dA); +outMat3 = mat3.fromQuat(outMat3, quatA); +outMat3 = mat3.normalFromMat4(outMat3, mat4A); +outStr = mat3.str(mat3A); +outVal = mat3.frob(mat3A); +outMat3 = mat3.add(outMat3, mat3A, mat3B); +outMat3 = mat3.subtract(outMat3, mat3A, mat3B); +outMat3 = mat3.sub(outMat3, mat3A, mat3B); +outMat3 = mat3.multiplyScalar (outMat3, mat3A, 2); +outMat3 = mat3.multiplyScalarAndAdd (outMat3, mat3A, mat3B, 2); +outBool = mat3.exactEquals(mat3A, mat3B); +outBool = mat3.equals(mat3A, mat3B); + +//mat4 +outMat4 = mat4.create(); +outMat4 = mat4.clone(mat4A); +outMat4 = mat4.copy(outMat4, mat4A); +outMat4 = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +outMat4 = mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +outMat4 = mat4.identity(outMat4); +outMat4 = mat4.transpose(outMat4, mat4A); +outMat4 = mat4.invert(outMat4, mat4A); +outMat4 = mat4.adjoint(outMat4, mat4A); +outVal = mat4.determinant(mat4A); +outMat4 = mat4.multiply(outMat4, mat4A, mat4B); +outMat4 = mat4.mul(outMat4, mat4A, mat4B); +outMat4 = mat4.translate(outMat4, mat4A, vec3A); +outMat4 = mat4.scale(outMat4, mat4A, vec3A); +outMat4 = mat4.rotate(outMat4, mat4A, Math.PI, vec3A); +outMat4 = mat4.rotateX(outMat4, mat4A, Math.PI); +outMat4 = mat4.rotateY(outMat4, mat4A, Math.PI); +outMat4 = mat4.rotateZ(outMat4, mat4A, Math.PI); +outMat4 = mat4.fromTranslation(outMat4, vec3A); +outMat4 = mat4.fromRotation(outMat4, Math.PI, vec3A); +outMat4 = mat4.fromScaling(outMat4, vec3A); +outMat4 = mat4.fromXRotation(outMat4, Math.PI); +outMat4 = mat4.fromYRotation(outMat4, Math.PI); +outMat4 = mat4.fromZRotation(outMat4, Math.PI); +outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A); +outVec3 = mat4.getTranslation(outVec3, mat4A) +outQuat = mat4.getRotation(outQuat, mat4A) +outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B); +outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A); +outMat4 = mat4.fromQuat(outMat4, quatB); +outMat4 = mat4.frustum(outMat4, -1, 1, -1, 1, -1, 1); +outMat4 = mat4.perspective(outMat4, Math.PI, 1, 0, 1); +outMat4 = mat4.perspectiveFromFieldOfView(outMat4, {upDegrees:Math.PI, downDegrees:-Math.PI, leftDegrees:-Math.PI, rightDegrees:Math.PI}, 1, 0); +outMat4 = mat4.ortho(outMat4, -1, 1, -1, 1, -1, 1); +outMat4 = mat4.lookAt(outMat4, vec3A, vec3B, vec3A); +outStr = mat4.str(mat4A); +outVal = mat4.frob(mat4A); +outMat4 = mat4.add(outMat4, mat4A, mat4B); +outMat4 = mat4.subtract(outMat4, mat4A, mat4B); +outMat4 = mat4.sub(outMat4, mat4A, mat4B); +outMat4 = mat4.multiplyScalar (outMat4, mat4A, 2); +outMat4 = mat4.multiplyScalarAndAdd (outMat4, mat4A, mat4B, 2); +outBool = mat4.exactEquals(mat4A, mat4B); +outBool = mat4.equals(mat4A, mat4B); + +// quat +var deg90 = Math.PI / 2; +outQuat = quat.create(); +outQuat = quat.clone(quatA); +outQuat = quat.fromValues(1, 2, 3, 4); +outQuat = quat.copy(outQuat, quatA); +outQuat = quat.set(outQuat, 1, 2, 3, 4); +outQuat = quat.identity(outQuat); +outQuat = quat.rotationTo(outQuat, vec3A, vec3B); +outQuat = quat.setAxes(outQuat, vec3A, vec3B, vec3A); +outQuat = quat.setAxisAngle(outQuat, vec3A, Math.PI * 0.5); +outVal = quat.getAxisAngle (outVec3, quatA); +outQuat = quat.add(outQuat, quatA, quatB); +outQuat = quat.multiply(outQuat, quatA, quatB); +outQuat = quat.mul(outQuat, quatA, quatB); +outQuat = quat.scale(outQuat, quatA, 2); +outVal = quat.length(quatA); +outVal = quat.len(quatA); +outVal = quat.squaredLength(quatA); +outVal = quat.sqrLen(quatA); +outQuat = quat.normalize(outQuat, quatA); +outVal = quat.dot(quatA, quatB); +outQuat = quat.lerp(outQuat, quatA, quatB, 0.5); +outQuat = quat.slerp(outQuat, quatA, quatB, 0.5); +outQuat = quat.invert(outQuat, quatA); +outQuat = quat.conjugate(outQuat, quatA); +outStr = quat.str(quatA); +outQuat = quat.rotateX(outQuat, quatA, deg90); +outQuat = quat.rotateY(outQuat, quatA, deg90); +outQuat = quat.rotateZ(outQuat, quatA, deg90); +outQuat = quat.fromMat3(outQuat, mat3A); +outQuat = quat.calculateW(outQuat, quatA); +outBool = quat.exactEquals(quatA, quatB); +outBool = quat.equals(quatA, quatB); \ No newline at end of file diff --git a/gl-matrix/gl-matrix-typed.d.ts b/gl-matrix/gl-matrix-typed.d.ts index f64225c6f7..e172074fec 100644 --- a/gl-matrix/gl-matrix-typed.d.ts +++ b/gl-matrix/gl-matrix-typed.d.ts @@ -1,16 +1,16 @@ // Type definitions for gl-matrix 2.2.2 // Project: https://github.com/toji/gl-matrix -// Definitions by: Tat +// Definitions by: Mattijs Kneppers , based on definitions by Tat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Common -declare namespace glMatrix { +export class glMatrix { /** - * Convert Degree To Radian - * - * @param a Angle in Degrees - */ - export function toRadian(a: number): number; + * Convert Degree To Radian + * + * @param a Angle in Degrees + */ + public static toRadian(a: number): number; } // vec2 @@ -396,8 +396,8 @@ export class vec2 extends Float32Array { * @param arg additional argument to pass to fn * @returns a */ - public static forEach(a: vec2, stride: number, offset: number, count: number, - fn: (a: vec2, b: vec2, arg: any) => void, arg: any): vec2; + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec2, b: vec2, arg: any) => void, arg: any): Float32Array; /** * Perform some operation over an array of vec2s. @@ -409,8 +409,8 @@ export class vec2 extends Float32Array { * @param fn Function to call for each vector in the array * @returns a */ - public static forEach(a: vec2, stride: number, offset: number, count: number, - fn: (a: vec2, b: vec2) => void): vec2; + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec2, b: vec2) => void): Float32Array; /** * Returns a string representation of a vector @@ -868,8 +868,8 @@ export class vec3 extends Float32Array { * @returns a * @function */ - public static forEach(a: vec3, stride: number, offset: number, count: number, - fn: (a: vec3, b: vec3, arg: any) => void, arg: any): vec3; + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec3, b: vec3, arg: any) => void, arg: any): Float32Array; /** * Perform some operation over an array of vec3s. @@ -882,8 +882,8 @@ export class vec3 extends Float32Array { * @returns a * @function */ - public static forEach(a: vec3, stride: number, offset: number, count: number, - fn: (a: vec3, b: vec3) => void): vec3; + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec3, b: vec3) => void): Float32Array; /** * Get the angle between two 3D vectors @@ -908,7 +908,7 @@ export class vec3 extends Float32Array { * @param {vec3} b The second vector. * @returns {boolean} True if the vectors are equal, false otherwise. */ - public static exactEquals (a, b): boolean + public static exactEquals (a:vec3, b:vec3): boolean /** * Returns whether or not the vectors have approximately the same elements in the same position. @@ -917,7 +917,7 @@ export class vec3 extends Float32Array { * @param {vec3} b The second vector. * @returns {boolean} True if the vectors are equal, false otherwise. */ - public static equals (a, b) : boolean + public static equals (a:vec3, b:vec3) : boolean } // vec4 @@ -1274,8 +1274,8 @@ export class vec4 extends Float32Array { * @returns a * @function */ - public static forEach(a: vec4, stride: number, offset: number, count: number, - fn: (a: vec4, b: vec4, arg: any) => void, arg: any): vec4; + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec4, b: vec4, arg: any) => void, arg: any): Float32Array; /** * Perform some operation over an array of vec4s. @@ -1288,8 +1288,8 @@ export class vec4 extends Float32Array { * @returns a * @function */ - public static forEach(a: vec4, stride: number, offset: number, count: number, - fn: (a: vec4, b: vec4) => void): vec4; + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec4, b: vec4) => void): Float32Array; /** * Returns a string representation of a vector @@ -1476,7 +1476,7 @@ export class mat2 extends Float32Array { * @param {vec2} v Scaling vector * @returns {mat2} out */ - public static fromScaling(out:mat2, v:vec2); + public static fromScaling(out:mat2, v:vec2):mat2; /** * Returns a string representation of a mat2 @@ -1623,7 +1623,7 @@ export class mat2d extends Float32Array { * @param {number} ty Component TY (index 5) * @returns {mat2d} A new mat2d */ - public static fromValues (a:number, b:number, c:number, d:number, tx:number, ty:number) : mat2d + public static fromValues (a:number, b:number, c:number, d:number, tx:number, ty:number) : mat2d /** @@ -1800,7 +1800,7 @@ export class mat2d extends Float32Array { * @param {number} b amount to scale the matrix's elements by * @returns {mat2d} out */ - public static multiplyScalar (out: mat2d, a: mat2d, b: mat2d): mat2d; + public static multiplyScalar (out: mat2d, a: mat2d, b: number): mat2d; /** * Adds two mat2d's after multiplying each element of the second operand by a scalar value. @@ -1883,7 +1883,7 @@ export class mat3 extends Float32Array { * @param {number} m22 Component in column 2, row 2 position (index 8) * @returns {mat3} A new mat3 */ - public static fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22):mat3; + public static fromValues(m00:number, m01:number, m02:number, m10:number, m11:number, m12:number, m20:number, m21:number, m22:number):mat3; /** @@ -2045,15 +2045,6 @@ export class mat3 extends Float32Array { **/ public static fromMat2d(out:mat3, a:mat2d):mat3; - /** - * Copies the upper-left 3x3 values into the given mat3. - * - * @param out the receiving 3x3 matrix - * @param a the source 4x4 matrix - * @returns out - */ - public static fromMat4(out:mat3, a:mat4):mat3; - /** * Calculates a 3x3 matrix from the given quaternion * @@ -2072,7 +2063,7 @@ export class mat3 extends Float32Array { * * @returns out */ - public static normalFromMat4(out:mat3, a:mat3):mat3; + public static normalFromMat4(out:mat3, a:mat4):mat3; /** * Returns a string representation of a mat3 @@ -2210,7 +2201,7 @@ export class mat4 extends Float32Array { * @param {number} m33 Component in column 3, row 3 position (index 15) * @returns {mat4} A new mat4 */ - public static fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33):mat4; + public static fromValues(m00:number, m01:number, m02:number, m03:number, m10:number, m11:number, m12:number, m13:number, m20:number, m21:number, m22:number, m23:number, m30:number, m31:number, m32:number, m33:number):mat4; /** * Set the components of a mat4 to the given values @@ -2234,7 +2225,7 @@ export class mat4 extends Float32Array { * @param {number} m33 Component in column 3, row 3 position (index 15) * @returns {mat4} out */ - public static set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33):mat4; + public static set(out:mat4, m00:number, m01:number, m02:number, m03:number, m10:number, m11:number, m12:number, m13:number, m20:number, m21:number, m22:number, m23:number, m30:number, m31:number, m32:number, m33:number):mat4; /** * Set a mat4 to the identity matrix @@ -2571,7 +2562,7 @@ export class mat4 extends Float32Array { */ public static perspectiveFromFieldOfView(out:mat4, fov:{upDegrees:number, downDegrees:number, leftDegrees:number, rightDegrees:number}, - near, far):mat4 + near:number, far:number):mat4 /** * Generates a orthogonal projection matrix with the given bounds @@ -2653,7 +2644,7 @@ export class mat4 extends Float32Array { * @param {number} b amount to scale the matrix's elements by * @returns {mat4} out */ - public static multiplyScalar(out:mat4, a:mat4, b:mat4):mat4 + public static multiplyScalar(out:mat4, a:mat4, b:number):mat4 /** * Adds two mat4's after multiplying each element of the second operand by a scalar value. @@ -3059,5 +3050,5 @@ export class quat extends Float32Array { * @param {quat} b The second vector. * @returns {boolean} True if the quaternions are equal, false otherwise. */ - public static equals (a:quat, b:quat) : boolean; + public static equals (a:quat, b:quat) : boolean; } From 764408a57180773350f7b5169e6520fefd86076f Mon Sep 17 00:00:00 2001 From: Batbold Gansukh Date: Sun, 24 Jul 2016 02:00:17 +0900 Subject: [PATCH 011/242] react-bootstrap v0.30.0 --- react-bootstrap/react-bootstrap-tests.jsx | 959 ++++++++++++++++++++++ react-bootstrap/react-bootstrap-tests.tsx | 405 +++++++-- react-bootstrap/react-bootstrap.d.ts | 116 ++- 3 files changed, 1347 insertions(+), 133 deletions(-) create mode 100644 react-bootstrap/react-bootstrap-tests.jsx diff --git a/react-bootstrap/react-bootstrap-tests.jsx b/react-bootstrap/react-bootstrap-tests.jsx new file mode 100644 index 0000000000..d5f33d94ca --- /dev/null +++ b/react-bootstrap/react-bootstrap-tests.jsx @@ -0,0 +1,959 @@ +// React-Bootstrap Test +// ================================================================================ +/// +/// +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +// Imports +// -------------------------------------------------------------------------------- +var React = require('react'); +var react_1 = require('react'); +var react_bootstrap_1 = require('react-bootstrap'); +var ReactBootstrapTest = (function (_super) { + __extends(ReactBootstrapTest, _super); + function ReactBootstrapTest() { + _super.apply(this, arguments); + } + ReactBootstrapTest.prototype.callback = function () { + alert('Callback: ' + JSON.stringify(arguments)); + }; + ReactBootstrapTest.prototype.render = function () { + var style = { padding: '50px' }; + var tooltip = (Holy guacamole! Check this info.); + var innerGlyphicon = ; + var innerButton = Before; + var innerDropdown = ( + Item + ); + var innerRadio = ; + var innerCheckbox = ; + return (
+
+ + Default + Primary + Success + Info + Warning + Danger + Link + +
+ +
+ + Large button + Large button + + + Default button + Default button + + + Small button + Small button + + + Extra small button + Extra small button + +
+ +
+ + Block level button + Block level button + +
+ +
+ + Primary button + Button + +
+ + +
+ + Link + Button + +
+ + +
+ + Left + Middle + Right + +
+ + +
+ + + 1 + 2 + 3 + 4 + + + 5 + 6 + 7 + + + 8 + + +
+ // TODO: Start here + + + // TODO: Start here + +
+ + + Left + Middle + Right + + + + + + Left + Middle + Right + + + + + + Left + Middle + Right + + + + + + Left + Middle + Right + + +
+ +
+ + Button + Button + + Dropdown link + Dropdown link + + Button + Button + + Dropdown link + Dropdown link + + + Dropdown link + Dropdown link + + +
+ +
+ + Action + Another action + Active Item + + Separated link + +
+ +
+
+
    + Header + link + + Header + link + disabled + + link with title + + + link that alerts + +
+
+
+ +
+ + Basic panel example + +
+ +
+
+ + Panel content + + + Panel content + +
+
+ +
+ + Panel content + +
+ +
+
+ + Panel content + + + + Panel content + + + + Panel content + + + + Panel content + + + + Panel content + + + + Panel content + +
+
+ +
+ + Some default panel content here. + + Item 1 + Item 2 + … + + Some more panel content here. + +
+ +
+ + + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer + farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + + + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer + farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + + + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer + farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + + +
+ +
+
+ + + Modal title + + + + One fine body... + + + + Close + Save changes + + + +
+
+ +
+
+ + Tooltip right + + + + Tooltip top + + + + Tooltip left + + + + Tooltip bottom + +
+
+ +
+ + + Holy guacamole! + + + + Holy guacamole! + + + + Holy guacamole! + + + + Holy guacamole! + + +
+ +
+
+ + And here's some amazing content. It's very engaging. right? + +
+
+ +
+ + Holy guacamole! Check this info.}> + Holy guacamole! + + Holy guacamole! Check this info.}> + Holy guacamole! + + Holy guacamole! Check this info.}> + Holy guacamole! + + Holy guacamole! Check this info.}> + Holy guacamole! + + +
+ +
+ + Holy guacamole! Check this info.}> + Click + + Holy guacamole! Check this info.}> + Hover + + Holy guacamole! Check this info.}> + Focus + + Holy guacamole! Check this info.}> + Click or hover or focus + + Holy guacamole! Check this info.}> + Click + rootClose + + +
+ +
+ +
+ +
+ +
+ +
+
+ + + + +
+
+ +
+
+ + + + +
+
+ +
+ +
+ +
+ + + + + +
+ +
+ + NavItem 1 content + NavItem 2 content + NavItem 3 content + +
+ +
+ + NavItem 1 content + NavItem 2 content + NavItem 3 content + +
+ +
+
+ + NavItem 1 content + NavItem 2 content + NavItem 3 content + +
+ + NavItem 1 content + NavItem 2 content + NavItem 3 content + +
+
+ +
+ + + + React-Bootstrap + + + + + + Link + Link + + Action + Another action + Something else here + + Separated link + + + + +
+ +
+ + + Link + Link + + +
+ +
+ + Previous + Next + +
+ +
+ + Tab 1 content + Tab 2 content + Tab 3 content + +
+ +
+ + + + + + Tab 1 + + + Tab 2 + + + + + + + Tab 1 content + + + Tab 2 content + + + + + +
+ +
+ + Previous + Next + +
+ +
+ + ← Previous Page + Next Page → + +
+ +
+ + ← Previous + Next → + +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + Holy guacamole! Best check yo self, you're not looking too good. + +
+ +
+ + + 900x500 +
+

First slide label

+

Nulla vitae elit libero, a pharetra augue mollis interdum.

+
+
+ + 900x500 +
+

Second slide label

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+
+
+ + 900x500 +
+

Third slide label

+

Praesent commodo cursus magna, vel scelerisque nisl consectetur.

+
+
+
+
+ +
+ + + <{'Col xs={12} md={8}'} /> + <{'Col xs={6} md={4}'} /> + + + + <{'Col xs={6} md={4}'} /> + <{'Col xs={6} md={4}'} /> + <{'Col xs={6} md={4}'} /> + + + + <{'Col xs={6} xsOffset={6}'} /> + + + + <{'Col md={6} mdPush={6}'} /> + <{'Col md={6} mdPull={6}'} /> + + +
+ +
+ + + + + + + + + + + + + +
+ +
+ + Item 1 + Item 2 + ... + +
+ +
+ + Link 1 + Link 2 + + Trigger an alert + + +
+ +
+ + Link 1 + Link 2 + Link 3 + +
+ +
+ + Success + Info + Warning + Danger + +
+ +
+ + Some body text + Linked item + Danger styling + +
+ +
+
+

Label New

+

Label New

+

Label New

+

Label New

+
Label New
+

Label New

+
+
+ +
+
+ Default  + Primary  + Success  + Info  + Warning  + Danger +
+
+ +
+

Badges 42

+
+ +
+ +

Hello, world!

+

This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.

+

Learn more

+
+
+ +
+ +
+ +
+ Example page header Subtext for header +
+ +
+ Look I'm in a well! +
+ +
+
+ Look I'm in a large well! + Look I'm in a small well! +
+
+ +
+
+ + + + + + + + + + + Star + Star + Star + Star + + +
+
+ +
+ + + + Number + First Name + Last Name + Username + + + + + 1 + Mark + Otto + @mdo + + + 2 + Jacob + Thornton + @fat + + + 3 + Larry the Bird + @twitter + + + +
+ +
+ + + + Number + Table heading + Table heading + Table heading + Table heading + Table heading + Table heading + + + + + 1 + Table cell + Table cell + Table cell + Table cell + Table cell + Table cell + + + 2 + Table cell + Table cell + Table cell + Table cell + Table cell + Table cell + + + 3 + Table cell + Table cell + Table cell + Table cell + Table cell + Table cell + + + +
+ +
+ + Working example with validation + + + Validation is based on string length. + +
+ +
+ + + + + + + + + + + + + +
+ +
+
+ + Child Text + + + +
+ +
+
+ + + + + + + + +
+
+ +
+
+ + + +
+
+ +
+
+ + + +
+
+ +
+
+ + + +
+
+ +
+ + + + + + + + + + +
+ +
+ + + Control Label + + + Help block message. + + + + 1 + {' '} + 2 + {' '} + 3 + + + 1 + {' '} + 2 + {' '} + 3 + + +
+ +
+ + + Image + + + Top aligned media +

Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

+

Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

+
+
+
+
); + }; + return ReactBootstrapTest; +}(react_1.Component)); +exports.ReactBootstrapTest = ReactBootstrapTest; diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index 2712853f28..9b2e56cc4e 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -7,7 +7,20 @@ // -------------------------------------------------------------------------------- import * as React from 'react'; import { Component, CSSProperties } from 'react'; -import { Button, ButtonToolbar, Modal, Well, ButtonGroup, DropdownButton, MenuItem, Panel, ListGroup, ListGroupItem, Accordion, Tooltip, OverlayTrigger, Popover, ProgressBar, Nav, NavItem, Navbar, NavDropdown, Tabs, Tab, Pager, PageItem, Pagination, Alert, Carousel, CarouselItem, Grid, Row, Col, Thumbnail, Image, Label, Badge, Jumbotron, PageHeader, Glyphicon, Table, Input, ButtonInput, Form, FormGroup, ControlLabel, FormControl, HelpBlock, Radio, Checkbox, Media } from 'react-bootstrap'; +import { + Button, ButtonToolbar, Modal, Well, ButtonGroup, + DropdownButton, MenuItem, Panel, ListGroup, + ListGroupItem, Accordion, Tooltip, + OverlayTrigger, Popover, ProgressBar, + Nav, NavItem, Navbar, NavDropdown, + Tabs, Tab, Pager, PageItem, + Pagination, Alert, Carousel, + Grid, Row, Col, Thumbnail, Image, + Label, Badge, Jumbotron, PageHeader, + Glyphicon, Table, Form, FormGroup, + ControlLabel, FormControl, HelpBlock, + Radio, Checkbox, Media, InputGroup +} from 'react-bootstrap'; export class ReactBootstrapTest extends Component { @@ -299,6 +312,40 @@ export class ReactBootstrapTest extends Component { +
+ ({})} style={style}> + + Modal heading + + +

Text in a modal

+

Duis mollis, est non commodo luctus, nisi erat porttitor ligula.

+ +

Popover in a modal

+

there is a popover here

+ +

Tooltips in a modal

+

there is a tooltip here

+ +
+ +

Overflowing text to show scroll behavior

+

Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

+

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

+

Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.

+

Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

+

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

+

Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.

+

Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

+

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

+

Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.

+
+ + + +
+
+
@@ -489,8 +536,23 @@ export class ReactBootstrapTest extends Component {
- Previous - Next + Previous + {' '} + Next + +
+ +
+ + ← Previous Page + Next Page → + +
+ +
+ + ← Previous + Next →
@@ -581,27 +643,27 @@ export class ReactBootstrapTest extends Component {
- - 900x500 -
+ + 900x500 +

First slide label

Nulla vitae elit libero, a pharetra augue mollis interdum.

-
-
- - 900x500 -
+ + + + 900x500 +

Second slide label

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

-
-
- - 900x500 -
+ + + + 900x500 +

Third slide label

Praesent commodo cursus magna, vel scelerisque nisl consectetur.

-
-
+ +
@@ -840,99 +902,264 @@ export class ReactBootstrapTest extends Component {
- + + Working example with validation + + + Validation is based on string length. +
- - - - - - - - - - - - - - - - - - + + Text + + + + Email address + + + + Pass + + + + File + + [Optional] Block level help text + + + Checkbox + + + Radio + + + Select + + + + + + + Textarea + +
- - Child Text - - + + + @ + + + + + + + .00 + + + + + $ + + .00 + + + + + + + + + + + + + + + + + + + + + + + + + Item + + + + + + + + + + + + + + + + + + + +
- - - - - - - - + + + + + + + + +
- - - -
-
+ + Input with success + + Help text with validation state. + -
-
- - - -
-
+ + Input with warning + + -
-
- - - -
-
+ + Input with error + + -
- - - - - - - - - - + + Input with success and feedback icon + + + + + + Input with warning and feedback icon + + + + + + Input with error and feedback icon + + + + + + Input with success and custom feedback icon + + + + + + + + Input group with warning + + @ + + + + + +
+ + + Input with error + + + + + + + + + + Input group with success + + + + @ + + + + + +
+ +
+ + Input with warning + {' '} + + + + {' '} + + Input group with error + {' '} + + @ + + + + +
+ + + Checkbox with success + + + Radio with warning + + + Checkbox with error + + + {/* This requires React 15's -less spaces to be exactly correct. */} + + + Checkbox + + {' '} + + with + + {' '} + + success + + +
diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index 0473057b04..0e4d9d27d7 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -72,7 +72,7 @@ declare namespace ReactBootstrap { { active?: boolean; id?: string | number; - linkId?: string | number; + // linkId?: string | number; // TODO: Removed since v0.30.0 href?: string; title?: React.ReactNode; target?: string; @@ -89,8 +89,8 @@ declare namespace ReactBootstrap { block?: boolean; bsStyle?: string; bsSize?: Sizes; - navItem?: boolean; - navDropdown?: boolean; + // navItem?: boolean; // TODO: Removed since v0.30.0 + // navDropdown?: boolean; // TODO: Removed since v0.30.0 componentClass?: React.ReactType; } type Button = React.ClassicComponent; @@ -234,6 +234,7 @@ declare namespace ReactBootstrap { open?: boolean; title?: string; useAnchor?: boolean; + bsClass?:string; // Added since v0.30.0 } class DropdownToggle extends React.Component @@ -444,8 +445,8 @@ declare namespace ReactBootstrap { bsSize?: Sizes; bsStyle?: string; placement?: string; - positionLeft?: number; - positionTop?: number; + positionLeft?: number|string; // String support added since v0.30.0 + positionTop?: number|string; // String support added since v0.30.0 } type Popover = React.ClassicComponent; var Popover: React.ClassicComponentClass; @@ -588,6 +589,7 @@ declare namespace ReactBootstrap { interface NavDropdownBaseProps extends DropdownBaseProps { + active?:boolean; noCaret?: boolean; } type NavDropdownProps = NavDropdownBaseProps & React.HTMLProps; @@ -652,13 +654,15 @@ declare namespace ReactBootstrap { // - interface PagerProps - extends React.HTMLProps + interface PagerProps extends React.HTMLProps { onSelect?: SelectCallback; } + interface PagerClass extends React.ClassicComponentClass { + Item: typeof PageItem // Added since v0.30.0 + } type Pager = React.ClassicComponent; - var Pager: React.ClassicComponentClass; + var Pager: PagerClass; // @@ -673,6 +677,7 @@ declare namespace ReactBootstrap { target?: string; } type PageItem = React.ClassicComponent; + /** @deprecated since v0.30.0, should use instead of */ var PageItem: React.ClassicComponentClass; @@ -740,7 +745,7 @@ declare namespace ReactBootstrap { active?: boolean; animtateIn?: boolean; animateOut?: boolean; - caption?: any; // TODO: Add more specific type + // caption?: any; // TODO: Removed since v0.30.0 direction?: string; index?: number; onAnimateOutEnd?: Function; @@ -807,6 +812,7 @@ declare namespace ReactBootstrap { // interface ListGroupProps extends React.HTMLProps { + componentClass?: React.ReactType; // Added since v0.30.0 fill?: boolean; // TODO: Add more specific type } class ListGroup extends React.Component { @@ -890,44 +896,45 @@ declare namespace ReactBootstrap { type Table = React.ClassicComponent; var Table: React.ClassicComponentClass; - // - interface InputProps extends React.HTMLProps { - defaultValue?:string; - addonAfter?: any; // TODO: Add more specific type - addonBefore?: any; // TODO: Add more specific type - bsSize?: Sizes; - bsStyle?: string; - buttonAfter?: any; // TODO: Add more specific type - buttonBefore?: any; // TODO: Add more specific type - feedbackIcon?: any; // TODO: Add more specific type - groupClassName?: string; - hasFeedback?: boolean; - help?: any; // TODO: Add more specific type - labelClassName?: string; - wrapperClassName?: string; - } + // // Removed since v0.30.0 + // interface InputProps extends React.HTMLProps { + // defaultValue?:string; + // addonAfter?: any; // TODO: Add more specific type + // addonBefore?: any; // TODO: Add more specific type + // bsSize?: Sizes; + // bsStyle?: string; + // buttonAfter?: any; // TODO: Add more specific type + // buttonBefore?: any; // TODO: Add more specific type + // feedbackIcon?: any; // TODO: Add more specific type + // groupClassName?: string; + // hasFeedback?: boolean; + // help?: any; // TODO: Add more specific type + // labelClassName?: string; + // wrapperClassName?: string; + // } /** @deprecated since v0.29.0 */ - class Input extends React.Component { - } + // class Input extends React.Component { + // } - // - interface ButtonInputProps extends React.HTMLProps { - addonAfter?: any; // TODO: Add more specific type - addonBefore?: any; // TODO: Add more specific type - bsSize?: Sizes; - bsStyle?: string; - buttonAfter?: any; // TODO: Add more specific type - buttonBefore?: any; // TODO: Add more specific type - feedbackIcon?: any; // TODO: Add more specific type - groupClassName?: string; - hasFeedback?: boolean; - help?: any; // TODO: Add more specific type - labelClassName?: string; - wrapperClassName?: string; - } + + // // Removed since v0.30. + // interface ButtonInputProps extends React.HTMLProps { + // addonAfter?: any; // TODO: Add more specific type + // addonBefore?: any; // TODO: Add more specific type + // bsSize?: Sizes; + // bsStyle?: string; + // buttonAfter?: any; // TODO: Add more specific type + // buttonBefore?: any; // TODO: Add more specific type + // feedbackIcon?: any; // TODO: Add more specific type + // groupClassName?: string; + // hasFeedback?: boolean; + // help?: any; // TODO: Add more specific type + // labelClassName?: string; + // wrapperClassName?: string; + // } /** @deprecated since v0.29.0 */ - class ButtonInput extends React.Component { - } + // class ButtonInput extends React.Component { + // } // @@ -1125,6 +1132,27 @@ declare namespace ReactBootstrap { } type Media = React.ClassicComponent; var Media: MediaClass; + + /* Utils */ + interface bootstrapUtilsType{ + // TODO: Implement functions + } + function createChainedFunctionType(...funcs:Function[]):Function + interface ValidComponentChildrenType{ + map: (children:any,func:any,context:any) => any + forEach:(children:any,func:any,context:any) => any + count:(children:any) => number + filter:(children:any,func:any,context:any) => any + find:(children:any,func:any,context:any) => any + every:(children:any,func:any,context:any) => any + some:(children:any,func:any,context:any) => any + toArray:(children:any) => any + } + class utils { + static bootstrapUtils:bootstrapUtilsType + static createChainedFunction: typeof createChainedFunctionType + static ValidComponentChildren:ValidComponentChildrenType + } } declare module "react-bootstrap" { From 6afa8beec11c0b4a7c58e4d05f21a8332701f66e Mon Sep 17 00:00:00 2001 From: Batbold Gansukh Date: Sun, 24 Jul 2016 02:22:25 +0900 Subject: [PATCH 012/242] add my name --- react-bootstrap/react-bootstrap.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index 0e4d9d27d7..f52ed96ef3 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -1,6 +1,8 @@ // Type definitions for react-bootstrap // Project: https://github.com/react-bootstrap/react-bootstrap -// Definitions by: Walker Burgin , Vincent Siao , Danilo Barros +// Definitions by: Walker Burgin , +// Vincent Siao , Danilo Barros , +// Batbold Gansukh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 9ecf2e4ab653edba9b81e29a407c909aaad6d1e9 Mon Sep 17 00:00:00 2001 From: Batbold Gansukh Date: Mon, 25 Jul 2016 01:21:14 +0900 Subject: [PATCH 013/242] Fix for feedback --- react-bootstrap/react-bootstrap.d.ts | 55 +++------------------------- 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index f52ed96ef3..634d73a5ee 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -1,8 +1,6 @@ // Type definitions for react-bootstrap // Project: https://github.com/react-bootstrap/react-bootstrap -// Definitions by: Walker Burgin , -// Vincent Siao , Danilo Barros , -// Batbold Gansukh +// Definitions by: Walker Burgin , Vincent Siao , Danilo Barros , Batbold Gansukh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -74,7 +72,6 @@ declare namespace ReactBootstrap { { active?: boolean; id?: string | number; - // linkId?: string | number; // TODO: Removed since v0.30.0 href?: string; title?: React.ReactNode; target?: string; @@ -447,8 +444,8 @@ declare namespace ReactBootstrap { bsSize?: Sizes; bsStyle?: string; placement?: string; - positionLeft?: number|string; // String support added since v0.30.0 - positionTop?: number|string; // String support added since v0.30.0 + positionLeft?: number | string; // String support added since v0.30.0 + positionTop?: number | string; // String support added since v0.30.0 } type Popover = React.ClassicComponent; var Popover: React.ClassicComponentClass; @@ -591,7 +588,7 @@ declare namespace ReactBootstrap { interface NavDropdownBaseProps extends DropdownBaseProps { - active?:boolean; + active?: boolean; noCaret?: boolean; } type NavDropdownProps = NavDropdownBaseProps & React.HTMLProps; @@ -656,8 +653,7 @@ declare namespace ReactBootstrap { // - interface PagerProps extends React.HTMLProps - { + interface PagerProps extends React.HTMLProps { onSelect?: SelectCallback; } interface PagerClass extends React.ClassicComponentClass { @@ -898,47 +894,6 @@ declare namespace ReactBootstrap { type Table = React.ClassicComponent; var Table: React.ClassicComponentClass; - // // Removed since v0.30.0 - // interface InputProps extends React.HTMLProps { - // defaultValue?:string; - // addonAfter?: any; // TODO: Add more specific type - // addonBefore?: any; // TODO: Add more specific type - // bsSize?: Sizes; - // bsStyle?: string; - // buttonAfter?: any; // TODO: Add more specific type - // buttonBefore?: any; // TODO: Add more specific type - // feedbackIcon?: any; // TODO: Add more specific type - // groupClassName?: string; - // hasFeedback?: boolean; - // help?: any; // TODO: Add more specific type - // labelClassName?: string; - // wrapperClassName?: string; - // } - /** @deprecated since v0.29.0 */ - // class Input extends React.Component { - // } - - - // // Removed since v0.30. - // interface ButtonInputProps extends React.HTMLProps { - // addonAfter?: any; // TODO: Add more specific type - // addonBefore?: any; // TODO: Add more specific type - // bsSize?: Sizes; - // bsStyle?: string; - // buttonAfter?: any; // TODO: Add more specific type - // buttonBefore?: any; // TODO: Add more specific type - // feedbackIcon?: any; // TODO: Add more specific type - // groupClassName?: string; - // hasFeedback?: boolean; - // help?: any; // TODO: Add more specific type - // labelClassName?: string; - // wrapperClassName?: string; - // } - /** @deprecated since v0.29.0 */ - // class ButtonInput extends React.Component { - // } - - // interface InputGroupProps extends React.HTMLProps From f4f8a0c9aef617f1cc4a98f2b12057c77515783b Mon Sep 17 00:00:00 2001 From: Batbold Gansukh Date: Mon, 25 Jul 2016 01:21:14 +0900 Subject: [PATCH 014/242] Fix for feedback --- react-bootstrap/react-bootstrap.d.ts | 58 +++------------------------- 1 file changed, 5 insertions(+), 53 deletions(-) diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index f52ed96ef3..76e51cb012 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -1,8 +1,6 @@ // Type definitions for react-bootstrap // Project: https://github.com/react-bootstrap/react-bootstrap -// Definitions by: Walker Burgin , -// Vincent Siao , Danilo Barros , -// Batbold Gansukh +// Definitions by: Walker Burgin , Vincent Siao , Danilo Barros , Batbold Gansukh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -74,7 +72,6 @@ declare namespace ReactBootstrap { { active?: boolean; id?: string | number; - // linkId?: string | number; // TODO: Removed since v0.30.0 href?: string; title?: React.ReactNode; target?: string; @@ -91,8 +88,6 @@ declare namespace ReactBootstrap { block?: boolean; bsStyle?: string; bsSize?: Sizes; - // navItem?: boolean; // TODO: Removed since v0.30.0 - // navDropdown?: boolean; // TODO: Removed since v0.30.0 componentClass?: React.ReactType; } type Button = React.ClassicComponent; @@ -447,8 +442,8 @@ declare namespace ReactBootstrap { bsSize?: Sizes; bsStyle?: string; placement?: string; - positionLeft?: number|string; // String support added since v0.30.0 - positionTop?: number|string; // String support added since v0.30.0 + positionLeft?: number | string; // String support added since v0.30.0 + positionTop?: number | string; // String support added since v0.30.0 } type Popover = React.ClassicComponent; var Popover: React.ClassicComponentClass; @@ -591,7 +586,7 @@ declare namespace ReactBootstrap { interface NavDropdownBaseProps extends DropdownBaseProps { - active?:boolean; + active?: boolean; noCaret?: boolean; } type NavDropdownProps = NavDropdownBaseProps & React.HTMLProps; @@ -656,8 +651,7 @@ declare namespace ReactBootstrap { // - interface PagerProps extends React.HTMLProps - { + interface PagerProps extends React.HTMLProps { onSelect?: SelectCallback; } interface PagerClass extends React.ClassicComponentClass { @@ -747,7 +741,6 @@ declare namespace ReactBootstrap { active?: boolean; animtateIn?: boolean; animateOut?: boolean; - // caption?: any; // TODO: Removed since v0.30.0 direction?: string; index?: number; onAnimateOutEnd?: Function; @@ -898,47 +891,6 @@ declare namespace ReactBootstrap { type Table = React.ClassicComponent; var Table: React.ClassicComponentClass; - // // Removed since v0.30.0 - // interface InputProps extends React.HTMLProps { - // defaultValue?:string; - // addonAfter?: any; // TODO: Add more specific type - // addonBefore?: any; // TODO: Add more specific type - // bsSize?: Sizes; - // bsStyle?: string; - // buttonAfter?: any; // TODO: Add more specific type - // buttonBefore?: any; // TODO: Add more specific type - // feedbackIcon?: any; // TODO: Add more specific type - // groupClassName?: string; - // hasFeedback?: boolean; - // help?: any; // TODO: Add more specific type - // labelClassName?: string; - // wrapperClassName?: string; - // } - /** @deprecated since v0.29.0 */ - // class Input extends React.Component { - // } - - - // // Removed since v0.30. - // interface ButtonInputProps extends React.HTMLProps { - // addonAfter?: any; // TODO: Add more specific type - // addonBefore?: any; // TODO: Add more specific type - // bsSize?: Sizes; - // bsStyle?: string; - // buttonAfter?: any; // TODO: Add more specific type - // buttonBefore?: any; // TODO: Add more specific type - // feedbackIcon?: any; // TODO: Add more specific type - // groupClassName?: string; - // hasFeedback?: boolean; - // help?: any; // TODO: Add more specific type - // labelClassName?: string; - // wrapperClassName?: string; - // } - /** @deprecated since v0.29.0 */ - // class ButtonInput extends React.Component { - // } - - // interface InputGroupProps extends React.HTMLProps From f4fc3a091b20ba971e3d482c7fdfeeced0973585 Mon Sep 17 00:00:00 2001 From: Batbold Gansukh Date: Mon, 25 Jul 2016 12:02:29 +0900 Subject: [PATCH 015/242] Delete react-bootstrap-tests.js,react-bootstrap-tests.jsx --- react-bootstrap/react-bootstrap-tests.jsx | 959 ---------------------- 1 file changed, 959 deletions(-) delete mode 100644 react-bootstrap/react-bootstrap-tests.jsx diff --git a/react-bootstrap/react-bootstrap-tests.jsx b/react-bootstrap/react-bootstrap-tests.jsx deleted file mode 100644 index d5f33d94ca..0000000000 --- a/react-bootstrap/react-bootstrap-tests.jsx +++ /dev/null @@ -1,959 +0,0 @@ -// React-Bootstrap Test -// ================================================================================ -/// -/// -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -// Imports -// -------------------------------------------------------------------------------- -var React = require('react'); -var react_1 = require('react'); -var react_bootstrap_1 = require('react-bootstrap'); -var ReactBootstrapTest = (function (_super) { - __extends(ReactBootstrapTest, _super); - function ReactBootstrapTest() { - _super.apply(this, arguments); - } - ReactBootstrapTest.prototype.callback = function () { - alert('Callback: ' + JSON.stringify(arguments)); - }; - ReactBootstrapTest.prototype.render = function () { - var style = { padding: '50px' }; - var tooltip = (Holy guacamole! Check this info.); - var innerGlyphicon = ; - var innerButton = Before; - var innerDropdown = ( - Item - ); - var innerRadio = ; - var innerCheckbox = ; - return (
-
- - Default - Primary - Success - Info - Warning - Danger - Link - -
- -
- - Large button - Large button - - - Default button - Default button - - - Small button - Small button - - - Extra small button - Extra small button - -
- -
- - Block level button - Block level button - -
- -
- - Primary button - Button - -
- - -
- - Link - Button - -
- - -
- - Left - Middle - Right - -
- - -
- - - 1 - 2 - 3 - 4 - - - 5 - 6 - 7 - - - 8 - - -
- // TODO: Start here - - - // TODO: Start here - -
- - - Left - Middle - Right - - - - - - Left - Middle - Right - - - - - - Left - Middle - Right - - - - - - Left - Middle - Right - - -
- -
- - Button - Button - - Dropdown link - Dropdown link - - Button - Button - - Dropdown link - Dropdown link - - - Dropdown link - Dropdown link - - -
- -
- - Action - Another action - Active Item - - Separated link - -
- -
-
-
    - Header - link - - Header - link - disabled - - link with title - - - link that alerts - -
-
-
- -
- - Basic panel example - -
- -
-
- - Panel content - - - Panel content - -
-
- -
- - Panel content - -
- -
-
- - Panel content - - - - Panel content - - - - Panel content - - - - Panel content - - - - Panel content - - - - Panel content - -
-
- -
- - Some default panel content here. - - Item 1 - Item 2 - … - - Some more panel content here. - -
- -
- - - Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer - farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. - - - Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer - farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. - - - Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer - farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. - - -
- -
-
- - - Modal title - - - - One fine body... - - - - Close - Save changes - - - -
-
- -
-
- - Tooltip right - - - - Tooltip top - - - - Tooltip left - - - - Tooltip bottom - -
-
- -
- - - Holy guacamole! - - - - Holy guacamole! - - - - Holy guacamole! - - - - Holy guacamole! - - -
- -
-
- - And here's some amazing content. It's very engaging. right? - -
-
- -
- - Holy guacamole! Check this info.}> - Holy guacamole! - - Holy guacamole! Check this info.}> - Holy guacamole! - - Holy guacamole! Check this info.}> - Holy guacamole! - - Holy guacamole! Check this info.}> - Holy guacamole! - - -
- -
- - Holy guacamole! Check this info.}> - Click - - Holy guacamole! Check this info.}> - Hover - - Holy guacamole! Check this info.}> - Focus - - Holy guacamole! Check this info.}> - Click or hover or focus - - Holy guacamole! Check this info.}> - Click + rootClose - - -
- -
- -
- -
- -
- -
-
- - - - -
-
- -
-
- - - - -
-
- -
- -
- -
- - - - - -
- -
- - NavItem 1 content - NavItem 2 content - NavItem 3 content - -
- -
- - NavItem 1 content - NavItem 2 content - NavItem 3 content - -
- -
-
- - NavItem 1 content - NavItem 2 content - NavItem 3 content - -
- - NavItem 1 content - NavItem 2 content - NavItem 3 content - -
-
- -
- - - - React-Bootstrap - - - - - - Link - Link - - Action - Another action - Something else here - - Separated link - - - - -
- -
- - - Link - Link - - -
- -
- - Previous - Next - -
- -
- - Tab 1 content - Tab 2 content - Tab 3 content - -
- -
- - - - - - Tab 1 - - - Tab 2 - - - - - - - Tab 1 content - - - Tab 2 content - - - - - -
- -
- - Previous - Next - -
- -
- - ← Previous Page - Next Page → - -
- -
- - ← Previous - Next → - -
- -
-
- -
- -
- - -
-
- -
- - Holy guacamole! Best check yo self, you're not looking too good. - -
- -
- - - 900x500 -
-

First slide label

-

Nulla vitae elit libero, a pharetra augue mollis interdum.

-
-
- - 900x500 -
-

Second slide label

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

-
-
- - 900x500 -
-

Third slide label

-

Praesent commodo cursus magna, vel scelerisque nisl consectetur.

-
-
-
-
- -
- - - <{'Col xs={12} md={8}'} /> - <{'Col xs={6} md={4}'} /> - - - - <{'Col xs={6} md={4}'} /> - <{'Col xs={6} md={4}'} /> - <{'Col xs={6} md={4}'} /> - - - - <{'Col xs={6} xsOffset={6}'} /> - - - - <{'Col md={6} mdPush={6}'} /> - <{'Col md={6} mdPull={6}'} /> - - -
- -
- - - - - - - - - - - - - -
- -
- - Item 1 - Item 2 - ... - -
- -
- - Link 1 - Link 2 - - Trigger an alert - - -
- -
- - Link 1 - Link 2 - Link 3 - -
- -
- - Success - Info - Warning - Danger - -
- -
- - Some body text - Linked item - Danger styling - -
- -
-
-

Label New

-

Label New

-

Label New

-

Label New

-
Label New
-

Label New

-
-
- -
-
- Default  - Primary  - Success  - Info  - Warning  - Danger -
-
- -
-

Badges 42

-
- -
- -

Hello, world!

-

This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.

-

Learn more

-
-
- -
- -
- -
- Example page header Subtext for header -
- -
- Look I'm in a well! -
- -
-
- Look I'm in a large well! - Look I'm in a small well! -
-
- -
-
- - - - - - - - - - - Star - Star - Star - Star - - -
-
- -
- - - - Number - First Name - Last Name - Username - - - - - 1 - Mark - Otto - @mdo - - - 2 - Jacob - Thornton - @fat - - - 3 - Larry the Bird - @twitter - - - -
- -
- - - - Number - Table heading - Table heading - Table heading - Table heading - Table heading - Table heading - - - - - 1 - Table cell - Table cell - Table cell - Table cell - Table cell - Table cell - - - 2 - Table cell - Table cell - Table cell - Table cell - Table cell - Table cell - - - 3 - Table cell - Table cell - Table cell - Table cell - Table cell - Table cell - - - -
- -
- - Working example with validation - - - Validation is based on string length. - -
- -
- - - - - - - - - - - - - -
- -
-
- - Child Text - - - -
- -
-
- - - - - - - - -
-
- -
-
- - - -
-
- -
-
- - - -
-
- -
-
- - - -
-
- -
- - - - - - - - - - -
- -
- - - Control Label - - - Help block message. - - - - 1 - {' '} - 2 - {' '} - 3 - - - 1 - {' '} - 2 - {' '} - 3 - - -
- -
- - - Image - - - Top aligned media -

Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

-

Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

-
-
-
-
); - }; - return ReactBootstrapTest; -}(react_1.Component)); -exports.ReactBootstrapTest = ReactBootstrapTest; From 25e18b592470e3dddccc826fde2bb8e7610ef863 Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Mon, 25 Jul 2016 12:37:59 -0400 Subject: [PATCH 016/242] Improve precision of Object.assign signature Modified the signature of `Object.assign`, adding three overloads, and adjusting the documentation of the fourth. Please note that these have been copied verbatim from the _lib.es2015.core.d.ts_ file shipped with typescript@2.1.0-dev.20160725. --- core-js/core-js.d.ts | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/core-js/core-js.d.ts b/core-js/core-js.d.ts index e9be316364..c633dc4ef6 100644 --- a/core-js/core-js.d.ts +++ b/core-js/core-js.d.ts @@ -31,7 +31,34 @@ interface ObjectConstructor { * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties */ assign(target: any, ...sources: any[]): any; From 97883bac0d3ce84bb738f2fdad9265a477561e18 Mon Sep 17 00:00:00 2001 From: Dani Hodovic Date: Mon, 25 Jul 2016 18:38:53 +0200 Subject: [PATCH 017/242] Added Redis retry_strategy Most of the ClientOpts that have to do with reconnecting have been deprecated in favor of the `retry_strategy` property. The DefinitelyTyped repo is outdated and is missing the retry_strategy property. See the docs at https://github.com/NodeRedis/node_redis. The following options of ClientOpts are deprecated in favor of retry_strategy: - retry_max_delay - connect_timeout - max_attempts --- redis/redis.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 6dd257bd9b..f97095c721 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -34,6 +34,10 @@ declare module "redis" { versions: number[]; } + interface RetryStrategy { + (options: {error: Error, total_retry_time: number, times_connected: number, attempt: number}): number; + } + export interface ClientOpts { parser?: string; return_buffers?: boolean; @@ -50,6 +54,7 @@ declare module "redis" { family?: string; command_queue_high_water?: number; command_queue_low_water?: number; + retry_strategy?: RetryStrategy; } export interface RedisClient extends NodeJS.EventEmitter { From 6cad73d91bf6a8449f632dc8aa95fdab3afc615e Mon Sep 17 00:00:00 2001 From: Andre Eckardt Date: Tue, 26 Jul 2016 18:41:18 +0200 Subject: [PATCH 018/242] extends node-webkit Tray class with EventEmitter See https://github.com/nwjs/nw.js/wiki/Tray#events --- node-webkit/node-webkit.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-webkit/node-webkit.d.ts b/node-webkit/node-webkit.d.ts index 81129274dc..a6760c9949 100644 --- a/node-webkit/node-webkit.d.ts +++ b/node-webkit/node-webkit.d.ts @@ -199,7 +199,7 @@ declare module "nw.gui" { menu?: Menu; } - export class Tray implements TrayOption { + export class Tray extends EventEmitter implements TrayOption { constructor(option: TrayOption); title: string; tooltip: string; From 7e54d47ca06643829f57aceef341defb6f682e1b Mon Sep 17 00:00:00 2001 From: Andre Eckardt Date: Tue, 26 Jul 2016 18:42:08 +0200 Subject: [PATCH 019/242] extends node-webkit App class with EventEmitter See https://github.com/nwjs/nw.js/wiki/App#events --- node-webkit/node-webkit.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-webkit/node-webkit.d.ts b/node-webkit/node-webkit.d.ts index a6760c9949..3a9533875b 100644 --- a/node-webkit/node-webkit.d.ts +++ b/node-webkit/node-webkit.d.ts @@ -156,7 +156,7 @@ declare module "nw.gui" { eval(frame: HTMLIFrameElement, script: string): void; } - export interface App { + export interface App extends EventEmitter { argv: any; fullArgv: any; dataPath: string; From e7d4c9f7a5acc5a7dc9648de73b34e6ed15c0de8 Mon Sep 17 00:00:00 2001 From: Andre Eckardt Date: Tue, 26 Jul 2016 19:08:22 +0200 Subject: [PATCH 020/242] adds typings for trayballoon module --- trayballoon/trayballoon-tests.ts | 15 +++++++++++++++ trayballoon/trayballoon.d.ts | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 trayballoon/trayballoon-tests.ts create mode 100644 trayballoon/trayballoon.d.ts diff --git a/trayballoon/trayballoon-tests.ts b/trayballoon/trayballoon-tests.ts new file mode 100644 index 0000000000..dab23777e0 --- /dev/null +++ b/trayballoon/trayballoon-tests.ts @@ -0,0 +1,15 @@ +/// + +import trayballoon = require( "trayballoon" ); + +function testTrayballoon() { + trayballoon( { + text: "text", + title: "title", + icon: "icon", + timeout: 5000, + wait: true + }, () => { + + } ); +} diff --git a/trayballoon/trayballoon.d.ts b/trayballoon/trayballoon.d.ts new file mode 100644 index 0000000000..c60ffed40b --- /dev/null +++ b/trayballoon/trayballoon.d.ts @@ -0,0 +1,17 @@ +// Type definitions for trayballoon +// Project: https://github.com/sindresorhus/trayballoon +// Definitions by: André Eckardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare interface TrayballoonOptions { + text:string + title?:string + icon?:string + timeout?:number + wait?:boolean +} + +declare function trayballoonFn( opts:TrayballoonOptions, fn:Function ): void; +declare module "trayballoon" { + export = trayballoonFn; +} \ No newline at end of file From 8438fa6a582ffb50832fdeecbf2230c3b7dc4183 Mon Sep 17 00:00:00 2001 From: darklektor Date: Tue, 26 Jul 2016 21:19:47 +0300 Subject: [PATCH 021/242] Added FeedDialogParams to fbsdk typings --- fbsdk/fbsdk.d.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/fbsdk/fbsdk.d.ts b/fbsdk/fbsdk.d.ts index 36078fddea..23e49a3683 100644 --- a/fbsdk/fbsdk.d.ts +++ b/fbsdk/fbsdk.d.ts @@ -67,11 +67,28 @@ interface PayDialogParams { test_currency?: string; } +interface FeedDialogParams { + method: string; // "feed" + app_id: string; + redirect_uri?: string; + display?: string; + from?: string; + to?: string; + link?: string; + picture?: string; + source?: string; + name: string; + caption?: string; + description?: string; + ref?: any; +} + declare type FBUIParams = ShareDialogParams | PageTabDialogParams | RequestsDialogParams | SendDialogParams - | PayDialogParams; + | PayDialogParams + | FeedDialogParams; interface FBLoginOptions{ auth_type?: string; From e5604f86ee04e132173dadc6a09d09a7995a10ed Mon Sep 17 00:00:00 2001 From: EvgeneOskin Date: Wed, 27 Jul 2016 16:00:08 +0600 Subject: [PATCH 022/242] Fix class hierarchy of OpenLayers events. --- openlayers/openlayers.d.ts | 42 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 243087c7b4..a70f3b115b 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -8,7 +8,7 @@ declare namespace olx { /** Attributions */ attributions?: Array - + /*** The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. */ crossOrigin?: string @@ -47,7 +47,7 @@ declare namespace olx { /*** The extent to zoom to. If undefined the validity extent of the view projection is used.*/ extent: ol.Extent; } - + interface AttributionOptions { /** HTML markup for this attribution. */ @@ -1220,7 +1220,7 @@ declare namespace ol { /** * Events emitted by ol.Collection instances are instances of this type. */ - class CollectionEvent { + class CollectionEvent extends ol.events.Event { /** * The element that is added to or removed from the collection. @@ -1279,7 +1279,7 @@ declare namespace ol { /** * Events emitted by ol.interaction.DragBox instances are instances of this type. */ - class DragBoxEvent { + class DragBoxEvent extends ol.events.Event { /** * The coordinate of the drag event. @@ -1935,7 +1935,7 @@ declare namespace ol { /** * Events emitted as map events are instances of this type. See ol.Map for which events trigger a map event. */ - class MapEvent { + class MapEvent extends ol.events.Event { /** * The frame state at the time of the event. @@ -2005,7 +2005,7 @@ declare namespace ol { /** * Events emitted by ol.Object instances are instances of this type. */ - class ObjectEvent { + class ObjectEvent extends ol.events.Event { /** * The name of the property whose value is changing. @@ -2045,7 +2045,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - on(type: string, listener: (event: MapBrowserEvent) => void, ref?: any): any; + on(type: string, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Listen for a certain type of event. @@ -2054,7 +2054,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - on(type: Array, listener: (event: MapBrowserEvent) => void, ref?: any): any; + on(type: Array, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Listen once for a certain type of event. @@ -2063,7 +2063,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - once(type: string, listener: (event: MapBrowserEvent) => void, ref?: any): any; + once(type: string, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Listen once for a certain type of event. @@ -2072,7 +2072,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - once(type: Array, listener: (event: MapBrowserEvent) => void, ref?: any): any; + once(type: Array, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Unlisten for a certain type of event. @@ -2081,7 +2081,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - un(type: Array, listener: (event: MapBrowserEvent) => void, ref?: any): any; + un(type: Array, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Removes an event listener using the key returned by on() or once(). Note that using the ol.Observable.unByKey static function is to be preferred. @@ -2165,7 +2165,7 @@ declare namespace ol { /** * Events emitted by ol.interaction.Select instances are instances of this type. */ - class SelectEvent { + class SelectEvent extends ol.events.Event { /** * Deselected features array. @@ -2551,6 +2551,12 @@ declare namespace ol { function targetNotEditable(mapBrowserEvent: ol.MapBrowserEvent): boolean; } interface ConditionType { (mapBrowseEvent: ol.MapBrowserEvent): boolean; } + class Event { + target: any; + type: string; + preventDefault(): void; + stopPropagation(): void; + } } namespace extent { @@ -3601,7 +3607,7 @@ declare namespace ol { class DragAndDrop { } - class DragAndDropEvent { + class DragAndDropEvent extends ol.events.Event { } class DragBox { @@ -3623,7 +3629,7 @@ declare namespace ol { constructor(opt_options?: olx.interaction.DrawOptions) } - class DrawEvent { + class DrawEvent extends ol.events.Event { } class Interaction extends ol.Object { @@ -4129,7 +4135,7 @@ declare namespace ol { namespace render { - class Event { + class Event extends ol.events.Event { } class VectorContext { @@ -4167,7 +4173,7 @@ declare namespace ol { class ImageCanvas extends Image { } - class ImageEvent { + class ImageEvent extends ol.events.Event { } class ImageMapGuide extends Image { @@ -4216,7 +4222,7 @@ declare namespace ol { class TileDebug extends Tile { } - class TileEvent { + class TileEvent extends ol.events.Event { } class TileImage extends UrlTile { @@ -4301,7 +4307,7 @@ declare namespace ol { getFeaturesAtCoordinate(coordinate: ol.Coordinate): ol.Feature[]; } - class VectorEvent { + class VectorEvent extends ol.events.Event { } class VectorTile extends UrlTile { From fbf674838e8743ad477b37b977bef02edd44ee88 Mon Sep 17 00:00:00 2001 From: Batbold Gansukh Date: Thu, 28 Jul 2016 14:12:09 +0900 Subject: [PATCH 023/242] Fix spacing --- react-bootstrap/react-bootstrap-tests.tsx | 1746 ++++++++++----------- 1 file changed, 870 insertions(+), 876 deletions(-) diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index 9b2e56cc4e..c6976d8a05 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -8,18 +8,18 @@ import * as React from 'react'; import { Component, CSSProperties } from 'react'; import { - Button, ButtonToolbar, Modal, Well, ButtonGroup, - DropdownButton, MenuItem, Panel, ListGroup, - ListGroupItem, Accordion, Tooltip, - OverlayTrigger, Popover, ProgressBar, - Nav, NavItem, Navbar, NavDropdown, - Tabs, Tab, Pager, PageItem, - Pagination, Alert, Carousel, - Grid, Row, Col, Thumbnail, Image, - Label, Badge, Jumbotron, PageHeader, - Glyphicon, Table, Form, FormGroup, - ControlLabel, FormControl, HelpBlock, - Radio, Checkbox, Media, InputGroup + Button, ButtonToolbar, Modal, Well, ButtonGroup, + DropdownButton, MenuItem, Panel, ListGroup, + ListGroupItem, Accordion, Tooltip, + OverlayTrigger, Popover, ProgressBar, + Nav, NavItem, Navbar, NavDropdown, + Tabs, Tab, Pager, PageItem, + Pagination, Alert, Carousel, + Grid, Row, Col, Thumbnail, Image, + Label, Badge, Jumbotron, PageHeader, + Glyphicon, Table, Form, FormGroup, + ControlLabel, FormControl, HelpBlock, + Radio, Checkbox, Media, InputGroup } from 'react-bootstrap'; @@ -129,87 +129,87 @@ export class ReactBootstrapTest extends Component { // TODO: Start here
- - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + +
- - - - - Dropdown link - Dropdown link - - - - - Dropdown link - Dropdown link - - - Dropdown link - Dropdown link - - + + + + + Dropdown link + Dropdown link + + + + + Dropdown link + Dropdown link + + + Dropdown link + Dropdown link + +
- - Action - Another action - Active Item - - Separated link - + + Action + Another action + Active Item + + Separated link +
-
-
    - Header - link - - Header - link - disabled - - link with title - - - link that alerts - -
-
+
+
    + Header + link + + Header + link + disabled + + link with title + + + link that alerts + +
+
@@ -219,569 +219,568 @@ export class ReactBootstrapTest extends Component {
-
- - Panel content - - - Panel content - -
+
+ + Panel content + + + Panel content + +
- - Panel content - + + Panel content +
-
- - Panel content - +
+ + Panel content + - - Panel content - + + Panel content + - - Panel content - + + Panel content + - - Panel content - + + Panel content + - - Panel content - + + Panel content + - - Panel content - -
+ + Panel content + +
- - Some default panel content here. - - Item 1 - Item 2 - … - - Some more panel content here. - + + Some default panel content here. + + Item 1 + Item 2 + … + + Some more panel content here. +
- - - Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer - farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. - - - Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer - farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. - - - Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer - farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. - - + + + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer + farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + + + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer + farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + + + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer + farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + +
-
- - - Modal title - +
+ + + Modal title + - - One fine body... - + + One fine body... + - - - - - - -
+ + + + +
+
- ({})} style={style}> - - Modal heading - - -

Text in a modal

-

Duis mollis, est non commodo luctus, nisi erat porttitor ligula.

+ ({})} style={style}> + + Modal heading + + +

Text in a modal

+

Duis mollis, est non commodo luctus, nisi erat porttitor ligula.

-

Popover in a modal

-

there is a popover here

+

Popover in a modal

+

there is a popover here

-

Tooltips in a modal

-

there is a tooltip here

+

Tooltips in a modal

+

there is a tooltip here

-
+
-

Overflowing text to show scroll behavior

-

Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

-

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

-

Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.

-

Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

-

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

-

Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.

-

Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

-

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

-

Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.

-
- - - -
+

Overflowing text to show scroll behavior

+

Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

+

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

+

Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.

+

Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

+

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

+

Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.

+

Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

+

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

+

Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.

+
+ + + +
-
- - Tooltip right - +
+ + Tooltip right + - - Tooltip top - + + Tooltip top + - - Tooltip left - + + Tooltip left + - - Tooltip bottom - -
+ + Tooltip bottom + +
- - - - + + + + - - - + + + - - - + + + - - - - + + + +
-
- - And here's some amazing content. It's very engaging. right? - -
+
+ + And here's some amazing content. It's very engaging. right? + +
- - Holy guacamole! Check this info.}> - - - Holy guacamole! Check this info.}> - - - Holy guacamole! Check this info.}> - - - Holy guacamole! Check this info.}> - - - + + Holy guacamole! Check this info.}> + + + Holy guacamole! Check this info.}> + + + Holy guacamole! Check this info.}> + + + Holy guacamole! Check this info.}> + + +
- - Holy guacamole! Check this info.}> - - - Holy guacamole! Check this info.}> - - - Holy guacamole! Check this info.}> - - - Holy guacamole! Check this info.}> - - - Holy guacamole! Check this info.}> - - - + + Holy guacamole! Check this info.}> + + + Holy guacamole! Check this info.}> + + + Holy guacamole! Check this info.}> + + + Holy guacamole! Check this info.}> + + + Holy guacamole! Check this info.}> + + +
- +
- +
-
- - - - -
+
+ + + + +
-
- - - - -
+
+ + + + +
- +
- - - - - + + + + +
- -
- -
- -
- -
-
-
+ +
+ -
- - - - React-Bootstrap - - - - - - - -
- -
- - - -
- -
- - Previous - {' '} - Next - -
- -
- - ← Previous Page - Next Page → - -
- -
- - ← Previous - Next → - -
- -
- - Tab 1 content - Tab 2 content - Tab 3 content - -
- -
- - - -
- - Previous - Next - + + + + React-Bootstrap + + + + + + +
- - ← Previous Page - Next Page → - + + +
- - ← Previous - Next → - + + Previous + {' '} + Next +
-
- -
- -
- - -
+ + ← Previous Page + Next Page → +
- - Holy guacamole! Best check yo self, you're not looking too good. - + + ← Previous + Next → +
- - - 900x500 - -

First slide label

-

Nulla vitae elit libero, a pharetra augue mollis interdum.

-
-
- - 900x500 - -

Second slide label

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

-
-
- - 900x500 - -

Third slide label

-

Praesent commodo cursus magna, vel scelerisque nisl consectetur.

-
-
-
+ + Tab 1 content + Tab 2 content + Tab 3 content +
- - - <{'Col xs={12} md={8}'} /> - <{'Col xs={6} md={4}'} /> - - - - <{'Col xs={6} md={4}'} /> - <{'Col xs={6} md={4}'} /> - <{'Col xs={6} md={4}'} /> - - - - <{'Col xs={6} xsOffset={6}'} /> - - - - <{'Col md={6} mdPush={6}'} /> - <{'Col md={6} mdPull={6}'} /> - - + + + + + + + + + Tab 1 content + + + Tab 2 content + + + + +
- - - - - - - - - - - - - + + Previous + Next +
- - Item 1 - Item 2 - ... - + + ← Previous Page + Next Page → +
- - Link 1 - Link 2 - - Trigger an alert - - + + ← Previous + Next → +
- - Link 1 - Link 2 - Link 3 - +
+ +
+ +
+ + +
- - Success - Info - Warning - Danger - + + Holy guacamole! Best check yo self, you're not looking too good. +
- - Some body text - Linked item - Danger styling - + + + 900x500 + +

First slide label

+

Nulla vitae elit libero, a pharetra augue mollis interdum.

+
+
+ + 900x500 + +

Second slide label

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+
+
+ + 900x500 + +

Third slide label

+

Praesent commodo cursus magna, vel scelerisque nisl consectetur.

+
+
+
-
-

Label

-

Label

-

Label

-

Label

-
Label
-

Label

-
+ + + <{'Col xs={12} md={8}'} /> + <{'Col xs={6} md={4}'} /> + + + + <{'Col xs={6} md={4}'} /> + <{'Col xs={6} md={4}'} /> + <{'Col xs={6} md={4}'} /> + + + + <{'Col xs={6} xsOffset={6}'} /> + + + + <{'Col md={6} mdPush={6}'} /> + <{'Col md={6} mdPull={6}'} /> + +
-
-   -   -   -   -   - -
+ + + + + + + + + + + + +
-

Badges 42

+ + Item 1 + Item 2 + ... +
- -

Hello, world!

-

This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.

-

-
+ + Link 1 + Link 2 + + Trigger an alert + + +
+ +
+ + Link 1 + Link 2 + Link 3 + +
+ +
+ + Success + Info + Warning + Danger + +
+ +
+ + Some body text + Linked item + Danger styling + +
+ +
+
+

Label

+

Label

+

Label

+

Label

+
Label
+

Label

+
+
+ +
+
+   +   +   +   +   + +
+
+ +
+

Badges 42

+
+ +
+ +

Hello, world!

+

This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.

+

+
@@ -789,7 +788,7 @@ export class ReactBootstrapTest extends Component {
- Example page header Subtext for header + Example page header Subtext for header
@@ -797,412 +796,407 @@ export class ReactBootstrapTest extends Component {
-
- Look I'm in a large well! - Look I'm in a small well! -
+
+ Look I'm in a large well! + Look I'm in a small well! +
-
- - - - - - - - - - - - - - - - -
+
+ + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NumberFirst NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larry the Bird@twitter
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NumberFirst NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larry the Bird@twitter
- - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + +
NumberTable headingTable headingTable headingTable headingTable headingTable heading
NumberTable headingTable headingTable headingTable headingTable headingTable heading
1Table cellTable cellTable cellTable cellTable cellTable cell
2Table cellTable cellTable cellTable cellTable cellTable cell
3Table cellTable cellTable cellTable cellTable cellTable cell
1Table cellTable cellTable cellTable cellTable cellTable cell
2Table cellTable cellTable cellTable cellTable cellTable cell
3Table cellTable cellTable cellTable cellTable cellTable cell
- - Working example with validation - - - Validation is based on string length. - + + Working example with validation + + + Validation is based on string length. +
-
- - Text - - - - Email address - - - - Pass - - - - File - - [Optional] Block level help text - - - Checkbox - - - Radio - - - Select - - - - - - - Textarea - - -
-
- -
-
- - - @ - - - - - - - .00 - - - - - $ - - .00 - - - - - - - - - - - - - - - - - - - - - - - - - Item - - - - - - - - - - - - - - - - - - - - + + + Text + + + + Email address + + + + Pass + + + + File + + [Optional] Block level help text + + + Checkbox + + + Radio + + + Select + + + + + + + Textarea + +
-
- - - - - - - - - -
+
+ + + @ + + + + + + + .00 + + + + + $ + + .00 + + + + + + + + + + + + + + + + + + + + + + + + + Item + + + + + + + + + + + + + + + + + + + + +
-
- - Input with success - - Help text with validation state. - + + + + + + + + + + +
+
- - Input with warning - - - - - Input with error - - - - - Input with success and feedback icon - - - - - - Input with warning and feedback icon - - - - - - Input with error and feedback icon - - - - - - Input with success and custom feedback icon - - - - - - - - Input group with warning - - @ - - - - - -
- - - Input with error - - - - - - - - - - Input group with success - - - - @ +
+ + + Input with success - - - - - + Help text with validation state. + -
- - Input with warning - {' '} - - - - {' '} - - Input group with error - {' '} - - @ - - - - -
+ + Input with warning + + - - Checkbox with success - - - Radio with warning - - - Checkbox with error - + + Input with error + + - {/* This requires React 15's -less spaces to be exactly correct. */} - - - Checkbox - - {' '} - - with - - {' '} - - success - - - + + Input with success and feedback icon + + + + + + Input with warning and feedback icon + + + + + + Input with error and feedback icon + + + + + + Input with success and custom feedback icon + + + + + + + + Input group with warning + + @ + + + + + +
+ + + Input with error + + + + + + + + + + Input group with success + + + + @ + + + + + +
+ +
+ + Input with warning + {' '} + + + + {' '} + + Input group with error + {' '} + + @ + + + + +
+ + + Checkbox with success + + + Radio with warning + + + Checkbox with error + + + {/* This requires React 15's -less spaces to be exactly correct. */} + + + Checkbox + + {' '} + + with + + {' '} + + success + + +
-
- - Control Label - - - Help block message. - + + + Control Label + + + Help block message. + - - 1 - {' '} - 2 - {' '} - 3 - - - 1 - {' '} - 2 - {' '} - 3 - -
+ + 1 + {' '} + 2 + {' '} + 3 + + + 1 + {' '} + 2 + {' '} + 3 + +
-
+
- - Image - - - Top aligned media -

Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

-

Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

-
+ + Image + + + Top aligned media +

Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

+

Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

+
From 404ea846dc219951683c3dad8fcf281b93ee2127 Mon Sep 17 00:00:00 2001 From: Batbold Gansukh Date: Thu, 28 Jul 2016 14:49:47 +0900 Subject: [PATCH 024/242] Fix formating --- react-bootstrap/react-bootstrap.d.ts | 160 +++++++-------------------- 1 file changed, 43 insertions(+), 117 deletions(-) diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index 76e51cb012..8c9d50a304 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -27,12 +27,12 @@ declare namespace ReactBootstrap { interface TransitionCallbacks { - onEnter?: Function; - onEntered?: Function; - onEntering?: Function; - onExit?: Function; - onExited?: Function; - onExiting?: Function; + onEnter?: Function; + onEntered?: Function; + onEntering?: Function; + onExit?: Function; + onExited?: Function; + onExiting?: Function; } @@ -52,14 +52,10 @@ declare namespace ReactBootstrap { // - interface BreadcrumbProps - extends React.Props - { + interface BreadcrumbProps extends React.Props { bsClass?: string; } - interface BreadcrumbClass - extends React.ClassicComponentClass - { + interface BreadcrumbClass extends React.ClassicComponentClass { Item: typeof BreadcrumbItem; } type Breadcrumb = React.ClassicComponent; @@ -67,9 +63,7 @@ declare namespace ReactBootstrap { // - interface BreadcrumbItemProps - extends React.Props - { + interface BreadcrumbItemProps extends React.Props { active?: boolean; id?: string | number; href?: string; @@ -81,9 +75,7 @@ declare namespace ReactBootstrap { //