├── .gitattributes ├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── misc.xml └── modules.xml ├── CHANGELOG.md ├── DEVELOPING.md ├── LICENSE ├── README.md ├── docs └── react-css-modules-webstorm-demo.gif ├── react-css-modules-intellij-plugin.iml ├── resources ├── META-INF │ └── plugin.xml └── intentionDescriptions │ └── CssModulesCreateClassIntention │ └── description.html ├── src ├── main │ └── com │ │ └── intellij │ │ └── react │ │ └── css │ │ └── modules │ │ ├── ide │ │ ├── annotator │ │ │ └── CssModulesClassAnnotator.java │ │ ├── completion │ │ │ ├── CssModulesClassNameCompletionConfidence.java │ │ │ └── CssModulesClassNameCompletionContributor.java │ │ └── intentions │ │ │ └── CssModulesCreateClassIntention.java │ │ └── psi │ │ ├── CssModulesIndexedStylesVarPsiReferenceContributor.java │ │ ├── CssModulesStyleNameAttributePsiReferenceContributor.java │ │ ├── CssModulesUnknownClassPsiReference.java │ │ └── CssModulesUtil.java └── test │ └── com │ └── intellij │ └── react │ └── css │ └── modules │ └── CssModulesCodeInsightTest.java └── test-resources └── testData ├── Annotations.css ├── CompletionComposesClassName.css ├── CompletionComposesClassNameMultiple.css ├── CompletionComposesClassNameSemiColon.css ├── CompletionComposesProperty.css ├── Component.css ├── Component.jsx ├── ComponentAnnotations.jsx ├── ComponentEs6Import.jsx ├── ComponentEs6ImportStyleName.jsx ├── ComponentFindUsages.css ├── ComponentFindUsages.jsx ├── ComponentNor.jsx ├── ComponentNormalErr.jsx ├── ComponentStringLiteral.jsx ├── ComponentStringLiteralNor.jsx ├── ComponentTypeScript.tsx ├── ComponentTypeScriptAnnotations.tsx ├── ComponentTypeScriptStringLiteral.tsx ├── react.d.ts └── tsconfig.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # plugin output 4 | out 5 | react-css-modules-intellij-plugin.jar 6 | 7 | # Mobile Tools for Java (J2ME) 8 | .mtj.tmp/ 9 | 10 | # Package Files # 11 | *.jar 12 | *.war 13 | *.ear 14 | 15 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 16 | hs_err_pid* 17 | 18 | # ========================= 19 | # Operating System Files 20 | # ========================= 21 | 22 | # OSX 23 | # ========================= 24 | 25 | .DS_Store 26 | .AppleDouble 27 | .LSOverride 28 | 29 | # Thumbnails 30 | ._* 31 | 32 | # Files that might appear in the root of a volume 33 | .DocumentRevisions-V100 34 | .fseventsd 35 | .Spotlight-V100 36 | .TemporaryItems 37 | .Trashes 38 | .VolumeIcon.icns 39 | 40 | # Directories potentially created on remote AFP share 41 | .AppleDB 42 | .AppleDesktop 43 | Network Trash Folder 44 | Temporary Items 45 | .apdisk 46 | 47 | # Windows 48 | # ========================= 49 | 50 | # Windows image file caches 51 | Thumbs.db 52 | ehthumbs.db 53 | 54 | # Folder config file 55 | Desktop.ini 56 | 57 | # Recycle Bin used on file shares 58 | $RECYCLE.BIN/ 59 | 60 | # Windows Installer files 61 | *.cab 62 | *.msi 63 | *.msm 64 | *.msp 65 | 66 | # Windows shortcuts 67 | *.lnk 68 | .idea/dictionaries/* 69 | .idea/workspace.xml 70 | .idea/uiDesigner.xml 71 | .idea/vcs.xml 72 | .idea/pure-run-config-templates.xml 73 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## v1.0.1 (2016-12-03) 2 | 3 | Fixes: 4 | 5 | - Support for ES6 import (#2) 6 | 7 | 8 | ## v1.0 (2016-11-25) 9 | 10 | Features: 11 | 12 | - Initial release. 13 | -------------------------------------------------------------------------------- /DEVELOPING.md: -------------------------------------------------------------------------------- 1 | # Developing 2 | 3 | ## Setting up the Plugin SDK 4 | - Add all jars in `/plugins/JavaScriptLanguage` 5 | - Add all jars in `/plugins/JavaScriptDebugger/lib` 6 | - Add the css.jar in `/plugins/CSS/lib` 7 | - Add the NodeNS.jar in `/.IntelliJIdea/config/plugins/NodeJS/lib` 8 | 9 | ## Setting up Intellij Community (OpenApi) sources: 10 | - https://github.com/JetBrains/intellij-plugins/tree/master/Dart -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-present, Jim Kynde Meyer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React CSS Modules IntelliJ Plugin 2 | 3 | React CSS Modules support for components written in JavaScript and TypeScript. 4 | 5 | It provides the following features in IntelliJ IDEA, WebStorm, RubyMine, PhpStorm, and PyCharm: 6 | 7 | - Completion and error highlighting for require'd CSS classes used in React `styleName` attributes 8 | - Completion and error highlighting for require'd CSS classes used in styles string literals, e.g. `styles['my-class']` 9 | - Intention to create missing CSS class from usage in React 10 | - Integrates React references to CSS class names with 'Find Usages', 'Rename', and 'Go to Declaration' 11 | 12 | ## Features demo 13 | 14 | **Completion, error highlighting, find usages** 15 | ![](docs/react-css-modules-webstorm-demo.gif) 16 | 17 | ## Known limitations 18 | 19 | `@value` shows "Unknown CSS at-rule" error in the editor. There doesn't appear to be an API hook for adding @value as a known rule, or for filtering the error. To remove the error marker (but also other at-rule error markers) disable the inspection. 20 | 21 | Accessing style names via fields (e.g. `styles.myClassName`) is not supported. There doesn't appear to be any PSI API hooks for achieving this. Instead, use `styles['my-class-name']` which also doesn't limit class names to camel-case. 22 | 23 | The plugin assumes a one-to-one relationship between a React component and the require'd .css/.scss/.less file. 24 | 25 | PR's are welcome. 26 | 27 | ## FAQ 28 | 29 | **Does this also work with .scss and .less files?** 30 | 31 | Yes. It should work for all CSS dialects supported by the IntelliJ platform. 32 | 33 | **Which IDEs are compatible with the plugin?** 34 | 35 | The plugin is compatible with version 163+ (2016.3 or newer) of IntelliJ IDEA, WebStorm, RubyMine, PhpStorm, and PyCharm. 2016.3 is the first official version that supports `:global`, `:local`, and `composes` used by CSS Modules. 36 | 37 | PyCharm CE is not supported since the plugin depends on two other plugins: NodeJS and JavaScript. 38 | 39 | **Where can I get the plugin?** 40 | 41 | The plugin is available from the JetBrains Plugin Repository at https://plugins.jetbrains.com/plugin/9275 42 | 43 | To install it, open "Settings", "Plugins", "Browse repositories..." and search for "CSS Modules". 44 | 45 | ## License 46 | MIT 47 | -------------------------------------------------------------------------------- /docs/react-css-modules-webstorm-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jimkyndemeyer/react-css-modules-intellij-plugin/70810955c9a67ce3a3515fb4660ff651ee6cf524/docs/react-css-modules-webstorm-demo.gif -------------------------------------------------------------------------------- /react-css-modules-intellij-plugin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /resources/META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | com.intellij.react.css.modules 13 | React CSS Modules 14 | 1.0.1 15 | Jim Kynde Meyer - jimkyndemeyer@gmail.com 16 | 17 | React CSS Modules support for components written in JavaScript and TypeScript.

19 |

Provides the following features:

20 |
    21 |
  • Completion and error highlighting for CSS classes used in React styleName attributes
  • 22 |
  • Completion and error highlighting for CSS classes used in styles string literals, e.g. styles['my-class']
  • 23 |
  • Intention to create missing CSS class from usage in React
  • 24 |
  • Integrates React references to CSS class names with 'Find Usages', 'Rename', and 'Go to Declaration'
  • 25 |
