Start transition

This commit is contained in:
Nathan Bierema 2023-12-11 23:45:32 -05:00
parent ca59d97cc6
commit 304c5cd530
5 changed files with 83 additions and 29 deletions

View File

@ -3,5 +3,5 @@
"compilerOptions": { "compilerOptions": {
"resolveJsonModule": true "resolveJsonModule": true
}, },
"include": ["../src", "src"] "include": ["src"]
} }

View File

@ -131,7 +131,24 @@ class RtkQueryInspector<S, A extends Action<string>> extends PureComponent<
<div <div
ref={this.inspectorRef} ref={this.inspectorRef}
data-wide-layout={+this.state.isWideLayout} data-wide-layout={+this.state.isWideLayout}
{...styling('inspector')} css={(theme) => ({
display: 'flex',
flexFlow: 'column nowrap',
overflow: 'hidden',
width: '100%',
height: '100%',
fontFamily: 'monaco, Consolas, "Lucida Console", monospace',
fontSize: '12px',
WebkitFontSmoothing: 'antialiased',
lineHeight: '1.5em',
backgroundColor: theme.BACKGROUND_COLOR,
color: theme.TEXT_COLOR,
'&[data-wide-layout="1"]': {
flexFlow: 'row nowrap',
},
})}
> >
<div <div
{...styling('querySectionWrapper')} {...styling('querySectionWrapper')}

View File

@ -9,9 +9,17 @@ import {
StyleUtils, StyleUtils,
} from '../types'; } from '../types';
import { import {
colorMap,
createThemeState, createThemeState,
StyleUtilsContext, StyleUtilsContext,
} from '../styles/createStylingFromTheme'; } from '../styles/createStylingFromTheme';
import { ThemeProvider } from '@emotion/react';
import {
getBase16Theme,
invertBase16Theme,
invertTheme,
} from 'react-base16-styling';
import * as reduxThemes from 'redux-devtools-themes';
interface DefaultProps { interface DefaultProps {
theme: string; theme: string;
@ -50,16 +58,26 @@ class RtkQueryMonitor<S, A extends Action<string>> extends Component<
actionsById, actionsById,
} = this.props; } = this.props;
// TODO Cleanup
const base16Theme =
getBase16Theme(this.props.theme, { ...reduxThemes }) ??
reduxThemes.nicinabox;
const theme = this.props.invertTheme
? invertBase16Theme(base16Theme)
: base16Theme;
return ( return (
<StyleUtilsContext.Provider value={this.state.styleUtils}> <StyleUtilsContext.Provider value={this.state.styleUtils}>
<RtkQueryInspector<S, AnyAction> <ThemeProvider theme={colorMap(theme)}>
computedStates={computedStates} <RtkQueryInspector<S, AnyAction>
currentStateIndex={currentStateIndex} computedStates={computedStates}
monitorState={monitorState} currentStateIndex={currentStateIndex}
dispatch={dispatch} monitorState={monitorState}
styleUtils={this.state.styleUtils} dispatch={dispatch}
actionsById={actionsById} styleUtils={this.state.styleUtils}
/> actionsById={actionsById}
/>
</ThemeProvider>
</StyleUtilsContext.Provider> </StyleUtilsContext.Provider>
); );
} }

View File

@ -17,6 +17,41 @@ import { RtkQueryMonitorProps, StyleUtils } from '../types';
jss.setup(preset()); jss.setup(preset());
declare module '@emotion/react' {
export interface Theme {
TEXT_COLOR: string;
TEXT_PLACEHOLDER_COLOR: string;
BACKGROUND_COLOR: string;
SELECTED_BACKGROUND_COLOR: string;
SKIPPED_BACKGROUND_COLOR: string;
HEADER_BACKGROUND_COLOR: string;
HEADER_BORDER_COLOR: string;
BORDER_COLOR: string;
LIST_BORDER_COLOR: string;
ACTION_TIME_BACK_COLOR: string;
ACTION_TIME_COLOR: string;
PIN_COLOR: string;
ITEM_HINT_COLOR: string;
TAB_BACK_SELECTED_COLOR: string;
TAB_BACK_COLOR: string;
TAB_BACK_HOVER_COLOR: string;
TAB_BORDER_COLOR: string;
DIFF_ADD_COLOR: string;
DIFF_REMOVE_COLOR: string;
DIFF_ARROW_COLOR: string;
LINK_COLOR: string;
LINK_HOVER_COLOR: string;
ERROR_COLOR: string;
ULIST_DISC_COLOR: string;
ULIST_COLOR: string;
ULIST_STRONG_COLOR: string;
TAB_CONTENT_COLOR: string;
TOGGLE_BUTTON_BACKGROUND: string;
TOGGLE_BUTTON_SELECTED_BACKGROUND: string;
TOGGLE_BUTTON_ERROR: string;
}
}
export const colorMap = (theme: reduxThemes.Base16Theme) => export const colorMap = (theme: reduxThemes.Base16Theme) =>
({ ({
TEXT_COLOR: theme.base06, TEXT_COLOR: theme.base06,
@ -62,25 +97,6 @@ const getSheetFromColorMap = (map: ColorMap) => {
}; };
return { return {
inspector: {
display: 'flex',
flexFlow: 'column nowrap',
overflow: 'hidden',
width: '100%',
height: '100%',
'font-family': 'monaco, Consolas, "Lucida Console", monospace',
'font-size': '12px',
'font-smoothing': 'antialiased',
'line-height': '1.5em',
'background-color': map.BACKGROUND_COLOR,
color: map.TEXT_COLOR,
'&[data-wide-layout="1"]': {
flexFlow: 'row nowrap',
},
},
querySectionWrapper: { querySectionWrapper: {
display: 'flex', display: 'flex',
flex: '0 0 auto', flex: '0 0 auto',

View File

@ -2517,6 +2517,9 @@ importers:
'@babel/preset-typescript': '@babel/preset-typescript':
specifier: ^7.23.3 specifier: ^7.23.3
version: 7.23.3(@babel/core@7.23.5) version: 7.23.3(@babel/core@7.23.5)
'@emotion/babel-preset-css-prop':
specifier: ^11.11.0
version: 11.11.0(@babel/core@7.23.5)
'@emotion/react': '@emotion/react':
specifier: ^11.11.1 specifier: ^11.11.1
version: 11.11.1(@types/react@18.2.43)(react@18.2.0) version: 11.11.1(@types/react@18.2.43)(react@18.2.0)