diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000000..d69eb74ded7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,23 @@ +## Contributing Issues + +### Before Submitting an Issue +First, please do a search in open issues to see if the issue or feature request has already been filed. If there is an issue add your comments to this issue. + +The Code project is distributed across multiple repositories, try to file the issue against the correct repository [Related Projects](https://github.com/Microsoft/vscode/wiki/Related-Projects). + +If your issue is a question then please ask the question on [Stack Overflow](https://stackoverflow.com/questions/tagged/vscode) using the tag `vscode`. + +## Writing Good Bug Reports and Feature Requests + +File a single issue per problem and feature request, do not file combo issues. + +The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix. Therefore: + +* Provide reproducable steps, what the result of the steps was, an what you would have expected. +* Description of what you expect to happen +* Animated GIFs +* Code that demonstrates the issue +* Version of VS Code +* Errors in the Dev Tools Console (Help | Toggle Developer Tools) +* When you have extensions installed, can you reproduce the issue when starting vscode without extensions by using the `--disable-extensions` command line argument? + diff --git a/build/gulpfile.common.js b/build/gulpfile.common.js index 8a8dfcd09d3..b96e4b238f2 100644 --- a/build/gulpfile.common.js +++ b/build/gulpfile.common.js @@ -31,8 +31,7 @@ exports.loaderConfig = function (emptyPaths) { paths: { 'vs': 'out-build/vs', 'vs/extensions': 'extensions', - 'vscode': 'empty:', - 'lib': 'out-build/lib' + 'vscode': 'empty:' }, 'vs/text': { paths: { diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 55367db027b..268b998f652 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -41,7 +41,7 @@ var baseModules = [ // Build var builtInExtensions = { - 'jrieken.vscode-omnisharp': '0.1.0', + 'jrieken.vscode-omnisharp': '0.3.0', }; var vscodeEntryPoints = _.flatten([ diff --git a/extensions/clojure/clojure.configuration.json b/extensions/clojure/clojure.configuration.json index d83f1ac8e9b..f0d6b7f37b8 100644 --- a/extensions/clojure/clojure.configuration.json +++ b/extensions/clojure/clojure.configuration.json @@ -1,7 +1,6 @@ { "comments": { - "lineComment": ";", - "blockComment": [ "(comment", ")" ] + "lineComment": ";" }, "brackets": [ ["{", "}"], diff --git a/extensions/csharp/OSSREADME.json b/extensions/csharp/OSSREADME.json deleted file mode 100644 index 0a9d97ec596..00000000000 --- a/extensions/csharp/OSSREADME.json +++ /dev/null @@ -1,7 +0,0 @@ -// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: -[{ - "name": "language-csharp", - "version": "0.11.0", - "license": "Dual-licensed under MIT and GPL", - "repositoryURL": "https://github.com/atom/language-csharp" -}] diff --git a/extensions/csharp/csharp.configuration.json b/extensions/csharp/csharp.configuration.json deleted file mode 100644 index 7c3c76c3c46..00000000000 --- a/extensions/csharp/csharp.configuration.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "comments": { - "lineComment": "//", - "blockComment": ["/*", "*/"] - }, - "brackets": [ - ["{", "}"], - ["[", "]"], - ["(", ")"] - ] -} \ No newline at end of file diff --git a/extensions/csharp/package.json b/extensions/csharp/package.json deleted file mode 100644 index 180fba39a2e..00000000000 --- a/extensions/csharp/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "csharp", - "version": "0.1.0", - "publisher": "vscode", - "engines": { "vscode": "*" }, - "contributes": { - "languages": [{ - "id": "csharp", - "extensions": [ ".cs", ".csx" ], - "aliases": [ "C#", "csharp" ], - "configuration": "./csharp.configuration.json" - }], - "grammars": [{ - "language": "csharp", - "scopeName": "source.cs", - "path": "./syntaxes/csharp.json" - }] - } -} \ No newline at end of file diff --git a/extensions/csharp/syntaxes/csharp.json b/extensions/csharp/syntaxes/csharp.json deleted file mode 100644 index 1d5924b81b0..00000000000 --- a/extensions/csharp/syntaxes/csharp.json +++ /dev/null @@ -1,566 +0,0 @@ -{ - "scopeName": "source.cs", - "name": "C#", - "fileTypes": [ - "cs" - ], - "foldingStartMarker": "^\\s*#\\s*region|^\\s*/\\*|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))", - "foldingStopMarker": "^\\s*#\\s*endregion|^\\s*\\*/|^\\s*\\}", - "patterns": [ - { - "captures": { - "1": { - "name": "keyword.other.using.cs" - } - }, - "begin": "^\\s*(using)\\b\\s*", - "end": "\\s*(?:$|(;))", - "name": "meta.keyword.using.cs" - }, - { - "begin": "^\\s*((namespace)\\s+([\\w.]+))", - "beginCaptures": { - "1": { - "name": "meta.namespace.identifier.cs" - }, - "2": { - "name": "keyword.other.namespace.cs" - }, - "3": { - "name": "entity.name.type.namespace.cs" - } - }, - "end": "}", - "endCaptures": { - "0": { - "name": "punctuation.section.namespace.end.cs" - } - }, - "name": "meta.namespace.cs", - "patterns": [ - { - "begin": "{", - "beginCaptures": { - "0": { - "name": "punctuation.section.namespace.begin.cs" - } - }, - "end": "(?=})", - "name": "meta.namespace.body.cs", - "patterns": [ - { - "include": "#code" - } - ] - } - ] - }, - { - "include": "#code" - } - ], - "repository": { - "block": { - "patterns": [ - { - "begin": "{", - "beginCaptures": { - "0": { - "name": "punctuation.section.block.begin.cs" - } - }, - "end": "}", - "endCaptures": { - "0": { - "name": "punctuation.section.block.end.cs" - } - }, - "name": "meta.block.cs", - "patterns": [ - { - "include": "#code" - } - ] - } - ] - }, - "builtinTypes": { - "patterns": [ - { - "match": "\\b(bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|object|short|ushort|string|void|class|struct|enum|interface)\\b", - "name": "storage.type.cs" - } - ] - }, - "class": { - "begin": "(?=\\w?[\\w\\s]*(?:class|struct|interface|enum)\\s+\\w+)", - "end": "}", - "endCaptures": { - "0": { - "name": "punctuation.section.class.end.cs" - } - }, - "name": "meta.class.cs", - "patterns": [ - { - "include": "#storage-modifiers" - }, - { - "include": "#comments" - }, - { - "captures": { - "1": { - "name": "storage.modifier.cs" - }, - "2": { - "name": "entity.name.type.class.cs" - } - }, - "match": "(class|struct|interface|enum)\\s+(\\w+)", - "name": "meta.class.identifier.cs" - }, - { - "begin": ":", - "end": "(?={)", - "patterns": [ - { - "captures": { - "1": { - "name": "storage.type.cs" - } - }, - "match": "\\s*,?([A-Za-z_]\\w*)\\b" - } - ] - }, - { - "begin": "{", - "beginCaptures": { - "0": { - "name": "punctuation.section.class.begin.cs" - } - }, - "end": "(?=})", - "name": "meta.class.body.cs", - "patterns": [ - { - "include": "#method" - }, - { - "include": "#code" - } - ] - } - ] - }, - "code": { - "patterns": [ - { - "include": "#block" - }, - { - "include": "#comments" - }, - { - "include": "#class" - }, - { - "include": "#constants" - }, - { - "include": "#storage-modifiers" - }, - { - "include": "#keywords" - }, - { - "include": "#preprocessor" - }, - { - "include": "#method-call" - }, - { - "include": "#builtinTypes" - }, - { - "include": "#documentation" - } - ] - }, - "comments": { - "patterns": [ - { - "begin": "///", - "captures": { - "0": { - "name": "punctuation.definition.comment.cs" - } - }, - "end": "$\\n?", - "name": "comment.block.documentation.cs", - "patterns": [ - { - "include": "text.xml" - } - ] - }, - { - "begin": "/\\*", - "captures": { - "0": { - "name": "punctuation.definition.comment.cs" - } - }, - "end": "\\*/\\n?", - "name": "comment.block.cs" - }, - { - "begin": "//", - "captures": { - "1": { - "name": "punctuation.definition.comment.cs" - } - }, - "end": "$\\n?", - "name": "comment.line.double-slash.cs" - } - ] - }, - "constants": { - "patterns": [ - { - "match": "\\b(true|false|null|this|base)\\b", - "name": "constant.language.cs" - }, - { - "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b", - "name": "constant.numeric.cs" - }, - { - "captures": { - "0": { - "name": "punctuation.definition.string.begin.cs" - } - }, - "match": "@\"([^\"]|\"\")*\"", - "name": "string.quoted.double.literal.cs" - }, - { - "begin": "\"", - "beginCaptures": { - "0": { - "name": "punctuation.definition.string.begin.cs" - } - }, - "end": "\"", - "endCaptures": { - "0": { - "name": "punctuation.definition.string.end.cs" - } - }, - "name": "string.quoted.double.cs", - "patterns": [ - { - "match": "\\\\.", - "name": "constant.character.escape.cs" - } - ] - }, - { - "begin": "'", - "beginCaptures": { - "0": { - "name": "punctuation.definition.string.begin.cs" - } - }, - "end": "'", - "endCaptures": { - "0": { - "name": "punctuation.definition.string.end.cs" - } - }, - "name": "string.quoted.single.cs", - "patterns": [ - { - "match": "\\\\.", - "name": "constant.character.escape.cs" - } - ] - } - ] - }, - "keywords": { - "patterns": [ - { - "match": "\\b(if|else|while|for|foreach|in|do|return|continue|break|switch|case|default|goto|throw|try|catch|finally|lock|yield|await)\\b", - "name": "keyword.control.cs" - }, - { - "match": "\\b(from|where|select|group|into|orderby|join|let|on|equals|by|ascending|descending)\\b", - "name": "keyword.linq.cs" - }, - { - "match": "\\b(new|is|as|using|checked|unchecked|typeof|sizeof|override|readonly|stackalloc)\\b", - "name": "keyword.operator.cs" - }, - { - "match": "\\b(event|delegate|fixed|add|remove|set|get|value)\\b", - "name": "keyword.other.cs" - }, - { - "match": "\\b(var)\\b", - "name": "storage.type.var.cs" - }, - { - "match": "[@]\\b(var|event|delegate|add|remove|set|get|value|new|is|as|using|checked|unchecked|typeof|sizeof |override|readonly|stackalloc|from|where|select|group|into|orderby|join|let|on|equals|by|ascending|descending |if|else|while|for|foreach|in|do|return|continue|break|switch|case|default|goto|throw|try|catch|finally|lock|yield|await)\\b", - "name": "meta.class.body.cs" - } - ] - }, - "method": { - "patterns": [ - { - "begin": "\\[", - "end": "\\]", - "name": "meta.method.annotation.cs", - "patterns": [ - { - "include": "#constants" - }, - { - "include": "#preprocessor" - }, - { - "include": "#builtinTypes" - } - ] - }, - { - "begin": "(?=\\bnew\\s+)(?=[\\w<].*\\s+)(?=[^=]+\\()", - "end": "(?={|;)", - "name": "meta.new-object.cs", - "patterns": [ - { - "include": "#code" - } - ] - }, - { - "begin": "(?name keyword.operator.assignment.js + await-modifier + + match + await + name + storage.modifier.js + block begin @@ -98,11 +105,11 @@ include - #expression + #object-member include - #object-member + #expression @@ -116,7 +123,7 @@ cast begin - (?:(?<=return|throw|yield|[=(,:>]))\s*(<)(?!<?\=) + (?:(?<=return|throw|yield|await|[=(,:>]))\s*(<)(?!<?\=) beginCaptures 1 @@ -380,7 +387,7 @@ field-declaration begin - (?<!\()\s*\b([a-zA-Z_$][\w$]*)\s*(\?\s*)?(?=(=|:)) + (?<!\()\s*((?:\b[a-zA-Z_$][\w$]*)|(?:\'[^']*\')|(?:\"[^"]*\"))\s*(\?\s*)?(?=(=|:)) beginCaptures 1 @@ -432,6 +439,10 @@ functioncall.expr.js patterns + + include + #await-modifier + include #type-parameters @@ -445,7 +456,7 @@ function-declaration begin - \b(?:(export)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* + \b(?:(export)\s+)?(?:(async)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* beginCaptures 1 @@ -456,9 +467,14 @@ 2 name - storage.type.function.js + storage.modifier.js 3 + + name + storage.type.function.js + + 4 name entity.name.function.js @@ -667,7 +683,7 @@ method-declaration begin - \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) + \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) beginCaptures 1 @@ -683,19 +699,24 @@ 3 name - storage.type.property.js + storage.modifier.js 4 name - keyword.operator.js + storage.type.property.js 5 name - entity.name.function.js + keyword.operator.js 6 + + name + entity.name.function.js + + 7 name keyword.operator.js diff --git a/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage b/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage index 8331a9176a2..c29607cd6ab 100644 --- a/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage +++ b/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage @@ -22,14 +22,14 @@ match \b(public|protected|private)\b name - storage.modifier.tsx + storage.modifier.jsx arithmetic-operator match \*|/|\-\-|\-|\+\+|\+|% name - keyword.operator.arithmetic.tsx + keyword.operator.arithmetic.jsx array-literal @@ -40,7 +40,7 @@ 0 name - meta.brace.square.tsx + meta.brace.square.jsx end @@ -50,11 +50,11 @@ 0 name - meta.brace.square.tsx + meta.brace.square.jsx name - meta.array.literal.tsx + meta.array.literal.jsx patterns @@ -68,7 +68,7 @@ match <<=|>>=|>>>=|\*=|(?<!\()/=|%=|\+=|\-=|&=|\^= name - keyword.operator.assignment.tsx + keyword.operator.assignment.jsx block @@ -79,7 +79,7 @@ 0 name - meta.brace.curly.tsx + meta.brace.curly.jsx end @@ -89,20 +89,20 @@ 0 name - meta.brace.curly.tsx + meta.brace.curly.jsx name - meta.block.tsx + meta.block.jsx patterns include - #expression + #object-member include - #object-member + #expression @@ -111,12 +111,12 @@ match \b(false|true)\b name - constant.language.boolean.tsx + constant.language.boolean.jsx comment name - comment.tsx + comment.jsx patterns @@ -140,7 +140,7 @@ end \*/ name - comment.block.tsx + comment.block.jsx comment-block-doc @@ -149,21 +149,21 @@ end \*/ name - comment.block.documentation.tsx + comment.block.documentation.jsx comment-line match (//).*$\n? name - comment.line.tsx + comment.line.jsx control-statement match (?<!\.)\b(break|catch|continue|debugger|declare|do|else|finally|for|if|return|switch|throw|try|while|with|super|switch|case)\b name - keyword.control.tsx + keyword.control.jsx decl-block @@ -174,7 +174,7 @@ 0 name - meta.brace.curly.tsx + meta.brace.curly.jsx end @@ -184,11 +184,11 @@ 0 name - meta.brace.curly.tsx + meta.brace.curly.jsx name - meta.decl.block.tsx + meta.decl.block.jsx patterns @@ -200,7 +200,7 @@ declaration name - meta.declaration.tsx + meta.declaration.jsx patterns @@ -228,28 +228,28 @@ 1 name - storage.modifier.tsx + storage.modifier.jsx 2 name - storage.type.tsx + storage.type.jsx 3 name - entity.name.class.tsx + entity.name.class.jsx match (?:\b(const)\s+)?\b(enum)\s+([a-zA-Z_$][\w$]*) name - meta.enum.declaration.tsx + meta.enum.declaration.jsx expression name - meta.expression.tsx + meta.expression.jsx patterns @@ -343,29 +343,29 @@ match =>|\b(delete|export|import|in|instanceof|module|namespace|new|typeof|void|as)\b name - keyword.operator.tsx + keyword.operator.jsx field-declaration begin - (?<!\()\s*\b([a-zA-Z_$][\w$]*)\s*(\?\s*)?(?=(=|:)) + (?<!\()\s*((?:\b[a-zA-Z_$][\w$]*)|(?:\'[^']*\')|(?:\"[^"]*\"))\s*(\?\s*)?(?=(=|:)) beginCaptures 1 name - variable.tsx + variable.jsx 2 name - keyword.operator.tsx + keyword.operator.jsx end (?=\}|;|,)|(?<=\}) name - meta.field.declaration.tsx + meta.field.declaration.jsx patterns @@ -381,23 +381,23 @@ 1 name - storage.type.tsx + storage.type.jsx 3 name - keyword.operator.tsx + keyword.operator.jsx match (?<=\()\s*\b(var|let|const)\s+([a-zA-Z_$][\w$]*)\s+(in|of)\b name - forin.expr.tsx + forin.expr.jsx function-call name - functioncall.expr.tsx + functioncall.expr.jsx patterns @@ -419,23 +419,23 @@ 1 name - storage.modifier.tsx + storage.modifier.jsx 2 name - storage.type.function.tsx + storage.type.function.jsx 3 name - entity.name.function.tsx + entity.name.function.jsx end (?=;|\})|(?<=\}) name - meta.function.tsx + meta.function.jsx patterns @@ -471,23 +471,23 @@ 1 name - storage.modifier.tsx + storage.modifier.jsx 2 name - storage.type.function.tsx + storage.type.function.jsx 3 name - entity.name.function.tsx + entity.name.function.jsx match \b(?:(export)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* name - meta.function.overload.tsx + meta.function.overload.jsx function-type-parameters @@ -498,7 +498,7 @@ 0 name - meta.brace.round.tsx + meta.brace.round.jsx end @@ -508,11 +508,11 @@ 0 name - meta.brace.round.tsx + meta.brace.round.jsx name - meta.function.type.parameter.tsx + meta.function.type.parameter.jsx patterns @@ -542,7 +542,7 @@ 0 name - meta.brace.square.tsx + meta.brace.square.jsx end @@ -552,16 +552,16 @@ 1 name - meta.brace.square.tsx + meta.brace.square.jsx 2 name - keyword.operator.tsx + keyword.operator.jsx name - meta.indexer.declaration.tsx + meta.indexer.declaration.jsx patterns @@ -585,18 +585,18 @@ 1 name - variable.parameter.tsx + variable.parameter.jsx match ([a-zA-Z_$][\w$]*)(?=\:) name - meta.indexer.parameter.tsx + meta.indexer.parameter.jsx jsx name - meta.jsx.tsx + meta.jsx.jsx patterns @@ -621,7 +621,7 @@ end (?=</) name - meta.jsx.children.tsx + meta.jsx.children.jsx patterns @@ -672,24 +672,24 @@ 1 name - punctuation.definition.entity.tsx + punctuation.definition.entity.jsx 3 name - punctuation.definition.entity.tsx + punctuation.definition.entity.jsx match (&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;) name - constant.character.entity.tsx + constant.character.entity.jsx match & name - invalid.illegal.bad-ampersand.tsx + invalid.illegal.bad-ampersand.jsx @@ -702,7 +702,7 @@ 0 name - punctuation.definition.brace.curly.start.tsx + punctuation.definition.brace.curly.start.jsx end @@ -712,11 +712,11 @@ 0 name - punctuation.definition.brace.curly.end.tsx + punctuation.definition.brace.curly.end.jsx name - meta.brace.curly.tsx + meta.brace.curly.jsx patterns @@ -734,7 +734,7 @@ 0 name - punctuation.definition.string.begin.tsx + punctuation.definition.string.begin.jsx end @@ -744,11 +744,11 @@ 0 name - punctuation.definition.string.end.tsx + punctuation.definition.string.end.jsx name - string.quoted.double.tsx + string.quoted.double.jsx patterns @@ -766,7 +766,7 @@ 0 name - punctuation.definition.string.begin.tsx + punctuation.definition.string.begin.jsx end @@ -776,11 +776,11 @@ 0 name - punctuation.definition.string.end.tsx + punctuation.definition.string.end.jsx name - string.quoted.single.tsx + string.quoted.single.jsx patterns @@ -794,7 +794,7 @@ match =(?=\s*(?:'|"|{|/\*|//|\n)) name - keyword.operator.assignment.tsx + keyword.operator.assignment.jsx jsx-tag-attribute-name @@ -803,7 +803,7 @@ 1 name - entity.other.attribute-name.tsx + entity.other.attribute-name.jsx match @@ -812,7 +812,7 @@ ([_$a-zA-Z][-$\w]*) (?=\s|=|/?>|/\*|//) name - meta.tag.attribute-name.tsx + meta.tag.attribute-name.jsx jsx-tag-attributes @@ -845,7 +845,7 @@ match \S+ name - invalid.illegal.attribute.tsx + invalid.illegal.attribute.jsx jsx-tag-close @@ -856,12 +856,12 @@ 1 name - punctuation.definition.tag.begin.tsx + punctuation.definition.tag.begin.jsx 2 name - entity.name.tag.tsx + entity.name.tag.jsx end @@ -871,11 +871,11 @@ 1 name - punctuation.definition.tag.end.tsx + punctuation.definition.tag.end.jsx name - tag.close.tsx + tag.close.jsx patterns @@ -889,7 +889,7 @@ match <\s*> name - invalid.illegal.tag.incomplete.tsx + invalid.illegal.tag.incomplete.jsx jsx-tag-open @@ -903,12 +903,12 @@ 1 name - punctuation.definition.tag.begin.tsx + punctuation.definition.tag.begin.jsx 2 name - entity.name.tag.tsx + entity.name.tag.jsx end @@ -918,11 +918,11 @@ 1 name - punctuation.definition.tag.end.tsx + punctuation.definition.tag.end.jsx name - tag.open.tsx + tag.open.jsx patterns @@ -948,17 +948,17 @@ 1 name - punctuation.definition.tag.begin.tsx + punctuation.definition.tag.begin.jsx 2 name - entity.name.tag.tsx + entity.name.tag.jsx 3 name - punctuation.definition.tag.end.tsx + punctuation.definition.tag.end.jsx end @@ -968,21 +968,21 @@ 1 name - punctuation.definition.tag.begin.tsx + punctuation.definition.tag.begin.jsx 2 name - entity.name.tag.tsx + entity.name.tag.jsx 3 name - punctuation.definition.tag.end.tsx + punctuation.definition.tag.end.jsx name - tag.without-attributes.tsx + tag.without-attributes.jsx patterns @@ -994,7 +994,7 @@ literal name - literal.tsx + literal.jsx patterns @@ -1028,7 +1028,7 @@ match \!|&|~|\||&&|\|\| name - keyword.operator.arithmetic.tsx + keyword.operator.arithmetic.jsx method-declaration @@ -1039,38 +1039,38 @@ 1 name - storage.modifier.tsx + storage.modifier.jsx 2 name - storage.modifier.tsx + storage.modifier.jsx 3 name - storage.type.property.tsx + storage.type.property.jsx 4 name - keyword.operator.tsx + keyword.operator.jsx 5 name - entity.name.function.tsx + entity.name.function.jsx 6 name - keyword.operator.tsx + keyword.operator.jsx end (?=\}|;|,)|(?<=\}) name - meta.method.declaration.tsx + meta.method.declaration.jsx patterns @@ -1106,28 +1106,28 @@ 1 name - storage.modifier.tsx + storage.modifier.jsx 2 name - keyword.operator.tsx + keyword.operator.jsx 3 name - entity.name.function.tsx + entity.name.function.jsx 4 name - keyword.operator.tsx + keyword.operator.jsx match \b(?:(public|private|protected)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) name - meta.method.overload.declaration.tsx + meta.method.overload.declaration.jsx new-expr @@ -1138,13 +1138,13 @@ 1 name - keyword.operator.tsx + keyword.operator.jsx end (?=[(;]|$) name - new.expr.tsx + new.expr.jsx patterns @@ -1158,14 +1158,14 @@ match \b(null)\b name - constant.language.null.tsx + constant.language.null.jsx numeric-literal match \b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b name - constant.numeric.tsx + constant.numeric.jsx object-body @@ -1176,7 +1176,7 @@ 0 name - meta.brace.curly.tsx + meta.brace.curly.jsx end @@ -1186,11 +1186,11 @@ 0 name - meta.brace.curly.tsx + meta.brace.curly.jsx name - meta.object.body.tsx + meta.object.body.jsx patterns @@ -1244,17 +1244,17 @@ 1 name - storage.modifier.tsx + storage.modifier.jsx 2 name - storage.modifier.tsx + storage.modifier.jsx 3 name - storage.type.tsx + storage.type.jsx end @@ -1264,11 +1264,11 @@ 1 name - brace.curly.tsx + brace.curly.jsx name - meta.declaration.object.tsx + meta.declaration.object.jsx patterns @@ -1302,7 +1302,7 @@ 1 name - keyword.other.tsx + keyword.other.jsx end @@ -1312,11 +1312,11 @@ 1 name - brace.curly.tsx + brace.curly.jsx name - meta.object.heritage.tsx + meta.object.heritage.jsx patterns @@ -1340,13 +1340,13 @@ 1 name - storage.type.tsx + storage.type.jsx match (?:\s*([a-zA-Z_$][\w$]*)) name - meta.object.heritage.parent.tsx + meta.object.heritage.parent.jsx object-member @@ -1355,7 +1355,7 @@ end (?=,|\}) name - meta.object.member.tsx + meta.object.member.jsx patterns @@ -1371,13 +1371,13 @@ 0 name - entity.name.class.tsx + entity.name.class.jsx match [a-zA-Z_$][\w$]* name - meta.object.name.tsx + meta.object.name.jsx parameter-name @@ -1386,28 +1386,28 @@ 1 name - storage.modifier.tsx + storage.modifier.jsx 2 name - keyword.operator.tsx + keyword.operator.jsx 3 name - variable.parameter.tsx + variable.parameter.jsx 4 name - keyword.operator.tsx + keyword.operator.jsx match (?:\s*\b(public|private|protected)\b\s+)?(\.\.\.)?\s*([a-zA-Z_$][\w$]*)\s*(\??) name - parameter.name.tsx + parameter.name.jsx paren-expression @@ -1418,7 +1418,7 @@ 0 name - meta.brace.paren.tsx + meta.brace.paren.jsx end @@ -1428,7 +1428,7 @@ 0 name - meta.brace.paren.tsx + meta.brace.paren.jsx patterns @@ -1444,7 +1444,7 @@ match \b(get|set)\b name - storage.type.property.tsx + storage.type.property.jsx qstring-double @@ -1453,7 +1453,7 @@ end "|(?=$) name - string.double.tsx + string.double.jsx patterns @@ -1469,7 +1469,7 @@ end '|(?=$) name - string.single.tsx + string.single.jsx patterns @@ -1485,20 +1485,20 @@ end $|(/)[igm]* name - string.regex.tsx + string.regex.jsx patterns match \\. name - constant.character.escape.tsx + constant.character.escape.jsx match \[(\\\]|[^\]])*\] name - constant.character.class.tsx + constant.character.class.jsx @@ -1507,7 +1507,7 @@ match ===|==|=|!=|!==|<=|>=|<>|<|> name - keyword.operator.comparison.tsx + keyword.operator.comparison.jsx return-type @@ -1516,7 +1516,7 @@ end (?=$)|(?=\{|;|//) name - meta.return.type.tsx + meta.return.type.jsx patterns @@ -1530,19 +1530,19 @@ match \b(static)\b name - keyword.other.tsx + keyword.other.jsx storage-keyword match \b(number|boolean|string|any|var|let|function|const)\b name - storage.type.tsx + storage.type.jsx string name - string.tsx + string.jsx patterns @@ -1571,13 +1571,13 @@ 1 name - keyword.control.tsx + keyword.control.jsx end : name - case.expr.tsx + case.expr.jsx patterns @@ -1595,7 +1595,7 @@ 0 name - string.template.tsx + string.template.jsx end @@ -1605,11 +1605,11 @@ 0 name - string.template.tsx + string.template.jsx name - meta.template.tsx + meta.template.jsx patterns @@ -1629,7 +1629,7 @@ end (?=(\$\{|`)) name - string.template.tsx + string.template.jsx patterns @@ -1647,7 +1647,7 @@ 0 name - keyword.operator.tsx + keyword.operator.jsx end @@ -1657,11 +1657,11 @@ 0 name - keyword.operator.tsx + keyword.operator.jsx name - template.element.tsx + template.element.jsx patterns @@ -1675,12 +1675,12 @@ match \b(this)\b name - constant.language.this.tsx + constant.language.this.jsx type name - meta.type.tsx + meta.type.jsx patterns @@ -1724,7 +1724,7 @@ end (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[a-zA-Z_$])\s*(?=\{) name - meta.type.annotation.tsx + meta.type.annotation.jsx patterns @@ -1750,18 +1750,18 @@ 1 name - keyword.other.tsx + keyword.other.jsx 2 name - storage.type.tsx + storage.type.jsx end (?=[,);>]|var|type|function|class|interface) name - meta.type.declaration.tsx + meta.type.declaration.jsx patterns @@ -1779,13 +1779,13 @@ 0 name - keyword.operator.tsx + keyword.operator.jsx end (?=\s*[,\)\{=;>]|//|$) name - meta.type.function.return.tsx + meta.type.function.return.jsx patterns @@ -1801,13 +1801,13 @@ 1 name - entity.name.type.tsx + entity.name.type.jsx match [a-zA-Z_$][.\w$]* name - meta.type.name.tsx + meta.type.name.jsx type-object @@ -1818,7 +1818,7 @@ 0 name - meta.brace.curly.tsx + meta.brace.curly.jsx end @@ -1828,11 +1828,11 @@ 0 name - meta.brace.curly.tsx + meta.brace.curly.jsx name - meta.object.type.tsx + meta.object.type.jsx patterns @@ -1862,7 +1862,7 @@ match [.|] name - keyword.operator.type.tsx + keyword.operator.type.jsx type-parameters @@ -1873,12 +1873,12 @@ 1 name - entity.name.type.tsx + entity.name.type.jsx 2 name - meta.brace.angle.tsx + meta.brace.angle.jsx end @@ -1888,18 +1888,18 @@ 2 name - meta.brace.angle.tsx + meta.brace.angle.jsx name - meta.type.parameters.tsx + meta.type.parameters.jsx patterns match \b(extends)\b name - keyword.other.tsx + keyword.other.jsx include @@ -1920,13 +1920,13 @@ 1 name - keyword.control.tsx + keyword.control.jsx end \) name - meta.type.paren.cover.tsx + meta.type.paren.cover.jsx patterns @@ -1950,13 +1950,13 @@ 1 name - storage.type.tsx + storage.type.jsx match \b(string|number|boolean|symbol|any|void)\b name - meta.type.primitive.tsx + meta.type.primitive.jsx type-tuple @@ -1967,7 +1967,7 @@ 0 name - meta.brace.square.tsx + meta.brace.square.jsx end @@ -1977,11 +1977,11 @@ 0 name - meta.brace.square.tsx + meta.brace.square.jsx name - meta.type.tuple.tsx + meta.type.tuple.jsx patterns @@ -1999,7 +1999,7 @@ match \b(undefined)\b name - constant.language.tsx + constant.language.jsx var-expr @@ -2010,18 +2010,18 @@ 1 name - storage.type.tsx + storage.type.jsx 2 name - variable.tsx + variable.jsx end (?=$|[;=\}\{])|(?<=\}) name - meta.var.expr.tsx + meta.var.expr.jsx patterns @@ -2047,7 +2047,7 @@ 1 name - keyword.operator.tsx + keyword.operator.jsx end @@ -2067,3 +2067,4 @@ 805375ec-d614-41f5-8993-5843fe63ea82 + diff --git a/extensions/json/package.json b/extensions/json/package.json index 224e446f8a0..0ba31d875a6 100644 --- a/extensions/json/package.json +++ b/extensions/json/package.json @@ -2,18 +2,41 @@ "name": "json", "version": "0.1.0", "publisher": "vscode", - "engines": { "vscode": "*" }, + "engines": { + "vscode": "*" + }, "contributes": { - "languages": [{ - "id": "json", - "aliases": ["JSON", "json"], - "extensions": [".json", ".bowerrc", ".jshintrc", ".jscsrc", ".eslintrc"], - "mimetypes": ["application/json"] - }], - "grammars": [{ - "language": "json", - "scopeName": "source.json", - "path": "./syntaxes/JSON.tmLanguage" - }] + "languages": [ + { + "id": "json", + "aliases": [ + "JSON", + "json" + ], + "extensions": [ + ".json", + ".bowerrc", + ".jshintrc", + ".jscsrc", + ".eslintrc" + ], + "mimetypes": [ + "application/json" + ] + } + ], + "grammars": [ + { + "language": "json", + "scopeName": "source.json", + "path": "./syntaxes/JSON.tmLanguage" + } + ], + "jsonValidation": [ + { + "fileMatch": "*.schema.json", + "url": "http://json-schema.org/draft-04/schema#" + } + ] } } \ No newline at end of file diff --git a/extensions/node-debug/node-debug.azure.json b/extensions/node-debug/node-debug.azure.json index 370a510e133..c39753b19c0 100644 --- a/extensions/node-debug/node-debug.azure.json +++ b/extensions/node-debug/node-debug.azure.json @@ -1,6 +1,6 @@ { "account": "monacobuild", "container": "debuggers", - "zip": "32575e3/node-debug.zip", + "zip": "e6b9b29/node-debug.zip", "output": "" -} +} \ No newline at end of file diff --git a/extensions/ruby/package.json b/extensions/ruby/package.json index 2dd3847cd34..7b1bf81aac6 100644 --- a/extensions/ruby/package.json +++ b/extensions/ruby/package.json @@ -6,7 +6,7 @@ "contributes": { "languages": [{ "id": "ruby", - "extensions": [ ".rb", ".rbx", ".rjs", ".gemspec", ".pp" ], + "extensions": [ ".rb", ".rbx", ".rjs", ".gemspec", ".pp", ".rake" ], "filenames": [ "rakefile", "gemfile" ], "aliases": [ "Ruby", "rb" ], "configuration": "./ruby.configuration.json" diff --git a/extensions/typescript/package.json b/extensions/typescript/package.json index 962e0a13f4d..162ac035bd2 100644 --- a/extensions/typescript/package.json +++ b/extensions/typescript/package.json @@ -101,6 +101,12 @@ "language": "typescriptreact", "path": "./snippets/typescriptreact.json" } + ], + "jsonValidation": [ + { + "fileMatch": "tsconfig.json", + "url": "http://json.schemastore.org/tsconfig" + } ] } } \ No newline at end of file diff --git a/extensions/typescript/src/features/bufferSyncSupport.ts b/extensions/typescript/src/features/bufferSyncSupport.ts index 4a3c929bdce..b2d41eb4759 100644 --- a/extensions/typescript/src/features/bufferSyncSupport.ts +++ b/extensions/typescript/src/features/bufferSyncSupport.ts @@ -21,8 +21,8 @@ class SyncedBuffer { private diagnosticRequestor: IDiagnosticRequestor; private client: ITypescriptServiceClient; - constructor(model: TextDocument, filepath: string, diagnosticRequestor: IDiagnosticRequestor, client: ITypescriptServiceClient) { - this.document = model; + constructor(document: TextDocument, filepath: string, diagnosticRequestor: IDiagnosticRequestor, client: ITypescriptServiceClient) { + this.document = document; this.filepath = filepath; this.diagnosticRequestor = diagnosticRequestor; this.client = client; @@ -30,26 +30,10 @@ class SyncedBuffer { public open(): void { let args: Proto.OpenRequestArgs = { - file: this.filepath + file: this.filepath, + fileContent: this.document.getText() }; this.client.execute('open', args, false); - // The last line never has a new line character at the end. So we use range. - // Sending a replace doesn't work if the buffer is newer then on disk and - // if changes are on the last line. In this case the tsserver has less characters - // which makes the tsserver bail since the range is invalid - /* - let lastLineRange = this.document.lineAt(this.document.lineCount - 1).range; - let text = this.document.getText(); - let changeArgs: Proto.ChangeRequestArgs = { - file: this.filepath, - line: 1, - offset: 1, - endLine: lastLineRange.end.line + 1, - endOffset: lastLineRange.end.character + 1, - insertString: text - } - this.client.execute('change', changeArgs, false); - */ } public close(): void { diff --git a/extensions/typescript/src/protocol.d.ts b/extensions/typescript/src/protocol.d.ts index 2eee75e8cab..aabef0c9ab7 100644 --- a/extensions/typescript/src/protocol.d.ts +++ b/extensions/typescript/src/protocol.d.ts @@ -4,251 +4,251 @@ * ------------------------------------------------------------------------------------------ */ /** - * A TypeScript Server message - */ + * A TypeScript Server message + */ export interface Message { /** - * Sequence number of the message - */ + * Sequence number of the message + */ seq: number; /** - * One of "request", "response", or "event" - */ + * One of "request", "response", or "event" + */ type: string; } /** - * Client-initiated request message - */ + * Client-initiated request message + */ export interface Request extends Message { /** - * The command to execute - */ + * The command to execute + */ command: string; /** - * Object containing arguments for the command - */ + * Object containing arguments for the command + */ arguments?: any; } /** - * Request to reload the project structure for all the opened files - */ + * Request to reload the project structure for all the opened files + */ export interface ReloadProjectsRequest extends Message { } /** - * Server-initiated event message - */ + * Server-initiated event message + */ export interface Event extends Message { /** - * Name of event - */ + * Name of event + */ event: string; /** - * Event-specific information - */ + * Event-specific information + */ body?: any; } /** - * Response by server to client request message. - */ + * Response by server to client request message. + */ export interface Response extends Message { /** - * Sequence number of the request message. - */ + * Sequence number of the request message. + */ request_seq: number; /** - * Outcome of the request. - */ + * Outcome of the request. + */ success: boolean; /** - * The command requested. - */ + * The command requested. + */ command: string; /** - * Contains error message if success === false. - */ + * Contains error message if success === false. + */ message?: string; /** - * Contains message body if success === true. - */ + * Contains message body if success === true. + */ body?: any; } /** - * Arguments for FileRequest messages. - */ + * Arguments for FileRequest messages. + */ export interface FileRequestArgs { /** - * The file for the request (absolute pathname required). - */ + * The file for the request (absolute pathname required). + */ file: string; } /** - * Arguments for ProjectInfoRequest request. - */ + * Arguments for ProjectInfoRequest request. + */ export interface ProjectInfoRequestArgs extends FileRequestArgs { /** - * Indicate if the file name list of the project is needed - */ + * Indicate if the file name list of the project is needed + */ needFileNameList: boolean; } /** - * A request to get the project information of the current file - */ + * A request to get the project information of the current file + */ export interface ProjectInfoRequest extends Request { arguments: ProjectInfoRequestArgs } /** - * Response message body for "projectInfo" request - */ + * Response message body for "projectInfo" request + */ export interface ProjectInfo { /** - * For configured project, this is the normalized path of the 'tsconfig.json' file - * For inferred project, this is undefined - */ + * For configured project, this is the normalized path of the 'tsconfig.json' file + * For inferred project, this is undefined + */ configFileName: string; /** - * The list of normalized file name in the project, including 'lib.d.ts' - */ + * The list of normalized file name in the project, including 'lib.d.ts' + */ fileNames?: string[]; } /** - * Response message for "projectInfo" request - */ + * Response message for "projectInfo" request + */ export interface ProjectInfoResponse extends Response { body?: ProjectInfo; } /** - * Request whose sole parameter is a file name. - */ + * Request whose sole parameter is a file name. + */ export interface FileRequest extends Request { arguments: FileRequestArgs; } /** - * Instances of this interface specify a location in a source file: - * (file, line, character offset), where line and character offset are 1-based. - */ + * Instances of this interface specify a location in a source file: + * (file, line, character offset), where line and character offset are 1-based. + */ export interface FileLocationRequestArgs extends FileRequestArgs { /** - * The line number for the request (1-based). - */ + * The line number for the request (1-based). + */ line: number; /** - * The character offset (on the line) for the request (1-based). - */ + * The character offset (on the line) for the request (1-based). + */ offset: number; } /** - * A request whose arguments specify a file location (file, line, col). - */ + * A request whose arguments specify a file location (file, line, col). + */ export interface FileLocationRequest extends FileRequest { arguments: FileLocationRequestArgs; } /** - * Arguments in document highlight request; include: filesToSearch, file, - * line, offset. - */ + * Arguments in document highlight request; include: filesToSearch, file, + * line, offset. + */ export interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { /** - * List of files to search for document highlights. - */ + * List of files to search for document highlights. + */ filesToSearch: string[]; } /** - * Go to definition request; value of command field is - * "definition". Return response giving the file locations that - * define the symbol found in file at location line, col. - */ + * Go to definition request; value of command field is + * "definition". Return response giving the file locations that + * define the symbol found in file at location line, col. + */ export interface DefinitionRequest extends FileLocationRequest { } /** - * Go to type request; value of command field is - * "typeDefinition". Return response giving the file locations that - * define the type for the symbol found in file at location line, col. - */ + * Go to type request; value of command field is + * "typeDefinition". Return response giving the file locations that + * define the type for the symbol found in file at location line, col. + */ export interface TypeDefinitionRequest extends FileLocationRequest { } /** - * Location in source code expressed as (one-based) line and character offset. - */ + * Location in source code expressed as (one-based) line and character offset. + */ export interface Location { line: number; offset: number; } /** - * Object found in response messages defining a span of text in source code. - */ + * Object found in response messages defining a span of text in source code. + */ export interface TextSpan { /** - * First character of the definition. - */ + * First character of the definition. + */ start: Location; /** - * One character past last character of the definition. - */ + * One character past last character of the definition. + */ end: Location; } /** - * Object found in response messages defining a span of text in a specific source file. - */ + * Object found in response messages defining a span of text in a specific source file. + */ export interface FileSpan extends TextSpan { /** - * File containing text span. - */ + * File containing text span. + */ file: string; } /** - * Definition response message. Gives text range for definition. - */ + * Definition response message. Gives text range for definition. + */ export interface DefinitionResponse extends Response { body?: FileSpan[]; } /** - * Definition response message. Gives text range for definition. - */ + * Definition response message. Gives text range for definition. + */ export interface TypeDefinitionResponse extends Response { body?: FileSpan[]; } /** - * Get occurrences request; value of command field is - * "occurrences". Return response giving spans that are relevant - * in the file at a given line and column. - */ + * Get occurrences request; value of command field is + * "occurrences". Return response giving spans that are relevant + * in the file at a given line and column. + */ export interface OccurrencesRequest extends FileLocationRequest { } export interface OccurrencesResponseItem extends FileSpan { /** - * True if the occurrence is a write location, false otherwise. - */ + * True if the occurrence is a write location, false otherwise. + */ isWriteAccess: boolean; } @@ -257,10 +257,10 @@ export interface OccurrencesResponse extends Response { } /** - * Get document highlights request; value of command field is - * "documentHighlights". Return response giving spans that are relevant - * in the file at a given line and column. - */ + * Get document highlights request; value of command field is + * "documentHighlights". Return response giving spans that are relevant + * in the file at a given line and column. + */ export interface DocumentHighlightsRequest extends FileLocationRequest { arguments: DocumentHighlightsRequestArgs } @@ -271,13 +271,13 @@ export interface HighlightSpan extends TextSpan { export interface DocumentHighlightsItem { /** - * File containing highlight spans. - */ + * File containing highlight spans. + */ file: string, /** - * Spans to highlight in file. - */ + * Spans to highlight in file. + */ highlightSpans: HighlightSpan[]; } @@ -286,55 +286,55 @@ export interface DocumentHighlightsResponse extends Response { } /** - * Find references request; value of command field is - * "references". Return response giving the file locations that - * reference the symbol found in file at location line, col. - */ + * Find references request; value of command field is + * "references". Return response giving the file locations that + * reference the symbol found in file at location line, col. + */ export interface ReferencesRequest extends FileLocationRequest { } export interface ReferencesResponseItem extends FileSpan { /** Text of line containing the reference. Including this - * with the response avoids latency of editor loading files - * to show text of reference line (the server already has - * loaded the referencing files). - */ + * with the response avoids latency of editor loading files + * to show text of reference line (the server already has + * loaded the referencing files). + */ lineText: string; /** - * True if reference is a write location, false otherwise. - */ + * True if reference is a write location, false otherwise. + */ isWriteAccess: boolean; } /** - * The body of a "references" response message. - */ + * The body of a "references" response message. + */ export interface ReferencesResponseBody { /** - * The file locations referencing the symbol. - */ + * The file locations referencing the symbol. + */ refs: ReferencesResponseItem[]; /** - * The name of the symbol. - */ + * The name of the symbol. + */ symbolName: string; /** - * The start character offset of the symbol (on the line provided by the references request). - */ + * The start character offset of the symbol (on the line provided by the references request). + */ symbolStartOffset: number; /** - * The full display name of the symbol. - */ + * The full display name of the symbol. + */ symbolDisplayString: string; } /** - * Response to "references" request. - */ + * Response to "references" request. + */ export interface ReferencesResponse extends Response { body?: ReferencesResponseBody; } @@ -346,53 +346,53 @@ export interface RenameRequestArgs extends FileLocationRequestArgs { /** - * Rename request; value of command field is "rename". Return - * response giving the file locations that reference the symbol - * found in file at location line, col. Also return full display - * name of the symbol so that client can print it unambiguously. - */ + * Rename request; value of command field is "rename". Return + * response giving the file locations that reference the symbol + * found in file at location line, col. Also return full display + * name of the symbol so that client can print it unambiguously. + */ export interface RenameRequest extends FileLocationRequest { arguments: RenameRequestArgs; } /** - * Information about the item to be renamed. - */ + * Information about the item to be renamed. + */ export interface RenameInfo { /** - * True if item can be renamed. - */ + * True if item can be renamed. + */ canRename: boolean; /** - * Error message if item can not be renamed. - */ + * Error message if item can not be renamed. + */ localizedErrorMessage?: string; /** - * Display name of the item to be renamed. - */ + * Display name of the item to be renamed. + */ displayName: string; /** - * Full display name of item to be renamed. - */ + * Full display name of item to be renamed. + */ fullDisplayName: string; /** - * The items's kind (such as 'className' or 'parameterName' or plain 'text'). - */ + * The items's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; } /** - * A group of text spans, all in 'file'. - */ + * A group of text spans, all in 'file'. + */ export interface SpanGroup { /** The file to which the spans apply */ file: string; @@ -402,26 +402,26 @@ export interface SpanGroup { export interface RenameResponseBody { /** - * Information about the item to be renamed. - */ + * Information about the item to be renamed. + */ info: RenameInfo; /** - * An array of span groups (one per file) that refer to the item to be renamed. - */ + * An array of span groups (one per file) that refer to the item to be renamed. + */ locs: SpanGroup[]; } /** - * Rename response message. - */ + * Rename response message. + */ export interface RenameResponse extends Response { body?: RenameResponseBody; } /** - * Editor options - */ + * Editor options + */ export interface EditorOptions { /** Number of spaces for each tab. Default value is 4. */ @@ -438,8 +438,8 @@ export interface EditorOptions { } /** - * Format options - */ + * Format options + */ export interface FormatOptions extends EditorOptions { /** Defines space handling after a comma delimiter. Default value is true. */ @@ -474,310 +474,315 @@ export interface FormatOptions extends EditorOptions { } /** - * Information found in a configure request. - */ + * Information found in a configure request. + */ export interface ConfigureRequestArguments { /** - * Information about the host, for example 'Emacs 24.4' or - * 'Sublime Text version 3075' - */ + * Information about the host, for example 'Emacs 24.4' or + * 'Sublime Text version 3075' + */ hostInfo?: string; /** - * If present, tab settings apply only to this file. - */ + * If present, tab settings apply only to this file. + */ file?: string; /** - * The format options to use during formatting and other code editing features. - */ + * The format options to use during formatting and other code editing features. + */ formatOptions?: FormatOptions; } /** - * Configure request; value of command field is "configure". Specifies - * host information, such as host type, tab size, and indent size. - */ + * Configure request; value of command field is "configure". Specifies + * host information, such as host type, tab size, and indent size. + */ export interface ConfigureRequest extends Request { arguments: ConfigureRequestArguments; } /** - * Response to "configure" request. This is just an acknowledgement, so - * no body field is required. - */ + * Response to "configure" request. This is just an acknowledgement, so + * no body field is required. + */ export interface ConfigureResponse extends Response { } /** - * Information found in an "open" request. - */ + * Information found in an "open" request. + */ export interface OpenRequestArgs extends FileRequestArgs { + /** + * Used when a version of the file content is known to be more up to date than the one on disk. + * Then the known content will be used upon opening instead of the disk copy + */ + fileContent?: string; } /** - * Open request; value of command field is "open". Notify the - * server that the client has file open. The server will not - * monitor the filesystem for changes in this file and will assume - * that the client is updating the server (using the change and/or - * reload messages) when the file changes. Server does not currently - * send a response to an open request. - */ + * Open request; value of command field is "open". Notify the + * server that the client has file open. The server will not + * monitor the filesystem for changes in this file and will assume + * that the client is updating the server (using the change and/or + * reload messages) when the file changes. Server does not currently + * send a response to an open request. + */ export interface OpenRequest extends Request { arguments: OpenRequestArgs; } /** - * Exit request; value of command field is "exit". Ask the server process - * to exit. - */ + * Exit request; value of command field is "exit". Ask the server process + * to exit. + */ export interface ExitRequest extends Request { } /** - * Close request; value of command field is "close". Notify the - * server that the client has closed a previously open file. If - * file is still referenced by open files, the server will resume - * monitoring the filesystem for changes to file. Server does not - * currently send a response to a close request. - */ + * Close request; value of command field is "close". Notify the + * server that the client has closed a previously open file. If + * file is still referenced by open files, the server will resume + * monitoring the filesystem for changes to file. Server does not + * currently send a response to a close request. + */ export interface CloseRequest extends FileRequest { } /** - * Quickinfo request; value of command field is - * "quickinfo". Return response giving a quick type and - * documentation string for the symbol found in file at location - * line, col. - */ + * Quickinfo request; value of command field is + * "quickinfo". Return response giving a quick type and + * documentation string for the symbol found in file at location + * line, col. + */ export interface QuickInfoRequest extends FileLocationRequest { } /** - * Body of QuickInfoResponse. - */ + * Body of QuickInfoResponse. + */ export interface QuickInfoResponseBody { /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; /** - * Starting file location of symbol. - */ + * Starting file location of symbol. + */ start: Location; /** - * One past last character of symbol. - */ + * One past last character of symbol. + */ end: Location; /** - * Type and kind of symbol. - */ + * Type and kind of symbol. + */ displayString: string; /** - * Documentation associated with symbol. - */ + * Documentation associated with symbol. + */ documentation: string; } /** - * Quickinfo response message. - */ + * Quickinfo response message. + */ export interface QuickInfoResponse extends Response { body?: QuickInfoResponseBody; } /** - * Arguments for format messages. - */ + * Arguments for format messages. + */ export interface FormatRequestArgs extends FileLocationRequestArgs { /** - * Last line of range for which to format text in file. - */ + * Last line of range for which to format text in file. + */ endLine: number; /** - * Character offset on last line of range for which to format text in file. - */ + * Character offset on last line of range for which to format text in file. + */ endOffset: number; } /** - * Format request; value of command field is "format". Return - * response giving zero or more edit instructions. The edit - * instructions will be sorted in file order. Applying the edit - * instructions in reverse to file will result in correctly - * reformatted text. - */ + * Format request; value of command field is "format". Return + * response giving zero or more edit instructions. The edit + * instructions will be sorted in file order. Applying the edit + * instructions in reverse to file will result in correctly + * reformatted text. + */ export interface FormatRequest extends FileLocationRequest { arguments: FormatRequestArgs; } /** - * Object found in response messages defining an editing - * instruction for a span of text in source code. The effect of - * this instruction is to replace the text starting at start and - * ending one character before end with newText. For an insertion, - * the text span is empty. For a deletion, newText is empty. - */ + * Object found in response messages defining an editing + * instruction for a span of text in source code. The effect of + * this instruction is to replace the text starting at start and + * ending one character before end with newText. For an insertion, + * the text span is empty. For a deletion, newText is empty. + */ export interface CodeEdit { /** - * First character of the text span to edit. - */ + * First character of the text span to edit. + */ start: Location; /** - * One character past last character of the text span to edit. - */ + * One character past last character of the text span to edit. + */ end: Location; /** - * Replace the span defined above with this string (may be - * the empty string). - */ + * Replace the span defined above with this string (may be + * the empty string). + */ newText: string; } /** - * Format and format on key response message. - */ + * Format and format on key response message. + */ export interface FormatResponse extends Response { body?: CodeEdit[]; } /** - * Arguments for format on key messages. - */ + * Arguments for format on key messages. + */ export interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { /** - * Key pressed (';', '\n', or '}'). - */ + * Key pressed (';', '\n', or '}'). + */ key: string; } /** - * Format on key request; value of command field is - * "formatonkey". Given file location and key typed (as string), - * return response giving zero or more edit instructions. The - * edit instructions will be sorted in file order. Applying the - * edit instructions in reverse to file will result in correctly - * reformatted text. - */ + * Format on key request; value of command field is + * "formatonkey". Given file location and key typed (as string), + * return response giving zero or more edit instructions. The + * edit instructions will be sorted in file order. Applying the + * edit instructions in reverse to file will result in correctly + * reformatted text. + */ export interface FormatOnKeyRequest extends FileLocationRequest { arguments: FormatOnKeyRequestArgs; } /** - * Arguments for completions messages. - */ + * Arguments for completions messages. + */ export interface CompletionsRequestArgs extends FileLocationRequestArgs { /** - * Optional prefix to apply to possible completions. - */ + * Optional prefix to apply to possible completions. + */ prefix?: string; } /** - * Completions request; value of command field is "completions". - * Given a file location (file, line, col) and a prefix (which may - * be the empty string), return the possible completions that - * begin with prefix. - */ + * Completions request; value of command field is "completions". + * Given a file location (file, line, col) and a prefix (which may + * be the empty string), return the possible completions that + * begin with prefix. + */ export interface CompletionsRequest extends FileLocationRequest { arguments: CompletionsRequestArgs; } /** - * Arguments for completion details request. - */ + * Arguments for completion details request. + */ export interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { /** - * Names of one or more entries for which to obtain details. - */ + * Names of one or more entries for which to obtain details. + */ entryNames: string[]; } /** - * Completion entry details request; value of command field is - * "completionEntryDetails". Given a file location (file, line, - * col) and an array of completion entry names return more - * detailed information for each completion entry. - */ + * Completion entry details request; value of command field is + * "completionEntryDetails". Given a file location (file, line, + * col) and an array of completion entry names return more + * detailed information for each completion entry. + */ export interface CompletionDetailsRequest extends FileLocationRequest { arguments: CompletionDetailsRequestArgs; } /** - * Part of a symbol description. - */ + * Part of a symbol description. + */ export interface SymbolDisplayPart { /** - * Text of an item describing the symbol. - */ + * Text of an item describing the symbol. + */ text: string; /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; } /** - * An item found in a completion response. - */ + * An item found in a completion response. + */ export interface CompletionEntry { /** - * The symbol's name. - */ + * The symbol's name. + */ name: string; /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; /** - * A string that is used for comparing completion items so that they can be ordered. This - * is often the same as the name but may be different in certain circumstances. - */ + * A string that is used for comparing completion items so that they can be ordered. This + * is often the same as the name but may be different in certain circumstances. + */ sortText: string; } /** - * Additional completion entry details, available on demand - */ + * Additional completion entry details, available on demand + */ export interface CompletionEntryDetails { /** - * The symbol's name. - */ + * The symbol's name. + */ name: string; /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; /** - * Display parts of the symbol (similar to quick info). - */ + * Display parts of the symbol (similar to quick info). + */ displayParts: SymbolDisplayPart[]; /** - * Documentation strings for the symbol. - */ + * Documentation strings for the symbol. + */ documentation: SymbolDisplayPart[]; } @@ -790,422 +795,422 @@ export interface CompletionDetailsResponse extends Response { } /** - * Signature help information for a single parameter - */ + * Signature help information for a single parameter + */ export interface SignatureHelpParameter { /** - * The parameter's name - */ + * The parameter's name + */ name: string; /** - * Documentation of the parameter. - */ + * Documentation of the parameter. + */ documentation: SymbolDisplayPart[]; /** - * Display parts of the parameter. - */ + * Display parts of the parameter. + */ displayParts: SymbolDisplayPart[]; /** - * Whether the parameter is optional or not. - */ + * Whether the parameter is optional or not. + */ isOptional: boolean; } /** - * Represents a single signature to show in signature help. - */ + * Represents a single signature to show in signature help. + */ export interface SignatureHelpItem { /** - * Whether the signature accepts a variable number of arguments. - */ + * Whether the signature accepts a variable number of arguments. + */ isVariadic: boolean; /** - * The prefix display parts. - */ + * The prefix display parts. + */ prefixDisplayParts: SymbolDisplayPart[]; /** - * The suffix disaply parts. - */ + * The suffix disaply parts. + */ suffixDisplayParts: SymbolDisplayPart[]; /** - * The separator display parts. - */ + * The separator display parts. + */ separatorDisplayParts: SymbolDisplayPart[]; /** - * The signature helps items for the parameters. - */ + * The signature helps items for the parameters. + */ parameters: SignatureHelpParameter[]; /** - * The signature's documentation - */ + * The signature's documentation + */ documentation: SymbolDisplayPart[]; } /** - * Signature help items found in the response of a signature help request. - */ + * Signature help items found in the response of a signature help request. + */ export interface SignatureHelpItems { /** - * The signature help items. - */ + * The signature help items. + */ items: SignatureHelpItem[]; /** - * The span for which signature help should appear on a signature - */ + * The span for which signature help should appear on a signature + */ applicableSpan: TextSpan; /** - * The item selected in the set of available help items. - */ + * The item selected in the set of available help items. + */ selectedItemIndex: number; /** - * The argument selected in the set of parameters. - */ + * The argument selected in the set of parameters. + */ argumentIndex: number; /** - * The argument count - */ + * The argument count + */ argumentCount: number; } /** - * Arguments of a signature help request. - */ + * Arguments of a signature help request. + */ export interface SignatureHelpRequestArgs extends FileLocationRequestArgs { } /** - * Signature help request; value of command field is "signatureHelp". - * Given a file location (file, line, col), return the signature - * help. - */ + * Signature help request; value of command field is "signatureHelp". + * Given a file location (file, line, col), return the signature + * help. + */ export interface SignatureHelpRequest extends FileLocationRequest { arguments: SignatureHelpRequestArgs; } /** - * Repsonse object for a SignatureHelpRequest. - */ + * Repsonse object for a SignatureHelpRequest. + */ export interface SignatureHelpResponse extends Response { body?: SignatureHelpItems; } /** - * Arguments for GeterrForProject request. - */ +* Arguments for GeterrForProject request. +*/ export interface GeterrForProjectRequestArgs { /** - * the file requesting project error list - */ + * the file requesting project error list + */ file: string; /** - * Delay in milliseconds to wait before starting to compute - * errors for the files in the file list - */ + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ delay: number; } /** - * GeterrForProjectRequest request; value of command field is - * "geterrForProject". It works similarly with 'Geterr', only - * it request for every file in this project. - */ + * GeterrForProjectRequest request; value of command field is + * "geterrForProject". It works similarly with 'Geterr', only + * it request for every file in this project. + */ export interface GeterrForProjectRequest extends Request { arguments: GeterrForProjectRequestArgs } /** - * Arguments for geterr messages. - */ + * Arguments for geterr messages. + */ export interface GeterrRequestArgs { /** - * List of file names for which to compute compiler errors. - * The files will be checked in list order. - */ + * List of file names for which to compute compiler errors. + * The files will be checked in list order. + */ files: string[]; /** - * Delay in milliseconds to wait before starting to compute - * errors for the files in the file list - */ + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ delay: number; } /** - * Geterr request; value of command field is "geterr". Wait for - * delay milliseconds and then, if during the wait no change or - * reload messages have arrived for the first file in the files - * list, get the syntactic errors for the file, field requests, - * and then get the semantic errors for the file. Repeat with a - * smaller delay for each subsequent file on the files list. Best - * practice for an editor is to send a file list containing each - * file that is currently visible, in most-recently-used order. - */ + * Geterr request; value of command field is "geterr". Wait for + * delay milliseconds and then, if during the wait no change or + * reload messages have arrived for the first file in the files + * list, get the syntactic errors for the file, field requests, + * and then get the semantic errors for the file. Repeat with a + * smaller delay for each subsequent file on the files list. Best + * practice for an editor is to send a file list containing each + * file that is currently visible, in most-recently-used order. + */ export interface GeterrRequest extends Request { arguments: GeterrRequestArgs; } /** - * Item of diagnostic information found in a DiagnosticEvent message. - */ + * Item of diagnostic information found in a DiagnosticEvent message. + */ export interface Diagnostic { /** - * Starting file location at which text appies. - */ + * Starting file location at which text appies. + */ start: Location; /** - * The last file location at which the text applies. - */ + * The last file location at which the text applies. + */ end: Location; /** - * Text of diagnostic message. - */ + * Text of diagnostic message. + */ text: string; } export interface DiagnosticEventBody { /** - * The file for which diagnostic information is reported. - */ + * The file for which diagnostic information is reported. + */ file: string; /** - * An array of diagnostic information items. - */ + * An array of diagnostic information items. + */ diagnostics: Diagnostic[]; } /** - * Event message for "syntaxDiag" and "semanticDiag" event types. - * These events provide syntactic and semantic errors for a file. - */ + * Event message for "syntaxDiag" and "semanticDiag" event types. + * These events provide syntactic and semantic errors for a file. + */ export interface DiagnosticEvent extends Event { body?: DiagnosticEventBody; } /** - * Arguments for reload request. - */ + * Arguments for reload request. + */ export interface ReloadRequestArgs extends FileRequestArgs { /** - * Name of temporary file from which to reload file - * contents. May be same as file. - */ + * Name of temporary file from which to reload file + * contents. May be same as file. + */ tmpfile: string; } /** - * Reload request message; value of command field is "reload". - * Reload contents of file with name given by the 'file' argument - * from temporary file with name given by the 'tmpfile' argument. - * The two names can be identical. - */ + * Reload request message; value of command field is "reload". + * Reload contents of file with name given by the 'file' argument + * from temporary file with name given by the 'tmpfile' argument. + * The two names can be identical. + */ export interface ReloadRequest extends FileRequest { arguments: ReloadRequestArgs; } /** - * Response to "reload" request. This is just an acknowledgement, so - * no body field is required. - */ + * Response to "reload" request. This is just an acknowledgement, so + * no body field is required. + */ export interface ReloadResponse extends Response { } /** - * Arguments for saveto request. - */ + * Arguments for saveto request. + */ export interface SavetoRequestArgs extends FileRequestArgs { /** - * Name of temporary file into which to save server's view of - * file contents. - */ + * Name of temporary file into which to save server's view of + * file contents. + */ tmpfile: string; } /** - * Saveto request message; value of command field is "saveto". - * For debugging purposes, save to a temporaryfile (named by - * argument 'tmpfile') the contents of file named by argument - * 'file'. The server does not currently send a response to a - * "saveto" request. - */ + * Saveto request message; value of command field is "saveto". + * For debugging purposes, save to a temporaryfile (named by + * argument 'tmpfile') the contents of file named by argument + * 'file'. The server does not currently send a response to a + * "saveto" request. + */ export interface SavetoRequest extends FileRequest { arguments: SavetoRequestArgs; } /** - * Arguments for navto request message. - */ + * Arguments for navto request message. + */ export interface NavtoRequestArgs extends FileRequestArgs { /** - * Search term to navigate to from current location; term can - * be '.*' or an identifier prefix. - */ + * Search term to navigate to from current location; term can + * be '.*' or an identifier prefix. + */ searchValue: string; /** - * Optional limit on the number of items to return. - */ + * Optional limit on the number of items to return. + */ maxResultCount?: number; } /** - * Navto request message; value of command field is "navto". - * Return list of objects giving file locations and symbols that - * match the search term given in argument 'searchTerm'. The - * context for the search is given by the named file. - */ + * Navto request message; value of command field is "navto". + * Return list of objects giving file locations and symbols that + * match the search term given in argument 'searchTerm'. The + * context for the search is given by the named file. + */ export interface NavtoRequest extends FileRequest { arguments: NavtoRequestArgs; } /** - * An item found in a navto response. - */ + * An item found in a navto response. + */ export interface NavtoItem { /** - * The symbol's name. - */ + * The symbol's name. + */ name: string; /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; /** - * exact, substring, or prefix. - */ + * exact, substring, or prefix. + */ matchKind?: string; /** - * If this was a case sensitive or insensitive match. - */ + * If this was a case sensitive or insensitive match. + */ isCaseSensitive?: boolean; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers?: string; /** - * The file in which the symbol is found. - */ + * The file in which the symbol is found. + */ file: string; /** - * The location within file at which the symbol is found. - */ + * The location within file at which the symbol is found. + */ start: Location; /** - * One past the last character of the symbol. - */ + * One past the last character of the symbol. + */ end: Location; /** - * Name of symbol's container symbol (if any); for example, - * the class name if symbol is a class member. - */ + * Name of symbol's container symbol (if any); for example, + * the class name if symbol is a class member. + */ containerName?: string; /** - * Kind of symbol's container symbol (if any). - */ + * Kind of symbol's container symbol (if any). + */ containerKind?: string; } /** - * Navto response message. Body is an array of navto items. Each - * item gives a symbol that matched the search term. - */ + * Navto response message. Body is an array of navto items. Each + * item gives a symbol that matched the search term. + */ export interface NavtoResponse extends Response { body?: NavtoItem[]; } /** - * Arguments for change request message. - */ + * Arguments for change request message. + */ export interface ChangeRequestArgs extends FormatRequestArgs { /** - * Optional string to insert at location (file, line, offset). - */ + * Optional string to insert at location (file, line, offset). + */ insertString?: string; } /** - * Change request message; value of command field is "change". - * Update the server's view of the file named by argument 'file'. - * Server does not currently send a response to a change request. - */ + * Change request message; value of command field is "change". + * Update the server's view of the file named by argument 'file'. + * Server does not currently send a response to a change request. + */ export interface ChangeRequest extends FileLocationRequest { arguments: ChangeRequestArgs; } /** - * Response to "brace" request. - */ + * Response to "brace" request. + */ export interface BraceResponse extends Response { body?: TextSpan[]; } /** - * Brace matching request; value of command field is "brace". - * Return response giving the file locations of matching braces - * found in file at location line, offset. - */ + * Brace matching request; value of command field is "brace". + * Return response giving the file locations of matching braces + * found in file at location line, offset. + */ export interface BraceRequest extends FileLocationRequest { } /** - * NavBar itesm request; value of command field is "navbar". - * Return response giving the list of navigation bar entries - * extracted from the requested file. - */ + * NavBar itesm request; value of command field is "navbar". + * Return response giving the list of navigation bar entries + * extracted from the requested file. + */ export interface NavBarRequest extends FileRequest { } export interface NavigationBarItem { /** - * The item's display text. - */ + * The item's display text. + */ text: string; /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers?: string; /** - * The definition locations of the item. - */ + * The definition locations of the item. + */ spans: TextSpan[]; /** - * Optional children. - */ + * Optional children. + */ childItems?: NavigationBarItem[]; } diff --git a/extensions/typescript/src/typescriptServiceClient.ts b/extensions/typescript/src/typescriptServiceClient.ts index aba7e657c0d..cd370db7f37 100644 --- a/extensions/typescript/src/typescriptServiceClient.ts +++ b/extensions/typescript/src/typescriptServiceClient.ts @@ -40,7 +40,7 @@ interface RequestItem { export default class TypeScriptServiceClient implements ITypescriptServiceClient { - public static Trace: boolean = false; + public static Trace: boolean = process.env.TSS_TRACE || false; private host: ITypescriptServiceClientHost; private pathSeparator: string; diff --git a/extensions/typescript/syntaxes/TypeScript.tmLanguage b/extensions/typescript/syntaxes/TypeScript.tmLanguage index 8017c3899c4..ae614a2e14a 100644 --- a/extensions/typescript/syntaxes/TypeScript.tmLanguage +++ b/extensions/typescript/syntaxes/TypeScript.tmLanguage @@ -70,6 +70,13 @@ name keyword.operator.assignment.ts + await-modifier + + match + await + name + storage.modifier.ts + block begin @@ -98,11 +105,11 @@ include - #expression + #object-member include - #object-member + #expression @@ -116,7 +123,7 @@ cast begin - (?:(?<=return|throw|yield|[=(,:>]))\s*(<)(?!<?\=) + (?:(?<=return|throw|yield|await|[=(,:>]))\s*(<)(?!<?\=) beginCaptures 1 @@ -380,7 +387,7 @@ field-declaration begin - (?<!\()\s*\b([a-zA-Z_$][\w$]*)\s*(\?\s*)?(?=(=|:)) + (?<!\()\s*((?:\b[a-zA-Z_$][\w$]*)|(?:\'[^']*\')|(?:\"[^"]*\"))\s*(\?\s*)?(?=(=|:)) beginCaptures 1 @@ -432,6 +439,10 @@ functioncall.expr.ts patterns + + include + #await-modifier + include #type-parameters @@ -445,7 +456,7 @@ function-declaration begin - \b(?:(export)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* + \b(?:(export)\s+)?(?:(async)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* beginCaptures 1 @@ -456,9 +467,14 @@ 2 name - storage.type.function.ts + storage.modifier.ts 3 + + name + storage.type.function.ts + + 4 name entity.name.function.ts @@ -667,7 +683,7 @@ method-declaration begin - \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) + \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) beginCaptures 1 @@ -683,19 +699,24 @@ 3 name - storage.type.property.ts + storage.modifier.ts 4 name - keyword.operator.ts + storage.type.property.ts 5 name - entity.name.function.ts + keyword.operator.ts 6 + + name + entity.name.function.ts + + 7 name keyword.operator.ts diff --git a/extensions/typescript/syntaxes/TypeScriptReact.tmLanguage b/extensions/typescript/syntaxes/TypeScriptReact.tmLanguage index a7d22de0f20..1a0c48cf5a3 100644 --- a/extensions/typescript/syntaxes/TypeScriptReact.tmLanguage +++ b/extensions/typescript/syntaxes/TypeScriptReact.tmLanguage @@ -98,11 +98,11 @@ include - #expression + #object-member include - #object-member + #expression @@ -348,7 +348,7 @@ field-declaration begin - (?<!\()\s*\b([a-zA-Z_$][\w$]*)\s*(\?\s*)?(?=(=|:)) + (?<!\()\s*((?:\b[a-zA-Z_$][\w$]*)|(?:\'[^']*\')|(?:\"[^"]*\"))\s*(\?\s*)?(?=(=|:)) beginCaptures 1 diff --git a/extensions/vb/vb.configuration.json b/extensions/vb/vb.configuration.json index f05c7584ecb..fceea4405f8 100644 --- a/extensions/vb/vb.configuration.json +++ b/extensions/vb/vb.configuration.json @@ -1,7 +1,6 @@ { "comments": { - "lineComment": "'", - "blockComment": [ "/*", "*/" ] + "lineComment": "'" }, "brackets": [ ["{", "}"], diff --git a/extensions/vscode-api-tests/src/commands.test.ts b/extensions/vscode-api-tests/src/commands.test.ts index 6d9453f3510..fe5a4e7aa11 100644 --- a/extensions/vscode-api-tests/src/commands.test.ts +++ b/extensions/vscode-api-tests/src/commands.test.ts @@ -6,24 +6,37 @@ 'use strict'; import * as assert from 'assert'; -import * as fs from 'fs'; -import * as os from 'os'; -import {workspace, window, Position, commands} from 'vscode'; -import {createRandomFile, deleteFile, cleanUp} from './utils'; +import {commands} from 'vscode'; import {join} from 'path'; -suite("editor tests", () => { +suite("commands namespace tests", () => { - teardown(cleanUp); + test('getCommands', function(done) { - // test('calling command completes with the extension host updated properly', () => { - // return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => { - // return window.showTextDocument(doc).then(editor => { - // assert.equal(window.visibleTextEditors.length, 1); - // return commands.executeCommand('workbench.action.closeAllEditors').then(() => { - // assert.equal(window.visibleTextEditors.length, 0); - // }); - // }); - // }); - // }); + let p1 = commands.getCommands().then(commands => { + let hasOneWithUnderscore = false; + for (let command of commands) { + if (command[0] === '_') { + hasOneWithUnderscore = true; + break; + } + } + assert.ok(hasOneWithUnderscore); + }, done); + + let p2 = commands.getCommands(true).then(commands => { + let hasOneWithUnderscore = false; + for (let command of commands) { + if (command[0] === '_') { + hasOneWithUnderscore = true; + break; + } + } + assert.ok(!hasOneWithUnderscore); + }, done); + + Promise.all([p1, p2]).then(() => { + done(); + }, done); + }); }); \ No newline at end of file diff --git a/extensions/vscode-api-tests/src/workspace.test.ts b/extensions/vscode-api-tests/src/workspace.test.ts index 1ec0533d7c1..b0a46690eb7 100644 --- a/extensions/vscode-api-tests/src/workspace.test.ts +++ b/extensions/vscode-api-tests/src/workspace.test.ts @@ -45,7 +45,7 @@ suite('workspace-namespace', () => { if (process.platform === 'win32') { return done(); // TODO@Joh this test fails on windows } - + workspace.openTextDocument(Uri.parse('untitled://' + join(workspace.rootPath, './newfile.txt'))).then(doc => { assert.equal(doc.uri.scheme, 'untitled'); assert.ok(doc.isDirty); @@ -53,28 +53,26 @@ suite('workspace-namespace', () => { }); }); - // test('openTextDocument, untitled closes on save', function(done) { - // workspace.openTextDocument(Uri.parse('untitled://' + join(workspace.rootPath, './newfile2.txt'))).then(doc => { - // assert.equal(doc.uri.scheme, 'untitled'); - // assert.ok(doc.isDirty); + test('openTextDocument, untitled closes on save', function() { + const path = join(workspace.rootPath, './newfile.txt'); - // let closed: TextDocument, opened: TextDocument; - // let d0 = workspace.onDidCloseTextDocument(e => closed = e); - // let d1 = workspace.onDidOpenTextDocument(e => opened = e); + return workspace.openTextDocument(Uri.parse('untitled://' + path)).then(doc => { + assert.equal(doc.uri.scheme, 'untitled'); + assert.ok(doc.isDirty); - // function donedone() { - // assert.ok(closed === doc); - // assert.equal(opened.uri.scheme, 'file'); - // assert.equal(opened.uri.toString(), 'file:///' + join(workspace.rootPath, './newfile2.txt')) - // d0.dispose(); - // d1.dispose(); + let closed: TextDocument; + let d0 = workspace.onDidCloseTextDocument(e => closed = e); - // deleteFile(opened.uri).then(done, done); - // } + return doc.save().then(() => { + assert.ok(closed === doc); + assert.ok(fs.existsSync(path)); - // doc.save().then(donedone, done); - // }); - // }) + d0.dispose(); + + return deleteFile(Uri.file(join(workspace.rootPath, './newfile.txt'))); + }); + }); + }); test('events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument', () => { return createRandomFile().then(file => { diff --git a/extensions/xml/package.json b/extensions/xml/package.json index e3e9e0474c2..e471964623a 100644 --- a/extensions/xml/package.json +++ b/extensions/xml/package.json @@ -8,6 +8,7 @@ "id": "xml", "extensions": [ ".ascx", + ".atom", ".axml", ".bpmn", ".config", diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index b815f4a9fd7..7ea6d8aaf70 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -414,16 +414,21 @@ "version": "4.3.6", "from": "semver@>=4.2.0 <5.0.0", "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz" + }, + "vscode-debugprotocol": { + "version": "1.0.1", + "from": "vscode-debugprotocol@>=1.0.1", + "resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.0.1.tgz" }, "vscode-textmate": { - "version": "1.0.8", - "from": "vscode-textmate@1.0.8", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-1.0.8.tgz", + "version": "1.0.9", + "from": "vscode-textmate@1.0.9", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-1.0.9.tgz", "dependencies": { - "oniguruma": { - "version": "5.1.1", - "from": "oniguruma@>=5.1.1 <6.0.0", - "resolved": "https://registry.npmjs.org/oniguruma/-/oniguruma-5.1.1.tgz", + "alexandrudima-oniguruma": { + "version": "6.0.1", + "from": "alexandrudima-oniguruma@>=6.0.0 <7.0.0", + "resolved": "https://registry.npmjs.org/alexandrudima-oniguruma/-/alexandrudima-oniguruma-6.0.1.tgz", "dependencies": { "nan": { "version": "2.0.9", @@ -440,9 +445,9 @@ } }, "native-keymap": { - "version": "0.0.2", - "from": "native-keymap@0.0.2", - "resolved": "https://registry.npmjs.org/native-keymap/-/native-keymap-0.0.2.tgz" + "version": "0.1.0", + "from": "native-keymap@0.1.0", + "resolved": "https://registry.npmjs.org/native-keymap/-/native-keymap-0.1.0.tgz" }, "winreg": { "version": "0.0.12", diff --git a/package.json b/package.json index b31c56c75aa..26c4d380149 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Code", - "version": "0.10.3", + "version": "0.10.4", "electronVersion": "0.34.5", "author": { "name": "Microsoft Corporation" @@ -26,8 +26,9 @@ "iconv-lite": "^0.4.13", "sax": "^1.1.1", "semver": "^4.2.0", - "vscode-textmate": "^1.0.8", - "native-keymap": "^0.0.2", + "vscode-debugprotocol": "^1.0.0", + "vscode-textmate": "^1.0.9", + "native-keymap": "^0.1.0", "winreg": "0.0.12", "yauzl": "^2.3.1" }, @@ -55,7 +56,7 @@ "gulp-rename": "^1.2.0", "gulp-sourcemaps": "^1.6.0", "gulp-symdest": "^1.0.0", - "gulp-tsb": "^1.7.3", + "gulp-tsb": "~1.7.3", "gulp-uglify": "^1.4.1", "gulp-util": "^3.0.6", "gulp-vinyl-zip": "^1.1.0", diff --git a/product.json b/product.json index e17a8d3020e..aafbf1db2da 100644 --- a/product.json +++ b/product.json @@ -2,10 +2,11 @@ "nameShort": "Code [OSS Build]", "nameLong": "Code [OSS Build]", "win32ExeBasename": "CodeOSS", + "win32MutexName": "vscodeoss", "companyName": "Microsoft Corporation", "copyright": "Copyright (C) 2015 Microsoft. All rights reserved", "licenseUrl": "https://github.com/Microsoft/vscode/blob/master/LICENSE.txt", - "darwinBundleIdentifier": "code.visualstudio.com.Code", + "darwinBundleIdentifier": "com.visualstudio.code.oss", "darwinApplicationCategoryType": "public.app-category.developer-tools", "darwinBundleDocumentTypes": [{ "name": "Code OSS Build document", diff --git a/src/bootstrap.js b/src/bootstrap.js index 43458652f50..0d390b5831f 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -119,10 +119,7 @@ function uriFromPath(_path) { } loader.config({ - baseUrl: uriFromPath(path.join(__dirname, '..')), - paths: { - 'vs': path.basename(__dirname) + '/vs' - }, + baseUrl: uriFromPath(path.join(__dirname)), catchError: true, nodeRequire: require, nodeMain: __filename diff --git a/src/lib/OSSREADME.json b/src/lib/OSSREADME.json deleted file mode 100644 index dd198bbe2ea..00000000000 --- a/src/lib/OSSREADME.json +++ /dev/null @@ -1,8 +0,0 @@ -// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: - -[{ - "name": "react", - "version": "0.12.0", - "license": "BSD", - "repositoryURL": "https://github.com/facebook/react" -}] \ No newline at end of file diff --git a/src/lib/react.d.ts b/src/lib/react.d.ts deleted file mode 100644 index a07e3f70c71..00000000000 --- a/src/lib/react.d.ts +++ /dev/null @@ -1,622 +0,0 @@ -// Type definitions for React 0.12.RC -// Project: http://facebook.github.io/react/ -// Definitions by: Asana -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -export declare class BaseComponent implements Specification { - public state: S; - public props: P; - public setState(substate: any, callback?: () => void): void; - public setProps(subprops:any, callback?: () => void): void; - public render(): RenderResult; - public componentWillReceiveProps(nextProps: P): void; - public shouldComponentUpdate(nextProps: P, nextState: S): boolean; -} - -export interface DomReferencer2 { - getDOMNode(): T; -} - -export interface RenderResult extends ReactElement { } - -export declare function createFactoryForTS

