Skip to content

Commit f59260b

Browse files
committed
v2: Context menu on option+right click [publish]
1 parent b1d0a96 commit f59260b

File tree

14 files changed

+840
-600
lines changed

14 files changed

+840
-600
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
if: ${{ contains(github.event.head_commit.message, '[publish]') }}
1010
steps:
1111
- uses: actions/checkout@v3
12-
- uses: xhyrom/setup-bun@v0.1.8
12+
- uses: xhyrom/setup-bun@v1
1313
- run: bun install
1414
- run: bun ci
1515
- uses: ArnaudBarre/npm-publish@v1

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 2.0.0
4+
5+
Context menu on option+right click to see all the intermediate components and jump to the right place!
6+
Direct click is remove for two reasons:
7+
8+
- It doesn't play well with buttons and links
9+
- In large apps, you often end up on the generic component instead of going inside the usage of it
10+
311
## 1.0.3
412

513
- Add Vite 4 to peer dependency range

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# vite-plugin-react-click-to-component [![npm](https://img.shields.io/npm/v/vite-plugin-react-click-to-component)](https://www.npmjs.com/package/vite-plugin-react-click-to-component)
22

3-
Option+Click React components in your browser to open the source in your editor.
3+
Option+Right Click in your browser to open the source in your editor.
44

55
Light version of [ericclemmons/click-to-component](https://github.com/ericclemmons/click-to-component) that uses Vite's launch editor middleware to open the source code in your currently running editor.
66

bun.lockb

3.12 KB
Binary file not shown.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vite-plugin-react-click-to-component",
3-
"version": "1.0.3",
3+
"version": "2.0.0",
44
"license": "MIT",
55
"scripts": {
66
"postinstall": "cd playground && bun i",
@@ -11,7 +11,7 @@
1111
"lint-ci": "eslint src scripts --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1212
"prettier": "yarn prettier-ci --write",
1313
"prettier-ci": "prettier --ignore-path=.gitignore --check '**/*.{ts,tsx,html,css,json,md,yml}'",
14-
"ci": "tsc && bun lint-ci && bun prettier-ci && bun run build"
14+
"ci": "tsc && bun lint-ci && bun prettier-ci && bun run build && cd playground && tsc && bun lint-ci"
1515
},
1616
"prettier": {
1717
"trailingComma": "all"
@@ -21,12 +21,12 @@
2121
"vite": "^2 || ^3 || ^4"
2222
},
2323
"devDependencies": {
24-
"@arnaud-barre/eslint-config": "^1.0.17",
24+
"@arnaud-barre/eslint-config": "^1.0.19",
2525
"@nabla/tnode": "^0.8.0",
26-
"@types/node": "^18.11.12",
27-
"eslint": "^8.29.0",
28-
"prettier": "^2.8.1",
29-
"typescript": "^4.9.4",
30-
"vite": "^4.0.0"
26+
"@types/node": "^18.14.0",
27+
"eslint": "^8.34.0",
28+
"prettier": "^2.8.4",
29+
"typescript": "^4.9.5",
30+
"vite": "^4.1.4"
3131
}
3232
}

playground/bun.lockb

-464 Bytes
Binary file not shown.

playground/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
"name": "playground",
33
"private": true,
44
"scripts": {
5-
"dev": "vite"
5+
"dev": "vite",
6+
"lint-ci": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
67
},
78
"dependencies": {
89
"react": "^18.2.0",
910
"react-dom": "^18.2.0"
1011
},
1112
"devDependencies": {
12-
"@types/react-dom": "^18.0.9",
13-
"@vitejs/plugin-react-swc": "^3.0.0"
13+
"@types/react-dom": "^18.0.11",
14+
"@vitejs/plugin-react-swc": "^3.2.0"
1415
}
1516
}

playground/src/App.tsx

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
1-
import { useState } from "react";
21
import reactLogo from "./react.svg";
2+
import { Button } from "./Button";
33
import "./App.css";
44