26 | ]]>
27 | 28 | 30 |
  • 1.0.1: Support for ES6 imports.
  • 31 |
  • 1.0: Initial version.
  • 32 | 33 | ]]> 34 |
    35 | 36 | 37 | 38 | 39 | com.intellij.modules.lang 40 | JavaScript 41 | NodeJS 42 | com.intellij.css 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | com.intellij.react.css.modules.ide.intentions.CssModulesCreateClassIntention 60 | CSS Modules 61 | 62 | 63 | 64 | 65 |
    -------------------------------------------------------------------------------- /resources/intentionDescriptions/CssModulesCreateClassIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Creates a new CSS Modules class 4 | 5 | -------------------------------------------------------------------------------- /src/main/com/intellij/react/css/modules/ide/annotator/CssModulesClassAnnotator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-present, Jim Kynde Meyer 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | package com.intellij.react.css.modules.ide.annotator; 9 | 10 | import com.intellij.lang.annotation.AnnotationHolder; 11 | import com.intellij.lang.annotation.Annotator; 12 | import com.intellij.lang.javascript.psi.JSLiteralExpression; 13 | import com.intellij.openapi.util.TextRange; 14 | import com.intellij.psi.PsiElement; 15 | import com.intellij.psi.PsiReference; 16 | import com.intellij.psi.xml.XmlAttributeValue; 17 | import com.intellij.react.css.modules.psi.CssModulesUnknownClassPsiReference; 18 | import com.intellij.react.css.modules.psi.CssModulesUtil; 19 | import org.jetbrains.annotations.NotNull; 20 | 21 | 22 | /** 23 | * Adds error markers to unknown class names. 24 | * 25 | * @see CssModulesUnknownClassPsiReference 26 | */ 27 | public class CssModulesClassAnnotator implements Annotator { 28 | 29 | @Override 30 | public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder annotationHolder) { 31 | PsiElement elementToAnnotate = null; 32 | if (psiElement instanceof XmlAttributeValue) { 33 | if (CssModulesUtil.STYLE_NAME_FILTER.isAcceptable(psiElement, psiElement)) { 34 | elementToAnnotate = psiElement; 35 | } 36 | } else if (psiElement instanceof JSLiteralExpression) { 37 | elementToAnnotate = psiElement; 38 | } 39 | if (elementToAnnotate != null) { 40 | for (PsiReference psiReference : psiElement.getReferences()) { 41 | if (psiReference instanceof CssModulesUnknownClassPsiReference) { 42 | final TextRange rangeInElement = psiReference.getRangeInElement(); 43 | if (rangeInElement.isEmpty()) { 44 | continue; 45 | } 46 | int start = psiElement.getTextRange().getStartOffset() + rangeInElement.getStartOffset(); 47 | int length = rangeInElement.getLength(); 48 | final TextRange textRange = TextRange.from(start, length); 49 | if (!textRange.isEmpty()) { 50 | final String message = "Unknown class name \"" + rangeInElement.substring(psiElement.getText()) + "\""; 51 | annotationHolder.createErrorAnnotation(textRange, message); 52 | } 53 | } 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/com/intellij/react/css/modules/ide/completion/CssModulesClassNameCompletionConfidence.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-present, Jim Kynde Meyer 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | package com.intellij.react.css.modules.ide.completion; 9 | 10 | 11 | import com.intellij.codeInsight.completion.CompletionConfidence; 12 | import com.intellij.lang.javascript.psi.JSLiteralExpression; 13 | import com.intellij.psi.PsiElement; 14 | import com.intellij.psi.PsiFile; 15 | import com.intellij.psi.css.StylesheetFile; 16 | import com.intellij.react.css.modules.psi.CssModulesUtil; 17 | import com.intellij.util.ThreeState; 18 | import org.jetbrains.annotations.NotNull; 19 | 20 | /** 21 | * Enables automatic completion inside styles['completion here'] string literals (which is disabled by default in JS) 22 | */ 23 | public class CssModulesClassNameCompletionConfidence extends CompletionConfidence { 24 | 25 | @NotNull 26 | @Override 27 | public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) { 28 | if (contextElement.getParent() instanceof JSLiteralExpression) { 29 | final PsiElement cssClassNamesImportOrRequire = CssModulesUtil.getCssClassNamesImportOrRequireDeclaration((JSLiteralExpression) contextElement.getParent()); 30 | if (cssClassNamesImportOrRequire != null) { 31 | final StylesheetFile stylesheetFile = CssModulesUtil.resolveStyleSheetFile(cssClassNamesImportOrRequire); 32 | if (stylesheetFile != null) { 33 | return ThreeState.NO; 34 | } 35 | } 36 | } 37 | return ThreeState.UNSURE; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/com/intellij/react/css/modules/ide/completion/CssModulesClassNameCompletionContributor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-present, Jim Kynde Meyer 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | package com.intellij.react.css.modules.ide.completion; 9 | 10 | import com.intellij.codeInsight.completion.*; 11 | import com.intellij.codeInsight.lookup.LookupElementBuilder; 12 | import com.intellij.lang.javascript.psi.JSLiteralExpression; 13 | import com.intellij.patterns.PlatformPatterns; 14 | import com.intellij.psi.PsiElement; 15 | import com.intellij.psi.css.CssClass; 16 | import com.intellij.psi.css.StylesheetFile; 17 | import com.intellij.psi.util.PsiTreeUtil; 18 | import com.intellij.psi.xml.XmlAttributeValue; 19 | import com.intellij.react.css.modules.psi.CssModulesUtil; 20 | import com.intellij.util.ProcessingContext; 21 | import org.jetbrains.annotations.NotNull; 22 | 23 | import java.util.Optional; 24 | 25 | 26 | /** 27 | * Completion on available class names from a require'd CSS file. 28 | */ 29 | public class CssModulesClassNameCompletionContributor extends CompletionContributor { 30 | 31 | public CssModulesClassNameCompletionContributor() { 32 | 33 | CompletionProvider provider = new CompletionProvider() { 34 | @Override 35 | protected void addCompletions(@NotNull final CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) { 36 | 37 | final PsiElement completionElement = Optional.ofNullable(parameters.getOriginalPosition()).orElse(parameters.getPosition()); 38 | 39 | if (completionElement.getParent() instanceof XmlAttributeValue) { 40 | // Completion for React styleName attribute 41 | if (CssModulesUtil.STYLE_NAME_FILTER.isAcceptable(completionElement.getParent(), completionElement)) { 42 | final StylesheetFile importedStyleSheetFile = CssModulesUtil.getImportedStyleSheetFile(completionElement); 43 | if (importedStyleSheetFile != null) { 44 | addCompletions(result, importedStyleSheetFile); 45 | } 46 | } 47 | } else if (completionElement.getParent() instanceof JSLiteralExpression) { 48 | // Completion for styles['my-class-name'] 49 | final JSLiteralExpression literalExpression = (JSLiteralExpression) completionElement.getParent(); 50 | final PsiElement cssClassNamesImportOrRequire = CssModulesUtil.getCssClassNamesImportOrRequireDeclaration(literalExpression); 51 | if (cssClassNamesImportOrRequire != null) { 52 | final StylesheetFile stylesheetFile = CssModulesUtil.resolveStyleSheetFile(cssClassNamesImportOrRequire); 53 | if (stylesheetFile != null) { 54 | addCompletions(result, stylesheetFile); 55 | } 56 | } 57 | } 58 | 59 | } 60 | 61 | private void addCompletions(@NotNull CompletionResultSet result, StylesheetFile stylesheetFile) { 62 | for (CssClass cssClass : PsiTreeUtil.findChildrenOfType(stylesheetFile, CssClass.class)) { 63 | if(!CssModulesUtil.isCssModuleClass(cssClass)) { 64 | continue; 65 | } 66 | LookupElementBuilder element = LookupElementBuilder.createWithIcon(cssClass); 67 | if (cssClass.getPresentation() != null) { 68 | final String location = cssClass.getPresentation().getLocationString(); 69 | element = element.withTypeText(location, true); 70 | } 71 | result.addElement(element); 72 | } 73 | } 74 | }; 75 | 76 | extend(CompletionType.BASIC, PlatformPatterns.psiElement(), provider); 77 | 78 | } 79 | 80 | 81 | } -------------------------------------------------------------------------------- /src/main/com/intellij/react/css/modules/ide/intentions/CssModulesCreateClassIntention.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-present, Jim Kynde Meyer 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | package com.intellij.react.css.modules.ide.intentions; 9 | 10 | import com.intellij.codeInsight.intention.HighPriorityAction; 11 | import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction; 12 | import com.intellij.ide.impl.DataManagerImpl; 13 | import com.intellij.lang.javascript.psi.JSLiteralExpression; 14 | import com.intellij.openapi.actionSystem.ActionManager; 15 | import com.intellij.openapi.actionSystem.ActionPlaces; 16 | import com.intellij.openapi.actionSystem.AnAction; 17 | import com.intellij.openapi.actionSystem.AnActionEvent; 18 | import com.intellij.openapi.editor.Editor; 19 | import com.intellij.openapi.fileEditor.FileEditor; 20 | import com.intellij.openapi.fileEditor.FileEditorManager; 21 | import com.intellij.openapi.fileEditor.TextEditor; 22 | import com.intellij.openapi.project.Project; 23 | import com.intellij.psi.PsiDocumentManager; 24 | import com.intellij.psi.PsiElement; 25 | import com.intellij.psi.PsiReference; 26 | import com.intellij.psi.css.CssElementFactory; 27 | import com.intellij.psi.css.StylesheetFile; 28 | import com.intellij.psi.util.PsiTreeUtil; 29 | import com.intellij.psi.xml.XmlAttributeValue; 30 | import com.intellij.psi.xml.XmlToken; 31 | import com.intellij.react.css.modules.psi.CssModulesUnknownClassPsiReference; 32 | import com.intellij.util.IncorrectOperationException; 33 | import org.jetbrains.annotations.Nls; 34 | import org.jetbrains.annotations.NotNull; 35 | 36 | /** 37 | * Intention for creating a missing CSS Modules class 38 | */ 39 | public class CssModulesCreateClassIntention extends PsiElementBaseIntentionAction implements HighPriorityAction { 40 | 41 | @Override 42 | public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException { 43 | final PsiElement intentionElement = getIntentionElement(element); 44 | for (PsiReference psiReference : intentionElement.getReferences()) { 45 | if (psiReference instanceof CssModulesUnknownClassPsiReference) { 46 | final String className = psiReference.getRangeInElement().substring(intentionElement.getText()); 47 | final StylesheetFile stylesheetFile = ((CssModulesUnknownClassPsiReference) psiReference).getStylesheetFile(); 48 | stylesheetFile.navigate(true); 49 | PsiElement ruleset = CssElementFactory.getInstance(project).createRuleset("." + className + " {\n\n}", stylesheetFile.getLanguage()); 50 | ruleset = stylesheetFile.add(ruleset); 51 | final int newCaretOffset = ruleset.getTextOffset() + ruleset.getText().indexOf("{") + 2; // after '{\n' 52 | final FileEditor[] editors = FileEditorManager.getInstance(project).getEditors(stylesheetFile.getVirtualFile()); 53 | for (FileEditor fileEditor : editors) { 54 | if (fileEditor instanceof TextEditor) { 55 | final Editor cssEditor = ((TextEditor) fileEditor).getEditor(); 56 | cssEditor.getCaretModel().moveToOffset(newCaretOffset); 57 | AnAction editorLineEnd = ActionManager.getInstance().getAction("EditorLineEnd"); 58 | if (editorLineEnd != null) { 59 | final AnActionEvent actionEvent = AnActionEvent.createFromDataContext( 60 | ActionPlaces.UNKNOWN, 61 | null, 62 | new DataManagerImpl.MyDataContext(cssEditor.getComponent()) 63 | ); 64 | PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(cssEditor.getDocument()); 65 | editorLineEnd.actionPerformed(actionEvent); 66 | } 67 | } 68 | } 69 | return; 70 | } 71 | } 72 | } 73 | 74 | @Override 75 | public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { 76 | final PsiElement intentionElement = getIntentionElement(element); 77 | if (intentionElement != null) { 78 | for (PsiReference psiReference : intentionElement.getReferences()) { 79 | if (psiReference instanceof CssModulesUnknownClassPsiReference) { 80 | return true; 81 | } 82 | } 83 | } 84 | return false; 85 | } 86 | 87 | @NotNull 88 | @Override 89 | public String getText() { 90 | return "Create CSS Modules class"; 91 | } 92 | 93 | @Nls 94 | @NotNull 95 | @Override 96 | public String getFamilyName() { 97 | return getText(); 98 | } 99 | 100 | 101 | private PsiElement getIntentionElement(@NotNull PsiElement element) { 102 | PsiElement intentionElement; 103 | if (element instanceof XmlToken) { 104 | intentionElement = PsiTreeUtil.getParentOfType(element, XmlAttributeValue.class); 105 | } else { 106 | intentionElement = PsiTreeUtil.getParentOfType(element, JSLiteralExpression.class); 107 | if (intentionElement == null) { 108 | intentionElement = PsiTreeUtil.getPrevSiblingOfType(element, JSLiteralExpression.class); 109 | } 110 | } 111 | return intentionElement; 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /src/main/com/intellij/react/css/modules/psi/CssModulesIndexedStylesVarPsiReferenceContributor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-present, Jim Kynde Meyer 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | package com.intellij.react.css.modules.psi; 9 | 10 | import com.intellij.lang.javascript.psi.JSLiteralExpression; 11 | import com.intellij.openapi.util.Ref; 12 | import com.intellij.openapi.util.TextRange; 13 | import com.intellij.psi.*; 14 | import com.intellij.psi.css.CssClass; 15 | import com.intellij.psi.css.StylesheetFile; 16 | import com.intellij.util.ProcessingContext; 17 | import org.apache.commons.lang.StringUtils; 18 | import org.jetbrains.annotations.NotNull; 19 | import org.jetbrains.annotations.Nullable; 20 | 21 | /** 22 | * Adds a PSI references from a indexed string literal on a styles object to its corresponding class name. 23 | * For example, the 'normal' in styles['normal'] will point to the '.normal {}' CSS class in a require'd stylesheet. 24 | */ 25 | public class CssModulesIndexedStylesVarPsiReferenceContributor extends PsiReferenceContributor { 26 | 27 | @Override 28 | public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { 29 | registrar.registerReferenceProvider(CssModulesUtil.STRING_PATTERN, new PsiReferenceProvider() { 30 | @NotNull 31 | @Override 32 | public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { 33 | final PsiElement cssClassNamesImportOrRequire = CssModulesUtil.getCssClassNamesImportOrRequireDeclaration((JSLiteralExpression) element); 34 | if (cssClassNamesImportOrRequire != null) { 35 | final String literalClass = "." + StringUtils.stripStart(StringUtils.stripEnd(element.getText(), "\"'"), "\"'"); 36 | final Ref referencedStyleSheet = new Ref<>(); 37 | final CssClass cssClass = CssModulesUtil.getCssClass(cssClassNamesImportOrRequire, literalClass, referencedStyleSheet); 38 | if (cssClass != null) { 39 | return new PsiReference[]{new PsiReferenceBase(element) { 40 | @Nullable 41 | @Override 42 | public PsiElement resolve() { 43 | return cssClass; 44 | } 45 | 46 | @NotNull 47 | @Override 48 | public Object[] getVariants() { 49 | return new Object[0]; 50 | } 51 | }}; 52 | } else { 53 | if (referencedStyleSheet.get() != null) { 54 | final TextRange rangeInElement = TextRange.from(1, element.getTextLength() - 2); // minus string quotes 55 | return new PsiReference[]{new CssModulesUnknownClassPsiReference(element, rangeInElement, referencedStyleSheet.get())}; 56 | } 57 | } 58 | 59 | } 60 | return new PsiReference[0]; 61 | } 62 | }); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/com/intellij/react/css/modules/psi/CssModulesStyleNameAttributePsiReferenceContributor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-present, Jim Kynde Meyer 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | package com.intellij.react.css.modules.psi; 9 | 10 | import com.google.common.collect.Lists; 11 | import com.intellij.openapi.util.Ref; 12 | import com.intellij.openapi.util.TextRange; 13 | import com.intellij.psi.*; 14 | import com.intellij.psi.css.CssClass; 15 | import com.intellij.psi.css.StylesheetFile; 16 | import com.intellij.psi.xml.XmlAttributeValue; 17 | import com.intellij.util.ProcessingContext; 18 | import org.jetbrains.annotations.NotNull; 19 | import org.jetbrains.annotations.Nullable; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * Adds a PSI references from class names used a styleName React attribute to their corresponding imported CSS classes. 25 | */ 26 | public class CssModulesStyleNameAttributePsiReferenceContributor extends PsiReferenceContributor { 27 | 28 | 29 | @Override 30 | public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { 31 | registrar.registerReferenceProvider(CssModulesUtil.STYLE_NAME_PATTERN, new PsiReferenceProvider() { 32 | @NotNull 33 | @Override 34 | public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { 35 | final StylesheetFile styleSheetFile = CssModulesUtil.getImportedStyleSheetFile(element); 36 | if (styleSheetFile != null) { 37 | final XmlAttributeValue xmlAttributeValue = (XmlAttributeValue) element; 38 | if (xmlAttributeValue.getValue().startsWith("{")) { 39 | // attribute value is a jsx expression and not a literal class name 40 | return PsiReference.EMPTY_ARRAY; 41 | } 42 | final String[] cssClassNames = xmlAttributeValue.getValue().split(" "); 43 | final List referenceList = Lists.newArrayListWithExpectedSize(1); 44 | int offset = xmlAttributeValue.getValueTextRange().getStartOffset() - xmlAttributeValue.getTextRange().getStartOffset(); 45 | for (String cssClassName : cssClassNames) { 46 | final Ref cssClassRef = new Ref<>(null); 47 | cssClassRef.set(CssModulesUtil.getCssClass(styleSheetFile, "." + cssClassName)); 48 | final TextRange rangeInElement = TextRange.from(offset, cssClassName.length()); 49 | if (cssClassRef.get() != null) { 50 | referenceList.add(new PsiReferenceBase(element, rangeInElement) { 51 | @Nullable 52 | @Override 53 | public PsiElement resolve() { 54 | return cssClassRef.get(); 55 | } 56 | 57 | @NotNull 58 | @Override 59 | public Object[] getVariants() { 60 | return new Object[0]; 61 | } 62 | }); 63 | } else { 64 | referenceList.add(new CssModulesUnknownClassPsiReference(element, rangeInElement, styleSheetFile)); 65 | } 66 | offset += cssClassName.length() + 1; 67 | } 68 | return referenceList.toArray(new PsiReference[referenceList.size()]); 69 | } 70 | 71 | return PsiReference.EMPTY_ARRAY; 72 | } 73 | }); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/com/intellij/react/css/modules/psi/CssModulesUnknownClassPsiReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-present, Jim Kynde Meyer 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | package com.intellij.react.css.modules.psi; 9 | 10 | import com.intellij.openapi.util.TextRange; 11 | import com.intellij.psi.PsiElement; 12 | import com.intellij.psi.PsiReferenceBase; 13 | import com.intellij.psi.css.StylesheetFile; 14 | import org.jetbrains.annotations.NotNull; 15 | import org.jetbrains.annotations.Nullable; 16 | 17 | /** 18 | * Represents an invalid CSS class reference in a specific style sheet file. 19 | */ 20 | public class CssModulesUnknownClassPsiReference extends PsiReferenceBase { 21 | 22 | private final StylesheetFile stylesheetFile; 23 | 24 | public CssModulesUnknownClassPsiReference(@NotNull PsiElement element, TextRange rangeInElement, StylesheetFile stylesheetFile) { 25 | super(element, rangeInElement); 26 | this.stylesheetFile = stylesheetFile; 27 | } 28 | 29 | @Nullable 30 | @Override 31 | public PsiElement resolve() { 32 | // self reference to prevent JS tooling from reporting unresolved symbol 33 | return this.getElement(); 34 | } 35 | 36 | @NotNull 37 | @Override 38 | public Object[] getVariants() { 39 | return new Object[0]; 40 | } 41 | 42 | public StylesheetFile getStylesheetFile() { 43 | return stylesheetFile; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/com/intellij/react/css/modules/psi/CssModulesUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-present, Jim Kynde Meyer 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | package com.intellij.react.css.modules.psi; 9 | 10 | import com.intellij.lang.ASTNode; 11 | import com.intellij.lang.ecmascript6.psi.ES6FromClause; 12 | import com.intellij.lang.ecmascript6.psi.ES6ImportedBinding; 13 | import com.intellij.lang.javascript.JSTokenTypes; 14 | import com.intellij.lang.javascript.psi.JSFile; 15 | import com.intellij.lang.javascript.psi.JSIndexedPropertyAccessExpression; 16 | import com.intellij.lang.javascript.psi.JSLiteralExpression; 17 | import com.intellij.lang.javascript.psi.JSVariable; 18 | import com.intellij.openapi.util.Ref; 19 | import com.intellij.patterns.PlatformPatterns; 20 | import com.intellij.patterns.PsiElementPattern; 21 | import com.intellij.psi.PsiElement; 22 | import com.intellij.psi.PsiRecursiveElementVisitor; 23 | import com.intellij.psi.PsiReference; 24 | import com.intellij.psi.css.CssClass; 25 | import com.intellij.psi.css.CssFunction; 26 | import com.intellij.psi.css.StylesheetFile; 27 | import com.intellij.psi.filters.ElementFilter; 28 | import com.intellij.psi.filters.position.FilterPattern; 29 | import com.intellij.psi.util.PsiTreeUtil; 30 | import com.intellij.psi.xml.XmlAttribute; 31 | import com.intellij.psi.xml.XmlAttributeValue; 32 | import org.jetbrains.annotations.Nullable; 33 | 34 | /** 35 | * Utility methods for navigating PSI trees with regards to CSS Modules. 36 | */ 37 | public class CssModulesUtil { 38 | 39 | /** 40 | * Filters to "styleName" React attributes. 41 | */ 42 | public static final ElementFilter STYLE_NAME_FILTER = new ElementFilter() { 43 | @Override 44 | public boolean isAcceptable(Object element, @Nullable PsiElement context) { 45 | if (element instanceof XmlAttributeValue && context != null && context.getContainingFile() instanceof JSFile) { 46 | final XmlAttributeValue value = (XmlAttributeValue) element; 47 | final XmlAttribute xmlAttribute = PsiTreeUtil.getParentOfType(value, XmlAttribute.class); 48 | if (xmlAttribute != null) { 49 | return xmlAttribute.getName().equals("styleName"); 50 | } 51 | } 52 | return false; 53 | } 54 | 55 | @Override 56 | public boolean isClassAcceptable(Class hintClass) { 57 | return XmlAttributeValue.class.isAssignableFrom(hintClass); 58 | } 59 | }; 60 | 61 | /** 62 | * PSI Pattern for matching "styleName" React attributes. 63 | */ 64 | public static final PsiElementPattern.Capture STYLE_NAME_PATTERN = PlatformPatterns 65 | .psiElement(XmlAttributeValue.class) 66 | .and(new FilterPattern(STYLE_NAME_FILTER)); 67 | 68 | 69 | /** 70 | * PSI Pattern for matching string literals, e.g. the 'normal' in styles['normal'] 71 | */ 72 | public static final PsiElementPattern.Capture STRING_PATTERN = PlatformPatterns. 73 | psiElement(JSLiteralExpression.class) 74 | .and(new FilterPattern(new ElementFilter() { 75 | @Override 76 | public boolean isAcceptable(Object element, @Nullable PsiElement context) { 77 | if (element instanceof JSLiteralExpression && context != null && context.getContainingFile() instanceof JSFile) { 78 | final ASTNode value = ((JSLiteralExpression) element).getNode().getFirstChildNode(); 79 | return value != null && value.getElementType() == JSTokenTypes.STRING_LITERAL; 80 | } 81 | return false; 82 | } 83 | 84 | @Override 85 | public boolean isClassAcceptable(Class hintClass) { 86 | return JSLiteralExpression.class.isAssignableFrom(hintClass); 87 | } 88 | })); 89 | 90 | 91 | /** 92 | * Visits the containing file of the specified element to find a require to a style sheet file 93 | * 94 | * @param cssReferencingElement starting point for finding an imported style sheet file 95 | * @return the PSI file for the first imported style sheet file 96 | */ 97 | public static StylesheetFile getImportedStyleSheetFile(PsiElement cssReferencingElement) { 98 | final Ref file = new Ref<>(); 99 | cssReferencingElement.getContainingFile().accept(new PsiRecursiveElementVisitor() { 100 | @Override 101 | public void visitElement(PsiElement element) { 102 | if (file.get() != null) { 103 | return; 104 | } 105 | if (element instanceof JSLiteralExpression) { 106 | if (resolveStyleSheetFile(element, file)) return; 107 | } 108 | if(element instanceof ES6FromClause) { 109 | if (resolveStyleSheetFile(element, file)) return; 110 | } 111 | super.visitElement(element); 112 | } 113 | }); 114 | return file.get(); 115 | } 116 | 117 | /** 118 | * Gets the CssClass PSI element whose name matches the specified cssClassName 119 | * 120 | * @param stylesheetFile the PSI style sheet file to visit 121 | * @param cssClass the class to find, including the leading ".", e.g. ".my-class-name" 122 | * @return the matching class or null if no matches are found 123 | */ 124 | public static CssClass getCssClass(StylesheetFile stylesheetFile, String cssClass) { 125 | final Ref cssClassRef = new Ref<>(); 126 | stylesheetFile.accept(new PsiRecursiveElementVisitor() { 127 | @Override 128 | public void visitElement(PsiElement element) { 129 | if (cssClassRef.get() != null) { 130 | return; 131 | } 132 | if (element instanceof CssClass) { 133 | if (cssClass.equals(element.getText()) && isCssModuleClass((CssClass) element)) { 134 | cssClassRef.set((CssClass) element); 135 | return; 136 | } 137 | } 138 | super.visitElement(element); 139 | } 140 | }); 141 | return cssClassRef.get(); 142 | } 143 | 144 | /** 145 | * Gets whether the specified CSS class is a CSS Modules class. 146 | * Classes nested in :global are considered false. 147 | */ 148 | public static boolean isCssModuleClass(CssClass cssClass) { 149 | final CssFunction parentFunction = PsiTreeUtil.getParentOfType(cssClass, CssFunction.class); 150 | if(parentFunction != null) { 151 | if("global".equals(parentFunction.getName())) { 152 | // not a generated CSS Modules class 153 | return false; 154 | } 155 | } 156 | return true; 157 | } 158 | 159 | /** 160 | * Gets the import/require declaration that a string literal belongs to, e.g 'normal' -> 161 | * 'const styles = require("./foo.css")' or 'import styles from "./foo.css"' based on styles['normal'] 162 | * 163 | * @param classNameLiteral a string literal that is potentially a CSS class name 164 | * @return the JS variable that is a potential require of a style sheet file, or null if the PSI structure doesn't match 165 | */ 166 | public static PsiElement getCssClassNamesImportOrRequireDeclaration(JSLiteralExpression classNameLiteral) { 167 | final JSIndexedPropertyAccessExpression expression = PsiTreeUtil.getParentOfType(classNameLiteral, JSIndexedPropertyAccessExpression.class); 168 | if (expression != null) { 169 | // string literal is part of "var['string literal']", e.g. "styles['normal']" 170 | if (expression.getQualifier() != null) { 171 | final PsiReference psiReference = expression.getQualifier().getReference(); 172 | if (psiReference != null) { 173 | final PsiElement varReference = psiReference.resolve(); 174 | if (varReference instanceof JSVariable) { 175 | return varReference; 176 | } 177 | if(varReference instanceof ES6ImportedBinding) { 178 | return varReference.getParent(); 179 | } 180 | } 181 | } 182 | } 183 | return null; 184 | } 185 | 186 | /** 187 | * Resolves the style sheet PSI file that backs a require("./stylesheet.css"). 188 | * 189 | * @param cssFileNameLiteralParent parent element to a file name string literal that points to a style sheet file 190 | * @return the matching style sheet PSI file, or null if the file can't be resolved 191 | */ 192 | public static StylesheetFile resolveStyleSheetFile(PsiElement cssFileNameLiteralParent) { 193 | final Ref stylesheetFileRef = new Ref<>(); 194 | cssFileNameLiteralParent.accept(new PsiRecursiveElementVisitor() { 195 | @Override 196 | public void visitElement(PsiElement element) { 197 | if (stylesheetFileRef.get() != null) { 198 | return; 199 | } 200 | if (element instanceof JSLiteralExpression) { 201 | if (resolveStyleSheetFile(element, stylesheetFileRef)) return; 202 | } 203 | if(element instanceof ES6FromClause) { 204 | if (resolveStyleSheetFile(element, stylesheetFileRef)) return; 205 | } 206 | super.visitElement(element); 207 | } 208 | }); 209 | return stylesheetFileRef.get(); 210 | } 211 | 212 | /** 213 | * Resolves a CssClass PSI element given a CSS filename and class name 214 | * 215 | * @param cssFileNameLiteralParent element which contains a require'd style sheet file 216 | * @param cssClass the CSS class to get including the "." 217 | * @param referencedStyleSheet ref to set to the style sheet that any matching CSS class is declared in 218 | * @return the matching CSS class, or null in case the class is unknown 219 | */ 220 | public static CssClass getCssClass(PsiElement cssFileNameLiteralParent, String cssClass, Ref referencedStyleSheet) { 221 | StylesheetFile stylesheetFile = resolveStyleSheetFile(cssFileNameLiteralParent); 222 | if (stylesheetFile != null) { 223 | referencedStyleSheet.set(stylesheetFile); 224 | return getCssClass(stylesheetFile, cssClass); 225 | } else { 226 | referencedStyleSheet.set(null); 227 | return null; 228 | } 229 | } 230 | 231 | /** 232 | * Gets the style sheet, if any, that the specified element resolves to 233 | * 234 | * @param element element used to resolve 235 | * @param stylesheetFileRef the ref to set the resolved sheet on 236 | * @return true if the element resolves to a style sheet file, false otherwise 237 | */ 238 | private static boolean resolveStyleSheetFile(PsiElement element, Ref stylesheetFileRef) { 239 | for (PsiReference reference : element.getReferences()) { 240 | final PsiElement fileReference = reference.resolve(); 241 | if (fileReference instanceof StylesheetFile) { 242 | stylesheetFileRef.set((StylesheetFile) fileReference); 243 | return true; 244 | } 245 | } 246 | return false; 247 | } 248 | 249 | } 250 | -------------------------------------------------------------------------------- /src/test/com/intellij/react/css/modules/CssModulesCodeInsightTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-present, Jim Kynde Meyer 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | package com.intellij.react.css.modules; 9 | 10 | import com.google.common.collect.Lists; 11 | import com.intellij.codeInsight.completion.CompletionType; 12 | import com.intellij.testFramework.LightProjectDescriptor; 13 | import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; 14 | import com.intellij.usageView.UsageInfo; 15 | import org.jetbrains.annotations.NotNull; 16 | import org.junit.Test; 17 | 18 | import java.util.List; 19 | 20 | 21 | public class CssModulesCodeInsightTest extends LightCodeInsightFixtureTestCase { 22 | 23 | @Override 24 | public void setUp() throws Exception { 25 | super.setUp(); 26 | myFixture.copyFileToProject("Component.css"); 27 | myFixture.copyFileToProject("ComponentFindUsages.jsx"); 28 | myFixture.copyFileToProject("react.d.ts"); 29 | myFixture.copyFileToProject("tsconfig.json"); 30 | } 31 | 32 | @Override 33 | protected String getTestDataPath() { 34 | return "test-resources/testData"; 35 | } 36 | 37 | @NotNull 38 | @Override 39 | protected LightProjectDescriptor getProjectDescriptor() { 40 | return super.getProjectDescriptor(); 41 | } 42 | 43 | 44 | // ---- completion ---- 45 | 46 | @Test 47 | public void testCompletionComponent() { 48 | doTestCompletion("Component.jsx", Lists.newArrayList("error", "normal", "north")); 49 | } 50 | 51 | @Test 52 | public void testCompletionComponentEs6Import() { 53 | doTestCompletion("ComponentEs6Import.jsx", Lists.newArrayList("error", "normal", "north")); 54 | } 55 | 56 | @Test 57 | public void testCompletionComponentEs6ImportStyleName() { 58 | doTestCompletion("ComponentEs6ImportStyleName.jsx", Lists.newArrayList("error", "normal", "north")); 59 | } 60 | 61 | @Test 62 | public void testCompletionComponentNor() { 63 | doTestCompletion("ComponentNor.jsx", Lists.newArrayList("normal", "north")); 64 | } 65 | 66 | @Test 67 | public void testCompletionComponentNormalErr() { 68 | doTestCompletion("ComponentNormalErr.jsx", null); // single match completion shows as null 69 | } 70 | 71 | @Test 72 | public void testCompletionComponentStringLiteral() { 73 | doTestCompletion("ComponentStringLiteral.jsx", Lists.newArrayList("error", "normal", "north")); 74 | } 75 | 76 | @Test 77 | public void testCompletionComponentStringLiteralNor() { 78 | doTestCompletion("ComponentStringLiteralNor.jsx", Lists.newArrayList("normal", "north")); 79 | } 80 | 81 | @Test 82 | public void testCompletionComponentTypeScript() { 83 | doTestCompletion("ComponentTypeScript.tsx", Lists.newArrayList("error", "normal", "north")); 84 | } 85 | 86 | @Test 87 | public void testCompletionComponentTypeScriptStringLiteral() { 88 | doTestCompletion("ComponentTypeScriptStringLiteral.tsx", Lists.newArrayList("normal", "north")); 89 | } 90 | 91 | @Test 92 | public void testCompletionComposesClassName() { 93 | doTestCompletion("CompletionComposesClassName.css", Lists.newArrayList("normal", "north")); 94 | } 95 | 96 | @Test 97 | public void testCompletionComposesClassNameMultiple() { 98 | doTestCompletion("CompletionComposesClassNameMultiple.css", Lists.newArrayList("north")); 99 | } 100 | 101 | @Test 102 | public void testCompletionComposesClassNameSemiColon() { 103 | doTestCompletion("CompletionComposesClassNameSemiColon.css", Lists.newArrayList("normal", "north")); 104 | } 105 | 106 | @Test 107 | public void testCompletionComposesProperty() { 108 | doTestCompletion("CompletionComposesProperty.css", Lists.newArrayList("composes", "mask-composite", "-webkit-background-composite", "-webkit-mask-composite")); 109 | } 110 | 111 | private void doTestCompletion(String sourceFile, List expectedCompletions) { 112 | myFixture.configureByFiles(sourceFile); 113 | myFixture.complete(CompletionType.BASIC, 1); 114 | final List completions = myFixture.getLookupElementStrings(); 115 | assertEquals("Wrong completions", expectedCompletions, completions); 116 | } 117 | 118 | 119 | // ---- error highlighting ----- 120 | 121 | @Test 122 | public void testCssAnnotations() { 123 | myFixture.configureByFiles("Annotations.css"); 124 | myFixture.checkHighlighting(true, false, true); 125 | } 126 | 127 | @Test 128 | public void testComponentAnnotations() { 129 | myFixture.configureByFiles("ComponentAnnotations.jsx"); 130 | myFixture.checkHighlighting(false, false, false); 131 | } 132 | 133 | @Test 134 | public void testComponentTypeScriptAnnotations() { 135 | myFixture.configureByFiles("ComponentTypeScriptAnnotations.tsx"); 136 | myFixture.checkHighlighting(false, false, false); 137 | } 138 | 139 | 140 | // --- PSI references (find usages etc.) --- 141 | 142 | @Test 143 | public void testComponentFindUsages() { 144 | final List usageInfos = Lists.newArrayList(myFixture.testFindUsages("ComponentFindUsages.css")); 145 | assertEquals(3, usageInfos.size()); // 2 from this plugin, one is self reference 146 | } 147 | 148 | } 149 | -------------------------------------------------------------------------------- /test-resources/testData/Annotations.css: -------------------------------------------------------------------------------- 1 | :global .foo { 2 | 3 | } 4 | 5 | :global(.foo) { 6 | 7 | } 8 | 9 | :local .foo { 10 | 11 | } 12 | 13 | :local(.foo) { 14 | 15 | } 16 | 17 | .normal { 18 | 19 | } 20 | 21 | .bar { 22 | composes: normal; 23 | } -------------------------------------------------------------------------------- /test-resources/testData/CompletionComposesClassName.css: -------------------------------------------------------------------------------- 1 | .normal { 2 | font-size: 12px 3 | } 4 | 5 | .north { 6 | 7 | } 8 | 9 | .error { 10 | composes: 11 | color: darkred; 12 | } -------------------------------------------------------------------------------- /test-resources/testData/CompletionComposesClassNameMultiple.css: -------------------------------------------------------------------------------- 1 | .normal { 2 | font-size: 12px 3 | } 4 | 5 | .north { 6 | 7 | } 8 | 9 | .error { 10 | composes: normal 11 | color: darkred; 12 | } -------------------------------------------------------------------------------- /test-resources/testData/CompletionComposesClassNameSemiColon.css: -------------------------------------------------------------------------------- 1 | .normal { 2 | font-size: 12px 3 | } 4 | 5 | .north { 6 | 7 | } 8 | 9 | .error { 10 | composes: ; 11 | color: darkred; 12 | } -------------------------------------------------------------------------------- /test-resources/testData/CompletionComposesProperty.css: -------------------------------------------------------------------------------- 1 | .normal { 2 | font-size: 12px 3 | } 4 | 5 | .north { 6 | 7 | } 8 | 9 | .error { 10 | compo; 11 | color: darkred; 12 | } -------------------------------------------------------------------------------- /test-resources/testData/Component.css: -------------------------------------------------------------------------------- 1 | .normal { 2 | font-size: 12px 3 | } 4 | 5 | .north { 6 | 7 | } 8 | 9 | .error { 10 | composes: normal; 11 | color: darkred; 12 | } 13 | 14 | :global(.not-css-modules) { 15 | fill: red; 16 | } -------------------------------------------------------------------------------- /test-resources/testData/Component.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./Component.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | return ( 7 |
    8 | ); 9 | } 10 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentAnnotations.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./Component.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | const normal = styles['normal']; 7 | const invalid = styles['invalid']; 8 | return ( 9 |
    invalid">
    10 | ); 11 | } 12 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentEs6Import.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import styles from "./Component.css"; 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | return ( 7 |
    ']}>
    8 | ); 9 | } 10 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentEs6ImportStyleName.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import styles from "./Component.css"; 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | return ( 7 |
    8 | ); 9 | } 10 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentFindUsages.css: -------------------------------------------------------------------------------- 1 | .normalusage { 2 | font-size: 12px 3 | } 4 | 5 | .north { 6 | 7 | } 8 | 9 | .error { 10 | composes: north; 11 | color: darkred; 12 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentFindUsages.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./ComponentFindUsages.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | const normal = styles['normalusage']; 7 | return ( 8 |
    9 | ); 10 | } 11 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentNor.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./Component.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | return ( 7 |
    8 | ); 9 | } 10 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentNormalErr.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./Component.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | return ( 7 |
    8 | ); 9 | } 10 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentStringLiteral.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./Component.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | const className = styles['']; 7 | return ( 8 |
    9 | ); 10 | } 11 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentStringLiteralNor.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./Component.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | const className = styles['nor']; 7 | return ( 8 |
    9 | ); 10 | } 11 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentTypeScript.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./Component.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | return ( 7 |
    8 | ); 9 | } 10 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentTypeScriptAnnotations.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./Component.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | const normal = styles['normal']; 7 | const invalid = styles['invalid']; 8 | return ( 9 |
    invalid">
    10 | ); 11 | } 12 | } -------------------------------------------------------------------------------- /test-resources/testData/ComponentTypeScriptStringLiteral.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | const styles = require("./Component.css"); 3 | 4 | export class Component1 extends React.Component { 5 | render() { 6 | const className = styles['nor']; 7 | return ( 8 |
    9 | ); 10 | } 11 | } -------------------------------------------------------------------------------- /test-resources/testData/react.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 2 | // Project: http://facebook.github.io/react/ 3 | // Definitions by: Asana , AssureSign , Microsoft 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | declare namespace __React { 7 | // 8 | // React Elements 9 | // ---------------------------------------------------------------------- 10 | 11 | type ReactType = string | ComponentClass | StatelessComponent; 12 | 13 | interface ReactElement

    > { 14 | type: string | ComponentClass

    | StatelessComponent

    ; 15 | props: P; 16 | key: string | number; 17 | ref: string | ((component: Component | Element) => any); 18 | } 19 | 20 | interface ClassicElement

    extends ReactElement

    { 21 | type: ClassicComponentClass

    ; 22 | ref: string | ((component: ClassicComponent) => any); 23 | } 24 | 25 | interface DOMElement

    > extends ReactElement

    { 26 | type: string; 27 | ref: string | ((element: Element) => any); 28 | } 29 | 30 | interface ReactHTMLElement extends DOMElement { 31 | ref: string | ((element: HTMLElement) => any); 32 | } 33 | 34 | interface ReactSVGElement extends DOMElement { 35 | ref: string | ((element: SVGElement) => any); 36 | } 37 | 38 | // 39 | // Factories 40 | // ---------------------------------------------------------------------- 41 | 42 | interface Factory

    { 43 | (props?: P, ...children: ReactNode[]): ReactElement

    ; 44 | } 45 | 46 | interface ClassicFactory

    extends Factory

    { 47 | (props?: P, ...children: ReactNode[]): ClassicElement

    ; 48 | } 49 | 50 | interface DOMFactory

    > extends Factory

    { 51 | (props?: P, ...children: ReactNode[]): DOMElement

    ; 52 | } 53 | 54 | type HTMLFactory = DOMFactory; 55 | type SVGFactory = DOMFactory; 56 | 57 | // 58 | // React Nodes 59 | // http://facebook.github.io/react/docs/glossary.html 60 | // ---------------------------------------------------------------------- 61 | 62 | type ReactText = string | number; 63 | type ReactChild = ReactElement | ReactText; 64 | 65 | // Should be Array but type aliases cannot be recursive 66 | type ReactFragment = {} | Array; 67 | type ReactNode = ReactChild | ReactFragment | boolean; 68 | 69 | // 70 | // Top Level API 71 | // ---------------------------------------------------------------------- 72 | 73 | function createClass(spec: ComponentSpec): ClassicComponentClass

    ; 74 | 75 | function createFactory

    (type: string): DOMFactory

    ; 76 | function createFactory

    (type: ClassicComponentClass

    ): ClassicFactory

    ; 77 | function createFactory

    (type: ComponentClass

    | StatelessComponent

    ): Factory

    ; 78 | 79 | function createElement

    ( 80 | type: string, 81 | props?: P, 82 | ...children: ReactNode[]): DOMElement

    ; 83 | function createElement

    ( 84 | type: ClassicComponentClass

    , 85 | props?: P, 86 | ...children: ReactNode[]): ClassicElement

    ; 87 | function createElement

    ( 88 | type: ComponentClass

    | StatelessComponent

    , 89 | props?: P, 90 | ...children: ReactNode[]): ReactElement

    ; 91 | 92 | function cloneElement

    ( 93 | element: DOMElement

    , 94 | props?: P, 95 | ...children: ReactNode[]): DOMElement

    ; 96 | function cloneElement

    ( 97 | element: ClassicElement

    , 98 | props?: P, 99 | ...children: ReactNode[]): ClassicElement

    ; 100 | function cloneElement

    ( 101 | element: ReactElement

    , 102 | props?: P, 103 | ...children: ReactNode[]): ReactElement

    ; 104 | 105 | function isValidElement(object: {}): boolean; 106 | 107 | var DOM: ReactDOM; 108 | var PropTypes: ReactPropTypes; 109 | var Children: ReactChildren; 110 | 111 | // 112 | // Component API 113 | // ---------------------------------------------------------------------- 114 | 115 | type ReactInstance = Component | Element; 116 | 117 | // Base component for plain JS classes 118 | class Component implements ComponentLifecycle { 119 | constructor(props?: P, context?: any); 120 | setState(f: (prevState: S, props: P) => S, callback?: () => any): void; 121 | setState(state: S, callback?: () => any): void; 122 | forceUpdate(callBack?: () => any): void; 123 | render(): JSX.Element; 124 | props: P; 125 | state: S; 126 | context: {}; 127 | refs: { 128 | [key: string]: ReactInstance 129 | }; 130 | } 131 | 132 | interface ClassicComponent extends Component { 133 | replaceState(nextState: S, callback?: () => any): void; 134 | isMounted(): boolean; 135 | getInitialState?(): S; 136 | } 137 | 138 | interface ChildContextProvider { 139 | getChildContext(): CC; 140 | } 141 | 142 | // 143 | // Class Interfaces 144 | // ---------------------------------------------------------------------- 145 | 146 | interface StatelessComponent

    { 147 | (props?: P, context?: any): ReactElement; 148 | propTypes?: ValidationMap

    ; 149 | contextTypes?: ValidationMap; 150 | defaultProps?: P; 151 | } 152 | 153 | interface ComponentClass

    { 154 | new(props?: P, context?: any): Component; 155 | propTypes?: ValidationMap

    ; 156 | contextTypes?: ValidationMap; 157 | childContextTypes?: ValidationMap; 158 | defaultProps?: P; 159 | } 160 | 161 | interface ClassicComponentClass

    extends ComponentClass

    { 162 | new(props?: P, context?: any): ClassicComponent; 163 | getDefaultProps?(): P; 164 | displayName?: string; 165 | } 166 | 167 | // 168 | // Component Specs and Lifecycle 169 | // ---------------------------------------------------------------------- 170 | 171 | interface ComponentLifecycle { 172 | componentWillMount?(): void; 173 | componentDidMount?(): void; 174 | componentWillReceiveProps?(nextProps: P, nextContext: any): void; 175 | shouldComponentUpdate?(nextProps: P, nextState: S, nextContext: any): boolean; 176 | componentWillUpdate?(nextProps: P, nextState: S, nextContext: any): void; 177 | componentDidUpdate?(prevProps: P, prevState: S, prevContext: any): void; 178 | componentWillUnmount?(): void; 179 | } 180 | 181 | interface Mixin extends ComponentLifecycle { 182 | mixins?: Mixin; 183 | statics?: { 184 | [key: string]: any; 185 | }; 186 | 187 | displayName?: string; 188 | propTypes?: ValidationMap; 189 | contextTypes?: ValidationMap; 190 | childContextTypes?: ValidationMap; 191 | 192 | getDefaultProps?(): P; 193 | getInitialState?(): S; 194 | } 195 | 196 | interface ComponentSpec extends Mixin { 197 | render(): ReactElement; 198 | 199 | [propertyName: string]: any; 200 | } 201 | 202 | // 203 | // Event System 204 | // ---------------------------------------------------------------------- 205 | 206 | interface SyntheticEvent { 207 | bubbles: boolean; 208 | cancelable: boolean; 209 | currentTarget: EventTarget; 210 | defaultPrevented: boolean; 211 | eventPhase: number; 212 | isTrusted: boolean; 213 | nativeEvent: Event; 214 | preventDefault(): void; 215 | stopPropagation(): void; 216 | target: EventTarget; 217 | timeStamp: Date; 218 | type: string; 219 | } 220 | 221 | interface ClipboardEvent extends SyntheticEvent { 222 | clipboardData: DataTransfer; 223 | } 224 | 225 | interface CompositionEvent extends SyntheticEvent { 226 | data: string; 227 | } 228 | 229 | interface DragEvent extends SyntheticEvent { 230 | dataTransfer: DataTransfer; 231 | } 232 | 233 | interface FocusEvent extends SyntheticEvent { 234 | relatedTarget: EventTarget; 235 | } 236 | 237 | interface FormEvent extends SyntheticEvent { 238 | } 239 | 240 | interface KeyboardEvent extends SyntheticEvent { 241 | altKey: boolean; 242 | charCode: number; 243 | ctrlKey: boolean; 244 | getModifierState(key: string): boolean; 245 | key: string; 246 | keyCode: number; 247 | locale: string; 248 | location: number; 249 | metaKey: boolean; 250 | repeat: boolean; 251 | shiftKey: boolean; 252 | which: number; 253 | } 254 | 255 | interface MouseEvent extends SyntheticEvent { 256 | altKey: boolean; 257 | button: number; 258 | buttons: number; 259 | clientX: number; 260 | clientY: number; 261 | ctrlKey: boolean; 262 | getModifierState(key: string): boolean; 263 | metaKey: boolean; 264 | pageX: number; 265 | pageY: number; 266 | relatedTarget: EventTarget; 267 | screenX: number; 268 | screenY: number; 269 | shiftKey: boolean; 270 | } 271 | 272 | interface TouchEvent extends SyntheticEvent { 273 | altKey: boolean; 274 | changedTouches: TouchList; 275 | ctrlKey: boolean; 276 | getModifierState(key: string): boolean; 277 | metaKey: boolean; 278 | shiftKey: boolean; 279 | targetTouches: TouchList; 280 | touches: TouchList; 281 | } 282 | 283 | interface UIEvent extends SyntheticEvent { 284 | detail: number; 285 | view: AbstractView; 286 | } 287 | 288 | interface WheelEvent extends SyntheticEvent { 289 | deltaMode: number; 290 | deltaX: number; 291 | deltaY: number; 292 | deltaZ: number; 293 | } 294 | 295 | // 296 | // Event Handler Types 297 | // ---------------------------------------------------------------------- 298 | 299 | interface EventHandler { 300 | (event: E): void; 301 | } 302 | 303 | type ReactEventHandler = EventHandler; 304 | 305 | type ClipboardEventHandler = EventHandler; 306 | type CompositionEventHandler = EventHandler; 307 | type DragEventHandler = EventHandler; 308 | type FocusEventHandler = EventHandler; 309 | type FormEventHandler = EventHandler; 310 | type KeyboardEventHandler = EventHandler; 311 | type MouseEventHandler = EventHandler; 312 | type TouchEventHandler = EventHandler; 313 | type UIEventHandler = EventHandler; 314 | type WheelEventHandler = EventHandler; 315 | 316 | // 317 | // Props / DOM Attributes 318 | // ---------------------------------------------------------------------- 319 | 320 | interface Props { 321 | children?: ReactNode; 322 | key?: string | number; 323 | ref?: string | ((component: T) => any); 324 | } 325 | 326 | interface HTMLProps extends HTMLAttributes, Props { 327 | styleName?: string; 328 | } 329 | 330 | interface SVGProps extends SVGAttributes, Props { 331 | } 332 | 333 | interface DOMAttributes { 334 | dangerouslySetInnerHTML?: { 335 | __html: string; 336 | }; 337 | 338 | // Clipboard Events 339 | onCopy?: ClipboardEventHandler; 340 | onCut?: ClipboardEventHandler; 341 | onPaste?: ClipboardEventHandler; 342 | 343 | // Composition Events 344 | onCompositionEnd?: CompositionEventHandler; 345 | onCompositionStart?: CompositionEventHandler; 346 | onCompositionUpdate?: CompositionEventHandler; 347 | 348 | // Focus Events 349 | onFocus?: FocusEventHandler; 350 | onBlur?: FocusEventHandler; 351 | 352 | // Form Events 353 | onChange?: FormEventHandler; 354 | onInput?: FormEventHandler; 355 | onSubmit?: FormEventHandler; 356 | 357 | // Image Events 358 | onLoad?: ReactEventHandler; 359 | onError?: ReactEventHandler; // also a Media Event 360 | 361 | // Keyboard Events 362 | onKeyDown?: KeyboardEventHandler; 363 | onKeyPress?: KeyboardEventHandler; 364 | onKeyUp?: KeyboardEventHandler; 365 | 366 | // Media Events 367 | onAbort?: ReactEventHandler; 368 | onCanPlay?: ReactEventHandler; 369 | onCanPlayThrough?: ReactEventHandler; 370 | onDurationChange?: ReactEventHandler; 371 | onEmptied?: ReactEventHandler; 372 | onEncrypted?: ReactEventHandler; 373 | onEnded?: ReactEventHandler; 374 | onLoadedData?: ReactEventHandler; 375 | onLoadedMetadata?: ReactEventHandler; 376 | onLoadStart?: ReactEventHandler; 377 | onPause?: ReactEventHandler; 378 | onPlay?: ReactEventHandler; 379 | onPlaying?: ReactEventHandler; 380 | onProgress?: ReactEventHandler; 381 | onRateChange?: ReactEventHandler; 382 | onSeeked?: ReactEventHandler; 383 | onSeeking?: ReactEventHandler; 384 | onStalled?: ReactEventHandler; 385 | onSuspend?: ReactEventHandler; 386 | onTimeUpdate?: ReactEventHandler; 387 | onVolumeChange?: ReactEventHandler; 388 | onWaiting?: ReactEventHandler; 389 | 390 | // MouseEvents 391 | onClick?: MouseEventHandler; 392 | onContextMenu?: MouseEventHandler; 393 | onDoubleClick?: MouseEventHandler; 394 | onDrag?: DragEventHandler; 395 | onDragEnd?: DragEventHandler; 396 | onDragEnter?: DragEventHandler; 397 | onDragExit?: DragEventHandler; 398 | onDragLeave?: DragEventHandler; 399 | onDragOver?: DragEventHandler; 400 | onDragStart?: DragEventHandler; 401 | onDrop?: DragEventHandler; 402 | onMouseDown?: MouseEventHandler; 403 | onMouseEnter?: MouseEventHandler; 404 | onMouseLeave?: MouseEventHandler; 405 | onMouseMove?: MouseEventHandler; 406 | onMouseOut?: MouseEventHandler; 407 | onMouseOver?: MouseEventHandler; 408 | onMouseUp?: MouseEventHandler; 409 | 410 | // Selection Events 411 | onSelect?: ReactEventHandler; 412 | 413 | // Touch Events 414 | onTouchCancel?: TouchEventHandler; 415 | onTouchEnd?: TouchEventHandler; 416 | onTouchMove?: TouchEventHandler; 417 | onTouchStart?: TouchEventHandler; 418 | 419 | // UI Events 420 | onScroll?: UIEventHandler; 421 | 422 | // Wheel Events 423 | onWheel?: WheelEventHandler; 424 | } 425 | 426 | // This interface is not complete. Only properties accepting 427 | // unitless numbers are listed here (see CSSProperty.js in React) 428 | interface CSSProperties { 429 | boxFlex?: number; 430 | boxFlexGroup?: number; 431 | columnCount?: number; 432 | flex?: number | string; 433 | flexGrow?: number; 434 | flexShrink?: number; 435 | fontWeight?: number | string; 436 | lineClamp?: number; 437 | lineHeight?: number | string; 438 | opacity?: number; 439 | order?: number; 440 | orphans?: number; 441 | widows?: number; 442 | zIndex?: number; 443 | zoom?: number; 444 | 445 | fontSize?: number | string; 446 | 447 | // SVG-related properties 448 | fillOpacity?: number; 449 | strokeOpacity?: number; 450 | strokeWidth?: number; 451 | 452 | // Remaining properties auto-extracted from http://docs.webplatform.org. 453 | // License: http://docs.webplatform.org/wiki/Template:CC-by-3.0 454 | /** 455 | * Aligns a flex container's lines within the flex container when there is extra space in the cross-axis, similar to how justify-content aligns individual items within the main-axis. 456 | */ 457 | alignContent?: any; 458 | 459 | /** 460 | * Sets the default alignment in the cross axis for all of the flex container's items, including anonymous flex items, similarly to how justify-content aligns items along the main axis. 461 | */ 462 | alignItems?: any; 463 | 464 | /** 465 | * Allows the default alignment to be overridden for individual flex items. 466 | */ 467 | alignSelf?: any; 468 | 469 | /** 470 | * This property allows precise alignment of elements, such as graphics, that do not have a baseline-table or lack the desired baseline in their baseline-table. With the alignment-adjust property, the position of the baseline identified by the alignment-baseline can be explicitly determined. It also determines precisely the alignment point for each glyph within a textual element. 471 | */ 472 | alignmentAdjust?: any; 473 | 474 | alignmentBaseline?: any; 475 | 476 | /** 477 | * Defines a length of time to elapse before an animation starts, allowing an animation to begin execution some time after it is applied. 478 | */ 479 | animationDelay?: any; 480 | 481 | /** 482 | * Defines whether an animation should run in reverse on some or all cycles. 483 | */ 484 | animationDirection?: any; 485 | 486 | /** 487 | * Specifies how many times an animation cycle should play. 488 | */ 489 | animationIterationCount?: any; 490 | 491 | /** 492 | * Defines the list of animations that apply to the element. 493 | */ 494 | animationName?: any; 495 | 496 | /** 497 | * Defines whether an animation is running or paused. 498 | */ 499 | animationPlayState?: any; 500 | 501 | /** 502 | * Allows changing the style of any element to platform-based interface elements or vice versa. 503 | */ 504 | appearance?: any; 505 | 506 | /** 507 | * Determines whether or not the “back” side of a transformed element is visible when facing the viewer. 508 | */ 509 | backfaceVisibility?: any; 510 | 511 | /** 512 | * This property describes how the element's background images should blend with each other and the element's background color. 513 | * The value is a list of blend modes that corresponds to each background image. Each element in the list will apply to the corresponding element of background-image. If a property doesn’t have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough. 514 | */ 515 | backgroundBlendMode?: any; 516 | 517 | backgroundComposite?: any; 518 | 519 | /** 520 | * Applies one or more background images to an element. These can be any valid CSS image, including url() paths to image files or CSS gradients. 521 | */ 522 | backgroundImage?: any; 523 | 524 | /** 525 | * Specifies what the background-position property is relative to. 526 | */ 527 | backgroundOrigin?: any; 528 | 529 | /** 530 | * Sets the horizontal position of a background image. 531 | */ 532 | backgroundPositionX?: any; 533 | 534 | /** 535 | * Background-repeat defines if and how background images will be repeated after they have been sized and positioned 536 | */ 537 | backgroundRepeat?: any; 538 | 539 | /** 540 | * Obsolete - spec retired, not implemented. 541 | */ 542 | baselineShift?: any; 543 | 544 | /** 545 | * Non standard. Sets or retrieves the location of the Dynamic HTML (DHTML) behavior. 546 | */ 547 | behavior?: any; 548 | 549 | /** 550 | * Shorthand property that defines the different properties of all four sides of an element's border in a single declaration. It can be used to set border-width, border-style and border-color, or a subset of these. 551 | */ 552 | border?: any; 553 | 554 | /** 555 | * Defines the shape of the border of the bottom-left corner. 556 | */ 557 | borderBottomLeftRadius?: any; 558 | 559 | /** 560 | * Defines the shape of the border of the bottom-right corner. 561 | */ 562 | borderBottomRightRadius?: any; 563 | 564 | /** 565 | * Sets the width of an element's bottom border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. 566 | */ 567 | borderBottomWidth?: any; 568 | 569 | /** 570 | * Border-collapse can be used for collapsing the borders between table cells 571 | */ 572 | borderCollapse?: any; 573 | 574 | /** 575 | * The CSS border-color property sets the color of an element's four borders. This property can have from one to four values, made up of the elementary properties: • border-top-color 576 | * • border-right-color 577 | * • border-bottom-color 578 | * • border-left-color The default color is the currentColor of each of these values. 579 | * If you provide one value, it sets the color for the element. Two values set the horizontal and vertical values, respectively. Providing three values sets the top, vertical, and bottom values, in that order. Four values set all for sides: top, right, bottom, and left, in that order. 580 | */ 581 | borderColor?: any; 582 | 583 | /** 584 | * Specifies different corner clipping effects, such as scoop (inner curves), bevel (straight cuts) or notch (cut-off rectangles). Works along with border-radius to specify the size of each corner effect. 585 | */ 586 | borderCornerShape?: any; 587 | 588 | /** 589 | * The property border-image-source is used to set the image to be used instead of the border style. If this is set to none the border-style is used instead. 590 | */ 591 | borderImageSource?: any; 592 | 593 | /** 594 | * The border-image-width CSS property defines the offset to use for dividing the border image in nine parts, the top-left corner, central top edge, top-right-corner, central right edge, bottom-right corner, central bottom edge, bottom-left corner, and central right edge. They represent inward distance from the top, right, bottom, and left edges. 595 | */ 596 | borderImageWidth?: any; 597 | 598 | /** 599 | * Shorthand property that defines the border-width, border-style and border-color of an element's left border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the left border — border-left-width, border-left-style and border-left-color. 600 | */ 601 | borderLeft?: any; 602 | 603 | /** 604 | * The CSS border-left-color property sets the color of an element's left border. This page explains the border-left-color value, but often you will find it more convenient to fix the border's left color as part of a shorthand set, either border-left or border-color. 605 | * Colors can be defined several ways. For more information, see Usage. 606 | */ 607 | borderLeftColor?: any; 608 | 609 | /** 610 | * Sets the style of an element's left border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. 611 | */ 612 | borderLeftStyle?: any; 613 | 614 | /** 615 | * Sets the width of an element's left border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. 616 | */ 617 | borderLeftWidth?: any; 618 | 619 | /** 620 | * Shorthand property that defines the border-width, border-style and border-color of an element's right border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the right border — border-right-width, border-right-style and border-right-color. 621 | */ 622 | borderRight?: any; 623 | 624 | /** 625 | * Sets the color of an element's right border. This page explains the border-right-color value, but often you will find it more convenient to fix the border's right color as part of a shorthand set, either border-right or border-color. 626 | * Colors can be defined several ways. For more information, see Usage. 627 | */ 628 | borderRightColor?: any; 629 | 630 | /** 631 | * Sets the style of an element's right border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. 632 | */ 633 | borderRightStyle?: any; 634 | 635 | /** 636 | * Sets the width of an element's right border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. 637 | */ 638 | borderRightWidth?: any; 639 | 640 | /** 641 | * Specifies the distance between the borders of adjacent cells. 642 | */ 643 | borderSpacing?: any; 644 | 645 | /** 646 | * Sets the style of an element's four borders. This property can have from one to four values. With only one value, the value will be applied to all four borders; otherwise, this works as a shorthand property for each of border-top-style, border-right-style, border-bottom-style, border-left-style, where each border style may be assigned a separate value. 647 | */ 648 | borderStyle?: any; 649 | 650 | /** 651 | * Shorthand property that defines the border-width, border-style and border-color of an element's top border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the top border — border-top-width, border-top-style and border-top-color. 652 | */ 653 | borderTop?: any; 654 | 655 | /** 656 | * Sets the color of an element's top border. This page explains the border-top-color value, but often you will find it more convenient to fix the border's top color as part of a shorthand set, either border-top or border-color. 657 | * Colors can be defined several ways. For more information, see Usage. 658 | */ 659 | borderTopColor?: any; 660 | 661 | /** 662 | * Sets the rounding of the top-left corner of the element. 663 | */ 664 | borderTopLeftRadius?: any; 665 | 666 | /** 667 | * Sets the rounding of the top-right corner of the element. 668 | */ 669 | borderTopRightRadius?: any; 670 | 671 | /** 672 | * Sets the style of an element's top border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. 673 | */ 674 | borderTopStyle?: any; 675 | 676 | /** 677 | * Sets the width of an element's top border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. 678 | */ 679 | borderTopWidth?: any; 680 | 681 | /** 682 | * Sets the width of an element's four borders. This property can have from one to four values. This is a shorthand property for setting values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. 683 | */ 684 | borderWidth?: any; 685 | 686 | /** 687 | * Obsolete. 688 | */ 689 | boxAlign?: any; 690 | 691 | /** 692 | * Breaks a box into fragments creating new borders, padding and repeating backgrounds or lets it stay as a continuous box on a page break, column break, or, for inline elements, at a line break. 693 | */ 694 | boxDecorationBreak?: any; 695 | 696 | /** 697 | * Deprecated 698 | */ 699 | boxDirection?: any; 700 | 701 | /** 702 | * Do not use. This property has been replaced by the flex-wrap property. 703 | * Gets or sets a value that specifies the direction to add successive rows or columns when the value of box-lines is set to multiple. 704 | */ 705 | boxLineProgression?: any; 706 | 707 | /** 708 | * Do not use. This property has been replaced by the flex-wrap property. 709 | * Gets or sets a value that specifies whether child elements wrap onto multiple lines or columns based on the space available in the object. 710 | */ 711 | boxLines?: any; 712 | 713 | /** 714 | * Do not use. This property has been replaced by flex-order. 715 | * Specifies the ordinal group that a child element of the object belongs to. This ordinal value identifies the display order (along the axis defined by the box-orient property) for the group. 716 | */ 717 | boxOrdinalGroup?: any; 718 | 719 | /** 720 | * The CSS break-after property allows you to force a break on multi-column layouts. More specifically, it allows you to force a break after an element. It allows you to determine if a break should occur, and what type of break it should be. The break-after CSS property describes how the page, column or region break behaves after the generated box. If there is no generated box, the property is ignored. 721 | */ 722 | breakAfter?: any; 723 | 724 | /** 725 | * Control page/column/region breaks that fall above a block of content 726 | */ 727 | breakBefore?: any; 728 | 729 | /** 730 | * Control page/column/region breaks that fall within a block of content 731 | */ 732 | breakInside?: any; 733 | 734 | /** 735 | * The clear CSS property specifies if an element can be positioned next to or must be positioned below the floating elements that precede it in the markup. 736 | */ 737 | clear?: any; 738 | 739 | /** 740 | * Deprecated; see clip-path. 741 | * Lets you specify the dimensions of an absolutely positioned element that should be visible, and the element is clipped into this shape, and displayed. 742 | */ 743 | clip?: any; 744 | 745 | /** 746 | * Clipping crops an graphic, so that only a portion of the graphic is rendered, or filled. This clip-rule property, when used with the clip-path property, defines which clip rule, or algorithm, to use when filling the different parts of a graphics. 747 | */ 748 | clipRule?: any; 749 | 750 | /** 751 | * The color property sets the color of an element's foreground content (usually text), accepting any standard CSS color from keywords and hex values to RGB(a) and HSL(a). 752 | */ 753 | color?: any; 754 | 755 | /** 756 | * Specifies how to fill columns (balanced or sequential). 757 | */ 758 | columnFill?: any; 759 | 760 | /** 761 | * The column-gap property controls the width of the gap between columns in multi-column elements. 762 | */ 763 | columnGap?: any; 764 | 765 | /** 766 | * Sets the width, style, and color of the rule between columns. 767 | */ 768 | columnRule?: any; 769 | 770 | /** 771 | * Specifies the color of the rule between columns. 772 | */ 773 | columnRuleColor?: any; 774 | 775 | /** 776 | * Specifies the width of the rule between columns. 777 | */ 778 | columnRuleWidth?: any; 779 | 780 | /** 781 | * The column-span CSS property makes it possible for an element to span across all columns when its value is set to all. An element that spans more than one column is called a spanning element. 782 | */ 783 | columnSpan?: any; 784 | 785 | /** 786 | * Specifies the width of columns in multi-column elements. 787 | */ 788 | columnWidth?: any; 789 | 790 | /** 791 | * This property is a shorthand property for setting column-width and/or column-count. 792 | */ 793 | columns?: any; 794 | 795 | /** 796 | * The counter-increment property accepts one or more names of counters (identifiers), each one optionally followed by an integer which specifies the value by which the counter should be incremented (e.g. if the value is 2, the counter increases by 2 each time it is invoked). 797 | */ 798 | counterIncrement?: any; 799 | 800 | /** 801 | * The counter-reset property contains a list of one or more names of counters, each one optionally followed by an integer (otherwise, the integer defaults to 0.) Each time the given element is invoked, the counters specified by the property are set to the given integer. 802 | */ 803 | counterReset?: any; 804 | 805 | /** 806 | * The cue property specifies sound files (known as an "auditory icon") to be played by speech media agents before and after presenting an element's content; if only one file is specified, it is played both before and after. The volume at which the file(s) should be played, relative to the volume of the main element, may also be specified. The icon files may also be set separately with the cue-before and cue-after properties. 807 | */ 808 | cue?: any; 809 | 810 | /** 811 | * The cue-after property specifies a sound file (known as an "auditory icon") to be played by speech media agents after presenting an element's content; the volume at which the file should be played may also be specified. The shorthand property cue sets cue sounds for both before and after the element is presented. 812 | */ 813 | cueAfter?: any; 814 | 815 | /** 816 | * The direction CSS property specifies the text direction/writing direction. The rtl is used for Hebrew or Arabic text, the ltr is for other languages. 817 | */ 818 | direction?: any; 819 | 820 | /** 821 | * This property specifies the type of rendering box used for an element. It is a shorthand property for many other display properties. 822 | */ 823 | display?: any; 824 | 825 | /** 826 | * The ‘fill’ property paints the interior of the given graphical element. The area to be painted consists of any areas inside the outline of the shape. To determine the inside of the shape, all subpaths are considered, and the interior is determined according to the rules associated with the current value of the ‘fill-rule’ property. The zero-width geometric outline of a shape is included in the area to be painted. 827 | */ 828 | fill?: any; 829 | 830 | /** 831 | * The ‘fill-rule’ property indicates the algorithm which is to be used to determine what parts of the canvas are included inside the shape. For a simple, non-intersecting path, it is intuitively clear what region lies "inside"; however, for a more complex path, such as a path that intersects itself or where one subpath encloses another, the interpretation of "inside" is not so obvious. 832 | * The ‘fill-rule’ property provides two options for how the inside of a shape is determined: 833 | */ 834 | fillRule?: any; 835 | 836 | /** 837 | * Applies various image processing effects. This property is largely unsupported. See Compatibility section for more information. 838 | */ 839 | filter?: any; 840 | 841 | /** 842 | * Obsolete, do not use. This property has been renamed to align-items. 843 | * Specifies the alignment (perpendicular to the layout axis defined by the flex-direction property) of child elements of the object. 844 | */ 845 | flexAlign?: any; 846 | 847 | /** 848 | * The flex-basis CSS property describes the initial main size of the flex item before any free space is distributed according to the flex factors described in the flex property (flex-grow and flex-shrink). 849 | */ 850 | flexBasis?: any; 851 | 852 | /** 853 | * The flex-direction CSS property describes how flex items are placed in the flex container, by setting the direction of the flex container's main axis. 854 | */ 855 | flexDirection?: any; 856 | 857 | /** 858 | * The flex-flow CSS property defines the flex container's main and cross axis. It is a shorthand property for the flex-direction and flex-wrap properties. 859 | */ 860 | flexFlow?: any; 861 | 862 | /** 863 | * Do not use. This property has been renamed to align-self 864 | * Specifies the alignment (perpendicular to the layout axis defined by flex-direction) of child elements of the object. 865 | */ 866 | flexItemAlign?: any; 867 | 868 | /** 869 | * Do not use. This property has been renamed to align-content. 870 | * Specifies how a flexbox's lines align within the flexbox when there is extra space along the axis that is perpendicular to the axis defined by the flex-direction property. 871 | */ 872 | flexLinePack?: any; 873 | 874 | /** 875 | * Gets or sets a value that specifies the ordinal group that a flexbox element belongs to. This ordinal value identifies the display order for the group. 876 | */ 877 | flexOrder?: any; 878 | 879 | /** 880 | * Elements which have the style float are floated horizontally. These elements can move as far to the left or right of the containing element. All elements after the floating element will flow around it, but elements before the floating element are not impacted. If several floating elements are placed after each other, they will float next to each other as long as there is room. 881 | */ 882 | float?: any; 883 | 884 | /** 885 | * Flows content from a named flow (specified by a corresponding flow-into) through selected elements to form a dynamic chain of layout regions. 886 | */ 887 | flowFrom?: any; 888 | 889 | /** 890 | * The font property is shorthand that allows you to do one of two things: you can either set up six of the most mature font properties in one line, or you can set one of a choice of keywords to adopt a system font setting. 891 | */ 892 | font?: any; 893 | 894 | /** 895 | * The font-family property allows one or more font family names and/or generic family names to be specified for usage on the selected element(s)' text. The browser then goes through the list; for each character in the selection it applies the first font family that has an available glyph for that character. 896 | */ 897 | fontFamily?: any; 898 | 899 | /** 900 | * The font-kerning property allows contextual adjustment of inter-glyph spacing, i.e. the spaces between the characters in text. This property controls metric kerning - that utilizes adjustment data contained in the font. Optical Kerning is not supported as yet. 901 | */ 902 | fontKerning?: any; 903 | 904 | /** 905 | * The font-size-adjust property adjusts the font-size of the fallback fonts defined with font-family, so that the x-height is the same no matter what font is used. This preserves the readability of the text when fallback happens. 906 | */ 907 | fontSizeAdjust?: any; 908 | 909 | /** 910 | * Allows you to expand or condense the widths for a normal, condensed, or expanded font face. 911 | */ 912 | fontStretch?: any; 913 | 914 | /** 915 | * The font-style property allows normal, italic, or oblique faces to be selected. Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face. Oblique faces can be simulated by artificially sloping the glyphs of the regular face. 916 | */ 917 | fontStyle?: any; 918 | 919 | /** 920 | * This value specifies whether the user agent is allowed to synthesize bold or oblique font faces when a font family lacks bold or italic faces. 921 | */ 922 | fontSynthesis?: any; 923 | 924 | /** 925 | * The font-variant property enables you to select the small-caps font within a font family. 926 | */ 927 | fontVariant?: any; 928 | 929 | /** 930 | * Fonts can provide alternate glyphs in addition to default glyph for a character. This property provides control over the selection of these alternate glyphs. 931 | */ 932 | fontVariantAlternates?: any; 933 | 934 | /** 935 | * Lays out one or more grid items bound by 4 grid lines. Shorthand for setting grid-column-start, grid-column-end, grid-row-start, and grid-row-end in a single declaration. 936 | */ 937 | gridArea?: any; 938 | 939 | /** 940 | * Controls a grid item's placement in a grid area, particularly grid position and a grid span. Shorthand for setting grid-column-start and grid-column-end in a single declaration. 941 | */ 942 | gridColumn?: any; 943 | 944 | /** 945 | * Controls a grid item's placement in a grid area as well as grid position and a grid span. The grid-column-end property (with grid-row-start, grid-row-end, and grid-column-start) determines a grid item's placement by specifying the grid lines of a grid item's grid area. 946 | */ 947 | gridColumnEnd?: any; 948 | 949 | /** 950 | * Determines a grid item's placement by specifying the starting grid lines of a grid item's grid area . A grid item's placement in a grid area consists of a grid position and a grid span. See also ( grid-row-start, grid-row-end, and grid-column-end) 951 | */ 952 | gridColumnStart?: any; 953 | 954 | /** 955 | * Gets or sets a value that indicates which row an element within a Grid should appear in. Shorthand for setting grid-row-start and grid-row-end in a single declaration. 956 | */ 957 | gridRow?: any; 958 | 959 | /** 960 | * Determines a grid item’s placement by specifying the block-end. A grid item's placement in a grid area consists of a grid position and a grid span. The grid-row-end property (with grid-row-start, grid-column-start, and grid-column-end) determines a grid item's placement by specifying the grid lines of a grid item's grid area. 961 | */ 962 | gridRowEnd?: any; 963 | 964 | /** 965 | * Specifies a row position based upon an integer location, string value, or desired row size. 966 | * css/properties/grid-row is used as short-hand for grid-row-position and grid-row-position 967 | */ 968 | gridRowPosition?: any; 969 | 970 | gridRowSpan?: any; 971 | 972 | /** 973 | * Specifies named grid areas which are not associated with any particular grid item, but can be referenced from the grid-placement properties. The syntax of the grid-template-areas property also provides a visualization of the structure of the grid, making the overall layout of the grid container easier to understand. 974 | */ 975 | gridTemplateAreas?: any; 976 | 977 | /** 978 | * Specifies (with grid-template-rows) the line names and track sizing functions of the grid. Each sizing function can be specified as a length, a percentage of the grid container’s size, a measurement of the contents occupying the column or row, or a fraction of the free space in the grid. 979 | */ 980 | gridTemplateColumns?: any; 981 | 982 | /** 983 | * Specifies (with grid-template-columns) the line names and track sizing functions of the grid. Each sizing function can be specified as a length, a percentage of the grid container’s size, a measurement of the contents occupying the column or row, or a fraction of the free space in the grid. 984 | */ 985 | gridTemplateRows?: any; 986 | 987 | /** 988 | * Sets the height of an element. The content area of the element height does not include the padding, border, and margin of the element. 989 | */ 990 | height?: any; 991 | 992 | minHeight?: any; 993 | 994 | /** 995 | * Specifies the minimum number of characters in a hyphenated word 996 | */ 997 | hyphenateLimitChars?: any; 998 | 999 | /** 1000 | * Indicates the maximum number of successive hyphenated lines in an element. The ‘no-limit’ value means that there is no limit. 1001 | */ 1002 | hyphenateLimitLines?: any; 1003 | 1004 | /** 1005 | * Specifies the maximum amount of trailing whitespace (before justification) that may be left in a line before hyphenation is triggered to pull part of a word from the next line back up into the current one. 1006 | */ 1007 | hyphenateLimitZone?: any; 1008 | 1009 | /** 1010 | * Specifies whether or not words in a sentence can be split by the use of a manual or automatic hyphenation mechanism. 1011 | */ 1012 | hyphens?: any; 1013 | 1014 | imeMode?: any; 1015 | 1016 | layoutGrid?: any; 1017 | 1018 | layoutGridChar?: any; 1019 | 1020 | layoutGridLine?: any; 1021 | 1022 | layoutGridMode?: any; 1023 | 1024 | layoutGridType?: any; 1025 | 1026 | /** 1027 | * Sets the left edge of an element 1028 | */ 1029 | left?: any; 1030 | 1031 | /** 1032 | * The letter-spacing CSS property specifies the spacing behavior between text characters. 1033 | */ 1034 | letterSpacing?: any; 1035 | 1036 | /** 1037 | * Deprecated. Gets or sets line-breaking rules for text in selected languages such as Japanese, Chinese, and Korean. 1038 | */ 1039 | lineBreak?: any; 1040 | 1041 | /** 1042 | * Shorthand property that sets the list-style-type, list-style-position and list-style-image properties in one declaration. 1043 | */ 1044 | listStyle?: any; 1045 | 1046 | /** 1047 | * This property sets the image that will be used as the list item marker. When the image is available, it will replace the marker set with the 'list-style-type' marker. That also means that if the image is not available, it will show the style specified by list-style-property 1048 | */ 1049 | listStyleImage?: any; 1050 | 1051 | /** 1052 | * Specifies if the list-item markers should appear inside or outside the content flow. 1053 | */ 1054 | listStylePosition?: any; 1055 | 1056 | /** 1057 | * Specifies the type of list-item marker in a list. 1058 | */ 1059 | listStyleType?: any; 1060 | 1061 | /** 1062 | * The margin property is shorthand to allow you to set all four margins of an element at once. Its equivalent longhand properties are margin-top, margin-right, margin-bottom and margin-left. Negative values are also allowed. 1063 | */ 1064 | margin?: any; 1065 | 1066 | /** 1067 | * margin-bottom sets the bottom margin of an element. 1068 | */ 1069 | marginBottom?: any; 1070 | 1071 | /** 1072 | * margin-left sets the left margin of an element. 1073 | */ 1074 | marginLeft?: any; 1075 | 1076 | /** 1077 | * margin-right sets the right margin of an element. 1078 | */ 1079 | marginRight?: any; 1080 | 1081 | /** 1082 | * margin-top sets the top margin of an element. 1083 | */ 1084 | marginTop?: any; 1085 | 1086 | /** 1087 | * The marquee-direction determines the initial direction in which the marquee content moves. 1088 | */ 1089 | marqueeDirection?: any; 1090 | 1091 | /** 1092 | * The 'marquee-style' property determines a marquee's scrolling behavior. 1093 | */ 1094 | marqueeStyle?: any; 1095 | 1096 | /** 1097 | * This property is shorthand for setting mask-image, mask-mode, mask-repeat, mask-position, mask-clip, mask-origin, mask-composite and mask-size. Omitted values are set to their original properties' initial values. 1098 | */ 1099 | mask?: any; 1100 | 1101 | /** 1102 | * This property is shorthand for setting mask-border-source, mask-border-slice, mask-border-width, mask-border-outset, and mask-border-repeat. Omitted values are set to their original properties' initial values. 1103 | */ 1104 | maskBorder?: any; 1105 | 1106 | /** 1107 | * This property specifies how the images for the sides and the middle part of the mask image are scaled and tiled. The first keyword applies to the horizontal sides, the second one applies to the vertical ones. If the second keyword is absent, it is assumed to be the same as the first, similar to the CSS border-image-repeat property. 1108 | */ 1109 | maskBorderRepeat?: any; 1110 | 1111 | /** 1112 | * This property specifies inward offsets from the top, right, bottom, and left edges of the mask image, dividing it into nine regions: four corners, four edges, and a middle. The middle image part is discarded and treated as fully transparent black unless the fill keyword is present. The four values set the top, right, bottom and left offsets in that order, similar to the CSS border-image-slice property. 1113 | */ 1114 | maskBorderSlice?: any; 1115 | 1116 | /** 1117 | * Specifies an image to be used as a mask. An image that is empty, fails to download, is non-existent, or cannot be displayed is ignored and does not mask the element. 1118 | */ 1119 | maskBorderSource?: any; 1120 | 1121 | /** 1122 | * This property sets the width of the mask box image, similar to the CSS border-image-width property. 1123 | */ 1124 | maskBorderWidth?: any; 1125 | 1126 | /** 1127 | * Determines the mask painting area, which defines the area that is affected by the mask. The painted content of an element may be restricted to this area. 1128 | */ 1129 | maskClip?: any; 1130 | 1131 | /** 1132 | * For elements rendered as a single box, specifies the mask positioning area. For elements rendered as multiple boxes (e.g., inline boxes on several lines, boxes on several pages) specifies which boxes box-decoration-break operates on to determine the mask positioning area(s). 1133 | */ 1134 | maskOrigin?: any; 1135 | 1136 | /** 1137 | * This property must not be used. It is no longer included in any standard or standard track specification, nor is it implemented in any browser. It is only used when the text-align-last property is set to size. It controls allowed adjustments of font-size to fit line content. 1138 | */ 1139 | maxFontSize?: any; 1140 | 1141 | /** 1142 | * Sets the maximum height for an element. It prevents the height of the element to exceed the specified value. If min-height is specified and is greater than max-height, max-height is overridden. 1143 | */ 1144 | maxHeight?: any; 1145 | 1146 | /** 1147 | * Sets the maximum width for an element. It limits the width property to be larger than the value specified in max-width. 1148 | */ 1149 | maxWidth?: any; 1150 | 1151 | /** 1152 | * Sets the minimum width of an element. It limits the width property to be not smaller than the value specified in min-width. 1153 | */ 1154 | minWidth?: any; 1155 | 1156 | /** 1157 | * The CSS outline property is a shorthand property for setting one or more of the individual outline properties outline-style, outline-width and outline-color in a single rule. In most cases the use of this shortcut is preferable and more convenient. 1158 | * Outlines differ from borders in the following ways: • Outlines do not take up space, they are drawn above the content. 1159 | * • Outlines may be non-rectangular. They are rectangular in Gecko/Firefox. Internet Explorer attempts to place the smallest contiguous outline around all elements or shapes that are indicated to have an outline. Opera draws a non-rectangular shape around a construct. 1160 | */ 1161 | outline?: any; 1162 | 1163 | /** 1164 | * The outline-color property sets the color of the outline of an element. An outline is a line that is drawn around elements, outside the border edge, to make the element stand out. 1165 | */ 1166 | outlineColor?: any; 1167 | 1168 | /** 1169 | * The outline-offset property offsets the outline and draw it beyond the border edge. 1170 | */ 1171 | outlineOffset?: any; 1172 | 1173 | /** 1174 | * The overflow property controls how extra content exceeding the bounding box of an element is rendered. It can be used in conjunction with an element that has a fixed width and height, to eliminate text-induced page distortion. 1175 | */ 1176 | overflow?: any; 1177 | 1178 | /** 1179 | * Specifies the preferred scrolling methods for elements that overflow. 1180 | */ 1181 | overflowStyle?: any; 1182 | 1183 | /** 1184 | * The overflow-x property is a specific case of the generic overflow property. It controls how extra content exceeding the x-axis of the bounding box of an element is rendered. 1185 | */ 1186 | overflowX?: any; 1187 | 1188 | /** 1189 | * The padding optional CSS property sets the required padding space on one to four sides of an element. The padding area is the space between an element and its border. Negative values are not allowed but decimal values are permitted. The element size is treated as fixed, and the content of the element shifts toward the center as padding is increased. 1190 | * The padding property is a shorthand to avoid setting each side separately (padding-top, padding-right, padding-bottom, padding-left). 1191 | */ 1192 | padding?: any; 1193 | 1194 | /** 1195 | * The padding-bottom CSS property of an element sets the padding space required on the bottom of an element. The padding area is the space between the content of the element and its border. Contrary to margin-bottom values, negative values of padding-bottom are invalid. 1196 | */ 1197 | paddingBottom?: any; 1198 | 1199 | /** 1200 | * The padding-left CSS property of an element sets the padding space required on the left side of an element. The padding area is the space between the content of the element and its border. Contrary to margin-left values, negative values of padding-left are invalid. 1201 | */ 1202 | paddingLeft?: any; 1203 | 1204 | /** 1205 | * The padding-right CSS property of an element sets the padding space required on the right side of an element. The padding area is the space between the content of the element and its border. Contrary to margin-right values, negative values of padding-right are invalid. 1206 | */ 1207 | paddingRight?: any; 1208 | 1209 | /** 1210 | * The padding-top CSS property of an element sets the padding space required on the top of an element. The padding area is the space between the content of the element and its border. Contrary to margin-top values, negative values of padding-top are invalid. 1211 | */ 1212 | paddingTop?: any; 1213 | 1214 | /** 1215 | * The page-break-after property is supported in all major browsers. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. 1216 | */ 1217 | pageBreakAfter?: any; 1218 | 1219 | /** 1220 | * The page-break-before property sets the page-breaking behavior before an element. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. 1221 | */ 1222 | pageBreakBefore?: any; 1223 | 1224 | /** 1225 | * Sets the page-breaking behavior inside an element. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. 1226 | */ 1227 | pageBreakInside?: any; 1228 | 1229 | /** 1230 | * The pause property determines how long a speech media agent should pause before and after presenting an element. It is a shorthand for the pause-before and pause-after properties. 1231 | */ 1232 | pause?: any; 1233 | 1234 | /** 1235 | * The pause-after property determines how long a speech media agent should pause after presenting an element. It may be replaced by the shorthand property pause, which sets pause time before and after. 1236 | */ 1237 | pauseAfter?: any; 1238 | 1239 | /** 1240 | * The pause-before property determines how long a speech media agent should pause before presenting an element. It may be replaced by the shorthand property pause, which sets pause time before and after. 1241 | */ 1242 | pauseBefore?: any; 1243 | 1244 | /** 1245 | * The perspective property defines how far an element is placed from the view on the z-axis, from the screen to the viewer. 1246 | * Perspective defines how an object is viewed. In graphic arts, perspective is the representation on a flat surface of what the viewer's eye would see in a 3D space. (See Wikipedia for more information about graphical perspective and for related illustrations.) 1247 | * The illusion of perspective on a flat surface, such as a computer screen, is created by projecting points on the flat surface as they would appear if the flat surface were a window through which the viewer was looking at the object. In discussion of virtual environments, this flat surface is called a projection plane. 1248 | */ 1249 | perspective?: any; 1250 | 1251 | /** 1252 | * The perspective-origin property establishes the origin for the perspective property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element. 1253 | * When used with perspective, perspective-origin changes the appearance of an object, as if a viewer were looking at it from a different origin. An object appears differently if a viewer is looking directly at it versus looking at it from below, above, or from the side. Thus, the perspective-origin is like a vanishing point. 1254 | * The default value of perspective-origin is 50% 50%. This displays an object as if the viewer's eye were positioned directly at the center of the screen, both top-to-bottom and left-to-right. A value of 0% 0% changes the object as if the viewer was looking toward the top left angle. A value of 100% 100% changes the appearance as if viewed toward the bottom right angle. 1255 | */ 1256 | perspectiveOrigin?: any; 1257 | 1258 | /** 1259 | * The pointer-events property allows you to control whether an element can be the target for the pointing device (e.g, mouse, pen) events. 1260 | */ 1261 | pointerEvents?: any; 1262 | 1263 | /** 1264 | * The position property controls the type of positioning used by an element within its parent elements. The effect of the position property depends on a lot of factors, for example the position property of parent elements. 1265 | */ 1266 | position?: any; 1267 | 1268 | /** 1269 | * Obsolete: unsupported. 1270 | * This property determines whether or not a full-width punctuation mark character should be trimmed if it appears at the beginning of a line, so that its "ink" lines up with the first glyph in the line above and below. 1271 | */ 1272 | punctuationTrim?: any; 1273 | 1274 | /** 1275 | * Sets the type of quotation marks for embedded quotations. 1276 | */ 1277 | quotes?: any; 1278 | 1279 | /** 1280 | * Controls whether the last region in a chain displays additional 'overset' content according its default overflow property, or if it displays a fragment of content as if it were flowing into a subsequent region. 1281 | */ 1282 | regionFragment?: any; 1283 | 1284 | /** 1285 | * The rest-after property determines how long a speech media agent should pause after presenting an element's main content, before presenting that element's exit cue sound. It may be replaced by the shorthand property rest, which sets rest time before and after. 1286 | */ 1287 | restAfter?: any; 1288 | 1289 | /** 1290 | * The rest-before property determines how long a speech media agent should pause after presenting an intro cue sound for an element, before presenting that element's main content. It may be replaced by the shorthand property rest, which sets rest time before and after. 1291 | */ 1292 | restBefore?: any; 1293 | 1294 | /** 1295 | * Specifies the position an element in relation to the right side of the containing element. 1296 | */ 1297 | right?: any; 1298 | 1299 | rubyAlign?: any; 1300 | 1301 | rubyPosition?: any; 1302 | 1303 | /** 1304 | * Defines the alpha channel threshold used to extract a shape from an image. Can be thought of as a "minimum opacity" threshold; that is, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. 1305 | */ 1306 | shapeImageThreshold?: any; 1307 | 1308 | /** 1309 | * A future level of CSS Shapes will define a shape-inside property, which will define a shape to wrap content within the element. See Editor's Draft and CSSWG wiki page on next-level plans 1310 | */ 1311 | shapeInside?: any; 1312 | 1313 | /** 1314 | * Adds a margin to a shape-outside. In effect, defines a new shape that is the smallest contour around all the points that are the shape-margin distance outward perpendicular to each point on the underlying shape. For points where a perpendicular direction is not defined (e.g., a triangle corner), takes all points on a circle centered at the point and with a radius of the shape-margin distance. This property accepts only non-negative values. 1315 | */ 1316 | shapeMargin?: any; 1317 | 1318 | /** 1319 | * Declares a shape around which text should be wrapped, with possible modifications from the shape-margin property. The shape defined by shape-outside and shape-margin changes the geometry of a float element's float area. 1320 | */ 1321 | shapeOutside?: any; 1322 | 1323 | /** 1324 | * The speak property determines whether or not a speech synthesizer will read aloud the contents of an element. 1325 | */ 1326 | speak?: any; 1327 | 1328 | /** 1329 | * The speak-as property determines how the speech synthesizer interprets the content: words as whole words or as a sequence of letters, numbers as a numerical value or a sequence of digits, punctuation as pauses in speech or named punctuation characters. 1330 | */ 1331 | speakAs?: any; 1332 | 1333 | /** 1334 | * The tab-size CSS property is used to customise the width of a tab (U+0009) character. 1335 | */ 1336 | tabSize?: any; 1337 | 1338 | /** 1339 | * The 'table-layout' property controls the algorithm used to lay out the table cells, rows, and columns. 1340 | */ 1341 | tableLayout?: any; 1342 | 1343 | /** 1344 | * The text-align CSS property describes how inline content like text is aligned in its parent block element. text-align does not control the alignment of block elements itself, only their inline content. 1345 | */ 1346 | textAlign?: any; 1347 | 1348 | /** 1349 | * The text-align-last CSS property describes how the last line of a block element or a line before line break is aligned in its parent block element. 1350 | */ 1351 | textAlignLast?: any; 1352 | 1353 | /** 1354 | * The text-decoration CSS property is used to set the text formatting to underline, overline, line-through or blink. 1355 | * underline and overline decorations are positioned under the text, line-through over it. 1356 | */ 1357 | textDecoration?: any; 1358 | 1359 | /** 1360 | * Sets the color of any text decoration, such as underlines, overlines, and strike throughs. 1361 | */ 1362 | textDecorationColor?: any; 1363 | 1364 | /** 1365 | * Sets what kind of line decorations are added to an element, such as underlines, overlines, etc. 1366 | */ 1367 | textDecorationLine?: any; 1368 | 1369 | textDecorationLineThrough?: any; 1370 | 1371 | textDecorationNone?: any; 1372 | 1373 | textDecorationOverline?: any; 1374 | 1375 | /** 1376 | * Specifies what parts of an element’s content are skipped over when applying any text decoration. 1377 | */ 1378 | textDecorationSkip?: any; 1379 | 1380 | /** 1381 | * This property specifies the style of the text decoration line drawn on the specified element. The intended meaning for the values are the same as those of the border-style-properties. 1382 | */ 1383 | textDecorationStyle?: any; 1384 | 1385 | textDecorationUnderline?: any; 1386 | 1387 | /** 1388 | * The text-emphasis property will apply special emphasis marks to the elements text. Slightly similar to the text-decoration property only that this property can have affect on the line-height. It also is noted that this is shorthand for text-emphasis-style and for text-emphasis-color. 1389 | */ 1390 | textEmphasis?: any; 1391 | 1392 | /** 1393 | * The text-emphasis-color property specifies the foreground color of the emphasis marks. 1394 | */ 1395 | textEmphasisColor?: any; 1396 | 1397 | /** 1398 | * The text-emphasis-style property applies special emphasis marks to an element's text. 1399 | */ 1400 | textEmphasisStyle?: any; 1401 | 1402 | /** 1403 | * This property helps determine an inline box's block-progression dimension, derived from the text-height and font-size properties for non-replaced elements, the height or the width for replaced elements, and the stacked block-progression dimension for inline-block elements. The block-progression dimension determines the position of the padding, border and margin for the element. 1404 | */ 1405 | textHeight?: any; 1406 | 1407 | /** 1408 | * Specifies the amount of space horizontally that should be left on the first line of the text of an element. This horizontal spacing is at the beginning of the first line and is in respect to the left edge of the containing block box. 1409 | */ 1410 | textIndent?: any; 1411 | 1412 | textJustifyTrim?: any; 1413 | 1414 | textKashidaSpace?: any; 1415 | 1416 | /** 1417 | * The text-line-through property is a shorthand property for text-line-through-style, text-line-through-color and text-line-through-mode. (Considered obsolete; use text-decoration instead.) 1418 | */ 1419 | textLineThrough?: any; 1420 | 1421 | /** 1422 | * Specifies the line colors for the line-through text decoration. 1423 | * (Considered obsolete; use text-decoration-color instead.) 1424 | */ 1425 | textLineThroughColor?: any; 1426 | 1427 | /** 1428 | * Sets the mode for the line-through text decoration, determining whether the text decoration affects the space characters or not. 1429 | * (Considered obsolete; use text-decoration-skip instead.) 1430 | */ 1431 | textLineThroughMode?: any; 1432 | 1433 | /** 1434 | * Specifies the line style for line-through text decoration. 1435 | * (Considered obsolete; use text-decoration-style instead.) 1436 | */ 1437 | textLineThroughStyle?: any; 1438 | 1439 | /** 1440 | * Specifies the line width for the line-through text decoration. 1441 | */ 1442 | textLineThroughWidth?: any; 1443 | 1444 | /** 1445 | * The text-overflow shorthand CSS property determines how overflowed content that is not displayed is signaled to the users. It can be clipped, display an ellipsis ('…', U+2026 HORIZONTAL ELLIPSIS) or a Web author-defined string. It covers the two long-hand properties text-overflow-mode and text-overflow-ellipsis 1446 | */ 1447 | textOverflow?: any; 1448 | 1449 | /** 1450 | * The text-overline property is the shorthand for the text-overline-style, text-overline-width, text-overline-color, and text-overline-mode properties. 1451 | */ 1452 | textOverline?: any; 1453 | 1454 | /** 1455 | * Specifies the line color for the overline text decoration. 1456 | */ 1457 | textOverlineColor?: any; 1458 | 1459 | /** 1460 | * Sets the mode for the overline text decoration, determining whether the text decoration affects the space characters or not. 1461 | */ 1462 | textOverlineMode?: any; 1463 | 1464 | /** 1465 | * Specifies the line style for overline text decoration. 1466 | */ 1467 | textOverlineStyle?: any; 1468 | 1469 | /** 1470 | * Specifies the line width for the overline text decoration. 1471 | */ 1472 | textOverlineWidth?: any; 1473 | 1474 | /** 1475 | * The text-rendering CSS property provides information to the browser about how to optimize when rendering text. Options are: legibility, speed or geometric precision. 1476 | */ 1477 | textRendering?: any; 1478 | 1479 | /** 1480 | * Obsolete: unsupported. 1481 | */ 1482 | textScript?: any; 1483 | 1484 | /** 1485 | * The CSS text-shadow property applies one or more drop shadows to the text and of an element. Each shadow is specified as an offset from the text, along with optional color and blur radius values. 1486 | */ 1487 | textShadow?: any; 1488 | 1489 | /** 1490 | * This property transforms text for styling purposes. (It has no effect on the underlying content.) 1491 | */ 1492 | textTransform?: any; 1493 | 1494 | /** 1495 | * Unsupported. 1496 | * This property will add a underline position value to the element that has an underline defined. 1497 | */ 1498 | textUnderlinePosition?: any; 1499 | 1500 | /** 1501 | * After review this should be replaced by text-decoration should it not? 1502 | * This property will set the underline style for text with a line value for underline, overline, and line-through. 1503 | */ 1504 | textUnderlineStyle?: any; 1505 | 1506 | /** 1507 | * This property specifies how far an absolutely positioned box's top margin edge is offset below the top edge of the box's containing block. For relatively positioned boxes, the offset is with respect to the top edges of the box itself (i.e., the box is given a position in the normal flow, then offset from that position according to these properties). 1508 | */ 1509 | top?: any; 1510 | 1511 | /** 1512 | * Determines whether touch input may trigger default behavior supplied by the user agent, such as panning or zooming. 1513 | */ 1514 | touchAction?: any; 1515 | 1516 | /** 1517 | * CSS transforms allow elements styled with CSS to be transformed in two-dimensional or three-dimensional space. Using this property, elements can be translated, rotated, scaled, and skewed. The value list may consist of 2D and/or 3D transform values. 1518 | */ 1519 | transform?: any; 1520 | 1521 | /** 1522 | * This property defines the origin of the transformation axes relative to the element to which the transformation is applied. 1523 | */ 1524 | transformOrigin?: any; 1525 | 1526 | /** 1527 | * This property allows you to define the relative position of the origin of the transformation grid along the z-axis. 1528 | */ 1529 | transformOriginZ?: any; 1530 | 1531 | /** 1532 | * This property specifies how nested elements are rendered in 3D space relative to their parent. 1533 | */ 1534 | transformStyle?: any; 1535 | 1536 | /** 1537 | * The transition CSS property is a shorthand property for transition-property, transition-duration, transition-timing-function, and transition-delay. It allows to define the transition between two states of an element. 1538 | */ 1539 | transition?: any; 1540 | 1541 | /** 1542 | * Defines when the transition will start. A value of ‘0s’ means the transition will execute as soon as the property is changed. Otherwise, the value specifies an offset from the moment the property is changed, and the transition will delay execution by that offset. 1543 | */ 1544 | transitionDelay?: any; 1545 | 1546 | /** 1547 | * The 'transition-duration' property specifies the length of time a transition animation takes to complete. 1548 | */ 1549 | transitionDuration?: any; 1550 | 1551 | /** 1552 | * The 'transition-property' property specifies the name of the CSS property to which the transition is applied. 1553 | */ 1554 | transitionProperty?: any; 1555 | 1556 | /** 1557 | * Sets the pace of action within a transition 1558 | */ 1559 | transitionTimingFunction?: any; 1560 | 1561 | /** 1562 | * The unicode-bidi CSS property specifies the level of embedding with respect to the bidirectional algorithm. 1563 | */ 1564 | unicodeBidi?: any; 1565 | 1566 | /** 1567 | * unicode-range allows you to set a specific range of characters to be downloaded from a font (embedded using @font-face) and made available for use on the current page. 1568 | */ 1569 | unicodeRange?: any; 1570 | 1571 | /** 1572 | * This is for all the high level UX stuff. 1573 | */ 1574 | userFocus?: any; 1575 | 1576 | /** 1577 | * For inputing user content 1578 | */ 1579 | userInput?: any; 1580 | 1581 | /** 1582 | * The vertical-align property controls how inline elements or text are vertically aligned compared to the baseline. If this property is used on table-cells it controls the vertical alignment of content of the table cell. 1583 | */ 1584 | verticalAlign?: any; 1585 | 1586 | /** 1587 | * The visibility property specifies whether the boxes generated by an element are rendered. 1588 | */ 1589 | visibility?: any; 1590 | 1591 | /** 1592 | * The voice-balance property sets the apparent position (in stereo sound) of the synthesized voice for spoken media. 1593 | */ 1594 | voiceBalance?: any; 1595 | 1596 | /** 1597 | * The voice-duration property allows the author to explicitly set the amount of time it should take a speech synthesizer to read an element's content, for example to allow the speech to be synchronized with other media. With a value of auto (the default) the length of time it takes to read the content is determined by the content itself and the voice-rate property. 1598 | */ 1599 | voiceDuration?: any; 1600 | 1601 | /** 1602 | * The voice-family property sets the speaker's voice used by a speech media agent to read an element. The speaker may be specified as a named character (to match a voice option in the speech reading software) or as a generic description of the age and gender of the voice. Similar to the font-family property for visual media, a comma-separated list of fallback options may be given in case the speech reader does not recognize the character name or cannot synthesize the requested combination of generic properties. 1603 | */ 1604 | voiceFamily?: any; 1605 | 1606 | /** 1607 | * The voice-pitch property sets pitch or tone (high or low) for the synthesized speech when reading an element; the pitch may be specified absolutely or relative to the normal pitch for the voice-family used to read the text. 1608 | */ 1609 | voicePitch?: any; 1610 | 1611 | /** 1612 | * The voice-range property determines how much variation in pitch or tone will be created by the speech synthesize when reading an element. Emphasized text, grammatical structures and punctuation may all be rendered as changes in pitch, this property determines how strong or obvious those changes are; large ranges are associated with enthusiastic or emotional speech, while small ranges are associated with flat or mechanical speech. 1613 | */ 1614 | voiceRange?: any; 1615 | 1616 | /** 1617 | * The voice-rate property sets the speed at which the voice synthesized by a speech media agent will read content. 1618 | */ 1619 | voiceRate?: any; 1620 | 1621 | /** 1622 | * The voice-stress property sets the level of vocal emphasis to be used for synthesized speech reading the element. 1623 | */ 1624 | voiceStress?: any; 1625 | 1626 | /** 1627 | * The voice-volume property sets the volume for spoken content in speech media. It replaces the deprecated volume property. 1628 | */ 1629 | voiceVolume?: any; 1630 | 1631 | /** 1632 | * The white-space property controls whether and how white space inside the element is collapsed, and whether lines may wrap at unforced "soft wrap" opportunities. 1633 | */ 1634 | whiteSpace?: any; 1635 | 1636 | /** 1637 | * Obsolete: unsupported. 1638 | */ 1639 | whiteSpaceTreatment?: any; 1640 | 1641 | /** 1642 | * Specifies the width of the content area of an element. The content area of the element width does not include the padding, border, and margin of the element. 1643 | */ 1644 | width?: any; 1645 | 1646 | /** 1647 | * The word-break property is often used when there is long generated content that is strung together without and spaces or hyphens to beak apart. A common case of this is when there is a long URL that does not have any hyphens. This case could potentially cause the breaking of the layout as it could extend past the parent element. 1648 | */ 1649 | wordBreak?: any; 1650 | 1651 | /** 1652 | * The word-spacing CSS property specifies the spacing behavior between "words". 1653 | */ 1654 | wordSpacing?: any; 1655 | 1656 | /** 1657 | * An alias of css/properties/overflow-wrap, word-wrap defines whether to break words when the content exceeds the boundaries of its container. 1658 | */ 1659 | wordWrap?: any; 1660 | 1661 | /** 1662 | * Specifies how exclusions affect inline content within block-level elements. Elements lay out their inline content in their content area but wrap around exclusion areas. 1663 | */ 1664 | wrapFlow?: any; 1665 | 1666 | /** 1667 | * Set the value that is used to offset the inner wrap shape from other shapes. Inline content that intersects a shape with this property will be pushed by this shape's margin. 1668 | */ 1669 | wrapMargin?: any; 1670 | 1671 | /** 1672 | * Obsolete and unsupported. Do not use. 1673 | * This CSS property controls the text when it reaches the end of the block in which it is enclosed. 1674 | */ 1675 | wrapOption?: any; 1676 | 1677 | /** 1678 | * writing-mode specifies if lines of text are laid out horizontally or vertically, and the direction which lines of text and blocks progress. 1679 | */ 1680 | writingMode?: any; 1681 | 1682 | 1683 | [propertyName: string]: any; 1684 | } 1685 | 1686 | interface HTMLAttributes extends DOMAttributes { 1687 | // React-specific Attributes 1688 | defaultChecked?: boolean; 1689 | defaultValue?: string | string[]; 1690 | 1691 | // Standard HTML Attributes 1692 | accept?: string; 1693 | acceptCharset?: string; 1694 | accessKey?: string; 1695 | action?: string; 1696 | allowFullScreen?: boolean; 1697 | allowTransparency?: boolean; 1698 | alt?: string; 1699 | async?: boolean; 1700 | autoComplete?: string; 1701 | autoFocus?: boolean; 1702 | autoPlay?: boolean; 1703 | capture?: boolean; 1704 | cellPadding?: number | string; 1705 | cellSpacing?: number | string; 1706 | charSet?: string; 1707 | challenge?: string; 1708 | checked?: boolean; 1709 | classID?: string; 1710 | className?: string; 1711 | cols?: number; 1712 | colSpan?: number; 1713 | content?: string; 1714 | contentEditable?: boolean; 1715 | contextMenu?: string; 1716 | controls?: boolean; 1717 | coords?: string; 1718 | crossOrigin?: string; 1719 | data?: string; 1720 | dateTime?: string; 1721 | default?: boolean; 1722 | defer?: boolean; 1723 | dir?: string; 1724 | disabled?: boolean; 1725 | download?: any; 1726 | draggable?: boolean; 1727 | encType?: string; 1728 | form?: string; 1729 | formAction?: string; 1730 | formEncType?: string; 1731 | formMethod?: string; 1732 | formNoValidate?: boolean; 1733 | formTarget?: string; 1734 | frameBorder?: number | string; 1735 | headers?: string; 1736 | height?: number | string; 1737 | hidden?: boolean; 1738 | high?: number; 1739 | href?: string; 1740 | hrefLang?: string; 1741 | htmlFor?: string; 1742 | httpEquiv?: string; 1743 | icon?: string; 1744 | id?: string; 1745 | inputMode?: string; 1746 | integrity?: string; 1747 | is?: string; 1748 | keyParams?: string; 1749 | keyType?: string; 1750 | kind?: string; 1751 | label?: string; 1752 | lang?: string; 1753 | list?: string; 1754 | loop?: boolean; 1755 | low?: number; 1756 | manifest?: string; 1757 | marginHeight?: number; 1758 | marginWidth?: number; 1759 | max?: number | string; 1760 | maxLength?: number; 1761 | media?: string; 1762 | mediaGroup?: string; 1763 | method?: string; 1764 | min?: number | string; 1765 | minLength?: number; 1766 | multiple?: boolean; 1767 | muted?: boolean; 1768 | name?: string; 1769 | noValidate?: boolean; 1770 | open?: boolean; 1771 | optimum?: number; 1772 | pattern?: string; 1773 | placeholder?: string; 1774 | poster?: string; 1775 | preload?: string; 1776 | radioGroup?: string; 1777 | readOnly?: boolean; 1778 | rel?: string; 1779 | required?: boolean; 1780 | role?: string; 1781 | rows?: number; 1782 | rowSpan?: number; 1783 | sandbox?: string; 1784 | scope?: string; 1785 | scoped?: boolean; 1786 | scrolling?: string; 1787 | seamless?: boolean; 1788 | selected?: boolean; 1789 | shape?: string; 1790 | size?: number; 1791 | sizes?: string; 1792 | span?: number; 1793 | spellCheck?: boolean; 1794 | src?: string; 1795 | srcDoc?: string; 1796 | srcLang?: string; 1797 | srcSet?: string; 1798 | start?: number; 1799 | step?: number | string; 1800 | style?: CSSProperties; 1801 | summary?: string; 1802 | tabIndex?: number; 1803 | target?: string; 1804 | title?: string; 1805 | type?: string; 1806 | useMap?: string; 1807 | value?: string | string[]; 1808 | width?: number | string; 1809 | wmode?: string; 1810 | wrap?: string; 1811 | 1812 | // RDFa Attributes 1813 | about?: string; 1814 | datatype?: string; 1815 | inlist?: any; 1816 | prefix?: string; 1817 | property?: string; 1818 | resource?: string; 1819 | typeof?: string; 1820 | vocab?: string; 1821 | 1822 | // Non-standard Attributes 1823 | autoCapitalize?: boolean; 1824 | autoCorrect?: string; 1825 | autoSave?: string; 1826 | color?: string; 1827 | itemProp?: string; 1828 | itemScope?: boolean; 1829 | itemType?: string; 1830 | itemID?: string; 1831 | itemRef?: string; 1832 | results?: number; 1833 | security?: string; 1834 | unselectable?: boolean; 1835 | } 1836 | 1837 | interface SVGAttributes extends HTMLAttributes { 1838 | clipPath?: string; 1839 | cx?: number | string; 1840 | cy?: number | string; 1841 | d?: string; 1842 | dx?: number | string; 1843 | dy?: number | string; 1844 | fill?: string; 1845 | fillOpacity?: number | string; 1846 | fontFamily?: string; 1847 | fontSize?: number | string; 1848 | fx?: number | string; 1849 | fy?: number | string; 1850 | gradientTransform?: string; 1851 | gradientUnits?: string; 1852 | markerEnd?: string; 1853 | markerMid?: string; 1854 | markerStart?: string; 1855 | offset?: number | string; 1856 | opacity?: number | string; 1857 | patternContentUnits?: string; 1858 | patternUnits?: string; 1859 | points?: string; 1860 | preserveAspectRatio?: string; 1861 | r?: number | string; 1862 | rx?: number | string; 1863 | ry?: number | string; 1864 | spreadMethod?: string; 1865 | stopColor?: string; 1866 | stopOpacity?: number | string; 1867 | stroke?: string; 1868 | strokeDasharray?: string; 1869 | strokeLinecap?: string; 1870 | strokeOpacity?: number | string; 1871 | strokeWidth?: number | string; 1872 | textAnchor?: string; 1873 | transform?: string; 1874 | version?: string; 1875 | viewBox?: string; 1876 | x1?: number | string; 1877 | x2?: number | string; 1878 | x?: number | string; 1879 | xlinkActuate?: string; 1880 | xlinkArcrole?: string; 1881 | xlinkHref?: string; 1882 | xlinkRole?: string; 1883 | xlinkShow?: string; 1884 | xlinkTitle?: string; 1885 | xlinkType?: string; 1886 | xmlBase?: string; 1887 | xmlLang?: string; 1888 | xmlSpace?: string; 1889 | y1?: number | string; 1890 | y2?: number | string; 1891 | y?: number | string; 1892 | } 1893 | 1894 | // 1895 | // React.DOM 1896 | // ---------------------------------------------------------------------- 1897 | 1898 | interface ReactDOM { 1899 | // HTML 1900 | a: HTMLFactory; 1901 | abbr: HTMLFactory; 1902 | address: HTMLFactory; 1903 | area: HTMLFactory; 1904 | article: HTMLFactory; 1905 | aside: HTMLFactory; 1906 | audio: HTMLFactory; 1907 | b: HTMLFactory; 1908 | base: HTMLFactory; 1909 | bdi: HTMLFactory; 1910 | bdo: HTMLFactory; 1911 | big: HTMLFactory; 1912 | blockquote: HTMLFactory; 1913 | body: HTMLFactory; 1914 | br: HTMLFactory; 1915 | button: HTMLFactory; 1916 | canvas: HTMLFactory; 1917 | caption: HTMLFactory; 1918 | cite: HTMLFactory; 1919 | code: HTMLFactory; 1920 | col: HTMLFactory; 1921 | colgroup: HTMLFactory; 1922 | data: HTMLFactory; 1923 | datalist: HTMLFactory; 1924 | dd: HTMLFactory; 1925 | del: HTMLFactory; 1926 | details: HTMLFactory; 1927 | dfn: HTMLFactory; 1928 | dialog: HTMLFactory; 1929 | div: HTMLFactory; 1930 | dl: HTMLFactory; 1931 | dt: HTMLFactory; 1932 | em: HTMLFactory; 1933 | embed: HTMLFactory; 1934 | fieldset: HTMLFactory; 1935 | figcaption: HTMLFactory; 1936 | figure: HTMLFactory; 1937 | footer: HTMLFactory; 1938 | form: HTMLFactory; 1939 | h1: HTMLFactory; 1940 | h2: HTMLFactory; 1941 | h3: HTMLFactory; 1942 | h4: HTMLFactory; 1943 | h5: HTMLFactory; 1944 | h6: HTMLFactory; 1945 | head: HTMLFactory; 1946 | header: HTMLFactory; 1947 | hr: HTMLFactory; 1948 | html: HTMLFactory; 1949 | i: HTMLFactory; 1950 | iframe: HTMLFactory; 1951 | img: HTMLFactory; 1952 | input: HTMLFactory; 1953 | ins: HTMLFactory; 1954 | kbd: HTMLFactory; 1955 | keygen: HTMLFactory; 1956 | label: HTMLFactory; 1957 | legend: HTMLFactory; 1958 | li: HTMLFactory; 1959 | link: HTMLFactory; 1960 | main: HTMLFactory; 1961 | map: HTMLFactory; 1962 | mark: HTMLFactory; 1963 | menu: HTMLFactory; 1964 | menuitem: HTMLFactory; 1965 | meta: HTMLFactory; 1966 | meter: HTMLFactory; 1967 | nav: HTMLFactory; 1968 | noscript: HTMLFactory; 1969 | object: HTMLFactory; 1970 | ol: HTMLFactory; 1971 | optgroup: HTMLFactory; 1972 | option: HTMLFactory; 1973 | output: HTMLFactory; 1974 | p: HTMLFactory; 1975 | param: HTMLFactory; 1976 | picture: HTMLFactory; 1977 | pre: HTMLFactory; 1978 | progress: HTMLFactory; 1979 | q: HTMLFactory; 1980 | rp: HTMLFactory; 1981 | rt: HTMLFactory; 1982 | ruby: HTMLFactory; 1983 | s: HTMLFactory; 1984 | samp: HTMLFactory; 1985 | script: HTMLFactory; 1986 | section: HTMLFactory; 1987 | select: HTMLFactory; 1988 | small: HTMLFactory; 1989 | source: HTMLFactory; 1990 | span: HTMLFactory; 1991 | strong: HTMLFactory; 1992 | style: HTMLFactory; 1993 | sub: HTMLFactory; 1994 | summary: HTMLFactory; 1995 | sup: HTMLFactory; 1996 | table: HTMLFactory; 1997 | tbody: HTMLFactory; 1998 | td: HTMLFactory; 1999 | textarea: HTMLFactory; 2000 | tfoot: HTMLFactory; 2001 | th: HTMLFactory; 2002 | thead: HTMLFactory; 2003 | time: HTMLFactory; 2004 | title: HTMLFactory; 2005 | tr: HTMLFactory; 2006 | track: HTMLFactory; 2007 | u: HTMLFactory; 2008 | ul: HTMLFactory; 2009 | "var": HTMLFactory; 2010 | video: HTMLFactory; 2011 | wbr: HTMLFactory; 2012 | 2013 | // SVG 2014 | svg: SVGFactory; 2015 | circle: SVGFactory; 2016 | defs: SVGFactory; 2017 | ellipse: SVGFactory; 2018 | g: SVGFactory; 2019 | image: SVGFactory; 2020 | line: SVGFactory; 2021 | linearGradient: SVGFactory; 2022 | mask: SVGFactory; 2023 | path: SVGFactory; 2024 | pattern: SVGFactory; 2025 | polygon: SVGFactory; 2026 | polyline: SVGFactory; 2027 | radialGradient: SVGFactory; 2028 | rect: SVGFactory; 2029 | stop: SVGFactory; 2030 | text: SVGFactory; 2031 | tspan: SVGFactory; 2032 | } 2033 | 2034 | // 2035 | // React.PropTypes 2036 | // ---------------------------------------------------------------------- 2037 | 2038 | interface Validator { 2039 | (object: T, key: string, componentName: string): Error; 2040 | } 2041 | 2042 | interface Requireable extends Validator { 2043 | isRequired: Validator; 2044 | } 2045 | 2046 | interface ValidationMap { 2047 | [key: string]: Validator; 2048 | } 2049 | 2050 | interface ReactPropTypes { 2051 | any: Requireable; 2052 | array: Requireable; 2053 | bool: Requireable; 2054 | func: Requireable; 2055 | number: Requireable; 2056 | object: Requireable; 2057 | string: Requireable; 2058 | node: Requireable; 2059 | element: Requireable; 2060 | instanceOf(expectedClass: {}): Requireable; 2061 | oneOf(types: any[]): Requireable; 2062 | oneOfType(types: Validator[]): Requireable; 2063 | arrayOf(type: Validator): Requireable; 2064 | objectOf(type: Validator): Requireable; 2065 | shape(type: ValidationMap): Requireable; 2066 | } 2067 | 2068 | // 2069 | // React.Children 2070 | // ---------------------------------------------------------------------- 2071 | 2072 | interface ReactChildren { 2073 | map(children: ReactNode, fn: (child: ReactChild, index: number) => T): T[]; 2074 | forEach(children: ReactNode, fn: (child: ReactChild, index: number) => any): void; 2075 | count(children: ReactNode): number; 2076 | only(children: ReactNode): ReactChild; 2077 | toArray(children: ReactNode): ReactChild[]; 2078 | } 2079 | 2080 | // 2081 | // Browser Interfaces 2082 | // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts 2083 | // ---------------------------------------------------------------------- 2084 | 2085 | interface AbstractView { 2086 | styleMedia: StyleMedia; 2087 | document: Document; 2088 | } 2089 | 2090 | interface Touch { 2091 | identifier: number; 2092 | target: EventTarget; 2093 | screenX: number; 2094 | screenY: number; 2095 | clientX: number; 2096 | clientY: number; 2097 | pageX: number; 2098 | pageY: number; 2099 | } 2100 | 2101 | interface TouchList { 2102 | [index: number]: Touch; 2103 | length: number; 2104 | item(index: number): Touch; 2105 | identifiedTouch(identifier: number): Touch; 2106 | } 2107 | } 2108 | 2109 | declare module "react" { 2110 | export = __React; 2111 | } 2112 | 2113 | declare namespace JSX { 2114 | import React = __React; 2115 | 2116 | interface Element extends React.ReactElement { } 2117 | interface ElementClass extends React.Component { 2118 | render(): JSX.Element; 2119 | } 2120 | interface ElementAttributesProperty { props: {}; } 2121 | 2122 | interface IntrinsicElements { 2123 | // HTML 2124 | a: React.HTMLProps; 2125 | abbr: React.HTMLProps; 2126 | address: React.HTMLProps; 2127 | area: React.HTMLProps; 2128 | article: React.HTMLProps; 2129 | aside: React.HTMLProps; 2130 | audio: React.HTMLProps; 2131 | b: React.HTMLProps; 2132 | base: React.HTMLProps; 2133 | bdi: React.HTMLProps; 2134 | bdo: React.HTMLProps; 2135 | big: React.HTMLProps; 2136 | blockquote: React.HTMLProps; 2137 | body: React.HTMLProps; 2138 | br: React.HTMLProps; 2139 | button: React.HTMLProps; 2140 | canvas: React.HTMLProps; 2141 | caption: React.HTMLProps; 2142 | cite: React.HTMLProps; 2143 | code: React.HTMLProps; 2144 | col: React.HTMLProps; 2145 | colgroup: React.HTMLProps; 2146 | data: React.HTMLProps; 2147 | datalist: React.HTMLProps; 2148 | dd: React.HTMLProps; 2149 | del: React.HTMLProps; 2150 | details: React.HTMLProps; 2151 | dfn: React.HTMLProps; 2152 | dialog: React.HTMLProps; 2153 | div: React.HTMLProps; 2154 | dl: React.HTMLProps; 2155 | dt: React.HTMLProps; 2156 | em: React.HTMLProps; 2157 | embed: React.HTMLProps; 2158 | fieldset: React.HTMLProps; 2159 | figcaption: React.HTMLProps; 2160 | figure: React.HTMLProps; 2161 | footer: React.HTMLProps; 2162 | form: React.HTMLProps; 2163 | h1: React.HTMLProps; 2164 | h2: React.HTMLProps; 2165 | h3: React.HTMLProps; 2166 | h4: React.HTMLProps; 2167 | h5: React.HTMLProps; 2168 | h6: React.HTMLProps; 2169 | head: React.HTMLProps; 2170 | header: React.HTMLProps; 2171 | hr: React.HTMLProps; 2172 | html: React.HTMLProps; 2173 | i: React.HTMLProps; 2174 | iframe: React.HTMLProps; 2175 | img: React.HTMLProps; 2176 | input: React.HTMLProps; 2177 | ins: React.HTMLProps; 2178 | kbd: React.HTMLProps; 2179 | keygen: React.HTMLProps; 2180 | label: React.HTMLProps; 2181 | legend: React.HTMLProps; 2182 | li: React.HTMLProps; 2183 | link: React.HTMLProps; 2184 | main: React.HTMLProps; 2185 | map: React.HTMLProps; 2186 | mark: React.HTMLProps; 2187 | menu: React.HTMLProps; 2188 | menuitem: React.HTMLProps; 2189 | meta: React.HTMLProps; 2190 | meter: React.HTMLProps; 2191 | nav: React.HTMLProps; 2192 | noscript: React.HTMLProps; 2193 | object: React.HTMLProps; 2194 | ol: React.HTMLProps; 2195 | optgroup: React.HTMLProps; 2196 | option: React.HTMLProps; 2197 | output: React.HTMLProps; 2198 | p: React.HTMLProps; 2199 | param: React.HTMLProps; 2200 | picture: React.HTMLProps; 2201 | pre: React.HTMLProps; 2202 | progress: React.HTMLProps; 2203 | q: React.HTMLProps; 2204 | rp: React.HTMLProps; 2205 | rt: React.HTMLProps; 2206 | ruby: React.HTMLProps; 2207 | s: React.HTMLProps; 2208 | samp: React.HTMLProps; 2209 | script: React.HTMLProps; 2210 | section: React.HTMLProps; 2211 | select: React.HTMLProps; 2212 | small: React.HTMLProps; 2213 | source: React.HTMLProps; 2214 | span: React.HTMLProps; 2215 | strong: React.HTMLProps; 2216 | style: React.HTMLProps; 2217 | sub: React.HTMLProps; 2218 | summary: React.HTMLProps; 2219 | sup: React.HTMLProps; 2220 | table: React.HTMLProps; 2221 | tbody: React.HTMLProps; 2222 | td: React.HTMLProps; 2223 | textarea: React.HTMLProps; 2224 | tfoot: React.HTMLProps; 2225 | th: React.HTMLProps; 2226 | thead: React.HTMLProps; 2227 | time: React.HTMLProps; 2228 | title: React.HTMLProps; 2229 | tr: React.HTMLProps; 2230 | track: React.HTMLProps; 2231 | u: React.HTMLProps; 2232 | ul: React.HTMLProps; 2233 | "var": React.HTMLProps; 2234 | video: React.HTMLProps; 2235 | wbr: React.HTMLProps; 2236 | 2237 | // SVG 2238 | circle: React.SVGProps; 2239 | defs: React.SVGProps; 2240 | ellipse: React.SVGProps; 2241 | g: React.SVGProps; 2242 | image: React.SVGProps; 2243 | line: React.SVGProps; 2244 | linearGradient: React.SVGProps; 2245 | mask: React.SVGProps; 2246 | path: React.SVGProps; 2247 | pattern: React.SVGProps; 2248 | polygon: React.SVGProps; 2249 | polyline: React.SVGProps; 2250 | radialGradient: React.SVGProps; 2251 | rect: React.SVGProps; 2252 | stop: React.SVGProps; 2253 | svg: React.SVGProps; 2254 | text: React.SVGProps; 2255 | tspan: React.SVGProps; 2256 | } 2257 | } 2258 | -------------------------------------------------------------------------------- /test-resources/testData/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "sourceMap": true, 5 | "module": "commonjs", 6 | "declaration": false, 7 | "noImplicitAny": false, 8 | "removeComments": true, 9 | "experimentalDecorators": true, 10 | "emitDecoratorMetadata": true, 11 | "noLib": false, 12 | "jsx": "react", 13 | "outDir": "dist" 14 | }, 15 | "exclude": [ 16 | "node_modules", 17 | "static" 18 | ] 19 | } 20 | --------------------------------------------------------------------------------