├── .circleci └── config.yml ├── .editorconfig ├── .github ├── CONTRIBUTING.md └── ISSUE_TEMPLATE.md ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── STYLE_GUIDE.md ├── docs ├── assets │ ├── logo.jpg │ ├── screenshot1.jpg │ ├── screenshot2.jpg │ └── screenshot3.jpg └── circleci.md ├── package-lock.json ├── package.json ├── src ├── components.d.ts ├── components │ ├── arrow │ │ ├── arrow.pcss │ │ └── arrow.tsx │ ├── category │ │ ├── category.pcss │ │ └── category.tsx │ ├── item-value │ │ ├── item-value.pcss │ │ └── item-value.tsx │ ├── item │ │ ├── item.pcss │ │ └── item.tsx │ ├── logo │ │ ├── logo.pcss │ │ └── logo.tsx │ ├── main │ │ ├── main.pcss │ │ └── main.tsx │ ├── message │ │ ├── message.pcss │ │ └── message.tsx │ └── refresh │ │ ├── refresh.pcss │ │ └── refresh.tsx ├── decorators │ └── autobind.ts ├── helpers │ ├── background-script.ts │ ├── checker.ts │ ├── content-script.ts │ ├── declarations.ts │ ├── injector.ts │ ├── scout.ts │ └── tsconfig.json ├── images │ ├── favicon.ico │ ├── stencil-logo-128x128.png │ ├── stencil-logo-16x16.png │ ├── stencil-logo-48x48.png │ ├── stencil-logo-disabled-128x128.png │ ├── stencil-logo-disabled-16x16.png │ └── stencil-logo-disabled-48x48.png ├── index.html ├── index.ts ├── statics │ ├── devtools.html │ ├── devtools.js │ ├── disabled.html │ ├── enabled.html │ └── manifest.json └── styles │ └── global.css ├── stencil.config.js ├── stylelint.config.js ├── tsconfig.json └── tslint.json /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | defaults: &defaults 2 | docker: 3 | - image: circleci/node:9.4.0 4 | environment: 5 | - APP_ID: komnnoelcbjpjfnbhmdpgmlbklmicmdi 6 | working_directory: ~/stencil-inspector 7 | 8 | build_filters: &build_filters 9 | filters: 10 | branches: 11 | only: 12 | - master 13 | 14 | version: 2 15 | jobs: 16 | dependencies: 17 | <<: *defaults 18 | steps: 19 | - checkout 20 | - save_cache: 21 | key: repo-cache-{{ .Environment.CIRCLE_SHA1 }} 22 | paths: 23 | - ~/stencil-inspector 24 | - restore_cache: 25 | keys: 26 | - dependency-cache-{{ checksum "package.json" }} 27 | - run: 28 | name: Installing npm dependencies 29 | command: npm install 30 | - save_cache: 31 | key: dependency-cache-{{ checksum "package.json" }} 32 | paths: 33 | - node_modules 34 | 35 | lint: 36 | <<: *defaults 37 | steps: 38 | - restore_cache: 39 | keys: 40 | - repo-cache-{{ .Environment.CIRCLE_SHA1 }} 41 | - restore_cache: 42 | keys: 43 | - dependency-cache-{{ checksum "package.json" }} 44 | - run: 45 | name: Linting 46 | command: npm run lint 47 | 48 | # test: 49 | # <<: *defaults 50 | # steps: 51 | # - restore_cache: 52 | # keys: 53 | # - repo-cache-{{ .Environment.CIRCLE_SHA1 }} 54 | # - restore_cache: 55 | # keys: 56 | # - dependency-cache-{{ checksum "package.json" }} 57 | # - run: 58 | # name: Testing 59 | # command: npm run test 60 | 61 | build: 62 | <<: *defaults 63 | steps: 64 | - restore_cache: 65 | keys: 66 | - repo-cache-{{ .Environment.CIRCLE_SHA1 }} 67 | - restore_cache: 68 | keys: 69 | - dependency-cache-{{ checksum "package.json" }} 70 | - run: 71 | name: Creating Build 72 | command: npm run build 73 | environment: 74 | - NODE_ENV: production 75 | - run: 76 | name: Archive 77 | command: zip -r stencil-inspector.zip ~/stencil-inspector/www 78 | - save_cache: 79 | key: build-cache-{{ .Environment.CIRCLE_SHA1 }} 80 | paths: 81 | - stencil-inspector.zip 82 | 83 | deploy: 84 | <<: *defaults 85 | steps: 86 | - restore_cache: 87 | keys: 88 | - repo-cache-{{ .Environment.CIRCLE_SHA1 }} 89 | - restore_cache: 90 | keys: 91 | - build-cache-{{ .Environment.CIRCLE_SHA1 }} 92 | - run: 93 | name: Updating OS dependencies 94 | command: sudo apt update 95 | - run: 96 | name: Installing curl 97 | command: sudo apt install curl 98 | - run: 99 | name: Installing jq 100 | command: sudo apt install jq 101 | - run: 102 | name: Deploy 103 | command: | 104 | ACCESS_TOKEN=$(curl "https://accounts.google.com/o/oauth2/token" -d "client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&refresh_token=${REFRESH_TOKEN}&grant_type=refresh_token&redirect_uri=urn:ietf:wg:oauth:2.0:oob" | jq -r .access_token) 105 | curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -X PUT -T stencil-inspector.zip -v "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${APP_ID}" 106 | curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -H "Content-Length: 0" -X POST -v "https://www.googleapis.com/chromewebstore/v1.1/items/${APP_ID}/publish" 107 | 108 | workflows: 109 | version: 2 110 | build_and_deploy: 111 | jobs: 112 | - dependencies 113 | - lint: 114 | requires: 115 | - dependencies 116 | # - test: 117 | # requires: 118 | # - dependencies 119 | - build: 120 | <<: *build_filters 121 | requires: 122 | - dependencies 123 | - deploy: 124 | <<: *build_filters 125 | requires: 126 | - lint 127 | # - test 128 | - build 129 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | indent_size = 3 15 | insert_final_newline = false 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thanks for your interest in contributing to the Stencil Inspector! :tada: 4 | 5 | 6 | ## Contributing Etiquette 7 | 8 | Please see our [Contributor Code of Conduct](https://github.com/ionic-team/stencil-inspector/blob/master/CODE_OF_CONDUCT.md) for information on our rules of conduct. 9 | 10 | 11 | ## Creating an Issue 12 | 13 | * If you have a question about using Stencil Inspector, please ask in the [Stencil Worldwide Slack](https://join.slack.com/t/stencil-worldwide/shared_invite/enQtMjQ2MzkyMTY0MTk0LTQ4ODgzYjFjNjdkNDY3YWVhMmNlMTljMWQxNTM3Yjg0ZTIyZTM1MmU2YWE5YzNjNzE1MmQ3ZTk2NjQ1YzM5ZDM group. 14 | 15 | * It is required that you clearly describe the steps necessary to reproduce the issue you are running into. Although we would love to help our users as much as possible, diagnosing issues without clear reproduction steps is extremely time-consuming and simply not sustainable. 16 | 17 | * The issue list of this repository is exclusively for bug reports and feature requests. Non-conforming issues will be closed immediately. 18 | 19 | * Issues with no clear steps to reproduce will not be triaged. If an issue is labeled with "needs reply" and receives no further replies from the author of the issue for more than 5 days, it will be closed. 20 | 21 | * If you think you have found a bug, or have a new feature idea, please start by making sure it hasn't already been [reported](https://github.com/ionic-team/stencil-inspector/issues?utf8=%E2%9C%93&q=is%3Aissue). You can search through existing issues to see if there is a similar one reported. Include closed issues as it may have been closed with a solution. 22 | 23 | * Next, [create a new issue](https://github.com/ionic-team/stencil-inspector/issues/new) that thoroughly explains the problem. Please fill out the populated issue form before submitting the issue. 24 | 25 | 26 | ## Creating a Pull Request 27 | 28 | * We appreciate you taking the time to contribute! Before submitting a pull request, we ask that you please [create an issue](#creating-an-issue) that explains the bug or feature request and let us know that you plan on creating a pull request for it. If an issue already exists, please comment on that issue letting us know you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort. 29 | 30 | * Looking for an issue to fix? Make sure to look through our issues with the [help wanted](https://github.com/ionic-team/stencil-inspector/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) label! 31 | 32 | ### Setup 33 | 34 | 1. Fork the repo. 35 | 2. Clone your fork. 36 | 3. Make a branch for your change. 37 | 4. Run `npm install` (make sure you have [node](https://nodejs.org/en/) and [npm](http://blog.npmjs.org/post/85484771375/how-to-install-npm) installed first) 38 | 39 | 40 | #### Updates 41 | 42 | 1. Unit test. Unit test. Unit test. Please take a look at how other unit tests are written, and you can't write too many tests. 43 | 2. If there is a `*.spec.ts` file located in the `test/` folder, update it to include a test for your change, if needed. If this file doesn't exist, please notify us. 44 | 3. Run `npm run test` or `npm run test.watch` to make sure all tests are working, regardless if a test was added. 45 | 46 | 47 | ## Commit Message Format 48 | 49 | We have very precise rules over how our git commit messages should be formatted. This leads to readable messages that are easy to follow when looking through the project history. We also use the git commit messages to generate our changelog. (Ok you got us, it's basically Angular's commit message format). 50 | 51 | `type(scope): subject` 52 | 53 | #### Type 54 | Must be one of the following: 55 | 56 | * **feat**: A new feature 57 | * **fix**: A bug fix 58 | * **docs**: Documentation only changes 59 | * **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) 60 | * **refactor**: A code change that neither fixes a bug nor adds a feature 61 | * **perf**: A code change that improves performance 62 | * **test**: Adding missing tests 63 | * **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation 64 | 65 | #### Scope 66 | The scope can be anything specifying place of the commit change. For example `renderer`, `compiler`, etc. 67 | 68 | #### Subject 69 | The subject contains succinct description of the change: 70 | 71 | * use the imperative, present tense: "change" not "changed" nor "changes" 72 | * do not capitalize first letter 73 | * do not place a period `.` at the end 74 | * entire length of the commit message must not go over 50 characters 75 | * describe what the commit does, not what issue it relates to or fixes 76 | * **be brief, yet descriptive** - we should have a good understanding of what the commit does by reading the subject 77 | 78 | 79 | #### Adding Documentation 80 | 81 | Please see the [stencil-site](https://github.com/ionic-team/stencil-site) repo to update documentation. 82 | 83 | 84 | ## License 85 | 86 | By contributing your code to the ionic-team/stencil-inspector GitHub Repository, you agree to license your contribution under the MIT license. 87 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | **Stencil Inspector version:** 7 | 8 | ``` 9 | @stencil/inspector@ 10 | ``` 11 | 12 | **I'm submitting a:** 13 | 14 | [ ] bug report 15 | [ ] feature request 16 | [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com 17 | 18 | **Current behavior:** 19 | 20 | 21 | **Expected behavior:** 22 | 23 | 24 | **Steps to reproduce:** 25 | 27 | 28 | **Related code:** 29 | 30 | ```tsx 31 | // insert any relevant code here 32 | ``` 33 | 34 | **Other information:** 35 | 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | $RECYCLE.BIN/ 2 | .DS_Store 3 | Thumbs.db 4 | 5 | *~ 6 | *.sw[mnpcod] 7 | *.log 8 | *.lock 9 | *.tmp 10 | *.tmp.* 11 | *.zip 12 | *.crx 13 | *.pem 14 | .stylelint-cache 15 | log.txt 16 | *.sublime-project 17 | *.sublime-workspace 18 | 19 | dist/ 20 | www/ 21 | 22 | .idea/ 23 | .sass-cache/ 24 | .versions/ 25 | node_modules/ 26 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of the Stencil Inspector project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities. 4 | 5 | Communication through any of Stencil's channels (GitHub, Slack, Forum, IRC, mailing lists, Twitter, etc.) must be constructive and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 6 | 7 | We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to the Stencil Inspector project to do the same. 8 | 9 | If any member of the community violates this code of conduct, the maintainers of the Stencil project may take action, removing issues, comments, and PRs or blocking accounts as deemed appropriate. 10 | 11 | If you are subject to or witness unacceptable behavior, or have any other concerns, please email us at [hi@ionicframework.com](mailto:hi@ionicframework.com). 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Ionic 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Stencil Inspector 2 | 3 | ![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI%2BCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI%2BCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU%2BCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00MjQuNywzNzMuOWMwLDM3LjYtNTUuMSw2OC42LTkyLjcsNjguNkgxODAuNGMtMzcuOSwwLTkyLjctMzAuNy05Mi43LTY4LjZ2LTMuNmgzMzYuOVYzNzMuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQyNC43LDI5Mi4xSDE4MC40Yy0zNy42LDAtOTIuNy0zMS05Mi43LTY4LjZ2LTMuNkgzMzJjMzcuNiwwLDkyLjcsMzEsOTIuNyw2OC42VjI5Mi4xeiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNDI0LjcsMTQxLjdIODcuN3YtMy42YzAtMzcuNiw1NC44LTY4LjYsOTIuNy02OC42SDMzMmMzNy45LDAsOTIuNywzMC43LDkyLjcsNjguNlYxNDEuN3oiLz4KPC9zdmc%2BCg%3D%3D&colorA=16161d&style=flat-square) 4 | 5 | A minimal Chrome extension for debugging web components built with [Stencil](https://stenciljs.com/). 6 | 7 | Compatibility: Stencil 0.7.0 and up 8 | 9 | Provided inspections: 10 |
11 | Props 12 | 20 |
21 |
22 | States 23 | 27 |
28 |
29 | Elements 30 |
31 |
32 | Methods 33 |
34 |
35 | Events 36 | 66 |
67 |
68 | Lifecycle methods 69 |
70 |
71 | Internal class members 72 |
73 | 74 | ## Instructions 75 | 76 | 1. Clone the repo 77 | 2. Build the project using `npm run build` 78 | 3. Load unpacked extension in Chrome 79 | 4. Point to the `www` folder 80 | 81 | ## Screenshots 82 | 83 | ![Screenshot 1](docs/assets/screenshot1.jpg?raw=true "Screenshot 1") 84 | ![Screenshot 2](docs/assets/screenshot2.jpg?raw=true "Screenshot 2") 85 | ![Screenshot 3](docs/assets/screenshot3.jpg?raw=true "Screenshot 3") 86 | 87 | ## Credits 88 | 89 | * [Stencil Team](https://stenciljs.com/) 90 | * [Aurelia Inspector](https://github.com/aurelia/inspector) 91 | * [Vue.js devtools](https://github.com/vuejs/vue-devtools) 92 | * [Douglas Crockford](https://github.com/douglascrockford/JSON-js) -------------------------------------------------------------------------------- /STYLE_GUIDE.md: -------------------------------------------------------------------------------- 1 | # Stencil Style Guide 2 | 3 | This is a component style guide created and enforced internally by the core team of Stencil, for the purpose of standardizing [Ionic Core](https://ionicframework.com/) components. This should only be used as a reference for other teams in creating their own style guides. Feel free to modify to your team's own preference. 4 | 5 | 6 | ## File structure 7 | 8 | - One component per file. 9 | - One component per directory. Though it may make sense to group similar components into the same directory, we've found it's easier to document components when each one has its own directory. 10 | - Implementation (.tsx) and styles of a component should live in the same directory. 11 | 12 | Example from ionic-core: 13 | 14 | ``` 15 | ├── card 16 | │ ├── card.ios.scss 17 | │ ├── card.md.scss 18 | │ ├── card.scss 19 | │ ├── card.tsx 20 | │ └── test 21 | │ └── basic 22 | │ ├── e2e.js 23 | │ └── index.html 24 | ├── card-content 25 | │ ├── card-content.ios.scss 26 | │ ├── card-content.md.scss 27 | │ ├── card-content.scss 28 | │ └── card-content.tsx 29 | ├── card-title 30 | │ ├── card-title.ios.scss 31 | │ ├── card-title.md.scss 32 | │ ├── card-title.scss 33 | ``` 34 | 35 | 36 | ## Naming 37 | ### HTML tag 38 | 39 | #### Prefix 40 | The prefix has a major role when you are creating a collection of components intended to be used across diferent projects, like [@ionic/core](https://www.npmjs.com/package/@ionic/core). Web Components are not scoped because they are globally declared within the webpage, which means an "unique" prefix is needed to prevent collisions. The prefix is also able help to quickly indentify the collection of an component. Additionally, web components are required to contain a "-" dash within the tag name, so using the first section to namespace your components is a natural fit. 41 | 42 | We do not recommend using "stencil" as prefix, since Stencil DOES NOT emit stencil components, but rather the output is simply standards compliant web components. 43 | 44 | DO NOT do this: 45 | ``` 46 | stencil-component 47 | stnl-component 48 | ``` 49 | 50 | Instead, use your own naming or brand. For example, [Ionic](https://ionicframework.com/) components are all prefixed with `ion-`. 51 | ``` 52 | ion-button 53 | ion-header 54 | ``` 55 | 56 | #### Name 57 | 58 | Components are not actions, they are conceptually "things". It is better to use nouns, instead of verbs, such us: "animation" instead of "animating". "input", "tab", "nav", "menu" are some examples. 59 | 60 | 61 | #### Modifiers 62 | 63 | When several components are related and/or coupled, it is a good idea to share the name, and then add different modifiers, for example: 64 | 65 | ``` 66 | ion-menu 67 | ion-menu-controller 68 | ``` 69 | 70 | ``` 71 | ion-card 72 | ion-card-header 73 | ion-card-content 74 | ``` 75 | 76 | 77 | ### Component (TS class) 78 | 79 | The name of the ES6 class of the components SHOULD NOT have prefix since classes are scoped. There is no risk of collision. 80 | 81 | ```ts 82 | @Component({ 83 | tag: 'ion-button' 84 | }) 85 | export class Button { ... } 86 | 87 | @Component({ 88 | tag: 'ion-menu' 89 | }) 90 | export class Menu { ... } 91 | ``` 92 | 93 | 94 | ## TypeScript 95 | 96 | 1. **Follow** [tslint-ionic-rules](https://github.com/ionic-team/tslint-ionic-rules/blob/master/tslint.js) 97 | 98 | 2. **Variable decorators should be inlined.** 99 | 100 | ```ts 101 | @Prop() name: string; 102 | @Element() el: HTMLElement; 103 | ``` 104 | 105 | 3. **Method decorator should be multi-line** 106 | 107 | ```ts 108 | @Listen('click') 109 | onClick() { 110 | ... 111 | } 112 | ``` 113 | 114 | 4. **Use private variables and methods as much possible:** They are useful to detect deadcode and enforce encapsulation. Note that this is a feature which TypeScript provides to help harden your code, but using `private`, `public` or `protected` does not make a difference in the actual JavaScript output. 115 | 116 | 5. **Code with Method/Prop/Event/Component decorators should have jsdocs:** This allows for documentation generation and for better user experience in an editor that has TypeScript intellisense 117 | 118 | ## Code organization 119 | 120 | ### Newspaper Metaphor from The Robert C. Martin's _Clean Code_ 121 | 122 | > The source file should be organized like a newspaper article, with the highest level summary at the top, and more and more details further down. Functions called from the top function come directly below it, and so on down to the lowest level and most detailed functions at the bottom. This is a good way to organize the source code, even though IDE:s make the location of functions less important, since it is so easy to navigate in and out of them. 123 | 124 | ### High level example (commented) 125 | 126 | ```ts 127 | @Component({ 128 | tag: 'ion-something', 129 | styleUrl: 'something.scss', 130 | styleUrls: { 131 | ios: 'something.ios.scss', 132 | md: 'something.md.scss', 133 | wp: 'something.wp.scss' 134 | }, 135 | host: { 136 | theme: 'something' 137 | } 138 | }) 139 | export class Something { 140 | 141 | /** 142 | * 1. Own Properties 143 | * Always set the type if a default value has not 144 | * been set. If a default value is being set, then type 145 | * is already inferred. List the own properties in 146 | * alphabetical order. Note that because these properties 147 | * do not have the @Prop() decorator, they will not be exposed 148 | * publicly on the host element, but only used internally. 149 | */ 150 | num: number; 151 | someText = 'default'; 152 | 153 | /** 154 | * 2. Reference to host HTML element. 155 | * Inlined decorator 156 | */ 157 | @Element() el: HTMLElement; 158 | 159 | /** 160 | * 3. State() variables 161 | * Inlined decorator, alphabetical order. 162 | */ 163 | @State() isValidated: boolean; 164 | @State() status = 0; 165 | 166 | /** 167 | * 4. Internal props (context and connect) 168 | * Inlined decorator, alphabetical order. 169 | */ 170 | @Prop({ context: 'config' }) config: Config; 171 | @Prop({ connect: 'ion-menu-controller' }) lazyMenuCtrl: Lazy; 172 | 173 | /** 174 | * 5. Public Property API 175 | * Inlined decorator, alphabetical order. These are 176 | * different than "own properties" in that public props 177 | * are exposed as properties and attributes on the host element. 178 | * Requires JSDocs for public API documentation. 179 | */ 180 | @Prop() content: string; 181 | @Prop() enabled: boolean; 182 | @Prop() menuId: string; 183 | @Prop() type = 'overlay'; 184 | 185 | /** 186 | * NOTE: Prop lifecycle events SHOULD go just behind the Prop they listen to. 187 | * This makes sense since both statements are strongly connected. 188 | * - If renaming the instance variable name you must also update the name in @Watch() 189 | * - Code is easier to follow and maintain. 190 | */ 191 | @Prop() swipeEnabled = true; 192 | 193 | @Watch('swipeEnabled') 194 | swipeEnabledChanged() { 195 | this.updateState(); 196 | } 197 | 198 | /** 199 | * 6. Events section 200 | * Inlined decorator, alphabetical order. 201 | * Requires JSDocs for public API documentation. 202 | */ 203 | @Event() ionClose: EventEmitter; 204 | @Event() ionDrag: EventEmitter; 205 | @Event() ionOpen: EventEmitter; 206 | 207 | /** 208 | * 7. Component lifecycle events 209 | * Ordered by their natural call order, for example 210 | * WillLoad should go before DidLoad. 211 | */ 212 | componentWillLoad() {} 213 | componentDidLoad() {} 214 | componentWillEnter() {} 215 | componentDidEnter() {} 216 | componentWillLeave() {} 217 | componentDidLeave() {} 218 | componentDidUnload() {} 219 | 220 | /** 221 | * 8. Listeners 222 | * It is ok to place them in a different location 223 | * if makes more sense in the context. Recommend 224 | * starting a listener method with "on". 225 | * Always use two lines. 226 | */ 227 | @Listen('click', { enabled: false }) 228 | onClick(ev: UIEvent) { 229 | console.log('hi!') 230 | } 231 | 232 | /** 233 | * 9. Public methods API 234 | * These methods are exposed on the host element. 235 | * Always use two lines. 236 | * Requires JSDocs for public API documentation. 237 | */ 238 | @Method() 239 | open() { 240 | ... 241 | } 242 | 243 | @Method() 244 | close() { 245 | ... 246 | } 247 | 248 | /** 249 | * 10. Local methods 250 | * Internal business logic. These methods cannot be 251 | * called from the host element. 252 | */ 253 | prepareAnimation(): Promise { 254 | ... 255 | } 256 | 257 | updateState() { 258 | ... 259 | } 260 | 261 | /** 262 | * 11. hostData() function 263 | * Used to dynamically set host element attributes. 264 | * Should be placed directly above render() 265 | */ 266 | hostData() { 267 | return { 268 | attribute: 'navigation', 269 | side: this.isRightSide ? 'right' : 'left', 270 | type: this.type, 271 | class: { 272 | 'something-is-animating': this.isAnimating 273 | } 274 | }; 275 | } 276 | 277 | /** 278 | * 12. render() function 279 | * Always the last one in the class. 280 | */ 281 | render() { 282 | return ( 283 | 286 | ); 287 | } 288 | } 289 | ``` 290 | -------------------------------------------------------------------------------- /docs/assets/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/stencil-inspector/11fd7161bda36ff78d4976604edcc47b2881914f/docs/assets/logo.jpg -------------------------------------------------------------------------------- /docs/assets/screenshot1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/stencil-inspector/11fd7161bda36ff78d4976604edcc47b2881914f/docs/assets/screenshot1.jpg -------------------------------------------------------------------------------- /docs/assets/screenshot2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/stencil-inspector/11fd7161bda36ff78d4976604edcc47b2881914f/docs/assets/screenshot2.jpg -------------------------------------------------------------------------------- /docs/assets/screenshot3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/stencil-inspector/11fd7161bda36ff78d4976604edcc47b2881914f/docs/assets/screenshot3.jpg -------------------------------------------------------------------------------- /docs/circleci.md: -------------------------------------------------------------------------------- 1 | # CircleCI Setup 2 | 3 | 1. Follow the official indications available here: https://circleci.com/blog/continuously-deploy-a-chrome-extension/ 4 | 2. Setup the following environment variables obtain from the above instructions: 5 | - CLIENT_ID 6 | - CLIENT_SECRET 7 | - REFRESH_TOKEN -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@stencil/inspector", 3 | "version": "0.0.1", 4 | "license": "MIT", 5 | "main": "dist/sti.js", 6 | "types": "dist/types/index.d.ts", 7 | "collection": "dist/collection/collection-manifest.json", 8 | "scripts": { 9 | "build": "npm run build.panel && npm run build.bridge", 10 | "build.panel": "stencil build", 11 | "build.bridge": "tsc -p src/helpers/tsconfig.json", 12 | "watch": "sd concurrent \"npm run watch.panel\" && \"npm run build.bridge\"", 13 | "watch.panel": "stencil build --watch", 14 | "watch.bridge": "tsc -w -p src/helpers/tsconfig.json", 15 | "lint": "sd concurrent \"npm run lint.ts\" \"npm run lint.styles\"", 16 | "lint.ts": "tslint -p tsconfig.json -c tslint.json", 17 | "lint.styles": "stylelint \"src/**/*.pcss\"", 18 | "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s" 19 | }, 20 | "dependencies": { 21 | "@stencil/core": "^0.7.2" 22 | }, 23 | "devDependencies": { 24 | "@stencil/postcss": "^0.0.4", 25 | "@stencil/utils": "^0.0.4", 26 | "@types/chrome": "^0.0.61", 27 | "conventional-changelog-cli": "^1.3.16", 28 | "postcss": "^6.0.20", 29 | "postcss-cssnext": "^3.1.0", 30 | "postcss-reporter": "^5.0.0", 31 | "postcss-url": "^7.3.1", 32 | "stylelint": "^9.1.3", 33 | "tslint": "^5.9.1", 34 | "tslint-ionic-rules": "^0.0.14", 35 | "tslint-language-service": "^0.9.8", 36 | "tslint-react": "^3.5.1", 37 | "typescript": "^2.7.2" 38 | }, 39 | "repository": { 40 | "type": "git", 41 | "url": "git+https://github.com/ionic-team/stencil-inspector.git" 42 | }, 43 | "author": "Ionic Team", 44 | "homepage": "https://stenciljs.com/", 45 | "description": "A minimal Chrome extension for debugging web components built with Stencil", 46 | "keywords": [ 47 | "stencil", 48 | "chrome", 49 | "debug", 50 | "plugin" 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /src/components.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is an autogenerated file created by the Stencil build process. 3 | * It contains typing information for all components that exist in this project 4 | * and imports for stencil collections that might be configured in your stencil.config.js file 5 | */ 6 | declare global { 7 | namespace JSX { 8 | interface Element {} 9 | export interface IntrinsicElements {} 10 | } 11 | namespace JSXElements {} 12 | 13 | interface HTMLStencilElement extends HTMLElement { 14 | componentOnReady(): Promise; 15 | componentOnReady(done: (ele?: this) => void): void; 16 | 17 | forceUpdate(): void; 18 | } 19 | 20 | interface HTMLAttributes {} 21 | } 22 | 23 | import { 24 | ItemData, 25 | ParsedCategoryData, 26 | } from '~helpers/declarations'; 27 | 28 | import { 29 | Arrow as StiArrow 30 | } from './components/arrow/arrow'; 31 | 32 | declare global { 33 | interface HTMLStiArrowElement extends StiArrow, HTMLStencilElement { 34 | } 35 | var HTMLStiArrowElement: { 36 | prototype: HTMLStiArrowElement; 37 | new (): HTMLStiArrowElement; 38 | }; 39 | interface HTMLElementTagNameMap { 40 | "sti-arrow": HTMLStiArrowElement; 41 | } 42 | interface ElementTagNameMap { 43 | "sti-arrow": HTMLStiArrowElement; 44 | } 45 | namespace JSX { 46 | interface IntrinsicElements { 47 | "sti-arrow": JSXElements.StiArrowAttributes; 48 | } 49 | } 50 | namespace JSXElements { 51 | export interface StiArrowAttributes extends HTMLAttributes { 52 | direction?: boolean; 53 | } 54 | } 55 | } 56 | 57 | 58 | import { 59 | Category as StiCategory 60 | } from './components/category/category'; 61 | 62 | declare global { 63 | interface HTMLStiCategoryElement extends StiCategory, HTMLStencilElement { 64 | } 65 | var HTMLStiCategoryElement: { 66 | prototype: HTMLStiCategoryElement; 67 | new (): HTMLStiCategoryElement; 68 | }; 69 | interface HTMLElementTagNameMap { 70 | "sti-category": HTMLStiCategoryElement; 71 | } 72 | interface ElementTagNameMap { 73 | "sti-category": HTMLStiCategoryElement; 74 | } 75 | namespace JSX { 76 | interface IntrinsicElements { 77 | "sti-category": JSXElements.StiCategoryAttributes; 78 | } 79 | } 80 | namespace JSXElements { 81 | export interface StiCategoryAttributes extends HTMLAttributes { 82 | category?: ParsedCategoryData; 83 | dark?: boolean; 84 | } 85 | } 86 | } 87 | 88 | 89 | import { 90 | ItemValue as StiItemValue 91 | } from './components/item-value/item-value'; 92 | 93 | declare global { 94 | interface HTMLStiItemValueElement extends StiItemValue, HTMLStencilElement { 95 | } 96 | var HTMLStiItemValueElement: { 97 | prototype: HTMLStiItemValueElement; 98 | new (): HTMLStiItemValueElement; 99 | }; 100 | interface HTMLElementTagNameMap { 101 | "sti-item-value": HTMLStiItemValueElement; 102 | } 103 | interface ElementTagNameMap { 104 | "sti-item-value": HTMLStiItemValueElement; 105 | } 106 | namespace JSX { 107 | interface IntrinsicElements { 108 | "sti-item-value": JSXElements.StiItemValueAttributes; 109 | } 110 | } 111 | namespace JSXElements { 112 | export interface StiItemValueAttributes extends HTMLAttributes { 113 | canExpand?: boolean; 114 | dark?: boolean; 115 | expanded?: boolean; 116 | item?: ItemData; 117 | onExpand?: (event: MouseEvent) => void; 118 | } 119 | } 120 | } 121 | 122 | 123 | import { 124 | Item as StiItem 125 | } from './components/item/item'; 126 | 127 | declare global { 128 | interface HTMLStiItemElement extends StiItem, HTMLStencilElement { 129 | } 130 | var HTMLStiItemElement: { 131 | prototype: HTMLStiItemElement; 132 | new (): HTMLStiItemElement; 133 | }; 134 | interface HTMLElementTagNameMap { 135 | "sti-item": HTMLStiItemElement; 136 | } 137 | interface ElementTagNameMap { 138 | "sti-item": HTMLStiItemElement; 139 | } 140 | namespace JSX { 141 | interface IntrinsicElements { 142 | "sti-item": JSXElements.StiItemAttributes; 143 | } 144 | } 145 | namespace JSXElements { 146 | export interface StiItemAttributes extends HTMLAttributes { 147 | dark?: boolean; 148 | item?: ItemData; 149 | print?: boolean; 150 | } 151 | } 152 | } 153 | 154 | 155 | import { 156 | Logo as StiLogo 157 | } from './components/logo/logo'; 158 | 159 | declare global { 160 | interface HTMLStiLogoElement extends StiLogo, HTMLStencilElement { 161 | } 162 | var HTMLStiLogoElement: { 163 | prototype: HTMLStiLogoElement; 164 | new (): HTMLStiLogoElement; 165 | }; 166 | interface HTMLElementTagNameMap { 167 | "sti-logo": HTMLStiLogoElement; 168 | } 169 | interface ElementTagNameMap { 170 | "sti-logo": HTMLStiLogoElement; 171 | } 172 | namespace JSX { 173 | interface IntrinsicElements { 174 | "sti-logo": JSXElements.StiLogoAttributes; 175 | } 176 | } 177 | namespace JSXElements { 178 | export interface StiLogoAttributes extends HTMLAttributes { 179 | dark?: boolean; 180 | } 181 | } 182 | } 183 | 184 | 185 | import { 186 | Main as StiMain 187 | } from './components/main/main'; 188 | 189 | declare global { 190 | interface HTMLStiMainElement extends StiMain, HTMLStencilElement { 191 | } 192 | var HTMLStiMainElement: { 193 | prototype: HTMLStiMainElement; 194 | new (): HTMLStiMainElement; 195 | }; 196 | interface HTMLElementTagNameMap { 197 | "sti-main": HTMLStiMainElement; 198 | } 199 | interface ElementTagNameMap { 200 | "sti-main": HTMLStiMainElement; 201 | } 202 | namespace JSX { 203 | interface IntrinsicElements { 204 | "sti-main": JSXElements.StiMainAttributes; 205 | } 206 | } 207 | namespace JSXElements { 208 | export interface StiMainAttributes extends HTMLAttributes { 209 | 210 | } 211 | } 212 | } 213 | 214 | 215 | import { 216 | Message as StiMessage 217 | } from './components/message/message'; 218 | 219 | declare global { 220 | interface HTMLStiMessageElement extends StiMessage, HTMLStencilElement { 221 | } 222 | var HTMLStiMessageElement: { 223 | prototype: HTMLStiMessageElement; 224 | new (): HTMLStiMessageElement; 225 | }; 226 | interface HTMLElementTagNameMap { 227 | "sti-message": HTMLStiMessageElement; 228 | } 229 | interface ElementTagNameMap { 230 | "sti-message": HTMLStiMessageElement; 231 | } 232 | namespace JSX { 233 | interface IntrinsicElements { 234 | "sti-message": JSXElements.StiMessageAttributes; 235 | } 236 | } 237 | namespace JSXElements { 238 | export interface StiMessageAttributes extends HTMLAttributes { 239 | dark?: boolean; 240 | message?: string; 241 | } 242 | } 243 | } 244 | 245 | 246 | import { 247 | Refresh as StiRefresh 248 | } from './components/refresh/refresh'; 249 | 250 | declare global { 251 | interface HTMLStiRefreshElement extends StiRefresh, HTMLStencilElement { 252 | } 253 | var HTMLStiRefreshElement: { 254 | prototype: HTMLStiRefreshElement; 255 | new (): HTMLStiRefreshElement; 256 | }; 257 | interface HTMLElementTagNameMap { 258 | "sti-refresh": HTMLStiRefreshElement; 259 | } 260 | interface ElementTagNameMap { 261 | "sti-refresh": HTMLStiRefreshElement; 262 | } 263 | namespace JSX { 264 | interface IntrinsicElements { 265 | "sti-refresh": JSXElements.StiRefreshAttributes; 266 | } 267 | } 268 | namespace JSXElements { 269 | export interface StiRefreshAttributes extends HTMLAttributes { 270 | 271 | } 272 | } 273 | } 274 | 275 | declare global { namespace JSX { interface StencilJSX {} } } 276 | -------------------------------------------------------------------------------- /src/components/arrow/arrow.pcss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: flex; 3 | font-size: 10px; 4 | color: rgb(105, 105, 105); 5 | cursor: default; 6 | margin: 0 5px 0 2px; 7 | box-sizing: border-box; 8 | align-self: center; 9 | transform: translateY(0); 10 | } 11 | -------------------------------------------------------------------------------- /src/components/arrow/arrow.tsx: -------------------------------------------------------------------------------- 1 | import { Component, Prop } from '@stencil/core'; 2 | 3 | @Component({ 4 | tag: 'sti-arrow', 5 | styleUrl: 'arrow.pcss', 6 | shadow: true 7 | }) 8 | export class Arrow { 9 | 10 | @Prop() direction = true; 11 | 12 | protected hostData() { 13 | return { 14 | class: { 15 | down: this.direction 16 | } 17 | }; 18 | } 19 | 20 | protected render() { 21 | return this.direction ? '▼' : '▶'; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/components/category/category.pcss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: flex; 3 | flex: 1; 4 | flex-flow: column; 5 | box-sizing: border-box; 6 | min-width: 100%; 7 | 8 | & .header { 9 | display: flex; 10 | flex: 1; 11 | font-weight: 400; 12 | font-size: 11px; 13 | margin: 0; 14 | padding: 4px; 15 | box-sizing: border-box; 16 | background: rgb(244, 244, 244); 17 | border-bottom: 0 solid rgba(0, 0, 0, 0.25); 18 | border-top: 1px solid rgba(0, 0, 0, 0.25); 19 | } 20 | } 21 | 22 | :host(:first-of-type) { 23 | & .header { 24 | border-top-width: 0; 25 | } 26 | } 27 | 28 | :host(:last-of-type), 29 | :host(.expanded) { 30 | & .header { 31 | border-bottom-width: 1px; 32 | } 33 | } 34 | 35 | :host(.expanded):host(:last-of-type) { 36 | border-bottom: 1px solid rgba(0, 0, 0, 0.25); 37 | } 38 | 39 | :host(.dark) { 40 | & .header { 41 | color: rgb(152, 152, 152); 42 | background: rgb(36, 36, 36); 43 | border-bottom-color: rgb(61, 61, 61); 44 | border-top-color: rgb(61, 61, 61); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/components/category/category.tsx: -------------------------------------------------------------------------------- 1 | import { Component, Prop, State } from '@stencil/core'; 2 | 3 | import autobind from '~decorators/autobind'; 4 | import { ItemData, ParsedCategoryData } from '~helpers/declarations'; 5 | 6 | @Component({ 7 | tag: 'sti-category', 8 | styleUrl: 'category.pcss', 9 | shadow: true 10 | }) 11 | export class Category { 12 | 13 | @Prop() category: ParsedCategoryData = null; 14 | 15 | @Prop() dark = false; 16 | 17 | @State() expanded = true; 18 | 19 | protected hostData() { 20 | return { 21 | class: { 22 | expanded: this.expanded, 23 | dark: this.dark 24 | } 25 | }; 26 | } 27 | 28 | @autobind 29 | private headerClickHandler() { 30 | this.expanded = !this.expanded; 31 | } 32 | 33 | @autobind 34 | private renderChild(item: ItemData) { 35 | return ( 36 | 37 | ); 38 | } 39 | 40 | private renderChildList() { 41 | if (!this.expanded) { 42 | return null; 43 | } 44 | 45 | const actualMessage: string = this.category.items.length === 0 ? 46 | `${this.category.label} has no entries.` : 47 | ''; 48 | 49 | return actualMessage ? 50 | : 51 | this.category.items.map(this.renderChild); 52 | } 53 | 54 | protected render() { 55 | return ( 56 |
57 |