(specification: Specification): ReactComponentFactory

; - - - - -export declare function createClass(specification: Specification): ReactComponentFactory

; - -export declare function createFactory

(clazz: ReactComponentFactory

): ReactComponentFactory

; - -export declare function createElement

(clazz: ReactComponentFactory

, props: P, ...children: any[]): ReactComponentElement

; - -export declare function createElement(type: string, props: DomAttributes, ...children: any[]): ReactHTMLElement; - -export declare function createElement(type: string, props: SvgAttributes, ...children: any[]): ReactSVGElement; - -export declare function render

(component: ReactComponentElement

, container: Element, callback?: () => void): ReactComponentElement

; - -export declare function render(component: ReactHTMLElement, container: Element, callback?: () => void): ReactHTMLElement; - -export declare function render(component: ReactSVGElement, container: Element, callback?: () => void): ReactSVGElement; - -export declare function unmountComponentAtNode(container: Element): boolean; - -export declare function renderToString

(component: ReactComponentElement

): string; - -export declare function renderToString(component: ReactHTMLElement): string; - -export declare function renderToString(component: ReactSVGElement): string; - -export declare function renderToStaticMarkup

(component: ReactComponentElement

): string; - -export declare function renderToStaticMarkup(component: ReactHTMLElement): string; - -export declare function renderToStaticMarkup(component: ReactSVGElement): string; - -export declare function isValidClass(factory: ReactComponentFactory): boolean; - -export declare function isValidElement(component: ReactComponentElement): boolean; - -export declare function isValidElement(component: ReactHTMLElement): boolean; - -export declare function isValidElement(component: ReactSVGElement): boolean; - -export declare function initializeTouchEvents(shouldUseTouch: boolean): void; - - -export interface ReactComponentFactory

