Skip to content

Commit 8318e04

Browse files
authored
Merge pull request #3986 from github/tuan-nguen/replace-vscode-webview
Remove the use of `@vscode/webview-ui-toolkit`
2 parents a76a79d + 4c49158 commit 8318e04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+503
-405
lines changed

extensions/ql-vscode/package-lock.json

Lines changed: 84 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,10 +1972,10 @@
19721972
"@octokit/plugin-retry": "^7.2.0",
19731973
"@octokit/plugin-throttling": "^9.6.0",
19741974
"@octokit/rest": "^21.1.1",
1975+
"@vscode-elements/react-elements": "^0.9.0",
19751976
"@vscode/codicons": "^0.0.36",
19761977
"@vscode/debugadapter": "^1.59.0",
19771978
"@vscode/debugprotocol": "^1.68.0",
1978-
"@vscode/webview-ui-toolkit": "^1.0.1",
19791979
"ajv": "^8.11.0",
19801980
"chokidar": "^3.6.0",
19811981
"d3": "^7.9.0",

extensions/ql-vscode/src/stories/Overview.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Canvas, Meta, Story } from '@storybook/blocks';
22

3-
import { VSCodeButton } from '@vscode/webview-ui-toolkit/react';
4-
53
import iframeImage from './images/update-css-variables-iframe.png';
64
import stylesImage from './images/update-css-variables-styles.png';
75
import bodyImage from './images/update-css-variables-body.png';

extensions/ql-vscode/src/stories/common/Alert.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Meta, StoryFn } from "@storybook/react";
2-
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react";
2+
import { VscodeButton } from "@vscode-elements/react-elements";
33

44
import { VariantAnalysisContainer } from "../../view/variant-analysis/VariantAnalysisContainer";
55
import { Alert } from "../../view/common";
@@ -84,8 +84,8 @@ ErrorWithButtons.args = {
8484
"Request to https://api.github.com/repos/octodemo/Hello-World/code-scanning/codeql/queries failed. Try running this query again.",
8585
actions: (
8686
<>
87-
<VSCodeButton appearance="secondary">View actions logs</VSCodeButton>
88-
<VSCodeButton>Retry</VSCodeButton>
87+
<VscodeButton secondary>View actions logs</VscodeButton>
88+
<VscodeButton>Retry</VscodeButton>
8989
</>
9090
),
9191
};

extensions/ql-vscode/src/stories/model-editor/LibraryRow.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ LibraryRow.args = {
220220
],
221221
},
222222
modifiedSignatures: new Set(["org.sql2o.Sql2o#Sql2o(String)"]),
223+
selectedSignatures: new Set(["org.sql2o.Sql2o#Sql2o(String)"]),
223224
viewState: createMockModelEditorViewState({
224225
showGenerateButton: true,
225226
}),

extensions/ql-vscode/src/stories/model-editor/MethodRow.stories.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Source.args = {
112112
modeledMethods: [{ ...modeledMethod, type: "source" }],
113113
methodCanBeModeled: true,
114114
viewState,
115+
onChange: () => {},
115116
};
116117

117118
export const Sink = Template.bind({});
@@ -120,6 +121,7 @@ Sink.args = {
120121
modeledMethods: [{ ...modeledMethod, type: "sink" }],
121122
methodCanBeModeled: true,
122123
viewState,
124+
onChange: () => {},
123125
};
124126

125127
export const Summary = Template.bind({});
@@ -136,6 +138,7 @@ Neutral.args = {
136138
modeledMethods: [{ ...modeledMethod, type: "neutral" }],
137139
methodCanBeModeled: true,
138140
viewState,
141+
onChange: () => {},
139142
};
140143

141144
export const AlreadyModeled = Template.bind({});
@@ -155,6 +158,7 @@ MultipleModelings.args = {
155158
],
156159
methodCanBeModeled: true,
157160
viewState,
161+
onChange: () => {},
158162
};
159163

160164
export const ValidationError = Template.bind({});
@@ -166,6 +170,7 @@ ValidationError.args = {
166170
],
167171
methodCanBeModeled: true,
168172
viewState,
173+
onChange: () => {},
169174
};
170175

171176
export const MultipleValidationErrors = Template.bind({});
@@ -180,4 +185,5 @@ MultipleValidationErrors.args = {
180185
],
181186
methodCanBeModeled: true,
182187
viewState,
188+
onChange: () => {},
183189
};

extensions/ql-vscode/src/stories/results/AlertTable.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,7 @@ WithCodeFlows.args = {
431431
showRawResults={() => action("show-raw-results")}
432432
/>
433433
),
434+
userSettings: {
435+
shouldShowProvenance: true,
436+
},
434437
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module "*.module.css";
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/* Styles have been copied from https://vscode-elements.github.io/elements-lite/components/action-button/configurator/ */
2+
.actionButton {
3+
align-items: center;
4+
background-color: transparent;
5+
border-color: transparent;
6+
border-style: solid;
7+
border-width: 1px;
8+
border-radius: 5px;
9+
color: var(--vscode-foreground);
10+
display: inline-flex;
11+
cursor: pointer;
12+
padding: 0;
13+
user-select: none;
14+
}
15+
16+
.actionButton:disabled {
17+
color: var(--vscode-disabledForeground);
18+
cursor: default;
19+
pointer-events: none;
20+
}
21+
22+
.actionButton :global(.codicon),
23+
.actionButton svg {
24+
color: var(--vscode-icon-foreground);
25+
display: block;
26+
padding: 2px;
27+
}
28+
29+
.actionButton svg {
30+
box-sizing: content-box;
31+
height: 16px;
32+
width: 16px;
33+
}
34+
35+
.actionButton:disabled :global(.codicon),
36+
.actionButton:disabled svg {
37+
color: var(--vscode-disabledForeground);
38+
}
39+
40+
.actionButton:hover {
41+
background-color: var(--vscode-toolbar-hoverBackground);
42+
outline: 1px dotted var(--vscode-contrastActiveBorder, transparent);
43+
outline-offset: -1px;
44+
}
45+
46+
.actionButton:active {
47+
background-color: var(--vscode-toolbar-activeBackground);
48+
}
49+
50+
.actionButton:focus {
51+
outline: none;
52+
}
53+
54+
.actionButton:focus-visible {
55+
border-color: var(--vscode-focusBorder);
56+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import styles from "./ActionButton.module.css";
2+
3+
// This is needed because vscode-elements/elements does not implement
4+
// the same styles for icon buttons as vscode/webview-ui-toolkit
5+
export const ActionButton = (props: React.ComponentProps<"button">) => (
6+
<button type="button" {...props} className={styles.actionButton}>
7+
{props.children}
8+
</button>
9+
);

0 commit comments

Comments
 (0)