From f1ce80c98d214e6b3352afdb572cd249fefcbc45 Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 27 Sep 2022 09:07:35 +0000 Subject: [PATCH 1/3] Update 7 files --- .codesandbox/tasks.json | 4 ++ sandpack-react/package.json | 4 ++ sandpack-react/src/Issues.stories.tsx | 14 ++++++ .../src/components/CodeEditor/CodeMirror.tsx | 5 ++- .../src/components/CodeEditor/styles.ts | 11 ----- .../src/components/FileTabs/index.tsx | 1 - yarn.lock | 44 ++++++++++++++++++- 7 files changed, 68 insertions(+), 15 deletions(-) diff --git a/.codesandbox/tasks.json b/.codesandbox/tasks.json index b91a9d0dd..f9244b528 100644 --- a/.codesandbox/tasks.json +++ b/.codesandbox/tasks.json @@ -68,6 +68,10 @@ "name": "Website theme", "command": "yarn dev:theme", "runAtStart": false + }, + "yarn install": { + "name": "Install", + "command": "yarn install" } } } diff --git a/sandpack-react/package.json b/sandpack-react/package.json index 0f2d6a969..07d8f6fd4 100644 --- a/sandpack-react/package.json +++ b/sandpack-react/package.json @@ -66,6 +66,10 @@ "@storybook/addon-knobs": "^6.1.9", "@storybook/addon-links": "^6.1.9", "@storybook/react": "^6.1.9", + "@codemirror/fold": "0.19.4", + "@codemirror/search": "0.19.10", + "@codemirror/stream-parser": "0.19.9", + "@replit/codemirror-vim": "0.19.1", "@types/fs-extra": "^5.0.4", "@types/glob": "^5.0.35", "@types/lodash.isequal": "^4.5.2", diff --git a/sandpack-react/src/Issues.stories.tsx b/sandpack-react/src/Issues.stories.tsx index 0003e2021..aaadf3f7d 100644 --- a/sandpack-react/src/Issues.stories.tsx +++ b/sandpack-react/src/Issues.stories.tsx @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ +import { vim } from "@replit/codemirror-vim"; import { useState } from "react"; import { @@ -13,6 +14,19 @@ export default { title: "Bug reports/Issues", }; +export const Issue576 = (): JSX.Element => { + return ( + + ); +}; + export const Issue482 = (): JSX.Element => { const [hidden, setHidden] = useState(false); diff --git a/sandpack-react/src/components/CodeEditor/CodeMirror.tsx b/sandpack-react/src/components/CodeEditor/CodeMirror.tsx index f58e7491f..c025d9254 100644 --- a/sandpack-react/src/components/CodeEditor/CodeMirror.tsx +++ b/sandpack-react/src/components/CodeEditor/CodeMirror.tsx @@ -225,6 +225,8 @@ export const CodeMirror = React.forwardRef( run: (): boolean => { if (readOnly) return true; + console.log(extensions); + if (wrapper.current) { wrapper.current.focus(); } @@ -243,6 +245,8 @@ export const CodeMirror = React.forwardRef( history(), closeBrackets(), + ...extensions, + keymap.of([ ...closeBracketsKeymap, ...defaultKeymap, @@ -257,7 +261,6 @@ export const CodeMirror = React.forwardRef( getEditorTheme(), highlightTheme, - ...extensions, ]; if (readOnly) { diff --git a/sandpack-react/src/components/CodeEditor/styles.ts b/sandpack-react/src/components/CodeEditor/styles.ts index 294b168b7..d602adc77 100644 --- a/sandpack-react/src/components/CodeEditor/styles.ts +++ b/sandpack-react/src/components/CodeEditor/styles.ts @@ -33,17 +33,6 @@ export const cmClassName = css({ margin: "0", outline: "none", height: "100%", - - "&:focus-visible": { - boxShadow: "inset 0 0 0 4px $colors$accent", - paddingLeft: "$space$1", - paddingRight: "$space$1", - }, - "&:focus-visible .cm-line": { padding: "0 $space$2" }, - "&:focus-visible .cm-gutter.cm-lineNumbers": { - paddingLeft: "0", - paddingRight: "$space$2", - }, }); export const readOnlyClassName = css({ diff --git a/sandpack-react/src/components/FileTabs/index.tsx b/sandpack-react/src/components/FileTabs/index.tsx index f556bbe43..43a4f895d 100644 --- a/sandpack-react/src/components/FileTabs/index.tsx +++ b/sandpack-react/src/components/FileTabs/index.tsx @@ -51,7 +51,6 @@ export const tabButton = css({ whiteSpace: "nowrap", "&:focus": { outline: "none" }, - "&:focus-visible": { boxShadow: "inset 0 0 0 2px $colors$accent" }, [`&:hover > .${closeButtonClassName}`]: { visibility: "unset" }, }); diff --git a/yarn.lock b/yarn.lock index ecebd34f7..fb1b9fb76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1378,7 +1378,18 @@ "@codemirror/text" "^0.19.0" "@codemirror/view" "^0.19.0" -"@codemirror/gutter@^0.19.4", "@codemirror/gutter@^0.19.9": +"@codemirror/fold@0.19.4": + version "0.19.4" + resolved "https://registry.yarnpkg.com/@codemirror/fold/-/fold-0.19.4.tgz#f2a17e508378d5a83dc587ed6f1a635969219a2b" + integrity sha512-0SNSkRSOa6gymD6GauHa3sxiysjPhUC0SRVyTlvL52o0gz9GHdc8kNqNQskm3fBtGGOiSriGwF/kAsajRiGhVw== + dependencies: + "@codemirror/gutter" "^0.19.0" + "@codemirror/language" "^0.19.0" + "@codemirror/rangeset" "^0.19.0" + "@codemirror/state" "^0.19.0" + "@codemirror/view" "^0.19.22" + +"@codemirror/gutter@^0.19.0", "@codemirror/gutter@^0.19.4", "@codemirror/gutter@^0.19.9": version "0.19.9" resolved "https://registry.yarnpkg.com/@codemirror/gutter/-/gutter-0.19.9.tgz#bbb69f4d49570d9c1b3f3df5d134980c516cd42b" integrity sha512-PFrtmilahin1g6uL27aG5tM/rqR9DZzZYZsIrCXA5Uc2OFTFqx4owuhoU9hqfYxHp5ovfvBwQ+txFzqS4vog6Q== @@ -1507,6 +1518,18 @@ dependencies: "@codemirror/state" "^0.19.0" +"@codemirror/search@0.19.10": + version "0.19.10" + resolved "https://registry.yarnpkg.com/@codemirror/search/-/search-0.19.10.tgz#4b0d91c53278db05088624ae04f164d66fd581cd" + integrity sha512-qjubm69HJixPBWzI6HeEghTWOOD8NXiHOTRNvdizqs8xWRuFChq9zkjD3XiAJ7GXSTzCuQJnAP9DBBGCLq4ZIA== + dependencies: + "@codemirror/panel" "^0.19.0" + "@codemirror/rangeset" "^0.19.0" + "@codemirror/state" "^0.19.3" + "@codemirror/text" "^0.19.0" + "@codemirror/view" "^0.19.34" + crelt "^1.0.5" + "@codemirror/state@^0.19.0", "@codemirror/state@^0.19.2", "@codemirror/state@^0.19.3", "@codemirror/state@^0.19.4", "@codemirror/state@^0.19.6", "@codemirror/state@^0.19.9": version "0.19.9" resolved "https://registry.yarnpkg.com/@codemirror/state/-/state-0.19.9.tgz#b797f9fbc204d6dc7975485e231693c09001b0dd" @@ -1514,6 +1537,18 @@ dependencies: "@codemirror/text" "^0.19.0" +"@codemirror/stream-parser@0.19.9": + version "0.19.9" + resolved "https://registry.yarnpkg.com/@codemirror/stream-parser/-/stream-parser-0.19.9.tgz#34955ea91a8047cf72abebd5ce28f0d332aeca48" + integrity sha512-WTmkEFSRCetpk8xIOvV2yyXdZs3DgYckM0IP7eFi4ewlxWnJO/H4BeJZLs4wQaydWsAqTQoDyIwNH1BCzK5LUQ== + dependencies: + "@codemirror/highlight" "^0.19.0" + "@codemirror/language" "^0.19.0" + "@codemirror/state" "^0.19.0" + "@codemirror/text" "^0.19.0" + "@lezer/common" "^0.15.0" + "@lezer/lr" "^0.15.0" + "@codemirror/text@^0.19.0", "@codemirror/text@^0.19.2", "@codemirror/text@^0.19.6": version "0.19.6" resolved "https://registry.yarnpkg.com/@codemirror/text/-/text-0.19.6.tgz#9adcbd8137f69b75518eacd30ddb16fd67bbac45" @@ -1527,7 +1562,7 @@ "@codemirror/state" "^0.19.0" "@codemirror/view" "^0.19.0" -"@codemirror/view@^0.19.0", "@codemirror/view@^0.19.22", "@codemirror/view@^0.19.23", "@codemirror/view@^0.19.32", "@codemirror/view@^0.19.39", "@codemirror/view@^0.19.44": +"@codemirror/view@^0.19.0", "@codemirror/view@^0.19.22", "@codemirror/view@^0.19.23", "@codemirror/view@^0.19.32", "@codemirror/view@^0.19.34", "@codemirror/view@^0.19.39", "@codemirror/view@^0.19.44": version "0.19.48" resolved "https://registry.yarnpkg.com/@codemirror/view/-/view-0.19.48.tgz#1c657e2b0f8ed896ac6448d6e2215ab115e2a0fc" integrity sha512-0eg7D2Nz4S8/caetCTz61rK0tkHI17V/d15Jy0kLOT8dTLGGNJUponDnW28h2B6bERmPlVHKh8MJIr5OCp1nGw== @@ -4905,6 +4940,11 @@ resolved "https://registry.yarnpkg.com/@react-hook/passive-layout-effect/-/passive-layout-effect-1.2.1.tgz#c06dac2d011f36d61259aa1c6df4f0d5e28bc55e" integrity sha512-IwEphTD75liO8g+6taS+4oqz+nnroocNfWVHWz7j+N+ZO2vYrc6PV1q7GQhuahL0IOR7JccFTsFKQ/mb6iZWAg== +"@replit/codemirror-vim@0.19.1": + version "0.19.1" + resolved "https://registry.yarnpkg.com/@replit/codemirror-vim/-/codemirror-vim-0.19.1.tgz#d21aeefb98bae9dbd5f1425c57237037ca33c195" + integrity sha512-9nlYgX4OkL18WkhJDWS38Q2OOl93eLbRik9wZSej0jbER7LdokpOLc6D/yUlzxlcRwSVlea/8c+grjNfkTzrbA== + "@rollup/plugin-babel@^5.2.0": version "5.3.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz#04bc0608f4aa4b2e4b1aebf284344d0f68fda283" From b6459f4968b01152e9f504d275844d385b9cb99d Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 27 Sep 2022 09:12:26 +0000 Subject: [PATCH 2/3] Update 4 files --- .codesandbox/ci.json | 2 +- sandpack-react/package.json | 4 -- .../src/components/CodeEditor/CodeMirror.tsx | 2 - yarn.lock | 44 +------------------ 4 files changed, 3 insertions(+), 49 deletions(-) diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index b24e32b2c..2ca350eef 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -1,5 +1,5 @@ { "packages": ["sandpack-client", "sandpack-react"], - "sandboxes": ["sowx8r"], + "sandboxes": ["sowx8r", "c3uup0"], "node": "14" } diff --git a/sandpack-react/package.json b/sandpack-react/package.json index 07d8f6fd4..0f2d6a969 100644 --- a/sandpack-react/package.json +++ b/sandpack-react/package.json @@ -66,10 +66,6 @@ "@storybook/addon-knobs": "^6.1.9", "@storybook/addon-links": "^6.1.9", "@storybook/react": "^6.1.9", - "@codemirror/fold": "0.19.4", - "@codemirror/search": "0.19.10", - "@codemirror/stream-parser": "0.19.9", - "@replit/codemirror-vim": "0.19.1", "@types/fs-extra": "^5.0.4", "@types/glob": "^5.0.35", "@types/lodash.isequal": "^4.5.2", diff --git a/sandpack-react/src/components/CodeEditor/CodeMirror.tsx b/sandpack-react/src/components/CodeEditor/CodeMirror.tsx index c025d9254..081c7a8cd 100644 --- a/sandpack-react/src/components/CodeEditor/CodeMirror.tsx +++ b/sandpack-react/src/components/CodeEditor/CodeMirror.tsx @@ -225,8 +225,6 @@ export const CodeMirror = React.forwardRef( run: (): boolean => { if (readOnly) return true; - console.log(extensions); - if (wrapper.current) { wrapper.current.focus(); } diff --git a/yarn.lock b/yarn.lock index fb1b9fb76..ecebd34f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1378,18 +1378,7 @@ "@codemirror/text" "^0.19.0" "@codemirror/view" "^0.19.0" -"@codemirror/fold@0.19.4": - version "0.19.4" - resolved "https://registry.yarnpkg.com/@codemirror/fold/-/fold-0.19.4.tgz#f2a17e508378d5a83dc587ed6f1a635969219a2b" - integrity sha512-0SNSkRSOa6gymD6GauHa3sxiysjPhUC0SRVyTlvL52o0gz9GHdc8kNqNQskm3fBtGGOiSriGwF/kAsajRiGhVw== - dependencies: - "@codemirror/gutter" "^0.19.0" - "@codemirror/language" "^0.19.0" - "@codemirror/rangeset" "^0.19.0" - "@codemirror/state" "^0.19.0" - "@codemirror/view" "^0.19.22" - -"@codemirror/gutter@^0.19.0", "@codemirror/gutter@^0.19.4", "@codemirror/gutter@^0.19.9": +"@codemirror/gutter@^0.19.4", "@codemirror/gutter@^0.19.9": version "0.19.9" resolved "https://registry.yarnpkg.com/@codemirror/gutter/-/gutter-0.19.9.tgz#bbb69f4d49570d9c1b3f3df5d134980c516cd42b" integrity sha512-PFrtmilahin1g6uL27aG5tM/rqR9DZzZYZsIrCXA5Uc2OFTFqx4owuhoU9hqfYxHp5ovfvBwQ+txFzqS4vog6Q== @@ -1518,18 +1507,6 @@ dependencies: "@codemirror/state" "^0.19.0" -"@codemirror/search@0.19.10": - version "0.19.10" - resolved "https://registry.yarnpkg.com/@codemirror/search/-/search-0.19.10.tgz#4b0d91c53278db05088624ae04f164d66fd581cd" - integrity sha512-qjubm69HJixPBWzI6HeEghTWOOD8NXiHOTRNvdizqs8xWRuFChq9zkjD3XiAJ7GXSTzCuQJnAP9DBBGCLq4ZIA== - dependencies: - "@codemirror/panel" "^0.19.0" - "@codemirror/rangeset" "^0.19.0" - "@codemirror/state" "^0.19.3" - "@codemirror/text" "^0.19.0" - "@codemirror/view" "^0.19.34" - crelt "^1.0.5" - "@codemirror/state@^0.19.0", "@codemirror/state@^0.19.2", "@codemirror/state@^0.19.3", "@codemirror/state@^0.19.4", "@codemirror/state@^0.19.6", "@codemirror/state@^0.19.9": version "0.19.9" resolved "https://registry.yarnpkg.com/@codemirror/state/-/state-0.19.9.tgz#b797f9fbc204d6dc7975485e231693c09001b0dd" @@ -1537,18 +1514,6 @@ dependencies: "@codemirror/text" "^0.19.0" -"@codemirror/stream-parser@0.19.9": - version "0.19.9" - resolved "https://registry.yarnpkg.com/@codemirror/stream-parser/-/stream-parser-0.19.9.tgz#34955ea91a8047cf72abebd5ce28f0d332aeca48" - integrity sha512-WTmkEFSRCetpk8xIOvV2yyXdZs3DgYckM0IP7eFi4ewlxWnJO/H4BeJZLs4wQaydWsAqTQoDyIwNH1BCzK5LUQ== - dependencies: - "@codemirror/highlight" "^0.19.0" - "@codemirror/language" "^0.19.0" - "@codemirror/state" "^0.19.0" - "@codemirror/text" "^0.19.0" - "@lezer/common" "^0.15.0" - "@lezer/lr" "^0.15.0" - "@codemirror/text@^0.19.0", "@codemirror/text@^0.19.2", "@codemirror/text@^0.19.6": version "0.19.6" resolved "https://registry.yarnpkg.com/@codemirror/text/-/text-0.19.6.tgz#9adcbd8137f69b75518eacd30ddb16fd67bbac45" @@ -1562,7 +1527,7 @@ "@codemirror/state" "^0.19.0" "@codemirror/view" "^0.19.0" -"@codemirror/view@^0.19.0", "@codemirror/view@^0.19.22", "@codemirror/view@^0.19.23", "@codemirror/view@^0.19.32", "@codemirror/view@^0.19.34", "@codemirror/view@^0.19.39", "@codemirror/view@^0.19.44": +"@codemirror/view@^0.19.0", "@codemirror/view@^0.19.22", "@codemirror/view@^0.19.23", "@codemirror/view@^0.19.32", "@codemirror/view@^0.19.39", "@codemirror/view@^0.19.44": version "0.19.48" resolved "https://registry.yarnpkg.com/@codemirror/view/-/view-0.19.48.tgz#1c657e2b0f8ed896ac6448d6e2215ab115e2a0fc" integrity sha512-0eg7D2Nz4S8/caetCTz61rK0tkHI17V/d15Jy0kLOT8dTLGGNJUponDnW28h2B6bERmPlVHKh8MJIr5OCp1nGw== @@ -4940,11 +4905,6 @@ resolved "https://registry.yarnpkg.com/@react-hook/passive-layout-effect/-/passive-layout-effect-1.2.1.tgz#c06dac2d011f36d61259aa1c6df4f0d5e28bc55e" integrity sha512-IwEphTD75liO8g+6taS+4oqz+nnroocNfWVHWz7j+N+ZO2vYrc6PV1q7GQhuahL0IOR7JccFTsFKQ/mb6iZWAg== -"@replit/codemirror-vim@0.19.1": - version "0.19.1" - resolved "https://registry.yarnpkg.com/@replit/codemirror-vim/-/codemirror-vim-0.19.1.tgz#d21aeefb98bae9dbd5f1425c57237037ca33c195" - integrity sha512-9nlYgX4OkL18WkhJDWS38Q2OOl93eLbRik9wZSej0jbER7LdokpOLc6D/yUlzxlcRwSVlea/8c+grjNfkTzrbA== - "@rollup/plugin-babel@^5.2.0": version "5.3.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz#04bc0608f4aa4b2e4b1aebf284344d0f68fda283" From 27f232eb469ff92ecc0aa1c401aa3f1cc2fbf869 Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 27 Sep 2022 09:18:40 +0000 Subject: [PATCH 3/3] Update Issues.stories.tsx --- sandpack-react/src/Issues.stories.tsx | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/sandpack-react/src/Issues.stories.tsx b/sandpack-react/src/Issues.stories.tsx index aaadf3f7d..0003e2021 100644 --- a/sandpack-react/src/Issues.stories.tsx +++ b/sandpack-react/src/Issues.stories.tsx @@ -1,5 +1,4 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { vim } from "@replit/codemirror-vim"; import { useState } from "react"; import { @@ -14,19 +13,6 @@ export default { title: "Bug reports/Issues", }; -export const Issue576 = (): JSX.Element => { - return ( - - ); -}; - export const Issue482 = (): JSX.Element => { const [hidden, setHidden] = useState(false);