{ - (properties: P, ...children: any[]): ReactComponentElement

; -} - -export interface ReactElementFactory

{ - (properties: P, ...children: any[]): ReactDOMElement

; -} - -export interface DomElement extends ReactElementFactory { -} - -export interface SvgElement extends ReactElementFactory { -} - -export interface ReactClass

{ - (props: P): ReactComponent

; -} - -export interface ReactComponent

{ - props: P; - render(): ReactElement; -} - -export interface ReactElement { - type: T; - props: P; - key: string; - ref: string; -} - -export interface ReactDOMElement

extends ReactElement { - props: P; -} - -export interface ReactHTMLElement extends ReactDOMElement { -} - -export interface ReactSVGElement extends ReactDOMElement { -} - -export interface ReactComponentElement

extends ReactElement, P> { - props: P; -} - -export interface Mixin { - componentWillMount?(): void; - componentDidMount?(): void; - componentWillReceiveProps?(nextProps: P): void; - shouldComponentUpdate?(nextProps: P, nextState: S): boolean; - componentWillUpdate?(nextProps: P, nextState: S): void; - componentDidUpdate?(prevProps: P, prevState: S): void; - componentWillUnmount?(): void; -} - -export interface Specification extends Mixin { - displayName?: string; - mixins?: Mixin[]; - statics?: { - [key: string]: Function; - }; - propTypes?: ValidationMap

; - getDefaultProps?(): P; - getInitialState?(): S; - render(): ReactElement; -} - -export interface DomReferencer { - getDOMNode(): Element; -} - -export interface Component extends DomReferencer { - refs: { - [key: string]: DomReferencer - }; - props: P; - state: S; - setState(nextState: S, callback?: () => void): void; - replaceState(nextState: S, callback?: () => void): void; - forceUpdate(callback?: () => void): void; - isMounted(): boolean; - setProps(nextProps: P, callback?: () => void): void; - replaceProps(nextProps: P, callback?: () => void): void; -} - -export interface Constructable { - new(): any; -} - -export interface Validator

