This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
218 additions
and
150 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
packages/monaco-editor-workers/workers/vite.editorWorker.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
export { fetchRemoteTheme, fetchAllThemesFromGitHub } from './themeRemoteHelper.js'; | ||
export { loadAllDefaultThemes } from './themeLocalHelper.js'; |
103 changes: 103 additions & 0 deletions
103
packages/monaco-editor-wrapper/src/helpers/themeLocalHelper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
import { IThemeExtensionPoint, setDefaultThemes } from 'vscode/service-override/theme'; | ||
|
||
const createThemesDefintion = () => { | ||
return [ | ||
{ | ||
id: 'Visual Studio Light', | ||
label: 'Light (Visual Studio)', | ||
uiTheme: 'vs-light', | ||
path: './themes/light_vs.json', | ||
extension: 'theme-defaults' | ||
}, | ||
{ | ||
id: 'Default Light+', | ||
label: 'Light+ (default light)', | ||
uiTheme: 'vs-light', | ||
path: './themes/light_plus.json', | ||
extension: 'theme-defaults' | ||
}, | ||
{ | ||
id: 'Light+ (Experimental)', | ||
label: 'Light+ (Experimental)', | ||
uiTheme: 'vs-light', | ||
path: './themes/light_plus_experimental.json', | ||
extension: 'theme-defaults' | ||
}, | ||
{ | ||
id: 'Default High Contrast Light', | ||
label: 'High Contrast Light', | ||
uiTheme: 'hc-light', | ||
path: './themes/hc_light.json' | ||
}, | ||
{ | ||
id: 'Visual Studio Dark', | ||
label: 'Dark (Visual Studio)', | ||
uiTheme: 'vs-dark', | ||
path: './themes/dark_vs.json', | ||
extension: 'theme-defaults' | ||
}, | ||
{ | ||
id: 'Default Dark+', | ||
label: 'Dark+ (default dark)', | ||
uiTheme: 'vs-dark', | ||
path: './themes/dark_plus.json', | ||
extension: 'theme-defaults' | ||
}, | ||
{ | ||
id: 'Dark+ (Experimental)', | ||
label: 'Dark+ (Experimental)', | ||
uiTheme: 'vs-dark', | ||
path: './themes/dark_plus_experimental.json', | ||
extension: 'theme-defaults' | ||
}, | ||
{ | ||
id: 'Default High Contrast Dark', | ||
label: 'High Contrast Dark', | ||
uiTheme: 'hc-black', | ||
path: './themes/hc_black.json' | ||
} | ||
] as IThemeExtensionPoint[]; | ||
}; | ||
|
||
const fetchLocalTheme = async (url: string) => { | ||
const resp = await fetch(url); | ||
return resp.text(); | ||
}; | ||
|
||
export const loadAllDefaultThemes = async (targetDir: string) => { | ||
const themeLightVsUrl = new URL(targetDir + '/light_vs.json', window.location.href).href; | ||
const themeLightPlusUrl = new URL(targetDir + '/light_plus.json', window.location.href).href; | ||
const themeLightPlusExpUrl = new URL(targetDir + '/light_plus_experimental.json', window.location.href).href; | ||
const themeLightHcUrl = new URL(targetDir + '/hc_light.json', window.location.href).href; | ||
const themeDarkVsUrl = new URL(targetDir + '/dark_vs.json', window.location.href).href; | ||
const themeDarkPlusUrl = new URL(targetDir + '/dark_plus.json', window.location.href).href; | ||
const themeDarkPlusExpUrl = new URL(targetDir + '/dark_plus_experimental.json', window.location.href).href; | ||
const themeDarkHcUrl = new URL(targetDir + '/hc_black.json', window.location.href).href; | ||
|
||
setDefaultThemes(createThemesDefintion(), (theme) => { | ||
switch (theme.path) { | ||
case './themes/light_vs.json': | ||
return fetchLocalTheme(themeLightVsUrl); | ||
case './themes/light_plus.json': | ||
return fetchLocalTheme(themeLightPlusUrl); | ||
case './themes/light_plus_experimental.json': | ||
return fetchLocalTheme(themeLightPlusExpUrl); | ||
case './themes/hc_light.json': | ||
return fetchLocalTheme(themeLightHcUrl); | ||
case './themes/dark_vs.json': | ||
return fetchLocalTheme(themeDarkVsUrl); | ||
case './themes/dark_plus.json': | ||
return fetchLocalTheme(themeDarkPlusUrl); | ||
case './themes/dark_plus_experimental.json': | ||
return fetchLocalTheme(themeDarkPlusExpUrl); | ||
case './themes/hc_dark.json': | ||
return fetchLocalTheme(themeDarkHcUrl); | ||
default: | ||
return Promise.reject(new Error(`Theme ${theme.path} not found`)); | ||
} | ||
}); | ||
}; |
27 changes: 27 additions & 0 deletions
27
packages/monaco-editor-wrapper/src/helpers/themeRemoteHelper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
import { writeFileSync } from 'fs'; | ||
|
||
export const fetchRemoteTheme = async (url: string, targetFile: string) => { | ||
const res = await fetch(url); | ||
res.text().then(x => { | ||
writeFileSync(targetFile, x); | ||
}); | ||
}; | ||
|
||
// re-fectch required themes | ||
export const fetchAllThemesFromGitHub = async (targetDir: string) => { | ||
// light | ||
fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/light_vs.json', targetDir + '/light_vs.json'); | ||
fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/light_plus.json', targetDir + '/light_plus.json'); | ||
fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/light_plus_experimental.json', targetDir + '/light_plus_experimental.json'); | ||
fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/hc_light.json', targetDir + '/hc_light.json'); | ||
|
||
// dark | ||
fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/dark_vs.json', targetDir + '/dark_vs.json'); | ||
fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/dark_plus.json', targetDir + '/dark_plus.json'); | ||
fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/dark_plus_experimental.json', targetDir + '/dark_plus_experimental.json'); | ||
fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/hc_black.json', targetDir + '/hc_black.json'); | ||
}; |
Oops, something went wrong.