Skip to content

Commit 9907331

Browse files
committed
improve docs and strucutre
1 parent 80b71f9 commit 9907331

9 files changed

Lines changed: 233 additions & 128 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
node-version: 22
2222
cache: npm
2323
- run: npm ci
24+
- run: npm run build
2425
- run: npm run lint
2526

2627
typecheck:
@@ -33,6 +34,7 @@ jobs:
3334
node-version: 22
3435
cache: npm
3536
- run: npm ci
37+
- run: npm run build
3638
- run: npm run tsc
3739

3840
test:

CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at <opensource@github.com>. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
## Contributing
2+
3+
[fork]: https://github.com/github/storybook-addon-performance-panel/fork
4+
[pr]: https://github.com/github/storybook-addon-performance-panel/compare
5+
6+
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
7+
8+
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
9+
10+
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
11+
12+
## Project structure
13+
14+
This is an npm workspaces monorepo with two packages:
15+
16+
| Directory | Package | Description |
17+
|-----------|---------|-------------|
18+
| `packages/storybook-addon-performance-panel` | `@github-ui/storybook-addon-performance-panel` | The addon — collectors, panel UI, and types |
19+
| `packages/docs` | `@github-ui/docs` | Documentation site built with Storybook |
20+
21+
### Useful commands
22+
23+
| Command | Description |
24+
|---------|-------------|
25+
| `npm run build` | Build the addon |
26+
| `npm run build:watch` | Build the addon in watch mode |
27+
| `npm test` | Run tests |
28+
| `npm run lint` | Lint with ESLint + Prettier |
29+
| `npm run tsc` | Type-check the addon |
30+
| `npm run docs` | Build the addon and start the docs site locally |
31+
| `npm run docs:build` | Build the addon and the docs site for production |
32+
33+
## Prerequisites for running and testing code
34+
35+
These are one time installations required to be able to test your changes locally as part of the pull request (PR) submission process.
36+
37+
1. Install [Node.js](https://nodejs.org/) (v22 or later)
38+
1. Install dependencies: `npm install`
39+
40+
## Submitting a pull request
41+
42+
1. [Fork][fork] and clone the repository
43+
1. Install the dependencies: `npm install`
44+
1. Build the addon: `npm run build`
45+
1. Make sure the tests pass on your machine: `npm test`
46+
1. Make sure the linter passes: `npm run lint`
47+
1. Create a new branch: `git checkout -b my-branch-name`
48+
1. Make your change, add tests, and make sure the tests and linter still pass
49+
1. Push to your fork and [submit a pull request][pr]
50+
1. Pat yourself on the back and wait for your pull request to be reviewed and merged.
51+
52+
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
53+
54+
- Write tests.
55+
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
56+
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
57+
58+
## Resources
59+
60+
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
61+
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
62+
- [GitHub Help](https://help.github.com)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright GitHub, Inc.
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.

SECURITY.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Thanks for helping make GitHub safe for everyone.
2+
3+
# Security
4+
5+
GitHub takes the security of our software products and services seriously, including all of the open source code repositories managed through our GitHub organizations, such as [GitHub](https://github.com/GitHub).
6+
7+
Even though [open source repositories are outside of the scope of our bug bounty program](https://bounty.github.com/index.html#scope) and therefore not eligible for bounty rewards, we will ensure that your finding gets passed along to the appropriate maintainers for remediation.
8+
9+
## Reporting Security Issues
10+
11+
If you believe you have found a security vulnerability in any GitHub-owned repository, please report it to us through coordinated disclosure.
12+
13+
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
14+
15+
Instead, please send an email to opensource-security[@]github.com.
16+
17+
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
18+
19+
* The type of issue (e.g., buffer overflow, SQL injection, or cross-site scripting)
20+
* Full paths of source file(s) related to the manifestation of the issue
21+
* The location of the affected source code (tag/branch/commit or direct URL)
22+
* Any special configuration required to reproduce the issue
23+
* Step-by-step instructions to reproduce the issue
24+
* Proof-of-concept or exploit code (if possible)
25+
* Impact of the issue, including how an attacker might exploit the issue
26+
27+
This information will help us triage your report more quickly.
28+
29+
## Policy
30+
31+
See [GitHub's Safe Harbor Policy](https://docs.github.com/en/site-policy/security-policies/github-bug-bounty-program-legal-safe-harbor#1-safe-harbor-terms)

SUPPORT.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Support
2+
3+
## How to file issues and get help
4+
5+
This project uses GitHub issues to track bugs and feature requests. Please search the [existing issues](https://github.com/github/storybook-addon-performance-panel/issues) before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new issue.
6+
7+
For help or questions about using this project, please open a [GitHub Discussion](https://github.com/github/storybook-addon-performance-panel/discussions) or file an issue.
8+
9+
**storybook-addon-performance-panel** is under active development and maintained by GitHub staff. We will do our best to respond to support, feature requests, and community questions in a timely manner.
10+
11+
## GitHub Support Policy
12+
13+
Support for this project is limited to the resources listed above.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"packages/*"
77
],
88
"scripts": {
9-
"build": "npm run build -w packages/storybook-addon-performance-panel",
10-
"build:watch": "npm run build:watch -w packages/storybook-addon-performance-panel",
9+
"build": "npm run build -w @github-ui/storybook-addon-performance-panel",
10+
"build:watch": "npm run build:watch -w @github-ui/storybook-addon-performance-panel",
1111
"lint": "eslint . --cache",
12-
"test": "npm test -w packages/storybook-addon-performance-panel",
12+
"test": "npm test -w @github-ui/storybook-addon-performance-panel",
1313
"tsc": "tsc -b packages/storybook-addon-performance-panel/tsconfig.build.json",
14-
"docs": "npm run build && npm run storybook -w packages/docs",
15-
"docs:build": "npm run build && npm run build-storybook -w packages/docs"
14+
"docs": "npm run build && npm run storybook -w @github-ui/docs",
15+
"docs:build": "npm run build && npm run build-storybook -w @github-ui/docs"
1616
},
1717
"devDependencies": {
1818
"@eslint/js": "^9.0.1",

packages/docs/stories/Metrics.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Collected via `requestAnimationFrame` loop (heuristic).
6262
</table>
6363

6464

65+
6566
**How it works:** A `requestAnimationFrame` callback measures the delta between frames. Each delta is compared against the 16.67ms target (60fps). Dropped frames are those where `delta > 33.34ms`. Frame stability tracks how consistently frames hit the target timing.
6667

6768
---
@@ -120,6 +121,7 @@ Collected via [Event Timing API](https://w3c.github.io/event-timing/) (optimal,
120121
</table>
121122

122123

124+
123125
**Interaction breakdown:** Each interaction timing is shown as `[wait Xms] → [js Xms] → [paint Xms]`:
124126
- **Wait** = input delay (main thread was busy before handlers ran)
125127
- **JS** = processing time (event handler execution)
@@ -171,6 +173,7 @@ Collected via [Long Tasks API](https://w3c.github.io/longtasks/) (optimal, Chrom
171173
</table>
172174

173175

176+
174177
**How TBT works:** For each long task, only the time exceeding 50ms counts. A 70ms task contributes 20ms to TBT. This matches the [Lighthouse TBT methodology](https://web.dev/articles/tbt).
175178

176179
---
@@ -211,6 +214,7 @@ Collected via [Long Animation Frames API](https://w3c.github.io/long-animation-f
211214
</table>
212215

213216

217+
214218
**Why LoAF matters:** Unlike Long Tasks, LoAF provides **script attribution** — which functions in which files caused the slow frame. Invoker types include `event-listener`, `user-callback`, `resolve-promise`, and `classic-script`. This is the primary tool for debugging INP issues.
215219

216220
---
@@ -248,6 +252,7 @@ Collected via [Layout Instability API](https://w3c.github.io/layout-instability/
248252
</table>
249253

250254

255+
251256
**Session windowing:** CLS uses session windows per the Core Web Vitals spec: groups of shifts with &lt;1s gaps and &lt;5s total duration. The final CLS is the maximum session window value.
252257

253258
---
@@ -276,6 +281,7 @@ Collected via [Layout Instability API](https://w3c.github.io/layout-instability/
276281
</table>
277282

278283

284+
279285
**Forced Reflows** — collected via property getter instrumentation (heuristic).
280286

281287
<table>
@@ -298,6 +304,7 @@ Collected via [Layout Instability API](https://w3c.github.io/layout-instability/
298304
</table>
299305

300306

307+
301308
**What triggers a forced reflow:** Reading any layout property (`offsetHeight`, `getBoundingClientRect()`, `getComputedStyle()`, etc.) after writing styles forces the browser to synchronously recalculate layout. This is one of the most common causes of jank.
302309

303310
---
@@ -342,6 +349,7 @@ Collected via [React Profiler API](https://react.dev/reference/react/Profiler) (
342349
</table>
343350

344351

352+
345353
**Render cascades** indicate `setState` called during the commit phase, typically in `useLayoutEffect`. These trigger synchronous re-renders and are expensive. Even 1 render cascade per interaction is worth investigating.
346354

347355
**Profiling in production:** By default, React strips the Profiler API in production builds. To keep it working in deployed Storybook, alias `react-dom/client` to `react-dom/profiling` in your Vite config (see [Setup Guide](?path=/docs/guides-setup--docs#react-profiling-in-production-builds)).
@@ -376,6 +384,7 @@ Collected via [React Profiler API](https://react.dev/reference/react/Profiler) (
376384
</table>
377385

378386

387+
379388
**GC Pressure:** Sustained values &gt;1 MB/s indicate memory-intensive operations. High GC pressure causes periodic frame drops when the garbage collector runs.
380389

381390
**Paint & Resources** — collected via Paint Timing API and Resource Timing API (optimal, all browsers).
@@ -404,6 +413,7 @@ Collected via [React Profiler API](https://react.dev/reference/react/Profiler) (
404413
</table>
405414

406415

416+
407417
---
408418

409419
## Element Timing
@@ -434,6 +444,7 @@ Collected via [Element Timing API](https://w3c.github.io/element-timing/) (optim
434444
</table>
435445

436446

447+
437448
**Usage:** Add the `elementtiming` attribute to any element you want to track:
438449

439450
```tsx
@@ -525,4 +536,5 @@ Collected via [Element Timing API](https://w3c.github.io/element-timing/) (optim
525536
</table>
526537

527538

539+
528540
**Chrome/Edge is recommended** for the most complete metrics during development and debugging.

0 commit comments

Comments
 (0)