{ - (props: P, propName: string, componentName: string): Error; -} - -export interface Requireable

extends Validator

{ - isRequired: Validator

; -} - -export interface ValidationMap

{ - [key: string]: Validator

; -} - -export declare var PropTypes: { - any: Requireable; - array: Requireable; - bool: Requireable; - func: Requireable; - number: Requireable; - object: Requireable; - string: Requireable; - node: Requireable; - component: Requireable; - instanceOf: (clazz: Constructable) => Requireable; - oneOf: (types: any[]) => Requireable; - oneOfType: (types: Validator[]) => Requireable; - arrayOf: (type: Validator) => Requireable; - objectOf: (type: Validator) => Requireable; - shape: (type: ValidationMap) => Requireable; -}; - -export declare var Children: { - map(children: any[], fn: (child: any) => any): any[]; - forEach(children: any[], fn: (child: any) => any): void; - count(children: any[]): number; - only(children: any[]): any; -}; - -// Browser Interfaces -// Taken from https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts -export interface AbstractView { - styleMedia: StyleMedia; - document: Document; -} - -export interface Touch { - identifier: number; - target: EventTarget; - screenX: number; - screenY: number; - clientX: number; - clientY: number; - pageX: number; - pageY: number; -} - -export interface TouchList { - [index: number]: Touch; - length: number; - item(index: number): Touch; - identifiedTouch(identifier: number): Touch; -} - -// Events -export interface SyntheticEvent { - bubbles: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - nativeEvent: Event; - preventDefault(): void; - stopPropagation(): void; - target: EventTarget; - timeStamp: number; - type: string; -} - -export interface ClipboardEvent extends SyntheticEvent { - clipboardData: DataTransfer; -} - -export interface KeyboardEvent extends SyntheticEvent { - altKey: boolean; - charCode: number; - ctrlKey: boolean; - getModifierState(key: string): boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; -} - -export interface FocusEvent extends SyntheticEvent { - relatedTarget: EventTarget; -} - -export interface MouseEvent extends SyntheticEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - getModifierState(key: string): boolean; - metaKey: boolean; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; -} - -export interface TouchEvent extends SyntheticEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - getModifierState(key: string): boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; -} - -export interface UiEvent extends SyntheticEvent { - detail: number; - view: AbstractView; -} - -export interface WheelEvent extends SyntheticEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; -} - -// Attributes -export interface EventAttributes { - onCopy?: (event: ClipboardEvent) => void; - onCut?: (event: ClipboardEvent) => void; - onPaste?: (event: ClipboardEvent) => void; - onKeyDown?: (event: KeyboardEvent) => void; - onKeyPress?: (event: KeyboardEvent) => void; - onKeyUp?: (event: KeyboardEvent) => void; - onFocus?: (event: FocusEvent) => void; - onBlur?: (event: FocusEvent) => void; - onChange?: (event: SyntheticEvent) => void; - onInput?: (event: SyntheticEvent) => void; - onSubmit?: (event: SyntheticEvent) => void; - onClick?: (event: MouseEvent) => void; - onDoubleClick?: (event: MouseEvent) => void; - onDrag?: (event: MouseEvent) => void; - onDragEnd?: (event: MouseEvent) => void; - onDragEnter?: (event: MouseEvent) => void; - onDragExit?: (event: MouseEvent) => void; - onDragLeave?: (event: MouseEvent) => void; - onDragOver?: (event: MouseEvent) => void; - onDragStart?: (event: MouseEvent) => void; - onDrop?: (event: MouseEvent) => void; - onMouseDown?: (event: MouseEvent) => void; - onMouseEnter?: (event: MouseEvent) => void; - onMouseLeave?: (event: MouseEvent) => void; - onMouseMove?: (event: MouseEvent) => void; - onMouseOut?: (event: MouseEvent) => void; - onMouseOver?: (event: MouseEvent) => void; - onMouseUp?: (event: MouseEvent) => void; - onTouchCancel?: (event: TouchEvent) => void; - onTouchEnd?: (event: TouchEvent) => void; - onTouchMove?: (event: TouchEvent) => void; - onTouchStart?: (event: TouchEvent) => void; - onScroll?: (event: UiEvent) => void; - onWheel?: (event: WheelEvent) => void; -} - -export interface ReactAttributes { - dangerouslySetInnerHTML?: { - __html: string; - }; - children?: any[]; - key?: string; - ref?: string; -} - -export interface DomAttributes extends EventAttributes, ReactAttributes { - // HTML Attributes - accept?: any; - accessKey?: any; - action?: any; - allowFullScreen?: any; - allowTransparency?: any; - alt?: any; - async?: any; - autoCapitalize?: any; - autoComplete?: any; - autoCorrect?: any; - autoFocus?: any; - autoPlay?: any; - cellPadding?: any; - cellSpacing?: any; - charSet?: any; - checked?: any; - className?: any; - cols?: any; - colSpan?: any; - content?: any; - contentEditable?: any; - contextMenu?: any; - controls?: any; - coords?: any; - crossOrigin?: any; - data?: any; - dateTime?: any; - defer?: any; - dir?: any; - disabled?: any; - download?: any; - draggable?: any; - encType?: any; - form?: any; - formNoValidate?: any; - frameBorder?: any; - height?: any; - hidden?: any; - href?: any; - hrefLang?: any; - htmlFor?: any; - httpEquiv?: any; - icon?: any; - id?: any; - itemProp?: any; - itemScope?: any; - itemType?: any; - label?: any; - lang?: any; - list?: any; - loop?: any; - max?: any; - maxLength?: any; - mediaGroup?: any; - method?: any; - min?: any; - multiple?: any; - muted?: any; - name?: any; - noValidate?: any; - open?: any; - pattern?: any; - placeholder?: any; - poster?: any; - preload?: any; - property?: any; - radioGroup?: any; - readOnly?: any; - rel?: any; - required?: any; - role?: any; - rows?: any; - rowSpan?: any; - sandbox?: any; - scope?: any; - scrollLeft?: any; - scrolling?: any; - scrollTop?: any; - seamless?: any; - selected?: any; - shape?: any; - size?: any; - span?: any; - spellCheck?: any; - src?: any; - srcDoc?: any; - srcSet?: any; - start?: any; - step?: any; - style?: any; - tabIndex?: any; - target?: any; - title?: any; - type?: any; - useMap?: any; - value?: any; - width?: any; - wmode?: any; -} - -export interface SvgAttributes extends EventAttributes, ReactAttributes { - cx?: any; - cy?: any; - d?: any; - dx?: any; - dy?: any; - fill?: any; - fillOpacity?: any; - fontFamily?: any; - fontSize?: any; - fx?: any; - fy?: any; - gradientTransform?: any; - gradientUnits?: any; - markerEnd?: any; - markerMid?: any; - markerStart?: any; - offset?: any; - opacity?: any; - patternContentUnits?: any; - patternUnits?: any; - points?: any; - preserveAspectRatio?: any; - r?: any; - rx?: any; - ry?: any; - spreadMethod?: any; - stopColor?: any; - stopOpacity?: any; - stroke?: any; - strokeDasharray?: any; - strokeLinecap?: any; - strokeOpacity?: any; - strokeWidth?: any; - textAnchor?: any; - transform?: any; - version?: any; - viewBox?: any; - x1?: any; - x2?: any; - x?: any; - y1?: any; - y2?: any; - y?: any; -} - -export declare var DOM: { - // HTML - a: DomElement; - abbr: DomElement; - address: DomElement; - area: DomElement; - article: DomElement; - aside: DomElement; - audio: DomElement; - b: DomElement; - base: DomElement; - bdi: DomElement; - bdo: DomElement; - big: DomElement; - blockquote: DomElement; - body: DomElement; - br: DomElement; - button: DomElement; - canvas: DomElement; - caption: DomElement; - cite: DomElement; - code: DomElement; - col: DomElement; - colgroup: DomElement; - data: DomElement; - datalist: DomElement; - dd: DomElement; - del: DomElement; - details: DomElement; - dfn: DomElement; - dialog: DomElement; - div: DomElement; - dl: DomElement; - dt: DomElement; - em: DomElement; - embed: DomElement; - fieldset: DomElement; - figcaption: DomElement; - figure: DomElement; - footer: DomElement; - form: DomElement; - h1: DomElement; - h2: DomElement; - h3: DomElement; - h4: DomElement; - h5: DomElement; - h6: DomElement; - head: DomElement; - header: DomElement; - hr: DomElement; - html: DomElement; - i: DomElement; - iframe: DomElement; - img: DomElement; - input: DomElement; - ins: DomElement; - kbd: DomElement; - keygen: DomElement; - label: DomElement; - legend: DomElement; - li: DomElement; - link: DomElement; - main: DomElement; - map: DomElement; - mark: DomElement; - menu: DomElement; - menuitem: DomElement; - meta: DomElement; - meter: DomElement; - nav: DomElement; - noscript: DomElement; - object: DomElement; - ol: DomElement; - optgroup: DomElement; - option: DomElement; - output: DomElement; - p: DomElement; - param: DomElement; - pre: DomElement; - progress: DomElement; - q: DomElement; - rp: DomElement; - rt: DomElement; - ruby: DomElement; - s: DomElement; - samp: DomElement; - script: DomElement; - section: DomElement; - select: DomElement; - small: DomElement; - source: DomElement; - span: DomElement; - strong: DomElement; - style: DomElement; - sub: DomElement; - summary: DomElement; - sup: DomElement; - table: DomElement; - tbody: DomElement; - td: DomElement; - textarea: DomElement; - tfoot: DomElement; - th: DomElement; - thead: DomElement; - time: DomElement; - title: DomElement; - tr: DomElement; - track: DomElement; - u: DomElement; - ul: DomElement; - 'var': DomElement; - video: DomElement; - wbr: DomElement; - // SVG - circle: SvgElement; - defs: SvgElement; - ellipse: SvgElement; - g: SvgElement; - line: SvgElement; - linearGradient: SvgElement; - mask: SvgElement; - path: SvgElement; - pattern: SvgElement; - polygon: SvgElement; - polyline: SvgElement; - radialGradient: SvgElement; - rect: SvgElement; - stop: SvgElement; - svg: SvgElement; - text: SvgElement; - tspan: SvgElement; -}; \ No newline at end of file diff --git a/src/lib/react.js b/src/lib/react.js deleted file mode 100644 index c8873828775..00000000000 --- a/src/lib/react.js +++ /dev/null @@ -1,95 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -'use strict'; - -define(['./react.raw'], function(React) { - - if (!React.isProxy) { - // Patch the real React to prevent immutable fields when handling events asynchronously - var wrapFormElement = function(ctor, displayName) { - return React.createClass({ - getDisplayName: function() { - return displayName; - }, - - getInitialState: function() { - return { - value: this.props.value - }; - }, - - onChange: function(e) { - this.setState({ - value: e.target.value - }); - if (this.props.onChange) { - this.props.onChange(e); - } - }, - - componentWillReceiveProps: function(newProps) { - this.setState({ - value: newProps.value - }); - }, - - render: function() { - var clone = {}; - for (var key in this.props) { - if (this.props.hasOwnProperty(key)) { - clone[key] = this.props[key]; - } - } - clone.value = this.state.value; - clone.onChange = this.onChange; - return ctor(clone); - } - }); - } - React.DOM.input = React.createFactory(wrapFormElement(React.DOM.input, 'input')); - React.DOM.textarea = React.createFactory(wrapFormElement(React.DOM.textarea, 'textarea')); - React.DOM.option = React.createFactory(wrapFormElement(React.DOM.option, 'option')); - } - if (typeof React.DOM.webview === 'undefined') { - if (typeof self.process !== 'undefined') { - React.DOM.webview = React.createFactory(React.createClass({ - componentDidMount: function() { - var webview = document.createElement('webview'); - webview.src = this.props.src; - var el = this.getDOMNode(); - el.appendChild(webview); - }, - - render: function() { - return React.DOM.div(); - } - })); - } else { - React.DOM.webview = React.createFactory(React.createClass({ - render: function() { - return React.DOM.iframe({ - src: this.props.src - }); - } - })); - } - } - - var exports = React; - - // Utils for easy usage of React in TS - exports.BaseComponent = function() { }; - exports.createFactoryForTS = function(klass) { - var r = {}; - for (var p in klass) { - if (p !== 'constructor' && klass.hasOwnProperty(p) && typeof klass[p] === 'function') { - r[p] = klass[p]; - } - } - return React.createFactory(React.createClass(r)); - } - - return exports; -}); \ No newline at end of file diff --git a/src/lib/react.raw.js b/src/lib/react.raw.js deleted file mode 100644 index 64499d49412..00000000000 --- a/src/lib/react.raw.js +++ /dev/null @@ -1,18095 +0,0 @@ -/** - * React v0.12.0 - */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.React=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -1) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { -// console.debug( -// 'Download the React DevTools for a better development experience: ' + -// 'http://fb.me/react-devtools' -// ); - } - } - - var expectedFeatures = [ - // shims - Array.isArray, - Array.prototype.every, - Array.prototype.forEach, - Array.prototype.indexOf, - Array.prototype.map, - Date.now, - Function.prototype.bind, - Object.keys, - String.prototype.split, - String.prototype.trim, - - // shams - Object.create, - Object.freeze - ]; - - for (var i = 0; i < expectedFeatures.length; i++) { - if (!expectedFeatures[i]) { - console.error( - 'One or more ES5 shim/shams expected by React are not available: ' + - 'http://fb.me/react-warning-polyfills' - ); - break; - } - } - } -} - -// Version exists only in the open-source version of React, not in Facebook's -// internal version. -React.version = '0.12.0'; - -module.exports = React; - -},{"./DOMPropertyOperations":12,"./EventPluginUtils":20,"./ExecutionEnvironment":22,"./Object.assign":27,"./ReactChildren":31,"./ReactComponent":32,"./ReactCompositeComponent":34,"./ReactContext":35,"./ReactCurrentOwner":36,"./ReactDOM":37,"./ReactDOMComponent":39,"./ReactDefaultInjection":49,"./ReactElement":52,"./ReactElementValidator":53,"./ReactInstanceHandles":60,"./ReactLegacyElement":61,"./ReactMount":63,"./ReactMultiChild":64,"./ReactPerf":68,"./ReactPropTypes":72,"./ReactServerRendering":76,"./ReactTextComponent":78,"./deprecated":106,"./onlyChild":137}],2:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule AutoFocusMixin - * @typechecks static-only - */ - -"use strict"; - -var focusNode = _dereq_("./focusNode"); - -var AutoFocusMixin = { - componentDidMount: function() { - if (this.props.autoFocus) { - focusNode(this.getDOMNode()); - } - } -}; - -module.exports = AutoFocusMixin; - -},{"./focusNode":111}],3:[function(_dereq_,module,exports){ -/** - * Copyright 2013 Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule BeforeInputEventPlugin - * @typechecks static-only - */ - -"use strict"; - -var EventConstants = _dereq_("./EventConstants"); -var EventPropagators = _dereq_("./EventPropagators"); -var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); -var SyntheticInputEvent = _dereq_("./SyntheticInputEvent"); - -var keyOf = _dereq_("./keyOf"); - -var canUseTextInputEvent = ( - ExecutionEnvironment.canUseDOM && - 'TextEvent' in window && - !('documentMode' in document || isPresto()) -); - -/** - * Opera <= 12 includes TextEvent in window, but does not fire - * text input events. Rely on keypress instead. - */ -function isPresto() { - var opera = window.opera; - return ( - typeof opera === 'object' && - typeof opera.version === 'function' && - parseInt(opera.version(), 10) <= 12 - ); -} - -var SPACEBAR_CODE = 32; -var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); - -var topLevelTypes = EventConstants.topLevelTypes; - -// Events and their corresponding property names. -var eventTypes = { - beforeInput: { - phasedRegistrationNames: { - bubbled: keyOf({onBeforeInput: null}), - captured: keyOf({onBeforeInputCapture: null}) - }, - dependencies: [ - topLevelTypes.topCompositionEnd, - topLevelTypes.topKeyPress, - topLevelTypes.topTextInput, - topLevelTypes.topPaste - ] - } -}; - -// Track characters inserted via keypress and composition events. -var fallbackChars = null; - -// Track whether we've ever handled a keypress on the space key. -var hasSpaceKeypress = false; - -/** - * Return whether a native keypress event is assumed to be a command. - * This is required because Firefox fires `keypress` events for key commands - * (cut, copy, select-all, etc.) even though no character is inserted. - */ -function isKeypressCommand(nativeEvent) { - return ( - (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && - // ctrlKey && altKey is equivalent to AltGr, and is not a command. - !(nativeEvent.ctrlKey && nativeEvent.altKey) - ); -} - -/** - * Create an `onBeforeInput` event to match - * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. - * - * This event plugin is based on the native `textInput` event - * available in Chrome, Safari, Opera, and IE. This event fires after - * `onKeyPress` and `onCompositionEnd`, but before `onInput`. - * - * `beforeInput` is spec'd but not implemented in any browsers, and - * the `input` event does not provide any useful information about what has - * actually been added, contrary to the spec. Thus, `textInput` is the best - * available event to identify the characters that have actually been inserted - * into the target node. - */ -var BeforeInputEventPlugin = { - - eventTypes: eventTypes, - - /** - * @param {string} topLevelType Record from `EventConstants`. - * @param {DOMEventTarget} topLevelTarget The listening component root node. - * @param {string} topLevelTargetID ID of `topLevelTarget`. - * @param {object} nativeEvent Native browser event. - * @return {*} An accumulation of synthetic events. - * @see {EventPluginHub.extractEvents} - */ - extractEvents: function( - topLevelType, - topLevelTarget, - topLevelTargetID, - nativeEvent) { - - var chars; - - if (canUseTextInputEvent) { - switch (topLevelType) { - case topLevelTypes.topKeyPress: - /** - * If native `textInput` events are available, our goal is to make - * use of them. However, there is a special case: the spacebar key. - * In Webkit, preventing default on a spacebar `textInput` event - * cancels character insertion, but it *also* causes the browser - * to fall back to its default spacebar behavior of scrolling the - * page. - * - * Tracking at: - * https://code.google.com/p/chromium/issues/detail?id=355103 - * - * To avoid this issue, use the keypress event as if no `textInput` - * event is available. - */ - var which = nativeEvent.which; - if (which !== SPACEBAR_CODE) { - return; - } - - hasSpaceKeypress = true; - chars = SPACEBAR_CHAR; - break; - - case topLevelTypes.topTextInput: - // Record the characters to be added to the DOM. - chars = nativeEvent.data; - - // If it's a spacebar character, assume that we have already handled - // it at the keypress level and bail immediately. Android Chrome - // doesn't give us keycodes, so we need to blacklist it. - if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { - return; - } - - // Otherwise, carry on. - break; - - default: - // For other native event types, do nothing. - return; - } - } else { - switch (topLevelType) { - case topLevelTypes.topPaste: - // If a paste event occurs after a keypress, throw out the input - // chars. Paste events should not lead to BeforeInput events. - fallbackChars = null; - break; - case topLevelTypes.topKeyPress: - /** - * As of v27, Firefox may fire keypress events even when no character - * will be inserted. A few possibilities: - * - * - `which` is `0`. Arrow keys, Esc key, etc. - * - * - `which` is the pressed key code, but no char is available. - * Ex: 'AltGr + d` in Polish. There is no modified character for - * this key combination and no character is inserted into the - * document, but FF fires the keypress for char code `100` anyway. - * No `input` event will occur. - * - * - `which` is the pressed key code, but a command combination is - * being used. Ex: `Cmd+C`. No character is inserted, and no - * `input` event will occur. - */ - if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { - fallbackChars = String.fromCharCode(nativeEvent.which); - } - break; - case topLevelTypes.topCompositionEnd: - fallbackChars = nativeEvent.data; - break; - } - - // If no changes have occurred to the fallback string, no relevant - // event has fired and we're done. - if (fallbackChars === null) { - return; - } - - chars = fallbackChars; - } - - // If no characters are being inserted, no BeforeInput event should - // be fired. - if (!chars) { - return; - } - - var event = SyntheticInputEvent.getPooled( - eventTypes.beforeInput, - topLevelTargetID, - nativeEvent - ); - - event.data = chars; - fallbackChars = null; - EventPropagators.accumulateTwoPhaseDispatches(event); - return event; - } -}; - -module.exports = BeforeInputEventPlugin; - -},{"./EventConstants":16,"./EventPropagators":21,"./ExecutionEnvironment":22,"./SyntheticInputEvent":89,"./keyOf":133}],4:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule CSSProperty - */ - -"use strict"; - -/** - * CSS properties which accept numbers but are not in units of "px". - */ -var isUnitlessNumber = { - columnCount: true, - fillOpacity: true, - flex: true, - flexGrow: true, - flexShrink: true, - fontWeight: true, - lineClamp: true, - lineHeight: true, - opacity: true, - order: true, - orphans: true, - widows: true, - zIndex: true, - zoom: true -}; - -/** - * @param {string} prefix vendor-specific prefix, eg: Webkit - * @param {string} key style name, eg: transitionDuration - * @return {string} style name prefixed with `prefix`, properly camelCased, eg: - * WebkitTransitionDuration - */ -function prefixKey(prefix, key) { - return prefix + key.charAt(0).toUpperCase() + key.substring(1); -} - -/** - * Support style names that may come passed in prefixed by adding permutations - * of vendor prefixes. - */ -var prefixes = ['Webkit', 'ms', 'Moz', 'O']; - -// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an -// infinite loop, because it iterates over the newly added props too. -Object.keys(isUnitlessNumber).forEach(function(prop) { - prefixes.forEach(function(prefix) { - isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; - }); -}); - -/** - * Most style properties can be unset by doing .style[prop] = '' but IE8 - * doesn't like doing that with shorthand properties so for the properties that - * IE8 breaks on, which are listed here, we instead unset each of the - * individual properties. See http://bugs.jquery.com/ticket/12385. - * The 4-value 'clock' properties like margin, padding, border-width seem to - * behave without any problems. Curiously, list-style works too without any - * special prodding. - */ -var shorthandPropertyExpansions = { - background: { - backgroundImage: true, - backgroundPosition: true, - backgroundRepeat: true, - backgroundColor: true - }, - border: { - borderWidth: true, - borderStyle: true, - borderColor: true - }, - borderBottom: { - borderBottomWidth: true, - borderBottomStyle: true, - borderBottomColor: true - }, - borderLeft: { - borderLeftWidth: true, - borderLeftStyle: true, - borderLeftColor: true - }, - borderRight: { - borderRightWidth: true, - borderRightStyle: true, - borderRightColor: true - }, - borderTop: { - borderTopWidth: true, - borderTopStyle: true, - borderTopColor: true - }, - font: { - fontStyle: true, - fontVariant: true, - fontWeight: true, - fontSize: true, - lineHeight: true, - fontFamily: true - } -}; - -var CSSProperty = { - isUnitlessNumber: isUnitlessNumber, - shorthandPropertyExpansions: shorthandPropertyExpansions -}; - -module.exports = CSSProperty; - -},{}],5:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule CSSPropertyOperations - * @typechecks static-only - */ - -"use strict"; - -var CSSProperty = _dereq_("./CSSProperty"); -var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); - -var camelizeStyleName = _dereq_("./camelizeStyleName"); -var dangerousStyleValue = _dereq_("./dangerousStyleValue"); -var hyphenateStyleName = _dereq_("./hyphenateStyleName"); -var memoizeStringOnly = _dereq_("./memoizeStringOnly"); -var warning = _dereq_("./warning"); - -var processStyleName = memoizeStringOnly(function(styleName) { - return hyphenateStyleName(styleName); -}); - -var styleFloatAccessor = 'cssFloat'; -if (ExecutionEnvironment.canUseDOM) { - // IE8 only supports accessing cssFloat (standard) as styleFloat - if (document.documentElement.style.cssFloat === undefined) { - styleFloatAccessor = 'styleFloat'; - } -} - -if ("production" !== "development") { - var warnedStyleNames = {}; - - var warnHyphenatedStyleName = function(name) { - if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { - return; - } - - warnedStyleNames[name] = true; - ("production" !== "development" ? warning( - false, - 'Unsupported style property ' + name + '. Did you mean ' + - camelizeStyleName(name) + '?' - ) : null); - }; -} - -/** - * Operations for dealing with CSS properties. - */ -var CSSPropertyOperations = { - - /** - * Serializes a mapping of style properties for use as inline styles: - * - * > createMarkupForStyles({width: '200px', height: 0}) - * "width:200px;height:0;" - * - * Undefined values are ignored so that declarative programming is easier. - * The result should be HTML-escaped before insertion into the DOM. - * - * @param {object} styles - * @return {?string} - */ - createMarkupForStyles: function(styles) { - var serialized = ''; - for (var styleName in styles) { - if (!styles.hasOwnProperty(styleName)) { - continue; - } - if ("production" !== "development") { - if (styleName.indexOf('-') > -1) { - warnHyphenatedStyleName(styleName); - } - } - var styleValue = styles[styleName]; - if (styleValue != null) { - serialized += processStyleName(styleName) + ':'; - serialized += dangerousStyleValue(styleName, styleValue) + ';'; - } - } - return serialized || null; - }, - - /** - * Sets the value for multiple styles on a node. If a value is specified as - * '' (empty string), the corresponding style property will be unset. - * - * @param {DOMElement} node - * @param {object} styles - */ - setValueForStyles: function(node, styles) { - var style = node.style; - for (var styleName in styles) { - if (!styles.hasOwnProperty(styleName)) { - continue; - } - if ("production" !== "development") { - if (styleName.indexOf('-') > -1) { - warnHyphenatedStyleName(styleName); - } - } - var styleValue = dangerousStyleValue(styleName, styles[styleName]); - if (styleName === 'float') { - styleName = styleFloatAccessor; - } - if (styleValue) { - style[styleName] = styleValue; - } else { - var expansion = CSSProperty.shorthandPropertyExpansions[styleName]; - if (expansion) { - // Shorthand property that IE8 won't like unsetting, so unset each - // component to placate it - for (var individualStyleName in expansion) { - style[individualStyleName] = ''; - } - } else { - style[styleName] = ''; - } - } - } - } - -}; - -module.exports = CSSPropertyOperations; - -},{"./CSSProperty":4,"./ExecutionEnvironment":22,"./camelizeStyleName":100,"./dangerousStyleValue":105,"./hyphenateStyleName":124,"./memoizeStringOnly":135,"./warning":145}],6:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule CallbackQueue - */ - -"use strict"; - -var PooledClass = _dereq_("./PooledClass"); - -var assign = _dereq_("./Object.assign"); -var invariant = _dereq_("./invariant"); - -/** - * A specialized pseudo-event module to help keep track of components waiting to - * be notified when their DOM representations are available for use. - * - * This implements `PooledClass`, so you should never need to instantiate this. - * Instead, use `CallbackQueue.getPooled()`. - * - * @class ReactMountReady - * @implements PooledClass - * @internal - */ -function CallbackQueue() { - this._callbacks = null; - this._contexts = null; -} - -assign(CallbackQueue.prototype, { - - /** - * Enqueues a callback to be invoked when `notifyAll` is invoked. - * - * @param {function} callback Invoked when `notifyAll` is invoked. - * @param {?object} context Context to call `callback` with. - * @internal - */ - enqueue: function(callback, context) { - this._callbacks = this._callbacks || []; - this._contexts = this._contexts || []; - this._callbacks.push(callback); - this._contexts.push(context); - }, - - /** - * Invokes all enqueued callbacks and clears the queue. This is invoked after - * the DOM representation of a component has been created or updated. - * - * @internal - */ - notifyAll: function() { - var callbacks = this._callbacks; - var contexts = this._contexts; - if (callbacks) { - ("production" !== "development" ? invariant( - callbacks.length === contexts.length, - "Mismatched list of contexts in callback queue" - ) : invariant(callbacks.length === contexts.length)); - this._callbacks = null; - this._contexts = null; - for (var i = 0, l = callbacks.length; i < l; i++) { - callbacks[i].call(contexts[i]); - } - callbacks.length = 0; - contexts.length = 0; - } - }, - - /** - * Resets the internal queue. - * - * @internal - */ - reset: function() { - this._callbacks = null; - this._contexts = null; - }, - - /** - * `PooledClass` looks for this. - */ - destructor: function() { - this.reset(); - } - -}); - -PooledClass.addPoolingTo(CallbackQueue); - -module.exports = CallbackQueue; - -},{"./Object.assign":27,"./PooledClass":28,"./invariant":126}],7:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ChangeEventPlugin - */ - -"use strict"; - -var EventConstants = _dereq_("./EventConstants"); -var EventPluginHub = _dereq_("./EventPluginHub"); -var EventPropagators = _dereq_("./EventPropagators"); -var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); -var ReactUpdates = _dereq_("./ReactUpdates"); -var SyntheticEvent = _dereq_("./SyntheticEvent"); - -var isEventSupported = _dereq_("./isEventSupported"); -var isTextInputElement = _dereq_("./isTextInputElement"); -var keyOf = _dereq_("./keyOf"); - -var topLevelTypes = EventConstants.topLevelTypes; - -var eventTypes = { - change: { - phasedRegistrationNames: { - bubbled: keyOf({onChange: null}), - captured: keyOf({onChangeCapture: null}) - }, - dependencies: [ - topLevelTypes.topBlur, - topLevelTypes.topChange, - topLevelTypes.topClick, - topLevelTypes.topFocus, - topLevelTypes.topInput, - topLevelTypes.topKeyDown, - topLevelTypes.topKeyUp, - topLevelTypes.topSelectionChange - ] - } -}; - -/** - * For IE shims - */ -var activeElement = null; -var activeElementID = null; -var activeElementValue = null; -var activeElementValueProp = null; - -/** - * SECTION: handle `change` event - */ -function shouldUseChangeEvent(elem) { - return ( - elem.nodeName === 'SELECT' || - (elem.nodeName === 'INPUT' && elem.type === 'file') - ); -} - -var doesChangeEventBubble = false; -if (ExecutionEnvironment.canUseDOM) { - // See `handleChange` comment below - doesChangeEventBubble = isEventSupported('change') && ( - !('documentMode' in document) || document.documentMode > 8 - ); -} - -function manualDispatchChangeEvent(nativeEvent) { - var event = SyntheticEvent.getPooled( - eventTypes.change, - activeElementID, - nativeEvent - ); - EventPropagators.accumulateTwoPhaseDispatches(event); - - // If change and propertychange bubbled, we'd just bind to it like all the - // other events and have it go through ReactBrowserEventEmitter. Since it - // doesn't, we manually listen for the events and so we have to enqueue and - // process the abstract event manually. - // - // Batching is necessary here in order to ensure that all event handlers run - // before the next rerender (including event handlers attached to ancestor - // elements instead of directly on the input). Without this, controlled - // components don't work properly in conjunction with event bubbling because - // the component is rerendered and the value reverted before all the event - // handlers can run. See https://github.com/facebook/react/issues/708. - ReactUpdates.batchedUpdates(runEventInBatch, event); -} - -function runEventInBatch(event) { - EventPluginHub.enqueueEvents(event); - EventPluginHub.processEventQueue(); -} - -function startWatchingForChangeEventIE8(target, targetID) { - activeElement = target; - activeElementID = targetID; - activeElement.attachEvent('onchange', manualDispatchChangeEvent); -} - -function stopWatchingForChangeEventIE8() { - if (!activeElement) { - return; - } - activeElement.detachEvent('onchange', manualDispatchChangeEvent); - activeElement = null; - activeElementID = null; -} - -function getTargetIDForChangeEvent( - topLevelType, - topLevelTarget, - topLevelTargetID) { - if (topLevelType === topLevelTypes.topChange) { - return topLevelTargetID; - } -} -function handleEventsForChangeEventIE8( - topLevelType, - topLevelTarget, - topLevelTargetID) { - if (topLevelType === topLevelTypes.topFocus) { - // stopWatching() should be a noop here but we call it just in case we - // missed a blur event somehow. - stopWatchingForChangeEventIE8(); - startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID); - } else if (topLevelType === topLevelTypes.topBlur) { - stopWatchingForChangeEventIE8(); - } -} - - -/** - * SECTION: handle `input` event - */ -var isInputEventSupported = false; -if (ExecutionEnvironment.canUseDOM) { - // IE9 claims to support the input event but fails to trigger it when - // deleting text, so we ignore its input events - isInputEventSupported = isEventSupported('input') && ( - !('documentMode' in document) || document.documentMode > 9 - ); -} - -/** - * (For old IE.) Replacement getter/setter for the `value` property that gets - * set on the active element. - */ -var newValueProp = { - get: function() { - return activeElementValueProp.get.call(this); - }, - set: function(val) { - // Cast to a string so we can do equality checks. - activeElementValue = '' + val; - activeElementValueProp.set.call(this, val); - } -}; - -/** - * (For old IE.) Starts tracking propertychange events on the passed-in element - * and override the value property so that we can distinguish user events from - * value changes in JS. - */ -function startWatchingForValueChange(target, targetID) { - activeElement = target; - activeElementID = targetID; - activeElementValue = target.value; - activeElementValueProp = Object.getOwnPropertyDescriptor( - target.constructor.prototype, - 'value' - ); - - Object.defineProperty(activeElement, 'value', newValueProp); - activeElement.attachEvent('onpropertychange', handlePropertyChange); -} - -/** - * (For old IE.) Removes the event listeners from the currently-tracked element, - * if any exists. - */ -function stopWatchingForValueChange() { - if (!activeElement) { - return; - } - - // delete restores the original property definition - delete activeElement.value; - activeElement.detachEvent('onpropertychange', handlePropertyChange); - - activeElement = null; - activeElementID = null; - activeElementValue = null; - activeElementValueProp = null; -} - -/** - * (For old IE.) Handles a propertychange event, sending a `change` event if - * the value of the active element has changed. - */ -function handlePropertyChange(nativeEvent) { - if (nativeEvent.propertyName !== 'value') { - return; - } - var value = nativeEvent.srcElement.value; - if (value === activeElementValue) { - return; - } - activeElementValue = value; - - manualDispatchChangeEvent(nativeEvent); -} - -/** - * If a `change` event should be fired, returns the target's ID. - */ -function getTargetIDForInputEvent( - topLevelType, - topLevelTarget, - topLevelTargetID) { - if (topLevelType === topLevelTypes.topInput) { - // In modern browsers (i.e., not IE8 or IE9), the input event is exactly - // what we want so fall through here and trigger an abstract event - return topLevelTargetID; - } -} - -// For IE8 and IE9. -function handleEventsForInputEventIE( - topLevelType, - topLevelTarget, - topLevelTargetID) { - if (topLevelType === topLevelTypes.topFocus) { - // In IE8, we can capture almost all .value changes by adding a - // propertychange handler and looking for events with propertyName - // equal to 'value' - // In IE9, propertychange fires for most input events but is buggy and - // doesn't fire when text is deleted, but conveniently, selectionchange - // appears to fire in all of the remaining cases so we catch those and - // forward the event if the value has changed - // In either case, we don't want to call the event handler if the value - // is changed from JS so we redefine a setter for `.value` that updates - // our activeElementValue variable, allowing us to ignore those changes - // - // stopWatching() should be a noop here but we call it just in case we - // missed a blur event somehow. - stopWatchingForValueChange(); - startWatchingForValueChange(topLevelTarget, topLevelTargetID); - } else if (topLevelType === topLevelTypes.topBlur) { - stopWatchingForValueChange(); - } -} - -// For IE8 and IE9. -function getTargetIDForInputEventIE( - topLevelType, - topLevelTarget, - topLevelTargetID) { - if (topLevelType === topLevelTypes.topSelectionChange || - topLevelType === topLevelTypes.topKeyUp || - topLevelType === topLevelTypes.topKeyDown) { - // On the selectionchange event, the target is just document which isn't - // helpful for us so just check activeElement instead. - // - // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire - // propertychange on the first input event after setting `value` from a - // script and fires only keydown, keypress, keyup. Catching keyup usually - // gets it and catching keydown lets us fire an event for the first - // keystroke if user does a key repeat (it'll be a little delayed: right - // before the second keystroke). Other input methods (e.g., paste) seem to - // fire selectionchange normally. - if (activeElement && activeElement.value !== activeElementValue) { - activeElementValue = activeElement.value; - return activeElementID; - } - } -} - - -/** - * SECTION: handle `click` event - */ -function shouldUseClickEvent(elem) { - // Use the `click` event to detect changes to checkbox and radio inputs. - // This approach works across all browsers, whereas `change` does not fire - // until `blur` in IE8. - return ( - elem.nodeName === 'INPUT' && - (elem.type === 'checkbox' || elem.type === 'radio') - ); -} - -function getTargetIDForClickEvent( - topLevelType, - topLevelTarget, - topLevelTargetID) { - if (topLevelType === topLevelTypes.topClick) { - return topLevelTargetID; - } -} - -/** - * This plugin creates an `onChange` event that normalizes change events - * across form elements. This event fires at a time when it's possible to - * change the element's value without seeing a flicker. - * - * Supported elements are: - * - input (see `isTextInputElement`) - * - textarea - * - select - */ -var ChangeEventPlugin = { - - eventTypes: eventTypes, - - /** - * @param {string} topLevelType Record from `EventConstants`. - * @param {DOMEventTarget} topLevelTarget The listening component root node. - * @param {string} topLevelTargetID ID of `topLevelTarget`. - * @param {object} nativeEvent Native browser event. - * @return {*} An accumulation of synthetic events. - * @see {EventPluginHub.extractEvents} - */ - extractEvents: function( - topLevelType, - topLevelTarget, - topLevelTargetID, - nativeEvent) { - - var getTargetIDFunc, handleEventFunc; - if (shouldUseChangeEvent(topLevelTarget)) { - if (doesChangeEventBubble) { - getTargetIDFunc = getTargetIDForChangeEvent; - } else { - handleEventFunc = handleEventsForChangeEventIE8; - } - } else if (isTextInputElement(topLevelTarget)) { - if (isInputEventSupported) { - getTargetIDFunc = getTargetIDForInputEvent; - } else { - getTargetIDFunc = getTargetIDForInputEventIE; - handleEventFunc = handleEventsForInputEventIE; - } - } else if (shouldUseClickEvent(topLevelTarget)) { - getTargetIDFunc = getTargetIDForClickEvent; - } - - if (getTargetIDFunc) { - var targetID = getTargetIDFunc( - topLevelType, - topLevelTarget, - topLevelTargetID - ); - if (targetID) { - var event = SyntheticEvent.getPooled( - eventTypes.change, - targetID, - nativeEvent - ); - EventPropagators.accumulateTwoPhaseDispatches(event); - return event; - } - } - - if (handleEventFunc) { - handleEventFunc( - topLevelType, - topLevelTarget, - topLevelTargetID - ); - } - } - -}; - -module.exports = ChangeEventPlugin; - -},{"./EventConstants":16,"./EventPluginHub":18,"./EventPropagators":21,"./ExecutionEnvironment":22,"./ReactUpdates":79,"./SyntheticEvent":87,"./isEventSupported":127,"./isTextInputElement":129,"./keyOf":133}],8:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ClientReactRootIndex - * @typechecks - */ - -"use strict"; - -var nextReactRootIndex = 0; - -var ClientReactRootIndex = { - createReactRootIndex: function() { - return nextReactRootIndex++; - } -}; - -module.exports = ClientReactRootIndex; - -},{}],9:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule CompositionEventPlugin - * @typechecks static-only - */ - -"use strict"; - -var EventConstants = _dereq_("./EventConstants"); -var EventPropagators = _dereq_("./EventPropagators"); -var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); -var ReactInputSelection = _dereq_("./ReactInputSelection"); -var SyntheticCompositionEvent = _dereq_("./SyntheticCompositionEvent"); - -var getTextContentAccessor = _dereq_("./getTextContentAccessor"); -var keyOf = _dereq_("./keyOf"); - -var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space -var START_KEYCODE = 229; - -var useCompositionEvent = ( - ExecutionEnvironment.canUseDOM && - 'CompositionEvent' in window -); - -// In IE9+, we have access to composition events, but the data supplied -// by the native compositionend event may be incorrect. In Korean, for example, -// the compositionend event contains only one character regardless of -// how many characters have been composed since compositionstart. -// We therefore use the fallback data while still using the native -// events as triggers. -var useFallbackData = ( - !useCompositionEvent || - ( - 'documentMode' in document && - document.documentMode > 8 && - document.documentMode <= 11 - ) -); - -var topLevelTypes = EventConstants.topLevelTypes; -var currentComposition = null; - -// Events and their corresponding property names. -var eventTypes = { - compositionEnd: { - phasedRegistrationNames: { - bubbled: keyOf({onCompositionEnd: null}), - captured: keyOf({onCompositionEndCapture: null}) - }, - dependencies: [ - topLevelTypes.topBlur, - topLevelTypes.topCompositionEnd, - topLevelTypes.topKeyDown, - topLevelTypes.topKeyPress, - topLevelTypes.topKeyUp, - topLevelTypes.topMouseDown - ] - }, - compositionStart: { - phasedRegistrationNames: { - bubbled: keyOf({onCompositionStart: null}), - captured: keyOf({onCompositionStartCapture: null}) - }, - dependencies: [ - topLevelTypes.topBlur, - topLevelTypes.topCompositionStart, - topLevelTypes.topKeyDown, - topLevelTypes.topKeyPress, - topLevelTypes.topKeyUp, - topLevelTypes.topMouseDown - ] - }, - compositionUpdate: { - phasedRegistrationNames: { - bubbled: keyOf({onCompositionUpdate: null}), - captured: keyOf({onCompositionUpdateCapture: null}) - }, - dependencies: [ - topLevelTypes.topBlur, - topLevelTypes.topCompositionUpdate, - topLevelTypes.topKeyDown, - topLevelTypes.topKeyPress, - topLevelTypes.topKeyUp, - topLevelTypes.topMouseDown - ] - } -}; - -/** - * Translate native top level events into event types. - * - * @param {string} topLevelType - * @return {object} - */ -function getCompositionEventType(topLevelType) { - switch (topLevelType) { - case topLevelTypes.topCompositionStart: - return eventTypes.compositionStart; - case topLevelTypes.topCompositionEnd: - return eventTypes.compositionEnd; - case topLevelTypes.topCompositionUpdate: - return eventTypes.compositionUpdate; - } -} - -/** - * Does our fallback best-guess model think this event signifies that - * composition has begun? - * - * @param {string} topLevelType - * @param {object} nativeEvent - * @return {boolean} - */ -function isFallbackStart(topLevelType, nativeEvent) { - return ( - topLevelType === topLevelTypes.topKeyDown && - nativeEvent.keyCode === START_KEYCODE - ); -} - -/** - * Does our fallback mode think that this event is the end of composition? - * - * @param {string} topLevelType - * @param {object} nativeEvent - * @return {boolean} - */ -function isFallbackEnd(topLevelType, nativeEvent) { - switch (topLevelType) { - case topLevelTypes.topKeyUp: - // Command keys insert or clear IME input. - return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1); - case topLevelTypes.topKeyDown: - // Expect IME keyCode on each keydown. If we get any other - // code we must have exited earlier. - return (nativeEvent.keyCode !== START_KEYCODE); - case topLevelTypes.topKeyPress: - case topLevelTypes.topMouseDown: - case topLevelTypes.topBlur: - // Events are not possible without cancelling IME. - return true; - default: - return false; - } -} - -/** - * Helper class stores information about selection and document state - * so we can figure out what changed at a later date. - * - * @param {DOMEventTarget} root - */ -function FallbackCompositionState(root) { - this.root = root; - this.startSelection = ReactInputSelection.getSelection(root); - this.startValue = this.getText(); -} - -/** - * Get current text of input. - * - * @return {string} - */ -FallbackCompositionState.prototype.getText = function() { - return this.root.value || this.root[getTextContentAccessor()]; -}; - -/** - * Text that has changed since the start of composition. - * - * @return {string} - */ -FallbackCompositionState.prototype.getData = function() { - var endValue = this.getText(); - var prefixLength = this.startSelection.start; - var suffixLength = this.startValue.length - this.startSelection.end; - - return endValue.substr( - prefixLength, - endValue.length - suffixLength - prefixLength - ); -}; - -/** - * This plugin creates `onCompositionStart`, `onCompositionUpdate` and - * `onCompositionEnd` events on inputs, textareas and contentEditable - * nodes. - */ -var CompositionEventPlugin = { - - eventTypes: eventTypes, - - /** - * @param {string} topLevelType Record from `EventConstants`. - * @param {DOMEventTarget} topLevelTarget The listening component root node. - * @param {string} topLevelTargetID ID of `topLevelTarget`. - * @param {object} nativeEvent Native browser event. - * @return {*} An accumulation of synthetic events. - * @see {EventPluginHub.extractEvents} - */ - extractEvents: function( - topLevelType, - topLevelTarget, - topLevelTargetID, - nativeEvent) { - - var eventType; - var data; - - if (useCompositionEvent) { - eventType = getCompositionEventType(topLevelType); - } else if (!currentComposition) { - if (isFallbackStart(topLevelType, nativeEvent)) { - eventType = eventTypes.compositionStart; - } - } else if (isFallbackEnd(topLevelType, nativeEvent)) { - eventType = eventTypes.compositionEnd; - } - - if (useFallbackData) { - // The current composition is stored statically and must not be - // overwritten while composition continues. - if (!currentComposition && eventType === eventTypes.compositionStart) { - currentComposition = new FallbackCompositionState(topLevelTarget); - } else if (eventType === eventTypes.compositionEnd) { - if (currentComposition) { - data = currentComposition.getData(); - currentComposition = null; - } - } - } - - if (eventType) { - var event = SyntheticCompositionEvent.getPooled( - eventType, - topLevelTargetID, - nativeEvent - ); - if (data) { - // Inject data generated from fallback path into the synthetic event. - // This matches the property of native CompositionEventInterface. - event.data = data; - } - EventPropagators.accumulateTwoPhaseDispatches(event); - return event; - } - } -}; - -module.exports = CompositionEventPlugin; - -},{"./EventConstants":16,"./EventPropagators":21,"./ExecutionEnvironment":22,"./ReactInputSelection":59,"./SyntheticCompositionEvent":85,"./getTextContentAccessor":121,"./keyOf":133}],10:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule DOMChildrenOperations - * @typechecks static-only - */ - -"use strict"; - -var Danger = _dereq_("./Danger"); -var ReactMultiChildUpdateTypes = _dereq_("./ReactMultiChildUpdateTypes"); - -var getTextContentAccessor = _dereq_("./getTextContentAccessor"); -var invariant = _dereq_("./invariant"); - -/** - * The DOM property to use when setting text content. - * - * @type {string} - * @private - */ -var textContentAccessor = getTextContentAccessor(); - -/** - * Inserts `childNode` as a child of `parentNode` at the `index`. - * - * @param {DOMElement} parentNode Parent node in which to insert. - * @param {DOMElement} childNode Child node to insert. - * @param {number} index Index at which to insert the child. - * @internal - */ -function insertChildAt(parentNode, childNode, index) { - // By exploiting arrays returning `undefined` for an undefined index, we can - // rely exclusively on `insertBefore(node, null)` instead of also using - // `appendChild(node)`. However, using `undefined` is not allowed by all - // browsers so we must replace it with `null`. - parentNode.insertBefore( - childNode, - parentNode.childNodes[index] || null - ); -} - -var updateTextContent; -if (textContentAccessor === 'textContent') { - /** - * Sets the text content of `node` to `text`. - * - * @param {DOMElement} node Node to change - * @param {string} text New text content - */ - updateTextContent = function(node, text) { - node.textContent = text; - }; -} else { - /** - * Sets the text content of `node` to `text`. - * - * @param {DOMElement} node Node to change - * @param {string} text New text content - */ - updateTextContent = function(node, text) { - // In order to preserve newlines correctly, we can't use .innerText to set - // the contents (see #1080), so we empty the element then append a text node - while (node.firstChild) { - node.removeChild(node.firstChild); - } - if (text) { - var doc = node.ownerDocument || document; - node.appendChild(doc.createTextNode(text)); - } - }; -} - -/** - * Operations for updating with DOM children. - */ -var DOMChildrenOperations = { - - dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, - - updateTextContent: updateTextContent, - - /** - * Updates a component's children by processing a series of updates. The - * update configurations are each expected to have a `parentNode` property. - * - * @param {array} updates List of update configurations. - * @param {array} markupList List of markup strings. - * @internal - */ - processUpdates: function(updates, markupList) { - var update; - // Mapping from parent IDs to initial child orderings. - var initialChildren = null; - // List of children that will be moved or removed. - var updatedChildren = null; - - for (var i = 0; update = updates[i]; i++) { - if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || - update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) { - var updatedIndex = update.fromIndex; - var updatedChild = update.parentNode.childNodes[updatedIndex]; - var parentID = update.parentID; - - ("production" !== "development" ? invariant( - updatedChild, - 'processUpdates(): Unable to find child %s of element. This ' + - 'probably means the DOM was unexpectedly mutated (e.g., by the ' + - 'browser), usually due to forgetting a when using tables, ' + - 'nesting tags like
,