5-
export const App = () => {
6-
const [count, setCount] = useState(0);
7-
8-
return (
9-
<div className="App">
10-
<div style={{ position: "fixed", right: 40, top: 40 }}>Top right</div>
11-
<div className="full-height">Full height</div>
12-
<div>
13-
<a href="https://vitejs.dev" target="_blank" rel="noreferrer">
14-
<img src="/vite.svg" className="logo" alt="Vite logo" />
15-
</a>
16-
<a href="https://reactjs.org" target="_blank" rel="noreferrer">
17-
<img src={reactLogo} className="logo react" alt="React logo" />
18-
</a>
19-
</div>
20-
<h1>Vite + React</h1>
21-
<div className="card">
22-
<button onClick={() => setCount(count + 1)}>count is {count}</button>
23-
<p>
24-
Edit <code>src/App.tsx</code> and save to test HMR
25-
</p>
26-
</div>
27-
<p className="read-the-docs">
28-
Click on the Vite and React logos to learn more
5+
export const App = () => (
6+
<div className="App">
7+
<div style={{ position: "fixed", right: 40, top: 40 }}>Top right</div>
8+
<div className="full-height">Full height</div>
9+
<div>
10+
<a href="https://vitejs.dev" target="_blank" rel="noreferrer">
11+
<img src="/vite.svg" className="logo" alt="Vite logo" />
12+
</a>
13+
<a href="https://reactjs.org" target="_blank" rel="noreferrer">
14+
<img src={reactLogo} className="logo react" alt="React logo" />
15+
</a>
16+
</div>
17+
<h1>Vite + React</h1>
18+
<div className="card">
19+
<Button />
20+
<p>
21+
Edit <code>src/App.tsx</code> and save to test HMR
2922
</p>
3023
</div>
31-
);
32-
};
24+
<p className="read-the-docs">
25+
Click on the Vite and React logos to learn more
26+
</p>
27+
</div>
28+
);

playground/src/Button.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { useState } from "react";
2+
3+
export const Button = () => {
4+
const [count, setCount] = useState(0);
5+
6+
return <button onClick={() => setCount(count + 1)}>count is {count}</button>;
7+
};

playground/yarn.lock

100755100644
Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,92 @@
11
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
22
# yarn lockfile v1
3-
# bun ./bun.lockb --hash: 7E502891CC3CE8CC-f8f63b46ff797c67-3D098B48DC753020-0c86a38c3d477462
3+
# bun ./bun.lockb --hash: C6A399B4BFDAB035-b0d685f590d9fa8d-44ABB523C705F2F6-56bcddc0f6883165
44

55