58 | 59 |
60 | {this.category.label} 61 |
62 |

63 | {this.renderChildList()} 64 |
65 | ); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/components/item-value/item-value.pcss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: flex; 3 | align-self: center; 4 | justify-self: stretch; 5 | flex: 1; 6 | font-size: 12px; 7 | color: rgb(105, 105, 105); 8 | font-family: monospace; 9 | padding: 4px 10px 0 6px; 10 | 11 | & .input { 12 | width: 100%; 13 | border-radius: 2px; 14 | padding: 4px 6px; 15 | border: 1px solid rgb(128, 128, 128); 16 | outline: none; 17 | } 18 | 19 | & .value { 20 | &.canEdit { 21 | cursor: pointer; 22 | } 23 | 24 | &.null, 25 | &.undefined { 26 | color: rgb(105, 105, 105); 27 | } 28 | 29 | &.boolean { 30 | color: rgb(255, 20, 147); 31 | } 32 | 33 | &.function { 34 | color: rgb(255, 0, 0); 35 | white-space: nowrap; 36 | } 37 | 38 | &.string { 39 | color: rgb(255, 0, 0); 40 | white-space: nowrap; 41 | 42 | &:before, 43 | &:after { 44 | content: '"'; 45 | } 46 | } 47 | 48 | &.number { 49 | color: rgb(0, 0, 255); 50 | } 51 | 52 | &.array { 53 | color: rgb(0, 0, 0); 54 | } 55 | 56 | &.object, 57 | &.node { 58 | color: rgb(0, 0, 0); 59 | } 60 | 61 | &.node { 62 | color: rgb(203, 203, 203); 63 | } 64 | } 65 | } 66 | 67 | :host(:not(.editMode)) { 68 | padding: 0; 69 | } 70 | 71 | :host(.print) { 72 | white-space: pre; 73 | 74 | & .value { 75 | &.string { 76 | white-space: pre; 77 | 78 | &:before, 79 | &:after { 80 | content: ''; 81 | } 82 | } 83 | } 84 | } 85 | 86 | :host(.dark) { 87 | & .input { 88 | color: rgb(152, 152, 152); 89 | background: rgb(36, 36, 36); 90 | border-color: rgb(61, 61, 61); 91 | } 92 | 93 | & .value { 94 | &.function, 95 | &.string, 96 | &.array, 97 | &.object { 98 | color: rgb(203, 203, 203); 99 | } 100 | 101 | &:host(.number) { 102 | color: rgb(89, 166, 202); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/components/item-value/item-value.tsx: -------------------------------------------------------------------------------- 1 | import { Component, Element, Prop, State, Watch } from '@stencil/core'; 2 | 3 | import autobind from '~decorators/autobind'; 4 | import { ItemData } from '~helpers/declarations'; 5 | import { Injector } from '~helpers/injector'; 6 | 7 | @Component({ 8 | tag: 'sti-item-value', 9 | styleUrl: 'item-value.pcss', 10 | shadow: true 11 | }) 12 | export class ItemValue { 13 | 14 | @Prop() canExpand = false; 15 | 16 | @Prop() expanded = false; 17 | 18 | @Prop() onExpand: (event: MouseEvent) => void; 19 | 20 | @Prop() item: ItemData; 21 | 22 | @Prop() dark = false; 23 | 24 | @State() value: string; 25 | 26 | @State() editMode = false; 27 | 28 | private valueSent = true; 29 | 30 | @Element() 31 | private $element; 32 | 33 | @Watch('item') 34 | protected initialValueChangeHandler() { 35 | this.value = this.item.value.toString(); 36 | 37 | this.valueSent = true; 38 | } 39 | 40 | protected componentWillLoad() { 41 | this.value = this.item.value.toString(); 42 | 43 | this.valueSent = true; 44 | } 45 | 46 | protected componentDidUpdate() { 47 | const inputElement: HTMLInputElement = this.$element.shadowRoot.querySelector('input'); 48 | 49 | if (inputElement) { 50 | if (document.activeElement !== inputElement) { 51 | inputElement.focus(); 52 | } 53 | } 54 | } 55 | 56 | protected hostData() { 57 | return { 58 | class: { 59 | edit: this.editMode, 60 | dark: this.dark 61 | } 62 | }; 63 | } 64 | 65 | private updateValue(newValue: string | number | boolean) { 66 | const { 67 | edit: { 68 | type, 69 | member, 70 | instance 71 | } 72 | } = this.item; 73 | 74 | Injector.Instance.updateValue(member, newValue, type, instance); 75 | } 76 | 77 | @autobind 78 | private valueClickHandler() { 79 | const { 80 | edit: { 81 | enable, 82 | type 83 | } 84 | } = this.item; 85 | 86 | if (enable && !this.editMode) { 87 | if (type === 'boolean') { 88 | const nextValue: boolean = !this.value || this.value === 'false' || this.value === 'undefined' ? true : false; 89 | 90 | this.updateValue(nextValue); 91 | } else { 92 | this.editMode = true; 93 | } 94 | } 95 | } 96 | 97 | @autobind 98 | private inputKeyDownHandler(evt: KeyboardEvent) { 99 | switch (evt.keyCode) { 100 | case 13: // enter key 101 | evt.preventDefault(); 102 | 103 | this.editMode = false; 104 | 105 | if (!this.valueSent) { 106 | this.updateValue(this.value); 107 | } 108 | break; 109 | 110 | case 27: // esc key 111 | this.value = this.item.value; 112 | 113 | this.editMode = false; 114 | 115 | this.valueSent = true; 116 | break; 117 | } 118 | } 119 | 120 | @autobind 121 | private inputBlurHandler() { 122 | this.editMode = false; 123 | 124 | if (!this.valueSent) { 125 | this.updateValue(this.value); 126 | } 127 | } 128 | 129 | @autobind 130 | private inputChangeHandler(evt: UIEvent) { 131 | this.value = (evt.currentTarget as HTMLInputElement).value.toString(); 132 | this.valueSent = false; 133 | } 134 | 135 | protected render() { 136 | if (!this.editMode) { 137 | return [ 138 | this.canExpand && this.item.expand.enable ? 139 | : 144 | null, 145 | 154 | {this.value} 155 | 156 | ]; 157 | } 158 | 159 | return ( 160 | 168 | ); 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /src/components/item/item.pcss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: flex; 3 | flex: 1; 4 | overflow: hidden; 5 | box-sizing: border-box; 6 | flex-flow: column; 7 | padding: 0 4px; 8 | 9 | & .item { 10 | display: flex; 11 | flex: 1; 12 | padding: 3px 0; 13 | box-sizing: border-box; 14 | white-space: nowrap; 15 | 16 | & .name { 17 | display: flex; 18 | font-size: 12px; 19 | color: rgb(128, 0, 128); 20 | font-family: monospace; 21 | margin: 0 4px 0 1px; 22 | box-sizing: border-box; 23 | padding-left: 16px; 24 | align-self: center; 25 | 26 | &:after { 27 | content: ':'; 28 | font-size: 12px; 29 | color: rgb(105, 105, 105); 30 | font-family: monospace; 31 | } 32 | 33 | &.print { 34 | display: none; 35 | } 36 | } 37 | 38 | & .arrow + .name { 39 | padding-left: 0; 40 | } 41 | } 42 | 43 | & .children { 44 | flex: 1; 45 | display: flex; 46 | box-sizing: border-box; 47 | flex-direction: column; 48 | padding-left: 5px; 49 | } 50 | } 51 | 52 | :host(.dark) { 53 | & .item { 54 | & .name { 55 | color: rgb(52, 199, 187); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/components/item/item.tsx: -------------------------------------------------------------------------------- 1 | import { Component, Prop, State, Watch } from '@stencil/core'; 2 | 3 | import autobind from '~decorators/autobind'; 4 | import { ItemData } from '~helpers/declarations'; 5 | 6 | enum ExpandedValues { 7 | NONE = -1, 8 | ITEM = 0, 9 | SUBVALUE = 1 10 | } 11 | 12 | @Component({ 13 | tag: 'sti-item', 14 | styleUrl: 'item.pcss', 15 | shadow: true 16 | }) 17 | export class Item { 18 | 19 | @Prop() item: ItemData = null; 20 | 21 | @Prop() print = false; 22 | 23 | @Prop() dark = false; 24 | 25 | @State() expanded = ExpandedValues.NONE; 26 | 27 | @Watch('item') 28 | protected itemChangeHandler(newValue: ItemData, oldValue: ItemData) { 29 | const oldLabel = oldValue ? oldValue.label : undefined; 30 | 31 | if (!newValue || newValue.label !== oldLabel) { 32 | this.expanded = ExpandedValues.NONE; 33 | } 34 | } 35 | 36 | protected hostData() { 37 | return { 38 | class: { 39 | dark: this.dark 40 | } 41 | }; 42 | } 43 | 44 | @autobind 45 | private arrowClickHandlerBinder(expandedValueType) { 46 | return () => { 47 | this.expanded = this.expanded === expandedValueType ? ExpandedValues.NONE : expandedValueType; 48 | }; 49 | } 50 | 51 | private renderChildList() { 52 | const item = this.expanded === ExpandedValues.ITEM ? this.item : this.item.subvalue; 53 | const items = item.expand.value; 54 | 55 | return ( 56 |
57 | { 58 | items && items.length > 0 ? 59 | items.map(currentItem => ( 60 | 61 | )) : 62 | 66 | } 67 |
68 | ); 69 | } 70 | 71 | protected render() { 72 | return [ 73 | ( 74 |
75 | { 76 | this.item.expand.enable ? 77 | : 82 | null 83 | } 84 |
88 | {this.item.label} 89 |
90 | 100 |
101 | ), 102 | this.expanded === ExpandedValues.NONE ? null : this.renderChildList() 103 | ]; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/components/logo/logo.pcss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: flex; 3 | flex: 1; 4 | background: rgb(244, 244, 244); 5 | padding: 5px 0; 6 | box-sizing: border-box; 7 | color: rgb(22, 22, 29); 8 | min-width: 100%; 9 | justify-content: center; 10 | border-bottom: 1px solid rgba(0, 0, 0, 0.25); 11 | 12 | & .logo { 13 | display: flex; 14 | height: 25px; 15 | vertical-align: text-top; 16 | } 17 | 18 | & .badge { 19 | display: flex; 20 | font-weight: 800; 21 | font-size: 12px; 22 | vertical-align: super; 23 | letter-spacing: -1px; 24 | } 25 | } 26 | 27 | :host(.dark) { 28 | background: rgb(42, 42, 42); 29 | color: rgb(244, 244, 244); 30 | border-bottom-color: rgb(61, 61, 61); 31 | } 32 | -------------------------------------------------------------------------------- /src/components/logo/logo.tsx: -------------------------------------------------------------------------------- 1 | import { Component, Prop } from '@stencil/core'; 2 | 3 | @Component({ 4 | tag: 'sti-logo', 5 | styleUrl: 'logo.pcss', 6 | shadow: true 7 | }) 8 | export class Logo { 9 | 10 | @Prop() dark = false; 11 | 12 | protected hostData() { 13 | return { 14 | class: { 15 | dark: this.dark 16 | } 17 | }; 18 | } 19 | 20 | protected render() { 21 | return [ 22 | ( 23 | 33 | ), 34 | ( 35 |
36 | (INSPECTOR) 37 |
38 | ) 39 | ]; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/components/main/main.pcss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: flex; 3 | box-sizing: border-box; 4 | flex-flow: column; 5 | min-width: 100%; 6 | width: fit-content; 7 | 8 | & .menu { 9 | display: flex; 10 | flex: 1; 11 | font-weight: 400; 12 | font-size: 12px; 13 | margin: 0; 14 | padding: 8px 14px 8px 4px; 15 | box-sizing: border-box; 16 | background: rgb(244, 244, 244); 17 | border-bottom: 1px solid rgba(0, 0, 0, 0.25); 18 | justify-content: flex-end; 19 | } 20 | 21 | & .message, 22 | & .category { 23 | flex: 1; 24 | box-sizing: border-box; 25 | width: fit-content; 26 | min-width: 100%; 27 | } 28 | 29 | & .message { 30 | text-align: center; 31 | } 32 | } 33 | 34 | :host(.dark) { 35 | background-color: rgb(27, 27, 27); 36 | 37 | & .menu { 38 | color: rgb(152, 152, 152); 39 | background: rgb(36, 36, 36); 40 | border-bottom-color: rgb(61, 61, 61); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/components/main/main.tsx: -------------------------------------------------------------------------------- 1 | import { Component, State } from '@stencil/core'; 2 | 3 | import autobind from '~decorators/autobind'; 4 | import { Injector } from '~helpers/injector'; 5 | import { ParsedGroupData } from '~helpers/declarations'; 6 | 7 | @Component({ 8 | tag: 'sti-main', 9 | styleUrl: 'main.pcss', 10 | shadow: true 11 | }) 12 | export class Main { 13 | 14 | @State() component: ParsedGroupData = { 15 | status: { 16 | success: false, 17 | message: 'Loading...' 18 | }, 19 | categories: [] 20 | }; 21 | 22 | @State() dark = false; 23 | 24 | @State() loading = true; 25 | 26 | protected componentWillLoad() { 27 | this.dark = chrome && chrome.devtools && chrome.devtools.panels && (chrome.devtools.panels as any).themeName === 'dark'; 28 | 29 | Injector.Instance.register(this); 30 | } 31 | 32 | @autobind 33 | changeComponent(component: ParsedGroupData) { 34 | this.component = component; 35 | this.loading = false; 36 | } 37 | 38 | @autobind 39 | startLoading() { 40 | this.loading = true; 41 | } 42 | 43 | protected hostData() { 44 | return { 45 | class: { 46 | dark: this.dark 47 | } 48 | }; 49 | } 50 | 51 | @autobind 52 | private renderChild(category) { 53 | return ( 54 | 55 | ); 56 | } 57 | 58 | protected render() { 59 | const { 60 | success, 61 | message 62 | } = this.component.status; 63 | 64 | let actualMessage = ''; 65 | const itemsKeys = this.component.categories || []; 66 | 67 | if (!success) { 68 | actualMessage = message || 'Unknown Error'; 69 | } else if (itemsKeys.length === 0) { 70 | actualMessage = `Component has no items.`; 71 | } 72 | 73 | return [ 74 |