Skip to content

Commit 4079d80

Browse files
d13nzaytsev
andcommitted
Converts the graph view to web-components
Co-authored-by: Nikolai Zaytsev <[email protected]>
1 parent 0d14a77 commit 4079d80

35 files changed

+7465
-213
lines changed

ThirdPartyNotices.txt

Lines changed: 203 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,25 @@ This project incorporates components from the projects listed below.
1717
12. @opentelemetry/resources version 1.30.1 (https://github.com/open-telemetry/opentelemetry-js)
1818
13. @opentelemetry/sdk-trace-base version 1.30.1 (https://github.com/open-telemetry/opentelemetry-js)
1919
14. @opentelemetry/semantic-conventions version 1.30.0 (https://github.com/open-telemetry/opentelemetry-js)
20-
15. @shoelace-style/shoelace version 2.20.0 (https://github.com/shoelace-style/shoelace)
21-
16. @vscode/codicons version 0.0.36 (https://github.com/microsoft/vscode-codicons)
22-
17. billboard.js version 3.14.3 (https://github.com/naver/billboard.js)
23-
18. https-proxy-agent version 5.0.1 (https://github.com/TooTallNate/node-https-proxy-agent)
24-
19. iconv-lite version 0.6.3 (https://github.com/ashtuchkin/iconv-lite)
25-
20. lit version 3.2.1 (https://github.com/lit/lit)
26-
21. marked version 15.0.7 (https://github.com/markedjs/marked)
27-
22. microsoft/vscode (https://github.com/microsoft/vscode)
28-
23. node-fetch version 2.7.0 (https://github.com/bitinn/node-fetch)
29-
24. os-browserify version 0.3.0 (https://github.com/CoderPuppy/os-browserify)
30-
25. path-browserify version 1.0.1 (https://github.com/browserify/path-browserify)
31-
26. react-dom version 16.8.4 (https://github.com/facebook/react)
32-
27. react version 16.8.4 (https://github.com/facebook/react)
33-
28. signal-utils version 0.21.1 (https://github.com/proposal-signals/signal-utils)
34-
29. slug version 10.0.0 (https://github.com/Trott/slug)
35-
30. sortablejs version 1.15.0 (https://github.com/SortableJS/Sortable)
20+
15. @r2wc/react-to-web-component version 2.0.4 (https://github.com/bitovi/react-to-web-component)
21+
16. @shoelace-style/shoelace version 2.20.0 (https://github.com/shoelace-style/shoelace)
22+
17. @vscode/codicons version 0.0.36 (https://github.com/microsoft/vscode-codicons)
23+
18. billboard.js version 3.14.3 (https://github.com/naver/billboard.js)
24+
19. https-proxy-agent version 5.0.1 (https://github.com/TooTallNate/node-https-proxy-agent)
25+
20. iconv-lite version 0.6.3 (https://github.com/ashtuchkin/iconv-lite)
26+
21. lit version 3.2.1 (https://github.com/lit/lit)
27+
22. marked version 15.0.7 (https://github.com/markedjs/marked)
28+
23. microsoft/vscode (https://github.com/microsoft/vscode)
29+
24. node-fetch version 2.7.0 (https://github.com/bitinn/node-fetch)
30+
25. os-browserify version 0.3.0 (https://github.com/CoderPuppy/os-browserify)
31+
26. path-browserify version 1.0.1 (https://github.com/browserify/path-browserify)
32+
27. react-dom version 16.14.0 (https://github.com/facebook/react)
33+
28. react-dom version 19.0.0 (https://github.com/facebook/react)
34+
29. react version 16.14.0 (https://github.com/facebook/react)
35+
30. react version 19.0.0 (https://github.com/facebook/react)
36+
31. signal-utils version 0.21.1 (https://github.com/proposal-signals/signal-utils)
37+
32. slug version 10.0.0 (https://github.com/Trott/slug)
38+
33. sortablejs version 1.15.0 (https://github.com/SortableJS/Sortable)
3639

3740
%% @gk-nzaytsev/fast-string-truncated-width NOTICES AND INFORMATION BEGIN HERE
3841
=========================================
@@ -1324,6 +1327,136 @@ END OF @opentelemetry/sdk-trace-base NOTICES AND INFORMATION
13241327
=========================================
13251328
END OF @opentelemetry/semantic-conventions NOTICES AND INFORMATION
13261329

1330+
%% @r2wc/react-to-web-component NOTICES AND INFORMATION BEGIN HERE
1331+
=========================================
1332+
# React to Web Component
1333+
1334+
`@r2wc/react-to-web-component` converts [React](https://reactjs.org/) components to [custom elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements)! It lets you share React components as native elements that **don't** require being mounted through React. The custom element acts as a wrapper for the underlying React component. Use these custom elements with any project that uses HTML even in any framework (vue, svelte, angular, ember, canjs) the same way you would use standard HTML elements.
1335+
1336+
> Note: The latest version of this package only works with the React 18. If you are using React 16 or 17, please use version 1.
1337+
1338+
`@r2wc/react-to-web-component`:
1339+
1340+
- Works in all modern browsers. (Edge needs a [customElements polyfill](https://github.com/webcomponents/polyfills/tree/master/packages/custom-elements)).
1341+
- Is `1.26KB` minified and gzipped.
1342+
1343+
## Setup
1344+
1345+
To install from npm:
1346+
1347+
```
1348+
npm install @r2wc/react-to-web-component
1349+
```
1350+
1351+
## Need help or have questions?
1352+
1353+
This project is supported by [Bitovi, a React consultancy](https://www.bitovi.com/frontend-javascript-consulting/react-consulting). You can get help or ask questions on our:
1354+
1355+
- [Discord Community](https://discord.gg/J7ejFsZnJ4)
1356+
- [Twitter](https://twitter.com/bitovi)
1357+
1358+
Or, you can hire us for training, consulting, or development. [Set up a free consultation.](https://www.bitovi.com/frontend-javascript-consulting/react-consulting)
1359+
1360+
## Basic Use
1361+
1362+
For basic usage, we will use this simple React component:
1363+
1364+
```js
1365+
const Greeting = () => {
1366+
return <h1>Hello, World!</h1>
1367+
}
1368+
```
1369+
1370+
With our React component complete, all we have to do is call `r2wc` and [customElements.define](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define) to create and define our custom element:
1371+
1372+
```js
1373+
import r2wc from "@r2wc/react-to-web-component"
1374+
1375+
const WebGreeting = r2wc(Greeting)
1376+
1377+
customElements.define("web-greeting", WebGreeting)
1378+
```
1379+
1380+
Now we can use `<web-greeting>` like any other HTML element!
1381+
1382+
```html
1383+
<body>
1384+
<h1>Greeting Demo</h1>
1385+
1386+
<web-greeting></web-greeting>
1387+
</body>
1388+
```
1389+
1390+
In the above case, the web-greeting custom element is not making use of the `name` property from our `Greeting` component.
1391+
1392+
## Working with Attributes
1393+
1394+
By default, custom elements created by `r2wc` only pass properties to the underlying React component. To make attributes work, you must specify your component's props.
1395+
1396+
```js
1397+
const Greeting = ({ name }) => {
1398+
return <h1>Hello, {name}!</h1>
1399+
}
1400+
1401+
const WebGreeting = r2wc(Greeting, {
1402+
props: {
1403+
name: "string",
1404+
},
1405+
})
1406+
```
1407+
1408+
Now `r2wc` will know to look for `name` attributes
1409+
as follows:
1410+
1411+
```html
1412+
<body>
1413+
<h1>Greeting Demo</h1>
1414+
1415+
<web-greeting name="Justin"></web-greeting>
1416+
</body>
1417+
```
1418+
1419+
For projects needing more advanced usage of the web components, see our [programatic usage and declarative demos](docs/programatic-usage.md).
1420+
1421+
We also have a [complete example using a third party library](docs/complete-example.md).
1422+
1423+
## Examples
1424+
1425+
- [Hello World](https://codesandbox.io/s/hello-world-md5oih) - The quintessential software demo!
1426+
- [All the Props](https://codesandbox.io/s/all-the-props-n8z5hv) - A demo of all the prop transform types that R2WC supports.
1427+
- [Header Example](https://codesandbox.io/s/example-header-blog-7k313l) - An example reusable Header component.
1428+
- [MUI Button](https://codesandbox.io/s/example-mui-button-qwidh9) - An example application using an MUI button with theme customization.
1429+
- [Checklist Demo](https://codesandbox.io/s/example-checklist-blog-y3nqwx) - An example Checklist application.
1430+
1431+
## Blog Posts
1432+
1433+
R2WC with Vite [View Post](https://www.bitovi.com/blog/react-everywhere-with-vite-and-react-to-webcomponent)
1434+
1435+
R2WC with Create React App (CRA) [View Post](https://www.bitovi.com/blog/how-to-create-a-web-component-with-create-react-app)
1436+
1437+
## How it works
1438+
1439+
Check out our [full API documentation](https://github.com/bitovi/react-to-web-component/blob/main/docs/api.md).
1440+
1441+
Under the hood, `r2wc` creates a `CustomElementConstructor` with custom getters/setters and life cycle methods that keep track of the props that you have defined. When a property is set, its custom setter:
1442+
1443+
- re-renders the React component inside the custom element.
1444+
- creates an enumerable getter / setter on the instance to save the set value and avoid hitting the proxy in the future.
1445+
1446+
Also:
1447+
1448+
- Enumerable properties and values on the custom element are used as the `props` passed to the React component.
1449+
- The React component is not rendered until the custom element is inserted into the page.
1450+
1451+
# We want to hear from you.
1452+
1453+
Come chat with us about open source in our Bitovi community [Discord](https://discord.gg/J7ejFsZnJ4).
1454+
1455+
See what we're up to by following us on [Twitter](https://twitter.com/bitovi).
1456+
1457+
=========================================
1458+
END OF @r2wc/react-to-web-component NOTICES AND INFORMATION
1459+
13271460
%% @shoelace-style/shoelace NOTICES AND INFORMATION BEGIN HERE
13281461
=========================================
13291462
Copyright (c) 2020 A Beautiful Site, LLC
@@ -2152,6 +2285,33 @@ SOFTWARE.
21522285
=========================================
21532286
END OF react-dom NOTICES AND INFORMATION
21542287

2288+
%% react-dom NOTICES AND INFORMATION BEGIN HERE
2289+
=========================================
2290+
MIT License
2291+
2292+
Copyright (c) Meta Platforms, Inc. and affiliates.
2293+
2294+
Permission is hereby granted, free of charge, to any person obtaining a copy
2295+
of this software and associated documentation files (the "Software"), to deal
2296+
in the Software without restriction, including without limitation the rights
2297+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2298+
copies of the Software, and to permit persons to whom the Software is
2299+
furnished to do so, subject to the following conditions:
2300+
2301+
The above copyright notice and this permission notice shall be included in all
2302+
copies or substantial portions of the Software.
2303+
2304+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2305+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2306+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2307+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2308+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2309+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2310+
SOFTWARE.
2311+
2312+
=========================================
2313+
END OF react-dom NOTICES AND INFORMATION
2314+
21552315
%% react NOTICES AND INFORMATION BEGIN HERE
21562316
=========================================
21572317
MIT License
@@ -2179,6 +2339,33 @@ SOFTWARE.
21792339
=========================================
21802340
END OF react NOTICES AND INFORMATION
21812341

2342+
%% react NOTICES AND INFORMATION BEGIN HERE
2343+
=========================================
2344+
MIT License
2345+
2346+
Copyright (c) Meta Platforms, Inc. and affiliates.
2347+
2348+
Permission is hereby granted, free of charge, to any person obtaining a copy
2349+
of this software and associated documentation files (the "Software"), to deal
2350+
in the Software without restriction, including without limitation the rights
2351+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2352+
copies of the Software, and to permit persons to whom the Software is
2353+
furnished to do so, subject to the following conditions:
2354+
2355+
The above copyright notice and this permission notice shall be included in all
2356+
copies or substantial portions of the Software.
2357+
2358+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2359+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2360+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2361+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2362+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2363+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2364+
SOFTWARE.
2365+
2366+
=========================================
2367+
END OF react NOTICES AND INFORMATION
2368+
21822369
%% signal-utils NOTICES AND INFORMATION BEGIN HERE
21832370
=========================================
21842371
MIT License

docs/telemetry-events.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,7 @@ or
919919
'context.config.dateStyle': 'absolute' | 'relative',
920920
'context.config.defaultItemLimit': number,
921921
'context.config.dimMergeCommits': boolean,
922+
'context.config.experimental.renderer.enabled': boolean,
922923
'context.config.highlightRowsOnRefHover': boolean,
923924
'context.config.issues.enabled': boolean,
924925
'context.config.layout': 'editor' | 'panel',

package.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,16 @@
10571057
"scope": "window",
10581058
"order": 300
10591059
},
1060+
"gitlens.graph.experimental.renderer.enabled": {
1061+
"type": "boolean",
1062+
"default": false,
1063+
"markdownDescription": "(Experimental) Specifies whether to use the new renderer for the _Commit Graph_. Requires a restart",
1064+
"scope": "window",
1065+
"order": 301,
1066+
"tags": [
1067+
"experimental"
1068+
]
1069+
},
10601070
"gitlens.graph.branchesVisibility": {
10611071
"type": "string",
10621072
"enum": [
@@ -21347,13 +21357,13 @@
2134721357
"analyze:bundle": "webpack --mode production --env analyzeBundle",
2134821358
"analyze:bundle:extension": "webpack --mode production --config-name extension:node --env analyzeBundle",
2134921359
"analyze:bundle:extension:browser": "webpack --mode production --config-name extension:webworker --env analyzeBundle",
21350-
"analyze:bundle:webviews": "webpack --mode production --config-name webviews --env analyzeBundle",
21360+
"analyze:bundle:webviews": "webpack --mode production --config-name webviews:common --config-name webviews --config-name webviews:graph-next --env analyzeBundle",
2135121361
"analyze:deps": "webpack --env analyzeDeps",
2135221362
"build": "webpack --mode development",
2135321363
"build:quick": "webpack --mode development --env skipLint",
2135421364
"build:extension": "webpack --mode development --config-name extension:node",
2135521365
"build:extension:browser": "webpack --mode development --config-name extension:webworker",
21356-
"build:webviews": "webpack --mode development --config-name webviews",
21366+
"build:webviews": "webpack --mode development --config-name webviews:common --config-name webviews --config-name webviews:graph-next",
2135721367
"build:icons": "pnpm run icons:svgo && pnpm fantasticon && pnpm run icons:apply && pnpm run icons:export",
2135821368
"build:tests": "node ./scripts/esbuild.tests.mjs",
2135921369
"// Extracts the contributions from package.json into contributions.json": "//",
@@ -21410,6 +21420,7 @@
2141021420
},
2141121421
"dependencies": {
2141221422
"@gitkraken/gitkraken-components": "10.7.0",
21423+
"@gitkraken/gitkraken-components-next": "npm:@gitkraken/[email protected]",
2141321424
"@gitkraken/provider-apis": "0.26.2",
2141421425
"@gitkraken/shared-web-components": "0.1.1-rc.15",
2141521426
"@gk-nzaytsev/fast-string-truncated-width": "1.1.0",
@@ -21426,6 +21437,7 @@
2142621437
"@opentelemetry/resources": "1.30.1",
2142721438
"@opentelemetry/sdk-trace-base": "1.30.1",
2142821439
"@opentelemetry/semantic-conventions": "1.30.0",
21440+
"@r2wc/react-to-web-component": "^2.0.4",
2142921441
"@shoelace-style/shoelace": "2.20.0",
2143021442
"@vscode/codicons": "0.0.36",
2143121443
"billboard.js": "3.14.3",
@@ -21436,8 +21448,10 @@
2143621448
"node-fetch": "2.7.0",
2143721449
"os-browserify": "0.3.0",
2143821450
"path-browserify": "1.0.1",
21439-
"react": "16.8.4",
21440-
"react-dom": "16.8.4",
21451+
"react": "16.14.0",
21452+
"react-dom": "16.14.0",
21453+
"react-next": "npm:[email protected]",
21454+
"react-dom-next": "npm:[email protected]",
2144121455
"signal-utils": "0.21.1",
2144221456
"slug": "10.0.0",
2144321457
"sortablejs": "1.15.0"
@@ -21451,7 +21465,9 @@
2145121465
"@types/mocha": "10.0.10",
2145221466
"@types/node": "20.14.15",
2145321467
"@types/react": "17.0.83",
21468+
"@types/react-next": "npm:@types/[email protected]",
2145421469
"@types/react-dom": "17.0.25",
21470+
"@types/react-dom-next": "npm:@types/[email protected]",
2145521471
"@types/sinon": "17.0.4",
2145621472
"@types/slug": "5.0.9",
2145721473
"@types/sortablejs": "1.15.8",

0 commit comments

Comments
 (0)