, or , or using non-SVG elements '+ - 'in an parent. Try inspecting the child nodes of the element ' + - 'with React ID `%s`.', - updatedIndex, - parentID - ) : invariant(updatedChild)); - - initialChildren = initialChildren || {}; - initialChildren[parentID] = initialChildren[parentID] || []; - initialChildren[parentID][updatedIndex] = updatedChild; - - updatedChildren = updatedChildren || []; - updatedChildren.push(updatedChild); - } - } - - var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); - - // Remove updated children first so that `toIndex` is consistent. - if (updatedChildren) { - for (var j = 0; j < updatedChildren.length; j++) { - updatedChildren[j].parentNode.removeChild(updatedChildren[j]); - } - } - - for (var k = 0; update = updates[k]; k++) { - switch (update.type) { - case ReactMultiChildUpdateTypes.INSERT_MARKUP: - insertChildAt( - update.parentNode, - renderedMarkup[update.markupIndex], - update.toIndex - ); - break; - case ReactMultiChildUpdateTypes.MOVE_EXISTING: - insertChildAt( - update.parentNode, - initialChildren[update.parentID][update.fromIndex], - update.toIndex - ); - break; - case ReactMultiChildUpdateTypes.TEXT_CONTENT: - updateTextContent( - update.parentNode, - update.textContent - ); - break; - case ReactMultiChildUpdateTypes.REMOVE_NODE: - // Already removed by the for-loop above. - break; - } - } - } - -}; - -module.exports = DOMChildrenOperations; - -},{"./Danger":13,"./ReactMultiChildUpdateTypes":65,"./getTextContentAccessor":121,"./invariant":126}],11:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule DOMProperty - * @typechecks static-only - */ - -/*jslint bitwise: true */ - -"use strict"; - -var invariant = _dereq_("./invariant"); - -function checkMask(value, bitmask) { - return (value & bitmask) === bitmask; -} - -var DOMPropertyInjection = { - /** - * Mapping from normalized, camelcased property names to a configuration that - * specifies how the associated DOM property should be accessed or rendered. - */ - MUST_USE_ATTRIBUTE: 0x1, - MUST_USE_PROPERTY: 0x2, - HAS_SIDE_EFFECTS: 0x4, - HAS_BOOLEAN_VALUE: 0x8, - HAS_NUMERIC_VALUE: 0x10, - HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10, - HAS_OVERLOADED_BOOLEAN_VALUE: 0x40, - - /** - * Inject some specialized knowledge about the DOM. This takes a config object - * with the following properties: - * - * isCustomAttribute: function that given an attribute name will return true - * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* - * attributes where it's impossible to enumerate all of the possible - * attribute names, - * - * Properties: object mapping DOM property name to one of the - * DOMPropertyInjection constants or null. If your attribute isn't in here, - * it won't get written to the DOM. - * - * DOMAttributeNames: object mapping React attribute name to the DOM - * attribute name. Attribute names not specified use the **lowercase** - * normalized name. - * - * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. - * Property names not specified use the normalized name. - * - * DOMMutationMethods: Properties that require special mutation methods. If - * `value` is undefined, the mutation method should unset the property. - * - * @param {object} domPropertyConfig the config as described above. - */ - injectDOMPropertyConfig: function(domPropertyConfig) { - var Properties = domPropertyConfig.Properties || {}; - var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; - var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; - var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; - - if (domPropertyConfig.isCustomAttribute) { - DOMProperty._isCustomAttributeFunctions.push( - domPropertyConfig.isCustomAttribute - ); - } - - for (var propName in Properties) { - ("production" !== "development" ? invariant( - !DOMProperty.isStandardName.hasOwnProperty(propName), - 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + - '\'%s\' which has already been injected. You may be accidentally ' + - 'injecting the same DOM property config twice, or you may be ' + - 'injecting two configs that have conflicting property names.', - propName - ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName))); - - DOMProperty.isStandardName[propName] = true; - - var lowerCased = propName.toLowerCase(); - DOMProperty.getPossibleStandardName[lowerCased] = propName; - - if (DOMAttributeNames.hasOwnProperty(propName)) { - var attributeName = DOMAttributeNames[propName]; - DOMProperty.getPossibleStandardName[attributeName] = propName; - DOMProperty.getAttributeName[propName] = attributeName; - } else { - DOMProperty.getAttributeName[propName] = lowerCased; - } - - DOMProperty.getPropertyName[propName] = - DOMPropertyNames.hasOwnProperty(propName) ? - DOMPropertyNames[propName] : - propName; - - if (DOMMutationMethods.hasOwnProperty(propName)) { - DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName]; - } else { - DOMProperty.getMutationMethod[propName] = null; - } - - var propConfig = Properties[propName]; - DOMProperty.mustUseAttribute[propName] = - checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE); - DOMProperty.mustUseProperty[propName] = - checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY); - DOMProperty.hasSideEffects[propName] = - checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS); - DOMProperty.hasBooleanValue[propName] = - checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE); - DOMProperty.hasNumericValue[propName] = - checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE); - DOMProperty.hasPositiveNumericValue[propName] = - checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE); - DOMProperty.hasOverloadedBooleanValue[propName] = - checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE); - - ("production" !== "development" ? invariant( - !DOMProperty.mustUseAttribute[propName] || - !DOMProperty.mustUseProperty[propName], - 'DOMProperty: Cannot require using both attribute and property: %s', - propName - ) : invariant(!DOMProperty.mustUseAttribute[propName] || - !DOMProperty.mustUseProperty[propName])); - ("production" !== "development" ? invariant( - DOMProperty.mustUseProperty[propName] || - !DOMProperty.hasSideEffects[propName], - 'DOMProperty: Properties that have side effects must use property: %s', - propName - ) : invariant(DOMProperty.mustUseProperty[propName] || - !DOMProperty.hasSideEffects[propName])); - ("production" !== "development" ? invariant( - !!DOMProperty.hasBooleanValue[propName] + - !!DOMProperty.hasNumericValue[propName] + - !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1, - 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + - 'numeric value, but not a combination: %s', - propName - ) : invariant(!!DOMProperty.hasBooleanValue[propName] + - !!DOMProperty.hasNumericValue[propName] + - !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1)); - } - } -}; -var defaultValueCache = {}; - -/** - * DOMProperty exports lookup objects that can be used like functions: - * - * > DOMProperty.isValid['id'] - * true - * > DOMProperty.isValid['foobar'] - * undefined - * - * Although this may be confusing, it performs better in general. - * - * @see http://jsperf.com/key-exists - * @see http://jsperf.com/key-missing - */ -var DOMProperty = { - - ID_ATTRIBUTE_NAME: 'data-reactid', - - /** - * Checks whether a property name is a standard property. - * @type {Object} - */ - isStandardName: {}, - - /** - * Mapping from lowercase property names to the properly cased version, used - * to warn in the case of missing properties. - * @type {Object} - */ - getPossibleStandardName: {}, - - /** - * Mapping from normalized names to attribute names that differ. Attribute - * names are used when rendering markup or with `*Attribute()`. - * @type {Object} - */ - getAttributeName: {}, - - /** - * Mapping from normalized names to properties on DOM node instances. - * (This includes properties that mutate due to external factors.) - * @type {Object} - */ - getPropertyName: {}, - - /** - * Mapping from normalized names to mutation methods. This will only exist if - * mutation cannot be set simply by the property or `setAttribute()`. - * @type {Object} - */ - getMutationMethod: {}, - - /** - * Whether the property must be accessed and mutated as an object property. - * @type {Object} - */ - mustUseAttribute: {}, - - /** - * Whether the property must be accessed and mutated using `*Attribute()`. - * (This includes anything that fails ` in `.) - * @type {Object} - */ - mustUseProperty: {}, - - /** - * Whether or not setting a value causes side effects such as triggering - * resources to be loaded or text selection changes. We must ensure that - * the value is only set if it has changed. - * @type {Object} - */ - hasSideEffects: {}, - - /** - * Whether the property should be removed when set to a falsey value. - * @type {Object} - */ - hasBooleanValue: {}, - - /** - * Whether the property must be numeric or parse as a - * numeric and should be removed when set to a falsey value. - * @type {Object} - */ - hasNumericValue: {}, - - /** - * Whether the property must be positive numeric or parse as a positive - * numeric and should be removed when set to a falsey value. - * @type {Object} - */ - hasPositiveNumericValue: {}, - - /** - * Whether the property can be used as a flag as well as with a value. Removed - * when strictly equal to false; present without a value when strictly equal - * to true; present with a value otherwise. - * @type {Object} - */ - hasOverloadedBooleanValue: {}, - - /** - * All of the isCustomAttribute() functions that have been injected. - */ - _isCustomAttributeFunctions: [], - - /** - * Checks whether a property name is a custom attribute. - * @method - */ - isCustomAttribute: function(attributeName) { - for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { - var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; - if (isCustomAttributeFn(attributeName)) { - return true; - } - } - return false; - }, - - /** - * Returns the default property value for a DOM property (i.e., not an - * attribute). Most default values are '' or false, but not all. Worse yet, - * some (in particular, `type`) vary depending on the type of element. - * - * TODO: Is it better to grab all the possible properties when creating an - * element to avoid having to create the same element twice? - */ - getDefaultValueForProperty: function(nodeName, prop) { - var nodeDefaults = defaultValueCache[nodeName]; - var testElement; - if (!nodeDefaults) { - defaultValueCache[nodeName] = nodeDefaults = {}; - } - if (!(prop in nodeDefaults)) { - testElement = document.createElement(nodeName); - nodeDefaults[prop] = testElement[prop]; - } - return nodeDefaults[prop]; - }, - - injection: DOMPropertyInjection -}; - -module.exports = DOMProperty; - -},{"./invariant":126}],12:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule DOMPropertyOperations - * @typechecks static-only - */ - -"use strict"; - -var DOMProperty = _dereq_("./DOMProperty"); - -var escapeTextForBrowser = _dereq_("./escapeTextForBrowser"); -var memoizeStringOnly = _dereq_("./memoizeStringOnly"); -var warning = _dereq_("./warning"); - -function shouldIgnoreValue(name, value) { - return value == null || - (DOMProperty.hasBooleanValue[name] && !value) || - (DOMProperty.hasNumericValue[name] && isNaN(value)) || - (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) || - (DOMProperty.hasOverloadedBooleanValue[name] && value === false); -} - -var processAttributeNameAndPrefix = memoizeStringOnly(function(name) { - return escapeTextForBrowser(name) + '="'; -}); - -if ("production" !== "development") { - var reactProps = { - children: true, - dangerouslySetInnerHTML: true, - key: true, - ref: true - }; - var warnedProperties = {}; - - var warnUnknownProperty = function(name) { - if (reactProps.hasOwnProperty(name) && reactProps[name] || - warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { - return; - } - - warnedProperties[name] = true; - var lowerCasedName = name.toLowerCase(); - - // data-* attributes should be lowercase; suggest the lowercase version - var standardName = ( - DOMProperty.isCustomAttribute(lowerCasedName) ? - lowerCasedName : - DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? - DOMProperty.getPossibleStandardName[lowerCasedName] : - null - ); - - // For now, only warn when we have a suggested correction. This prevents - // logging too much when using transferPropsTo. - ("production" !== "development" ? warning( - standardName == null, - 'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?' - ) : null); - - }; -} - -/** - * Operations for dealing with DOM properties. - */ -var DOMPropertyOperations = { - - /** - * Creates markup for the ID property. - * - * @param {string} id Unescaped ID. - * @return {string} Markup string. - */ - createMarkupForID: function(id) { - return processAttributeNameAndPrefix(DOMProperty.ID_ATTRIBUTE_NAME) + - escapeTextForBrowser(id) + '"'; - }, - - /** - * Creates markup for a property. - * - * @param {string} name - * @param {*} value - * @return {?string} Markup string, or null if the property was invalid. - */ - createMarkupForProperty: function(name, value) { - if (DOMProperty.isStandardName.hasOwnProperty(name) && - DOMProperty.isStandardName[name]) { - if (shouldIgnoreValue(name, value)) { - return ''; - } - var attributeName = DOMProperty.getAttributeName[name]; - if (DOMProperty.hasBooleanValue[name] || - (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) { - return escapeTextForBrowser(attributeName); - } - return processAttributeNameAndPrefix(attributeName) + - escapeTextForBrowser(value) + '"'; - } else if (DOMProperty.isCustomAttribute(name)) { - if (value == null) { - return ''; - } - return processAttributeNameAndPrefix(name) + - escapeTextForBrowser(value) + '"'; - } else if ("production" !== "development") { - warnUnknownProperty(name); - } - return null; - }, - - /** - * Sets the value for a property on a node. - * - * @param {DOMElement} node - * @param {string} name - * @param {*} value - */ - setValueForProperty: function(node, name, value) { - if (DOMProperty.isStandardName.hasOwnProperty(name) && - DOMProperty.isStandardName[name]) { - var mutationMethod = DOMProperty.getMutationMethod[name]; - if (mutationMethod) { - mutationMethod(node, value); - } else if (shouldIgnoreValue(name, value)) { - this.deleteValueForProperty(node, name); - } else if (DOMProperty.mustUseAttribute[name]) { - // `setAttribute` with objects becomes only `[object]` in IE8/9, - // ('' + value) makes it output the correct toString()-value. - node.setAttribute(DOMProperty.getAttributeName[name], '' + value); - } else { - var propName = DOMProperty.getPropertyName[name]; - // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the - // property type before comparing; only `value` does and is string. - if (!DOMProperty.hasSideEffects[name] || - ('' + node[propName]) !== ('' + value)) { - // Contrary to `setAttribute`, object properties are properly - // `toString`ed by IE8/9. - node[propName] = value; - } - } - } else if (DOMProperty.isCustomAttribute(name)) { - if (value == null) { - node.removeAttribute(name); - } else { - node.setAttribute(name, '' + value); - } - } else if ("production" !== "development") { - warnUnknownProperty(name); - } - }, - - /** - * Deletes the value for a property on a node. - * - * @param {DOMElement} node - * @param {string} name - */ - deleteValueForProperty: function(node, name) { - if (DOMProperty.isStandardName.hasOwnProperty(name) && - DOMProperty.isStandardName[name]) { - var mutationMethod = DOMProperty.getMutationMethod[name]; - if (mutationMethod) { - mutationMethod(node, undefined); - } else if (DOMProperty.mustUseAttribute[name]) { - node.removeAttribute(DOMProperty.getAttributeName[name]); - } else { - var propName = DOMProperty.getPropertyName[name]; - var defaultValue = DOMProperty.getDefaultValueForProperty( - node.nodeName, - propName - ); - if (!DOMProperty.hasSideEffects[name] || - ('' + node[propName]) !== defaultValue) { - node[propName] = defaultValue; - } - } - } else if (DOMProperty.isCustomAttribute(name)) { - node.removeAttribute(name); - } else if ("production" !== "development") { - warnUnknownProperty(name); - } - } - -}; - -module.exports = DOMPropertyOperations; - -},{"./DOMProperty":11,"./escapeTextForBrowser":109,"./memoizeStringOnly":135,"./warning":145}],13:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule Danger - * @typechecks static-only - */ - -/*jslint evil: true, sub: true */ - -"use strict"; - -var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); - -var createNodesFromMarkup = _dereq_("./createNodesFromMarkup"); -var emptyFunction = _dereq_("./emptyFunction"); -var getMarkupWrap = _dereq_("./getMarkupWrap"); -var invariant = _dereq_("./invariant"); - -var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; -var RESULT_INDEX_ATTR = 'data-danger-index'; - -/** - * Extracts the `nodeName` from a string of markup. - * - * NOTE: Extracting the `nodeName` does not require a regular expression match - * because we make assumptions about React-generated markup (i.e. there are no - * spaces surrounding the opening tag and there is at least one attribute). - * - * @param {string} markup String of markup. - * @return {string} Node name of the supplied markup. - * @see http://jsperf.com/extract-nodename - */ -function getNodeName(markup) { - return markup.substring(1, markup.indexOf(' ')); -} - -var Danger = { - - /** - * Renders markup into an array of nodes. The markup is expected to render - * into a list of root nodes. Also, the length of `resultList` and - * `markupList` should be the same. - * - * @param {array} markupList List of markup strings to render. - * @return {array} List of rendered nodes. - * @internal - */ - dangerouslyRenderMarkup: function(markupList) { - ("production" !== "development" ? invariant( - ExecutionEnvironment.canUseDOM, - 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + - 'thread. Make sure `window` and `document` are available globally ' + - 'before requiring React when unit testing or use ' + - 'React.renderToString for server rendering.' - ) : invariant(ExecutionEnvironment.canUseDOM)); - var nodeName; - var markupByNodeName = {}; - // Group markup by `nodeName` if a wrap is necessary, else by '*'. - for (var i = 0; i < markupList.length; i++) { - ("production" !== "development" ? invariant( - markupList[i], - 'dangerouslyRenderMarkup(...): Missing markup.' - ) : invariant(markupList[i])); - nodeName = getNodeName(markupList[i]); - nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; - markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; - markupByNodeName[nodeName][i] = markupList[i]; - } - var resultList = []; - var resultListAssignmentCount = 0; - for (nodeName in markupByNodeName) { - if (!markupByNodeName.hasOwnProperty(nodeName)) { - continue; - } - var markupListByNodeName = markupByNodeName[nodeName]; - - // This for-in loop skips the holes of the sparse array. The order of - // iteration should follow the order of assignment, which happens to match - // numerical index order, but we don't rely on that. - for (var resultIndex in markupListByNodeName) { - if (markupListByNodeName.hasOwnProperty(resultIndex)) { - var markup = markupListByNodeName[resultIndex]; - - // Push the requested markup with an additional RESULT_INDEX_ATTR - // attribute. If the markup does not start with a < character, it - // will be discarded below (with an appropriate console.error). - markupListByNodeName[resultIndex] = markup.replace( - OPEN_TAG_NAME_EXP, - // This index will be parsed back out below. - '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ' - ); - } - } - - // Render each group of markup with similar wrapping `nodeName`. - var renderNodes = createNodesFromMarkup( - markupListByNodeName.join(''), - emptyFunction // Do nothing special with

; - * } - * }); - * - * The class specification supports a specific protocol of methods that have - * special meaning (e.g. `render`). See `ReactCompositeComponentInterface` for - * more the comprehensive protocol. Any other properties and methods in the - * class specification will available on the prototype. - * - * @interface ReactCompositeComponentInterface - * @internal - */ -var ReactCompositeComponentInterface = { - - /** - * An array of Mixin objects to include when defining your component. - * - * @type {array} - * @optional - */ - mixins: SpecPolicy.DEFINE_MANY, - - /** - * An object containing properties and methods that should be defined on - * the component's constructor instead of its prototype (static methods). - * - * @type {object} - * @optional - */ - statics: SpecPolicy.DEFINE_MANY, - - /** - * Definition of prop types for this component. - * - * @type {object} - * @optional - */ - propTypes: SpecPolicy.DEFINE_MANY, - - /** - * Definition of context types for this component. - * - * @type {object} - * @optional - */ - contextTypes: SpecPolicy.DEFINE_MANY, - - /** - * Definition of context types this component sets for its children. - * - * @type {object} - * @optional - */ - childContextTypes: SpecPolicy.DEFINE_MANY, - - // ==== Definition methods ==== - - /** - * Invoked when the component is mounted. Values in the mapping will be set on - * `this.props` if that prop is not specified (i.e. using an `in` check). - * - * This method is invoked before `getInitialState` and therefore cannot rely - * on `this.state` or use `this.setState`. - * - * @return {object} - * @optional - */ - getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED, - - /** - * Invoked once before the component is mounted. The return value will be used - * as the initial value of `this.state`. - * - * getInitialState: function() { - * return { - * isOn: false, - * fooBaz: new BazFoo() - * } - * } - * - * @return {object} - * @optional - */ - getInitialState: SpecPolicy.DEFINE_MANY_MERGED, - - /** - * @return {object} - * @optional - */ - getChildContext: SpecPolicy.DEFINE_MANY_MERGED, - - /** - * Uses props from `this.props` and state from `this.state` to render the - * structure of the component. - * - * No guarantees are made about when or how often this method is invoked, so - * it must not have side effects. - * - * render: function() { - * var name = this.props.name; - * return
Hello, {name}!
; - * } - * - * @return {ReactComponent} - * @nosideeffects - * @required - */ - render: SpecPolicy.DEFINE_ONCE, - - - - // ==== Delegate methods ==== - - /** - * Invoked when the component is initially created and about to be mounted. - * This may have side effects, but any external subscriptions or data created - * by this method must be cleaned up in `componentWillUnmount`. - * - * @optional - */ - componentWillMount: SpecPolicy.DEFINE_MANY, - - /** - * Invoked when the component has been mounted and has a DOM representation. - * However, there is no guarantee that the DOM node is in the document. - * - * Use this as an opportunity to operate on the DOM when the component has - * been mounted (initialized and rendered) for the first time. - * - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidMount: SpecPolicy.DEFINE_MANY, - - /** - * Invoked before the component receives new props. - * - * Use this as an opportunity to react to a prop transition by updating the - * state using `this.setState`. Current props are accessed via `this.props`. - * - * componentWillReceiveProps: function(nextProps, nextContext) { - * this.setState({ - * likesIncreasing: nextProps.likeCount > this.props.likeCount - * }); - * } - * - * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop - * transition may cause a state change, but the opposite is not true. If you - * need it, you are probably looking for `componentWillUpdate`. - * - * @param {object} nextProps - * @optional - */ - componentWillReceiveProps: SpecPolicy.DEFINE_MANY, - - /** - * Invoked while deciding if the component should be updated as a result of - * receiving new props, state and/or context. - * - * Use this as an opportunity to `return false` when you're certain that the - * transition to the new props/state/context will not require a component - * update. - * - * shouldComponentUpdate: function(nextProps, nextState, nextContext) { - * return !equal(nextProps, this.props) || - * !equal(nextState, this.state) || - * !equal(nextContext, this.context); - * } - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @return {boolean} True if the component should update. - * @optional - */ - shouldComponentUpdate: SpecPolicy.DEFINE_ONCE, - - /** - * Invoked when the component is about to update due to a transition from - * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` - * and `nextContext`. - * - * Use this as an opportunity to perform preparation before an update occurs. - * - * NOTE: You **cannot** use `this.setState()` in this method. - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @param {ReactReconcileTransaction} transaction - * @optional - */ - componentWillUpdate: SpecPolicy.DEFINE_MANY, - - /** - * Invoked when the component's DOM representation has been updated. - * - * Use this as an opportunity to operate on the DOM when the component has - * been updated. - * - * @param {object} prevProps - * @param {?object} prevState - * @param {?object} prevContext - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidUpdate: SpecPolicy.DEFINE_MANY, - - /** - * Invoked when the component is about to be removed from its parent and have - * its DOM representation destroyed. - * - * Use this as an opportunity to deallocate any external resources. - * - * NOTE: There is no `componentDidUnmount` since your component will have been - * destroyed by that point. - * - * @optional - */ - componentWillUnmount: SpecPolicy.DEFINE_MANY, - - - - // ==== Advanced methods ==== - - /** - * Updates the component's currently mounted DOM representation. - * - * By default, this implements React's rendering and reconciliation algorithm. - * Sophisticated clients may wish to override this. - * - * @param {ReactReconcileTransaction} transaction - * @internal - * @overridable - */ - updateComponent: SpecPolicy.OVERRIDE_BASE - -}; - -/** - * Mapping from class specification keys to special processing functions. - * - * Although these are declared like instance properties in the specification - * when defining classes using `React.createClass`, they are actually static - * and are accessible on the constructor instead of the prototype. Despite - * being static, they must be defined outside of the "statics" key under - * which all other static methods are defined. - */ -var RESERVED_SPEC_KEYS = { - displayName: function(Constructor, displayName) { - Constructor.displayName = displayName; - }, - mixins: function(Constructor, mixins) { - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - mixSpecIntoComponent(Constructor, mixins[i]); - } - } - }, - childContextTypes: function(Constructor, childContextTypes) { - validateTypeDef( - Constructor, - childContextTypes, - ReactPropTypeLocations.childContext - ); - Constructor.childContextTypes = assign( - {}, - Constructor.childContextTypes, - childContextTypes - ); - }, - contextTypes: function(Constructor, contextTypes) { - validateTypeDef( - Constructor, - contextTypes, - ReactPropTypeLocations.context - ); - Constructor.contextTypes = assign( - {}, - Constructor.contextTypes, - contextTypes - ); - }, - /** - * Special case getDefaultProps which should move into statics but requires - * automatic merging. - */ - getDefaultProps: function(Constructor, getDefaultProps) { - if (Constructor.getDefaultProps) { - Constructor.getDefaultProps = createMergedResultFunction( - Constructor.getDefaultProps, - getDefaultProps - ); - } else { - Constructor.getDefaultProps = getDefaultProps; - } - }, - propTypes: function(Constructor, propTypes) { - validateTypeDef( - Constructor, - propTypes, - ReactPropTypeLocations.prop - ); - Constructor.propTypes = assign( - {}, - Constructor.propTypes, - propTypes - ); - }, - statics: function(Constructor, statics) { - mixStaticSpecIntoComponent(Constructor, statics); - } -}; - -function getDeclarationErrorAddendum(component) { - var owner = component._owner || null; - if (owner && owner.constructor && owner.constructor.displayName) { - return ' Check the render method of `' + owner.constructor.displayName + - '`.'; - } - return ''; -} - -function validateTypeDef(Constructor, typeDef, location) { - for (var propName in typeDef) { - if (typeDef.hasOwnProperty(propName)) { - ("production" !== "development" ? invariant( - typeof typeDef[propName] == 'function', - '%s: %s type `%s` is invalid; it must be a function, usually from ' + - 'React.PropTypes.', - Constructor.displayName || 'ReactCompositeComponent', - ReactPropTypeLocationNames[location], - propName - ) : invariant(typeof typeDef[propName] == 'function')); - } - } -} - -function validateMethodOverride(proto, name) { - var specPolicy = ReactCompositeComponentInterface.hasOwnProperty(name) ? - ReactCompositeComponentInterface[name] : - null; - - // Disallow overriding of base class methods unless explicitly allowed. - if (ReactCompositeComponentMixin.hasOwnProperty(name)) { - ("production" !== "development" ? invariant( - specPolicy === SpecPolicy.OVERRIDE_BASE, - 'ReactCompositeComponentInterface: You are attempting to override ' + - '`%s` from your class specification. Ensure that your method names ' + - 'do not overlap with React methods.', - name - ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE)); - } - - // Disallow defining methods more than once unless explicitly allowed. - if (proto.hasOwnProperty(name)) { - ("production" !== "development" ? invariant( - specPolicy === SpecPolicy.DEFINE_MANY || - specPolicy === SpecPolicy.DEFINE_MANY_MERGED, - 'ReactCompositeComponentInterface: You are attempting to define ' + - '`%s` on your component more than once. This conflict may be due ' + - 'to a mixin.', - name - ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY || - specPolicy === SpecPolicy.DEFINE_MANY_MERGED)); - } -} - -function validateLifeCycleOnReplaceState(instance) { - var compositeLifeCycleState = instance._compositeLifeCycleState; - ("production" !== "development" ? invariant( - instance.isMounted() || - compositeLifeCycleState === CompositeLifeCycle.MOUNTING, - 'replaceState(...): Can only update a mounted or mounting component.' - ) : invariant(instance.isMounted() || - compositeLifeCycleState === CompositeLifeCycle.MOUNTING)); - ("production" !== "development" ? invariant( - ReactCurrentOwner.current == null, - 'replaceState(...): Cannot update during an existing state transition ' + - '(such as within `render`). Render methods should be a pure function ' + - 'of props and state.' - ) : invariant(ReactCurrentOwner.current == null)); - ("production" !== "development" ? invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, - 'replaceState(...): Cannot update while unmounting component. This ' + - 'usually means you called setState() on an unmounted component.' - ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING)); -} - -/** - * Mixin helper which handles policy validation and reserved - * specification keys when building `ReactCompositeComponent` classses. - */ -function mixSpecIntoComponent(Constructor, spec) { - if (!spec) { - return; - } - - ("production" !== "development" ? invariant( - !ReactLegacyElement.isValidFactory(spec), - 'ReactCompositeComponent: You\'re attempting to ' + - 'use a component class as a mixin. Instead, just use a regular object.' - ) : invariant(!ReactLegacyElement.isValidFactory(spec))); - ("production" !== "development" ? invariant( - !ReactElement.isValidElement(spec), - 'ReactCompositeComponent: You\'re attempting to ' + - 'use a component as a mixin. Instead, just use a regular object.' - ) : invariant(!ReactElement.isValidElement(spec))); - - var proto = Constructor.prototype; - - // By handling mixins before any other properties, we ensure the same - // chaining order is applied to methods with DEFINE_MANY policy, whether - // mixins are listed before or after these methods in the spec. - if (spec.hasOwnProperty(MIXINS_KEY)) { - RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); - } - - for (var name in spec) { - if (!spec.hasOwnProperty(name)) { - continue; - } - - if (name === MIXINS_KEY) { - // We have already handled mixins in a special case above - continue; - } - - var property = spec[name]; - validateMethodOverride(proto, name); - - if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { - RESERVED_SPEC_KEYS[name](Constructor, property); - } else { - // Setup methods on prototype: - // The following member methods should not be automatically bound: - // 1. Expected ReactCompositeComponent methods (in the "interface"). - // 2. Overridden methods (that were mixed in). - var isCompositeComponentMethod = - ReactCompositeComponentInterface.hasOwnProperty(name); - var isAlreadyDefined = proto.hasOwnProperty(name); - var markedDontBind = property && property.__reactDontBind; - var isFunction = typeof property === 'function'; - var shouldAutoBind = - isFunction && - !isCompositeComponentMethod && - !isAlreadyDefined && - !markedDontBind; - - if (shouldAutoBind) { - if (!proto.__reactAutoBindMap) { - proto.__reactAutoBindMap = {}; - } - proto.__reactAutoBindMap[name] = property; - proto[name] = property; - } else { - if (isAlreadyDefined) { - var specPolicy = ReactCompositeComponentInterface[name]; - - // These cases should already be caught by validateMethodOverride - ("production" !== "development" ? invariant( - isCompositeComponentMethod && ( - specPolicy === SpecPolicy.DEFINE_MANY_MERGED || - specPolicy === SpecPolicy.DEFINE_MANY - ), - 'ReactCompositeComponent: Unexpected spec policy %s for key %s ' + - 'when mixing in component specs.', - specPolicy, - name - ) : invariant(isCompositeComponentMethod && ( - specPolicy === SpecPolicy.DEFINE_MANY_MERGED || - specPolicy === SpecPolicy.DEFINE_MANY - ))); - - // For methods which are defined more than once, call the existing - // methods before calling the new property, merging if appropriate. - if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) { - proto[name] = createMergedResultFunction(proto[name], property); - } else if (specPolicy === SpecPolicy.DEFINE_MANY) { - proto[name] = createChainedFunction(proto[name], property); - } - } else { - proto[name] = property; - if ("production" !== "development") { - // Add verbose displayName to the function, which helps when looking - // at profiling tools. - if (typeof property === 'function' && spec.displayName) { - proto[name].displayName = spec.displayName + '_' + name; - } - } - } - } - } - } -} - -function mixStaticSpecIntoComponent(Constructor, statics) { - if (!statics) { - return; - } - for (var name in statics) { - var property = statics[name]; - if (!statics.hasOwnProperty(name)) { - continue; - } - - var isReserved = name in RESERVED_SPEC_KEYS; - ("production" !== "development" ? invariant( - !isReserved, - 'ReactCompositeComponent: You are attempting to define a reserved ' + - 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + - 'as an instance property instead; it will still be accessible on the ' + - 'constructor.', - name - ) : invariant(!isReserved)); - - var isInherited = name in Constructor; - ("production" !== "development" ? invariant( - !isInherited, - 'ReactCompositeComponent: You are attempting to define ' + - '`%s` on your component more than once. This conflict may be ' + - 'due to a mixin.', - name - ) : invariant(!isInherited)); - Constructor[name] = property; - } -} - -/** - * Merge two objects, but throw if both contain the same key. - * - * @param {object} one The first object, which is mutated. - * @param {object} two The second object - * @return {object} one after it has been mutated to contain everything in two. - */ -function mergeObjectsWithNoDuplicateKeys(one, two) { - ("production" !== "development" ? invariant( - one && two && typeof one === 'object' && typeof two === 'object', - 'mergeObjectsWithNoDuplicateKeys(): Cannot merge non-objects' - ) : invariant(one && two && typeof one === 'object' && typeof two === 'object')); - - mapObject(two, function(value, key) { - ("production" !== "development" ? invariant( - one[key] === undefined, - 'mergeObjectsWithNoDuplicateKeys(): ' + - 'Tried to merge two objects with the same key: `%s`. This conflict ' + - 'may be due to a mixin; in particular, this may be caused by two ' + - 'getInitialState() or getDefaultProps() methods returning objects ' + - 'with clashing keys.', - key - ) : invariant(one[key] === undefined)); - one[key] = value; - }); - return one; -} - -/** - * Creates a function that invokes two functions and merges their return values. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ -function createMergedResultFunction(one, two) { - return function mergedResult() { - var a = one.apply(this, arguments); - var b = two.apply(this, arguments); - if (a == null) { - return b; - } else if (b == null) { - return a; - } - return mergeObjectsWithNoDuplicateKeys(a, b); - }; -} - -/** - * Creates a function that invokes two functions and ignores their return vales. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ -function createChainedFunction(one, two) { - return function chainedFunction() { - one.apply(this, arguments); - two.apply(this, arguments); - }; -} - -/** - * `ReactCompositeComponent` maintains an auxiliary life cycle state in - * `this._compositeLifeCycleState` (which can be null). - * - * This is different from the life cycle state maintained by `ReactComponent` in - * `this._lifeCycleState`. The following diagram shows how the states overlap in - * time. There are times when the CompositeLifeCycle is null - at those times it - * is only meaningful to look at ComponentLifeCycle alone. - * - * Top Row: ReactComponent.ComponentLifeCycle - * Low Row: ReactComponent.CompositeLifeCycle - * - * +-------+---------------------------------+--------+ - * | UN | MOUNTED | UN | - * |MOUNTED| | MOUNTED| - * +-------+---------------------------------+--------+ - * | ^--------+ +-------+ +--------^ | - * | | | | | | | | - * | 0--|MOUNTING|-0-|RECEIVE|-0-| UN |--->0 | - * | | | |PROPS | |MOUNTING| | - * | | | | | | | | - * | | | | | | | | - * | +--------+ +-------+ +--------+ | - * | | | | - * +-------+---------------------------------+--------+ - */ -var CompositeLifeCycle = keyMirror({ - /** - * Components in the process of being mounted respond to state changes - * differently. - */ - MOUNTING: null, - /** - * Components in the process of being unmounted are guarded against state - * changes. - */ - UNMOUNTING: null, - /** - * Components that are mounted and receiving new props respond to state - * changes differently. - */ - RECEIVING_PROPS: null -}); - -/** - * @lends {ReactCompositeComponent.prototype} - */ -var ReactCompositeComponentMixin = { - - /** - * Base constructor for all composite component. - * - * @param {ReactElement} element - * @final - * @internal - */ - construct: function(element) { - // Children can be either an array or more than one argument - ReactComponent.Mixin.construct.apply(this, arguments); - ReactOwner.Mixin.construct.apply(this, arguments); - - this.state = null; - this._pendingState = null; - - // This is the public post-processed context. The real context and pending - // context lives on the element. - this.context = null; - - this._compositeLifeCycleState = null; - }, - - /** - * Checks whether or not this composite component is mounted. - * @return {boolean} True if mounted, false otherwise. - * @protected - * @final - */ - isMounted: function() { - return ReactComponent.Mixin.isMounted.call(this) && - this._compositeLifeCycleState !== CompositeLifeCycle.MOUNTING; - }, - - /** - * Initializes the component, renders markup, and registers event listeners. - * - * @param {string} rootID DOM ID of the root node. - * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction - * @param {number} mountDepth number of components in the owner hierarchy - * @return {?string} Rendered markup to be inserted into the DOM. - * @final - * @internal - */ - mountComponent: ReactPerf.measure( - 'ReactCompositeComponent', - 'mountComponent', - function(rootID, transaction, mountDepth) { - ReactComponent.Mixin.mountComponent.call( - this, - rootID, - transaction, - mountDepth - ); - this._compositeLifeCycleState = CompositeLifeCycle.MOUNTING; - - if (this.__reactAutoBindMap) { - this._bindAutoBindMethods(); - } - - this.context = this._processContext(this._currentElement._context); - this.props = this._processProps(this.props); - - this.state = this.getInitialState ? this.getInitialState() : null; - ("production" !== "development" ? invariant( - typeof this.state === 'object' && !Array.isArray(this.state), - '%s.getInitialState(): must return an object or null', - this.constructor.displayName || 'ReactCompositeComponent' - ) : invariant(typeof this.state === 'object' && !Array.isArray(this.state))); - - this._pendingState = null; - this._pendingForceUpdate = false; - - if (this.componentWillMount) { - this.componentWillMount(); - // When mounting, calls to `setState` by `componentWillMount` will set - // `this._pendingState` without triggering a re-render. - if (this._pendingState) { - this.state = this._pendingState; - this._pendingState = null; - } - } - - this._renderedComponent = instantiateReactComponent( - this._renderValidatedComponent(), - this._currentElement.type // The wrapping type - ); - - // Done with mounting, `setState` will now trigger UI changes. - this._compositeLifeCycleState = null; - var markup = this._renderedComponent.mountComponent( - rootID, - transaction, - mountDepth + 1 - ); - if (this.componentDidMount) { - transaction.getReactMountReady().enqueue(this.componentDidMount, this); - } - return markup; - } - ), - - /** - * Releases any resources allocated by `mountComponent`. - * - * @final - * @internal - */ - unmountComponent: function() { - this._compositeLifeCycleState = CompositeLifeCycle.UNMOUNTING; - if (this.componentWillUnmount) { - this.componentWillUnmount(); - } - this._compositeLifeCycleState = null; - - this._renderedComponent.unmountComponent(); - this._renderedComponent = null; - - ReactComponent.Mixin.unmountComponent.call(this); - - // Some existing components rely on this.props even after they've been - // destroyed (in event handlers). - // TODO: this.props = null; - // TODO: this.state = null; - }, - - /** - * Sets a subset of the state. Always use this or `replaceState` to mutate - * state. You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * There is no guarantee that calls to `setState` will run synchronously, - * as they may eventually be batched together. You can provide an optional - * callback that will be executed when the call to setState is actually - * completed. - * - * @param {object} partialState Next partial state to be merged with state. - * @param {?function} callback Called after state is updated. - * @final - * @protected - */ - setState: function(partialState, callback) { - ("production" !== "development" ? invariant( - typeof partialState === 'object' || partialState == null, - 'setState(...): takes an object of state variables to update.' - ) : invariant(typeof partialState === 'object' || partialState == null)); - if ("production" !== "development"){ - ("production" !== "development" ? warning( - partialState != null, - 'setState(...): You passed an undefined or null state object; ' + - 'instead, use forceUpdate().' - ) : null); - } - // Merge with `_pendingState` if it exists, otherwise with existing state. - this.replaceState( - assign({}, this._pendingState || this.state, partialState), - callback - ); - }, - - /** - * Replaces all of the state. Always use this or `setState` to mutate state. - * You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * @param {object} completeState Next state. - * @param {?function} callback Called after state is updated. - * @final - * @protected - */ - replaceState: function(completeState, callback) { - validateLifeCycleOnReplaceState(this); - this._pendingState = completeState; - if (this._compositeLifeCycleState !== CompositeLifeCycle.MOUNTING) { - // If we're in a componentWillMount handler, don't enqueue a rerender - // because ReactUpdates assumes we're in a browser context (which is wrong - // for server rendering) and we're about to do a render anyway. - // TODO: The callback here is ignored when setState is called from - // componentWillMount. Either fix it or disallow doing so completely in - // favor of getInitialState. - ReactUpdates.enqueueUpdate(this, callback); - } - }, - - /** - * Filters the context object to only contain keys specified in - * `contextTypes`, and asserts that they are valid. - * - * @param {object} context - * @return {?object} - * @private - */ - _processContext: function(context) { - var maskedContext = null; - var contextTypes = this.constructor.contextTypes; - if (contextTypes) { - maskedContext = {}; - for (var contextName in contextTypes) { - maskedContext[contextName] = context[contextName]; - } - if ("production" !== "development") { - this._checkPropTypes( - contextTypes, - maskedContext, - ReactPropTypeLocations.context - ); - } - } - return maskedContext; - }, - - /** - * @param {object} currentContext - * @return {object} - * @private - */ - _processChildContext: function(currentContext) { - var childContext = this.getChildContext && this.getChildContext(); - var displayName = this.constructor.displayName || 'ReactCompositeComponent'; - if (childContext) { - ("production" !== "development" ? invariant( - typeof this.constructor.childContextTypes === 'object', - '%s.getChildContext(): childContextTypes must be defined in order to ' + - 'use getChildContext().', - displayName - ) : invariant(typeof this.constructor.childContextTypes === 'object')); - if ("production" !== "development") { - this._checkPropTypes( - this.constructor.childContextTypes, - childContext, - ReactPropTypeLocations.childContext - ); - } - for (var name in childContext) { - ("production" !== "development" ? invariant( - name in this.constructor.childContextTypes, - '%s.getChildContext(): key "%s" is not defined in childContextTypes.', - displayName, - name - ) : invariant(name in this.constructor.childContextTypes)); - } - return assign({}, currentContext, childContext); - } - return currentContext; - }, - - /** - * Processes props by setting default values for unspecified props and - * asserting that the props are valid. Does not mutate its argument; returns - * a new props object with defaults merged in. - * - * @param {object} newProps - * @return {object} - * @private - */ - _processProps: function(newProps) { - if ("production" !== "development") { - var propTypes = this.constructor.propTypes; - if (propTypes) { - this._checkPropTypes(propTypes, newProps, ReactPropTypeLocations.prop); - } - } - return newProps; - }, - - /** - * Assert that the props are valid - * - * @param {object} propTypes Map of prop name to a ReactPropType - * @param {object} props - * @param {string} location e.g. "prop", "context", "child context" - * @private - */ - _checkPropTypes: function(propTypes, props, location) { - // TODO: Stop validating prop types here and only use the element - // validation. - var componentName = this.constructor.displayName; - for (var propName in propTypes) { - if (propTypes.hasOwnProperty(propName)) { - var error = - propTypes[propName](props, propName, componentName, location); - if (error instanceof Error) { - // We may want to extend this logic for similar errors in - // renderComponent calls, so I'm abstracting it away into - // a function to minimize refactoring in the future - var addendum = getDeclarationErrorAddendum(this); - ("production" !== "development" ? warning(false, error.message + addendum) : null); - } - } - } - }, - - /** - * If any of `_pendingElement`, `_pendingState`, or `_pendingForceUpdate` - * is set, update the component. - * - * @param {ReactReconcileTransaction} transaction - * @internal - */ - performUpdateIfNecessary: function(transaction) { - var compositeLifeCycleState = this._compositeLifeCycleState; - // Do not trigger a state transition if we are in the middle of mounting or - // receiving props because both of those will already be doing this. - if (compositeLifeCycleState === CompositeLifeCycle.MOUNTING || - compositeLifeCycleState === CompositeLifeCycle.RECEIVING_PROPS) { - return; - } - - if (this._pendingElement == null && - this._pendingState == null && - !this._pendingForceUpdate) { - return; - } - - var nextContext = this.context; - var nextProps = this.props; - var nextElement = this._currentElement; - if (this._pendingElement != null) { - nextElement = this._pendingElement; - nextContext = this._processContext(nextElement._context); - nextProps = this._processProps(nextElement.props); - this._pendingElement = null; - - this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_PROPS; - if (this.componentWillReceiveProps) { - this.componentWillReceiveProps(nextProps, nextContext); - } - } - - this._compositeLifeCycleState = null; - - var nextState = this._pendingState || this.state; - this._pendingState = null; - - var shouldUpdate = - this._pendingForceUpdate || - !this.shouldComponentUpdate || - this.shouldComponentUpdate(nextProps, nextState, nextContext); - - if ("production" !== "development") { - if (typeof shouldUpdate === "undefined") { - console.warn( - (this.constructor.displayName || 'ReactCompositeComponent') + - '.shouldComponentUpdate(): Returned undefined instead of a ' + - 'boolean value. Make sure to return true or false.' - ); - } - } - - if (shouldUpdate) { - this._pendingForceUpdate = false; - // Will set `this.props`, `this.state` and `this.context`. - this._performComponentUpdate( - nextElement, - nextProps, - nextState, - nextContext, - transaction - ); - } else { - // If it's determined that a component should not update, we still want - // to set props and state. - this._currentElement = nextElement; - this.props = nextProps; - this.state = nextState; - this.context = nextContext; - - // Owner cannot change because shouldUpdateReactComponent doesn't allow - // it. TODO: Remove this._owner completely. - this._owner = nextElement._owner; - } - }, - - /** - * Merges new props and state, notifies delegate methods of update and - * performs update. - * - * @param {ReactElement} nextElement Next element - * @param {object} nextProps Next public object to set as properties. - * @param {?object} nextState Next object to set as state. - * @param {?object} nextContext Next public object to set as context. - * @param {ReactReconcileTransaction} transaction - * @private - */ - _performComponentUpdate: function( - nextElement, - nextProps, - nextState, - nextContext, - transaction - ) { - var prevElement = this._currentElement; - var prevProps = this.props; - var prevState = this.state; - var prevContext = this.context; - - if (this.componentWillUpdate) { - this.componentWillUpdate(nextProps, nextState, nextContext); - } - - this._currentElement = nextElement; - this.props = nextProps; - this.state = nextState; - this.context = nextContext; - - // Owner cannot change because shouldUpdateReactComponent doesn't allow - // it. TODO: Remove this._owner completely. - this._owner = nextElement._owner; - - this.updateComponent( - transaction, - prevElement - ); - - if (this.componentDidUpdate) { - transaction.getReactMountReady().enqueue( - this.componentDidUpdate.bind(this, prevProps, prevState, prevContext), - this - ); - } - }, - - receiveComponent: function(nextElement, transaction) { - if (nextElement === this._currentElement && - nextElement._owner != null) { - // Since elements are immutable after the owner is rendered, - // we can do a cheap identity compare here to determine if this is a - // superfluous reconcile. It's possible for state to be mutable but such - // change should trigger an update of the owner which would recreate - // the element. We explicitly check for the existence of an owner since - // it's possible for a element created outside a composite to be - // deeply mutated and reused. - return; - } - - ReactComponent.Mixin.receiveComponent.call( - this, - nextElement, - transaction - ); - }, - - /** - * Updates the component's currently mounted DOM representation. - * - * By default, this implements React's rendering and reconciliation algorithm. - * Sophisticated clients may wish to override this. - * - * @param {ReactReconcileTransaction} transaction - * @param {ReactElement} prevElement - * @internal - * @overridable - */ - updateComponent: ReactPerf.measure( - 'ReactCompositeComponent', - 'updateComponent', - function(transaction, prevParentElement) { - ReactComponent.Mixin.updateComponent.call( - this, - transaction, - prevParentElement - ); - - var prevComponentInstance = this._renderedComponent; - var prevElement = prevComponentInstance._currentElement; - var nextElement = this._renderValidatedComponent(); - if (shouldUpdateReactComponent(prevElement, nextElement)) { - prevComponentInstance.receiveComponent(nextElement, transaction); - } else { - // These two IDs are actually the same! But nothing should rely on that. - var thisID = this._rootNodeID; - var prevComponentID = prevComponentInstance._rootNodeID; - prevComponentInstance.unmountComponent(); - this._renderedComponent = instantiateReactComponent( - nextElement, - this._currentElement.type - ); - var nextMarkup = this._renderedComponent.mountComponent( - thisID, - transaction, - this._mountDepth + 1 - ); - ReactComponent.BackendIDOperations.dangerouslyReplaceNodeWithMarkupByID( - prevComponentID, - nextMarkup - ); - } - } - ), - - /** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldUpdateComponent`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {?function} callback Called after update is complete. - * @final - * @protected - */ - forceUpdate: function(callback) { - var compositeLifeCycleState = this._compositeLifeCycleState; - ("production" !== "development" ? invariant( - this.isMounted() || - compositeLifeCycleState === CompositeLifeCycle.MOUNTING, - 'forceUpdate(...): Can only force an update on mounted or mounting ' + - 'components.' - ) : invariant(this.isMounted() || - compositeLifeCycleState === CompositeLifeCycle.MOUNTING)); - ("production" !== "development" ? invariant( - compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING && - ReactCurrentOwner.current == null, - 'forceUpdate(...): Cannot force an update while unmounting component ' + - 'or within a `render` function.' - ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING && - ReactCurrentOwner.current == null)); - this._pendingForceUpdate = true; - ReactUpdates.enqueueUpdate(this, callback); - }, - - /** - * @private - */ - _renderValidatedComponent: ReactPerf.measure( - 'ReactCompositeComponent', - '_renderValidatedComponent', - function() { - var renderedComponent; - var previousContext = ReactContext.current; - ReactContext.current = this._processChildContext( - this._currentElement._context - ); - ReactCurrentOwner.current = this; - try { - renderedComponent = this.render(); - if (renderedComponent === null || renderedComponent === false) { - renderedComponent = ReactEmptyComponent.getEmptyComponent(); - ReactEmptyComponent.registerNullComponentID(this._rootNodeID); - } else { - ReactEmptyComponent.deregisterNullComponentID(this._rootNodeID); - } - } finally { - ReactContext.current = previousContext; - ReactCurrentOwner.current = null; - } - ("production" !== "development" ? invariant( - ReactElement.isValidElement(renderedComponent), - '%s.render(): A valid ReactComponent must be returned. You may have ' + - 'returned undefined, an array or some other invalid object.', - this.constructor.displayName || 'ReactCompositeComponent' - ) : invariant(ReactElement.isValidElement(renderedComponent))); - return renderedComponent; - } - ), - - /** - * @private - */ - _bindAutoBindMethods: function() { - for (var autoBindKey in this.__reactAutoBindMap) { - if (!this.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { - continue; - } - var method = this.__reactAutoBindMap[autoBindKey]; - this[autoBindKey] = this._bindAutoBindMethod(ReactErrorUtils.guard( - method, - this.constructor.displayName + '.' + autoBindKey - )); - } - }, - - /** - * Binds a method to the component. - * - * @param {function} method Method to be bound. - * @private - */ - _bindAutoBindMethod: function(method) { - var component = this; - var boundMethod = method.bind(component); - if ("production" !== "development") { - boundMethod.__reactBoundContext = component; - boundMethod.__reactBoundMethod = method; - boundMethod.__reactBoundArguments = null; - var componentName = component.constructor.displayName; - var _bind = boundMethod.bind; - boundMethod.bind = function(newThis ) {var args=Array.prototype.slice.call(arguments,1); - // User is trying to bind() an autobound method; we effectively will - // ignore the value of "this" that the user is trying to use, so - // let's warn. - if (newThis !== component && newThis !== null) { - monitorCodeUse('react_bind_warning', { component: componentName }); - console.warn( - 'bind(): React component methods may only be bound to the ' + - 'component instance. See ' + componentName - ); - } else if (!args.length) { - monitorCodeUse('react_bind_warning', { component: componentName }); - console.warn( - 'bind(): You are binding a component method to the component. ' + - 'React does this for you automatically in a high-performance ' + - 'way, so you can safely remove this call. See ' + componentName - ); - return boundMethod; - } - var reboundMethod = _bind.apply(boundMethod, arguments); - reboundMethod.__reactBoundContext = component; - reboundMethod.__reactBoundMethod = method; - reboundMethod.__reactBoundArguments = args; - return reboundMethod; - }; - } - return boundMethod; - } -}; - -var ReactCompositeComponentBase = function() {}; -assign( - ReactCompositeComponentBase.prototype, - ReactComponent.Mixin, - ReactOwner.Mixin, - ReactPropTransferer.Mixin, - ReactCompositeComponentMixin -); - -/** - * Module for creating composite components. - * - * @class ReactCompositeComponent - * @extends ReactComponent - * @extends ReactOwner - * @extends ReactPropTransferer - */ -var ReactCompositeComponent = { - - LifeCycle: CompositeLifeCycle, - - Base: ReactCompositeComponentBase, - - /** - * Creates a composite component class given a class specification. - * - * @param {object} spec Class specification (which must define `render`). - * @return {function} Component constructor function. - * @public - */ - createClass: function(spec) { - var Constructor = function(props) { - // This constructor is overridden by mocks. The argument is used - // by mocks to assert on what gets mounted. This will later be used - // by the stand-alone class implementation. - }; - Constructor.prototype = new ReactCompositeComponentBase(); - Constructor.prototype.constructor = Constructor; - - injectedMixins.forEach( - mixSpecIntoComponent.bind(null, Constructor) - ); - - mixSpecIntoComponent(Constructor, spec); - - // Initialize the defaultProps property after all mixins have been merged - if (Constructor.getDefaultProps) { - Constructor.defaultProps = Constructor.getDefaultProps(); - } - - ("production" !== "development" ? invariant( - Constructor.prototype.render, - 'createClass(...): Class specification must implement a `render` method.' - ) : invariant(Constructor.prototype.render)); - - if ("production" !== "development") { - if (Constructor.prototype.componentShouldUpdate) { - monitorCodeUse( - 'react_component_should_update_warning', - { component: spec.displayName } - ); - console.warn( - (spec.displayName || 'A component') + ' has a method called ' + - 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + - 'The name is phrased as a question because the function is ' + - 'expected to return a value.' - ); - } - } - - // Reduce time spent doing lookups by setting these on the prototype. - for (var methodName in ReactCompositeComponentInterface) { - if (!Constructor.prototype[methodName]) { - Constructor.prototype[methodName] = null; - } - } - - if ("production" !== "development") { - return ReactLegacyElement.wrapFactory( - ReactElementValidator.createFactory(Constructor) - ); - } - return ReactLegacyElement.wrapFactory( - ReactElement.createFactory(Constructor) - ); - }, - - injection: { - injectMixin: function(mixin) { - injectedMixins.push(mixin); - } - } -}; - -module.exports = ReactCompositeComponent; - -},{"./Object.assign":27,"./ReactComponent":32,"./ReactContext":35,"./ReactCurrentOwner":36,"./ReactElement":52,"./ReactElementValidator":53,"./ReactEmptyComponent":54,"./ReactErrorUtils":55,"./ReactLegacyElement":61,"./ReactOwner":67,"./ReactPerf":68,"./ReactPropTransferer":69,"./ReactPropTypeLocationNames":70,"./ReactPropTypeLocations":71,"./ReactUpdates":79,"./instantiateReactComponent":125,"./invariant":126,"./keyMirror":132,"./keyOf":133,"./mapObject":134,"./monitorCodeUse":136,"./shouldUpdateReactComponent":142,"./warning":145}],35:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactContext - */ - -"use strict"; - -var assign = _dereq_("./Object.assign"); - -/** - * Keeps track of the current context. - * - * The context is automatically passed down the component ownership hierarchy - * and is accessible via `this.context` on ReactCompositeComponents. - */ -var ReactContext = { - - /** - * @internal - * @type {object} - */ - current: {}, - - /** - * Temporarily extends the current context while executing scopedCallback. - * - * A typical use case might look like - * - * render: function() { - * var children = ReactContext.withContext({foo: 'foo'}, () => ( - * - * )); - * return
{children}
; - * } - * - * @param {object} newContext New context to merge into the existing context - * @param {function} scopedCallback Callback to run with the new context - * @return {ReactComponent|array} - */ - withContext: function(newContext, scopedCallback) { - var result; - var previousContext = ReactContext.current; - ReactContext.current = assign({}, previousContext, newContext); - try { - result = scopedCallback(); - } finally { - ReactContext.current = previousContext; - } - return result; - } - -}; - -module.exports = ReactContext; - -},{"./Object.assign":27}],36:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactCurrentOwner - */ - -"use strict"; - -/** - * Keeps track of the current owner. - * - * The current owner is the component who should own any components that are - * currently being constructed. - * - * The depth indicate how many composite components are above this render level. - */ -var ReactCurrentOwner = { - - /** - * @internal - * @type {ReactComponent} - */ - current: null - -}; - -module.exports = ReactCurrentOwner; - -},{}],37:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactDOM - * @typechecks static-only - */ - -"use strict"; - -var ReactElement = _dereq_("./ReactElement"); -var ReactElementValidator = _dereq_("./ReactElementValidator"); -var ReactLegacyElement = _dereq_("./ReactLegacyElement"); - -var mapObject = _dereq_("./mapObject"); - -/** - * Create a factory that creates HTML tag elements. - * - * @param {string} tag Tag name (e.g. `div`). - * @private - */ -function createDOMFactory(tag) { - if ("production" !== "development") { - return ReactLegacyElement.markNonLegacyFactory( - ReactElementValidator.createFactory(tag) - ); - } - return ReactLegacyElement.markNonLegacyFactory( - ReactElement.createFactory(tag) - ); -} - -/** - * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. - * This is also accessible via `React.DOM`. - * - * @public - */ -var ReactDOM = mapObject({ - a: 'a', - abbr: 'abbr', - address: 'address', - area: 'area', - article: 'article', - aside: 'aside', - audio: 'audio', - b: 'b', - base: 'base', - bdi: 'bdi', - bdo: 'bdo', - big: 'big', - blockquote: 'blockquote', - body: 'body', - br: 'br', - button: 'button', - canvas: 'canvas', - caption: 'caption', - cite: 'cite', - code: 'code', - col: 'col', - colgroup: 'colgroup', - data: 'data', - datalist: 'datalist', - dd: 'dd', - del: 'del', - details: 'details', - dfn: 'dfn', - dialog: 'dialog', - div: 'div', - dl: 'dl', - dt: 'dt', - em: 'em', - embed: 'embed', - fieldset: 'fieldset', - figcaption: 'figcaption', - figure: 'figure', - footer: 'footer', - form: 'form', - h1: 'h1', - h2: 'h2', - h3: 'h3', - h4: 'h4', - h5: 'h5', - h6: 'h6', - head: 'head', - header: 'header', - hr: 'hr', - html: 'html', - i: 'i', - iframe: 'iframe', - img: 'img', - input: 'input', - ins: 'ins', - kbd: 'kbd', - keygen: 'keygen', - label: 'label', - legend: 'legend', - li: 'li', - link: 'link', - main: 'main', - map: 'map', - mark: 'mark', - menu: 'menu', - menuitem: 'menuitem', - meta: 'meta', - meter: 'meter', - nav: 'nav', - noscript: 'noscript', - object: 'object', - ol: 'ol', - optgroup: 'optgroup', - option: 'option', - output: 'output', - p: 'p', - param: 'param', - picture: 'picture', - pre: 'pre', - progress: 'progress', - q: 'q', - rp: 'rp', - rt: 'rt', - ruby: 'ruby', - s: 's', - samp: 'samp', - script: 'script', - section: 'section', - select: 'select', - small: 'small', - source: 'source', - span: 'span', - strong: 'strong', - style: 'style', - sub: 'sub', - summary: 'summary', - sup: 'sup', - table: 'table', - tbody: 'tbody', - td: 'td', - textarea: 'textarea', - tfoot: 'tfoot', - th: 'th', - thead: 'thead', - time: 'time', - title: 'title', - tr: 'tr', - track: 'track', - u: 'u', - ul: 'ul', - 'var': 'var', - video: 'video', - wbr: 'wbr', - - // SVG - circle: 'circle', - defs: 'defs', - ellipse: 'ellipse', - g: 'g', - line: 'line', - linearGradient: 'linearGradient', - mask: 'mask', - path: 'path', - pattern: 'pattern', - polygon: 'polygon', - polyline: 'polyline', - radialGradient: 'radialGradient', - rect: 'rect', - stop: 'stop', - svg: 'svg', - text: 'text', - tspan: 'tspan' - -}, createDOMFactory); - -module.exports = ReactDOM; - -},{"./ReactElement":52,"./ReactElementValidator":53,"./ReactLegacyElement":61,"./mapObject":134}],38:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactDOMButton - */ - -"use strict"; - -var AutoFocusMixin = _dereq_("./AutoFocusMixin"); -var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); -var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); -var ReactElement = _dereq_("./ReactElement"); -var ReactDOM = _dereq_("./ReactDOM"); - -var keyMirror = _dereq_("./keyMirror"); - -// Store a reference to the