6-
"@swc/core@^1.3.21":
7-
version "1.3.22"
8-
resolved "https://registry.npmjs.org/@swc/core/-/core-1.3.22.tgz"
9-
integrity sha512-oQ9EPEb7NgWcGIDoVfLCuffvtC4MzVtrwjqwKzFHP8FUh1fn8+2wraOjkkDXW74BB4Hgve5ykkaHix9bebB9Ww==
6+
"@swc/core@^1.3.35":
7+
version "1.3.36"
8+
resolved "https://registry.npmjs.org/@swc/core/-/core-1.3.36.tgz"
9+
integrity sha512-Ogrd9uRNIj7nHjXxG66UlKBIcXESUenJ7OD6K2a8p82qlg6ne7Ne5Goiipm/heHYhSfVmjcnRWL9ZJ4gv+YCPA==
1010
dependencies:
11-
"@swc/core-win32-x64-msvc" "1.3.22"
12-
"@swc/core-darwin-x64" "1.3.22"
13-
"@swc/core-linux-x64-gnu" "1.3.22"
14-
"@swc/core-linux-x64-musl" "1.3.22"
15-
"@swc/core-win32-ia32-msvc" "1.3.22"
16-
"@swc/core-linux-arm64-gnu" "1.3.22"
17-
"@swc/core-linux-arm-gnueabihf" "1.3.22"
18-
"@swc/core-darwin-arm64" "1.3.22"
19-
"@swc/core-linux-arm64-musl" "1.3.22"
20-
"@swc/core-win32-arm64-msvc" "1.3.22"
21-
22-
23-
version "1.3.22"
24-
resolved "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.22.tgz"
25-
integrity sha512-MMhtPsuXp8gpUgr9bs+RZQ2IyFGiUNDG93usCDAFgAF+6VVp+YaAVjET/3/Bx5Lk2WAt0RxT62C9KTEw1YMo3w==
26-
27-
28-
version "1.3.22"
29-
resolved "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.22.tgz"
30-
integrity sha512-SG6QbNat4GZ5VJU3Zo6a54oQOtbhJVE6BCQw4JjOCZJmAeBzNebGy9wsT4+fCJNHC3C5qtaRw7ToXJvLniXwfg==
31-
32-
33-
version "1.3.22"
34-
resolved "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.22.tgz"
35-
integrity sha512-4E+TdQT1oHnHjDaPs/DyrRy9lOuFd6ncEd67yYA4j9lFqt6nuz/jnXss45k8KU7wR5kOTtdW73xPwkU4NbOWdw==
36-
37-
38-
version "1.3.22"
39-
resolved "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.22.tgz"
40-
integrity sha512-6VcynOMbOBcbLutIPENI3Ejvg5LGz/Pwvzm25hM0FoiEtPxHA+tawQUwLx8Alk1Yr+Rnqid06UEZ0veJOGn2pQ==
41-
42-
43-
version "1.3.22"
44-
resolved "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.22.tgz"
45-
integrity sha512-86RxGy0L3qa4De3xWHx8vL2caTxvSLSWTlgUW/Yd4l1pvrCFibMjhkImGu5ViKiReX9DlBtJ7CBs4dln2kHidw==
46-
47-
48-
version "1.3.22"
49-
resolved "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.22.tgz"
50-
integrity sha512-FLkbiqsdXsVIFZi6iedx4rSBGX8x0vo/5aDlklSxJAAYOcQpO0QADKP5Yr65iMT1d6ABCt2d+/StpGLF7GWOcA==
51-
52-
53-
version "1.3.22"
54-
resolved "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.22.tgz"
55-
integrity sha512-giBuw+Z0Bq6fpZ0Y5TcfpcQwf9p/cE1fOQyO/K1XSTn/haQOqFi7421Jq/dFThSARZiXw1u9Om9VFbwxr8VI+A==
56-
57-
58-
version "1.3.22"
59-
resolved "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.22.tgz"
60-
integrity sha512-loKGO+ZM2By6VdrmVJk1G79jVgDPaee93qLFuis5KyeoLLb4m1MlNMc/6SIDZUSuYg6NqaGP1spFeiFetMQ4Zg==
61-
62-
63-
version "1.3.22"
64-
resolved "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.22.tgz"
65-
integrity sha512-lvNWAZ3QjXMsrsch6oLLQVikT/hC/4ZcLrTBXa14HwQylaYigkGElgp3ekJr78HjWDPwB46GXwBbNMG0VNAfvA==
66-
67-
68-
version "1.3.22"
69-
resolved "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.22.tgz"
70-
integrity sha512-ESyn4lZXAKEE3mcTaDfXatsolCiEfVGstsXdgBmZYa6o1IE1bDW8FE7Ob/Y+82WTpm9+A9ZYXYjZ62t67POHZg==
11+
"@swc/core-win32-x64-msvc" "1.3.36"
12+
"@swc/core-darwin-x64" "1.3.36"
13+
"@swc/core-linux-x64-gnu" "1.3.36"
14+
"@swc/core-linux-x64-musl" "1.3.36"
15+
"@swc/core-win32-ia32-msvc" "1.3.36"
16+
"@swc/core-linux-arm64-gnu" "1.3.36"
17+
"@swc/core-linux-arm-gnueabihf" "1.3.36"
18+
"@swc/core-darwin-arm64" "1.3.36"
19+
"@swc/core-linux-arm64-musl" "1.3.36"
20+
"@swc/core-win32-arm64-msvc" "1.3.36"
21+
22+
23+
version "1.3.36"
24+
resolved "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.36.tgz"
25+
integrity sha512-lsP+C8p9cC/Vd9uAbtxpEnM8GoJI/MMnVuXak7OlxOtDH9/oTwmAcAQTfNGNaH19d2FAIRwf+5RbXCPnxa2Zjw==
26+
27+
28+
version "1.3.36"
29+
resolved "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.36.tgz"
30+
integrity sha512-jaLXsozWN5xachl9fPxDMi5nbWq1rRxPAt6ISeiYB6RJk0MQKH1634pOweBBem2pUDDzwDFXFw6f22LTm/cFvA==
31+
32+
33+
version "1.3.36"
34+
resolved "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.36.tgz"
35+
integrity sha512-vcBdTHjoEpvJDbFlgto+S6VwAHzLA9GyCiuNcTU2v4KNQlFzhbO4A4PMfMCb/Z0RLJEr16tirfHdWIxjU3h8nw==
36+
37+
38+
version "1.3.36"
39+
resolved "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.36.tgz"
40+
integrity sha512-o7f5OsvwWppJo+qIZmrGO5+XC6DPt6noecSbRHjF6o1YAcR13ETPC14k1eC9H1YbQwpyCFNVAFXyNcUbCeQyrQ==
41+
42+
43+
version "1.3.36"
44+
resolved "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.36.tgz"
45+
integrity sha512-FSHPngMi3c0fuGt9yY2Ubn5UcELi3EiPLJxBSC3X8TF9atI/WHZzK9PE9Gtn0C/LyRh4CoyOugDtSOPzGYmLQg==
46+
47+
48+
version "1.3.36"
49+
resolved "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.36.tgz"
50+
integrity sha512-PHSsH2rek5pr3e0K09VgWAbrWK2vJhaI7MW9TPoTjyACYjcs3WwjcjQ30MghXUs2Dc/bXjWAOi9KFTjq/uCyFg==
51+
52+
53+
version "1.3.36"
54+
resolved "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.36.tgz"
55+
integrity sha512-4LfMYQHzozHCKkIcmQy83b+4SpI+mOp6sYNbXqSRz5dYvTVjegKZXe596P1U/87cK2cgR4uYvkgkgBXquaWvwQ==
56+
57+
58+
version "1.3.36"
59+
resolved "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.36.tgz"
60+
integrity sha512-7y3dDcun79TAjCyk3Iv0eOMw1X/KNQbkVyKOGqnEgq9g22F8F1FoUGKHNTzUqVdzpHeJSsHgW5PlkEkl3c/d9w==
61+
62+
63+
version "1.3.36"
64+
resolved "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.36.tgz"
65+
integrity sha512-zK0VR3B4LX5hzQ+7eD+K+FkxJlJg5Lo36BeahMzQ+/i0IURpnuyFlW88sdkFkMsc2swdU6bpvxLZeIRQ3W4OUg==
66+
67+
68+
version "1.3.36"
69+
resolved "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.36.tgz"
70+
integrity sha512-2bIjr9DhAckGiXZEvj6z2z7ECPcTimG+wD0VuQTvr+wkx46uAJKl5Kq+Zk+dd15ErL7JGUtCet1T7bf1k4FwvQ==
7171

