Skip to content

Commit

Permalink
Revert "[Visual Refresh] Add Borealis theme (elastic#199993)"
Browse files Browse the repository at this point in the history
This reverts commit ee49986.
  • Loading branch information
tsullivan committed Nov 21, 2024
1 parent 3c8f077 commit 56c00b9
Show file tree
Hide file tree
Showing 24 changed files with 56 additions and 155 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@
"@elastic/ecs": "^8.11.1",
"@elastic/elasticsearch": "^8.15.2",
"@elastic/ems-client": "8.5.3",
"@elastic/eui": "97.3.1-borealis.2",
"@elastic/eui-theme-borealis": "0.0.2",
"@elastic/eui": "97.3.1",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "^1.2.3",
"@elastic/numeral": "^2.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,25 @@
*/

import React, { FC } from 'react';
import { type DarkModeValue, ThemeName } from '@kbn/core-ui-settings-common';
import type { DarkModeValue } from '@kbn/core-ui-settings-common';

interface Props {
darkMode: DarkModeValue;
themeName: ThemeName;
stylesheetPaths: string[];
}

export const Styles: FC<Props> = ({ darkMode, themeName, stylesheetPaths }) => {
export const Styles: FC<Props> = ({ darkMode, stylesheetPaths }) => {
return (
<>
{darkMode !== 'system' && <InlineStyles darkMode={darkMode} themeName={themeName} />}
{darkMode !== 'system' && <InlineStyles darkMode={darkMode} />}
{stylesheetPaths.map((path) => (
<link key={path} rel="stylesheet" type="text/css" href={path} />
))}
</>
);
};

const InlineStyles: FC<{ darkMode: boolean; themeName: ThemeName }> = ({ darkMode, themeName }) => {
const getThemeStyles = (theme: ThemeName) => {
if (theme === 'borealis') {
return {
pageBackground: darkMode ? '#07101F' : '#F6F9FC', // colors.body
welcomeText: darkMode ? '#8E9FBC' : '#5A6D8C', // colors.subduedText
progress: darkMode ? '#172336' : '#ECF1F9', // colors.lightestShade
progressBefore: darkMode ? '#599DFF' : '#0B64DD', // colors.primary
};
}

return {
pageBackground: darkMode ? '#141519' : '#F8FAFD',
welcomeText: darkMode ? '#98A2B3' : '#69707D',
progress: darkMode ? '#25262E' : '#F5F7FA',
progressBefore: darkMode ? '#1BA9F5' : '#006DE4',
};
};

const themeStyles = getThemeStyles(themeName);

const InlineStyles: FC<{ darkMode: boolean }> = ({ darkMode }) => {
// must be kept in sync with
// packages/core/apps/core-apps-server-internal/assets/legacy_theme.js
/* eslint-disable react/no-danger */
Expand All @@ -57,19 +36,19 @@ const InlineStyles: FC<{ darkMode: boolean; themeName: ThemeName }> = ({ darkMod
__html: `
html {
background-color: ${themeStyles.pageBackground}
background-color: ${darkMode ? '#141519' : '#F8FAFD'}
}
.kbnWelcomeText {
color: ${themeStyles.welcomeText};
color: ${darkMode ? '#98A2B3' : '#69707D'};
}
.kbnProgress {
background-color: ${themeStyles.progress};
background-color: ${darkMode ? '#25262E' : '#F5F7FA'};
}
.kbnProgress:before {
background-color: ${themeStyles.progressBefore};
background-color: ${darkMode ? '#1BA9F5' : '#006DE4'};
}
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ export const Template: FunctionComponent<Props> = ({
{/* Inject EUI reset and global styles before all other component styles */}
<meta name={EUI_STYLES_GLOBAL} />
<meta name="emotion" />
<Styles
darkMode={darkMode}
themeName={injectedMetadata.theme.name}
stylesheetPaths={stylesheetPaths}
/>
<Styles darkMode={darkMode} stylesheetPaths={stylesheetPaths} />
{scriptPaths.map((path) => (
<script key={path} src={path} />
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ export function parseThemeTags(input?: unknown): ThemeTags {
return DEFAULT_THEME_TAGS;
}

// TODO: remove when Borealis is in public beta
if (input === 'experimental') {
return SUPPORTED_THEME_TAGS;
}

let rawTags: string[];
if (typeof input === 'string') {
rawTags = input.split(',').map((tag) => tag.trim());
Expand Down
17 changes: 7 additions & 10 deletions packages/kbn-eslint-config/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,13 @@ module.exports = {
exclude: USES_STYLED_COMPONENTS,
disallowedMessage: `Prefer using @emotion/react instead. To use styled-components, ensure you plugin is enabled in packages/kbn-babel-preset/styled_components_files.js.`,
},
...[
'@elastic/eui/dist/eui_theme_amsterdam_light.json',
'@elastic/eui/dist/eui_theme_amsterdam_dark.json',
'@elastic/eui/dist/eui_theme_borealis_light.json',
'@elastic/eui/dist/eui_theme_borealis_dark.json',
].map((from) => ({
from,
to: false,
disallowedMessage: `Use "@kbn/ui-theme" to access theme vars.`,
})),
...['@elastic/eui/dist/eui_theme_light.json', '@elastic/eui/dist/eui_theme_dark.json'].map(
(from) => ({
from,
to: false,
disallowedMessage: `Use "@kbn/ui-theme" to access theme vars.`,
})
),
{
from: '@kbn/test/jest',
to: '@kbn/test-jest-helpers',
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pageLoadAssetSize:
actions: 20000
advancedSettings: 27596
aiAssistantManagementSelection: 19146
aiops: 16670
aiops: 16600
alerting: 106936
apm: 64385
banners: 17946
Expand Down Expand Up @@ -31,7 +31,7 @@ pageLoadAssetSize:
dataUsage: 30000
dataViewEditor: 28082
dataViewFieldEditor: 42021
dataViewManagement: 5370
dataViewManagement: 5300
dataViews: 65000
dataVisualizer: 30000
devTools: 38637
Expand Down
6 changes: 2 additions & 4 deletions packages/kbn-ui-shared-deps-npm/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ module.exports = (_, argv) => {
'@elastic/eui/optimize/es/components/provider/nested',
'@elastic/eui/optimize/es/services',
'@elastic/eui/optimize/es/services/format',
'@elastic/eui/dist/eui_theme_amsterdam_light.json',
'@elastic/eui/dist/eui_theme_amsterdam_dark.json',
'@elastic/eui/dist/eui_theme_borealis_light.json',
'@elastic/eui/dist/eui_theme_borealis_dark.json',
'@elastic/eui/dist/eui_theme_light.json',
'@elastic/eui/dist/eui_theme_dark.json',
'@elastic/numeral',
'@emotion/cache',
'@emotion/react',
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-ui-shared-deps-src/src/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ const externals = {
'__kbnSharedDeps__.ElasticEuiLibComponentsUseIsNestedEuiProvider',
'@elastic/eui/lib/services': '__kbnSharedDeps__.ElasticEuiLibServices',
'@elastic/eui/lib/services/format': '__kbnSharedDeps__.ElasticEuiLibServicesFormat',
'@elastic/eui-theme-borealis': '__kbnSharedDeps__.ElasticEuiThemeBorealis',

// transient dep of eui
'@hello-pangea/dnd': '__kbnSharedDeps__.HelloPangeaDnd',
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-ui-shared-deps-src/src/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const Rxjs = require('rxjs');
export const ElasticNumeral = require('@elastic/numeral');
export const ElasticCharts = require('@elastic/charts');
export const ElasticEui = require('@elastic/eui');
export const ElasticEuiThemeBorealis = require('@elastic/eui-theme-borealis');
export const ElasticEuiLibComponentsUseIsNestedEuiProvider = require('@elastic/eui/optimize/es/components/provider/nested');
export const ElasticEuiLibServices = require('@elastic/eui/optimize/es/services');
export const ElasticEuiLibServicesFormat = require('@elastic/eui/optimize/es/services/format');
Expand Down
46 changes: 11 additions & 35 deletions packages/kbn-ui-theme/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

/* eslint-disable-next-line @kbn/eslint/module_migration */
import { default as v8Light } from '@elastic/eui/dist/eui_theme_amsterdam_light.json';
/* eslint-disable-next-line @kbn/eslint/module_migration */
import { default as v8Dark } from '@elastic/eui/dist/eui_theme_amsterdam_dark.json';
// TODO(tkajtoch): Add support for multiple themes

/* eslint-disable-next-line @kbn/eslint/module_migration */
import { default as borealisLight } from '@elastic/eui/dist/eui_theme_borealis_light.json';
import { default as v8Light } from '@elastic/eui/dist/eui_theme_light.json';
/* eslint-disable-next-line @kbn/eslint/module_migration */
import { default as borealisDark } from '@elastic/eui/dist/eui_theme_borealis_dark.json';
import { default as v8Dark } from '@elastic/eui/dist/eui_theme_dark.json';

const globals: any = typeof window === 'undefined' ? {} : window;

Expand All @@ -30,40 +27,19 @@ export const version = 8;
/** @deprecated theme can be dynamic now, access is discouraged */
export const darkMode = tag.endsWith('dark');

export const euiLightVars: Theme = v8Light;
export const euiDarkVars: Theme = v8Dark;

let isDarkMode = darkMode;
export const _setDarkMode = (mode: boolean) => {
isDarkMode = mode;
};

const getThemeVars = (): { light: Theme; dark: Theme } => {
if (globals?.__kbnThemeTag__?.includes('borealis')) {
return {
light: borealisLight,
dark: borealisDark,
};
}

return {
light: v8Light,
dark: v8Dark,
};
};

export const euiLightVars: Theme = getThemeVars().light;
export const euiDarkVars: Theme = getThemeVars().dark;

/**
* EUI Theme vars that automatically adjust to light/dark theme
*/
export const euiThemeVars: Theme = new Proxy(
isDarkMode ? getThemeVars().dark : getThemeVars().light,
{
get(accessedTarget, accessedKey, ...rest) {
return Reflect.get(
isDarkMode ? getThemeVars().dark : getThemeVars().light,
accessedKey,
...rest
);
},
}
);
export const euiThemeVars: Theme = new Proxy(isDarkMode ? euiDarkVars : euiLightVars, {
get(accessedTarget, accessedKey, ...rest) {
return Reflect.get(isDarkMode ? euiDarkVars : euiLightVars, accessedKey, ...rest);
},
});
4 changes: 0 additions & 4 deletions packages/react/kibana_context/common/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

import { EuiThemeSystem, EuiThemeAmsterdam } from '@elastic/eui';
import { EuiThemeBorealis } from '@elastic/eui-theme-borealis';

export interface ThemeConfig {
euiTheme: EuiThemeSystem;
Expand All @@ -18,9 +17,6 @@ const THEMES: Record<string, ThemeConfig> = {
amsterdam: {
euiTheme: EuiThemeAmsterdam,
},
borealis: {
euiTheme: EuiThemeBorealis,
},
};

export const getThemeConfigByName = (name: string): ThemeConfig | null => {
Expand Down
9 changes: 0 additions & 9 deletions src/core/public/styles/core_app/_globals_borealisdark.scss

This file was deleted.

9 changes: 0 additions & 9 deletions src/core/public/styles/core_app/_globals_borealislight.scss

This file was deleted.

3 changes: 1 addition & 2 deletions src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ export const LICENSE_OVERRIDES = {
'[email protected]': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/[email protected]': ['MIT'], // license in readme https://github.com/tmcw/jsonlint
'@elastic/[email protected]': ['Elastic License 2.0'],
'@elastic/[email protected]': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'],
'@elastic/[email protected]': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'],
'@elastic/[email protected]': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'],
'[email protected]': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry
'[email protected]': ['MIT'], // license in importing module https://www.npmjs.com/package/binary
'@bufbuild/[email protected]': ['Apache-2.0'], // license (Apache-2.0 AND BSD-3-Clause)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
}

&--securitySolution img {
background-color: $euiColorAccentSecondary;
background-color: $euiColorSuccess;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 56c00b9

Please sign in to comment.