7272
"@types/prop-types@*":
7373
version "15.7.5"
7474
resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz"
7575
integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==
7676

7777
"@types/react@*":
78-
version "18.0.25"
79-
resolved "https://registry.npmjs.org/@types/react/-/react-18.0.25.tgz"
80-
integrity sha512-xD6c0KDT4m7n9uD4ZHi02lzskaiqcBxf4zi+tXZY98a04wvc0hi/TcCPC2FOESZi51Nd7tlUeOJY8RofL799/g==
78+
version "18.0.28"
79+
resolved "https://registry.npmjs.org/@types/react/-/react-18.0.28.tgz"
80+
integrity sha512-RD0ivG1kEztNBdoAK7lekI9M+azSnitIn85h4iOiaLjaTrMjzslhaqCGaI4IyCJ1RljWiLCEu4jyrLLgqxBTew==
8181
dependencies:
8282
"@types/prop-types" "*"
8383
"@types/scheduler" "*"
8484
csstype "^3.0.2"
8585

86-
"@types/react-dom@^18.0.9":
87-
version "18.0.9"
88-
resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.9.tgz"
89-
integrity sha512-qnVvHxASt/H7i+XG1U1xMiY5t+IHcPGUK7TDMDzom08xa7e86eCeKOiLZezwCKVxJn6NEiiy2ekgX8aQssjIKg==
86+
"@types/react-dom@^18.0.11":
87+
version "18.0.11"
88+
resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.11.tgz"
89+
integrity sha512-O38bPbI2CWtgw/OoQoY+BRelw7uysmXbWvw3nLWO21H1HSh+GOlqPuXshJfjmpNlKiiSDG9cc1JZAaMmVdcTlw==
9090
dependencies:
9191
"@types/react" "*"
9292

@@ -95,12 +95,12 @@
9595
resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz"
9696
integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==
9797

98-
"@vitejs/plugin-react-swc@^3.0.0":
99-
version "3.0.0"
100-
resolved "https://registry.npmjs.org/@vitejs/plugin-react-swc/-/plugin-react-swc-3.0.0.tgz"
101-
integrity sha512-vYlodz/mjYRbxMGbHzDgR8aPR+z8n7K/enWkyBGH096xrL2DIPCuTvQVRYPTXGyy6wO7OFiMxZ3r4nKQD1sH0A==
98+
"@vitejs/plugin-react-swc@^3.2.0":
99+
version "3.2.0"
100+
resolved "https://registry.npmjs.org/@vitejs/plugin-react-swc/-/plugin-react-swc-3.2.0.tgz"
101+
integrity sha512-IcBoXL/mcH7JdQr/nfDlDwTdIaH8Rg7LpfQDF4nAht+juHWIuv6WhpKPCSfY4+zztAaB07qdBoFz1XCZsgo3pQ==
102102
dependencies:
103-
"@swc/core" "^1.3.21"
103+
"@swc/core" "^1.3.35"
104104

105105
csstype@^3.0.2:
106106
version "3.1.1"
@@ -109,7 +109,7 @@ csstype@^3.0.2:
109109

110110
"js-tokens@^3.0.0 || ^4.0.0":
111111
version "4.0.0"
112-
resolved ""
112+
resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz"
113113
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
114114

115115
loose-envify@^1.1.0:

0 commit comments

Comments
 (0)