mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-22 09:36:43 +03:00
chore(*): upgrade prettier (#743)
* chore(*): upgrade prettier * Update snapshots
This commit is contained in:
parent
b50af14542
commit
55e2284a3d
|
@ -3,13 +3,8 @@ import PropTypes from 'prop-types';
|
||||||
|
|
||||||
class Counter extends Component {
|
class Counter extends Component {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { increment, autoIncrement, incrementAsync, decrement, counter } =
|
||||||
increment,
|
this.props;
|
||||||
autoIncrement,
|
|
||||||
incrementAsync,
|
|
||||||
decrement,
|
|
||||||
counter,
|
|
||||||
} = this.props;
|
|
||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
Clicked: {counter} times <button onClick={increment}>+</button>{' '}
|
Clicked: {counter} times <button onClick={increment}>+</button>{' '}
|
||||||
|
|
|
@ -149,12 +149,8 @@ export function toContentScript(message, serializeState, serializeAction) {
|
||||||
message.action = stringify(message.action, serializeAction);
|
message.action = stringify(message.action, serializeAction);
|
||||||
message.payload = stringify(message.payload, serializeState);
|
message.payload = stringify(message.payload, serializeState);
|
||||||
} else if (message.type === 'STATE' || message.type === 'PARTIAL_STATE') {
|
} else if (message.type === 'STATE' || message.type === 'PARTIAL_STATE') {
|
||||||
const {
|
const { actionsById, computedStates, committedState, ...rest } =
|
||||||
actionsById,
|
message.payload;
|
||||||
computedStates,
|
|
||||||
committedState,
|
|
||||||
...rest
|
|
||||||
} = message.payload;
|
|
||||||
message.payload = rest;
|
message.payload = rest;
|
||||||
message.actionsById = stringify(actionsById, serializeAction);
|
message.actionsById = stringify(actionsById, serializeAction);
|
||||||
message.computedStates = stringify(computedStates, serializeState);
|
message.computedStates = stringify(computedStates, serializeState);
|
||||||
|
|
|
@ -448,33 +448,32 @@ window.devToolsExtension.disconnect = (...args) => {
|
||||||
return disconnect.apply(null, args);
|
return disconnect.apply(null, args);
|
||||||
};
|
};
|
||||||
|
|
||||||
const preEnhancer = (instanceId) => (next) => (
|
const preEnhancer =
|
||||||
reducer,
|
(instanceId) => (next) => (reducer, preloadedState, enhancer) => {
|
||||||
preloadedState,
|
const store = next(reducer, preloadedState, enhancer);
|
||||||
enhancer
|
|
||||||
) => {
|
|
||||||
const store = next(reducer, preloadedState, enhancer);
|
|
||||||
|
|
||||||
if (stores[instanceId]) {
|
if (stores[instanceId]) {
|
||||||
stores[instanceId].initialDispatch = store.dispatch;
|
stores[instanceId].initialDispatch = store.dispatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...store,
|
...store,
|
||||||
dispatch: (...args) =>
|
dispatch: (...args) =>
|
||||||
!window.__REDUX_DEVTOOLS_EXTENSION_LOCKED__ && store.dispatch(...args),
|
!window.__REDUX_DEVTOOLS_EXTENSION_LOCKED__ && store.dispatch(...args),
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
const extensionCompose = (config) => (...funcs) => {
|
const extensionCompose =
|
||||||
return (...args) => {
|
(config) =>
|
||||||
const instanceId = generateId(config.instanceId);
|
(...funcs) => {
|
||||||
return [preEnhancer(instanceId), ...funcs].reduceRight(
|
return (...args) => {
|
||||||
(composed, f) => f(composed),
|
const instanceId = generateId(config.instanceId);
|
||||||
__REDUX_DEVTOOLS_EXTENSION__({ ...config, instanceId })(...args)
|
return [preEnhancer(instanceId), ...funcs].reduceRight(
|
||||||
);
|
(composed, f) => f(composed),
|
||||||
|
__REDUX_DEVTOOLS_EXTENSION__({ ...config, instanceId })(...args)
|
||||||
|
);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = (...funcs) => {
|
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = (...funcs) => {
|
||||||
if (funcs.length === 0) {
|
if (funcs.length === 0) {
|
||||||
|
|
|
@ -43,8 +43,7 @@ const get = (callback) => {
|
||||||
blacklist: '',
|
blacklist: '',
|
||||||
shouldCatchErrors: false,
|
shouldCatchErrors: false,
|
||||||
inject: true,
|
inject: true,
|
||||||
urls:
|
urls: '^https?://localhost|0\\.0\\.0\\.0:\\d+\n^https?://.+\\.github\\.io',
|
||||||
'^https?://localhost|0\\.0\\.0\\.0:\\d+\n^https?://.+\\.github\\.io',
|
|
||||||
showContextMenus: true,
|
showContextMenus: true,
|
||||||
},
|
},
|
||||||
function (items) {
|
function (items) {
|
||||||
|
|
|
@ -155,9 +155,9 @@ describe('Redux enhancer', () => {
|
||||||
state: JSON.stringify({
|
state: JSON.stringify({
|
||||||
monitorState: {},
|
monitorState: {},
|
||||||
actionsById: {
|
actionsById: {
|
||||||
'0': { type: 'PERFORM_ACTION', action: { type: '@@INIT' } },
|
0: { type: 'PERFORM_ACTION', action: { type: '@@INIT' } },
|
||||||
'1': { type: 'PERFORM_ACTION', action: { type: 'INCREMENT' } },
|
1: { type: 'PERFORM_ACTION', action: { type: 'INCREMENT' } },
|
||||||
'2': { type: 'PERFORM_ACTION', action: { type: 'INCREMENT' } },
|
2: { type: 'PERFORM_ACTION', action: { type: 'INCREMENT' } },
|
||||||
},
|
},
|
||||||
nextActionId: 3,
|
nextActionId: 3,
|
||||||
stagedActionIds: [0, 1, 2],
|
stagedActionIds: [0, 1, 2],
|
||||||
|
@ -193,9 +193,8 @@ describe('Redux enhancer', () => {
|
||||||
|
|
||||||
it('should create the store using old Redux api', async () => {
|
it('should create the store using old Redux api', async () => {
|
||||||
const message = await listenMessage(() => {
|
const message = await listenMessage(() => {
|
||||||
window.store = window.__REDUX_DEVTOOLS_EXTENSION__()(createStore)(
|
window.store =
|
||||||
counter
|
window.__REDUX_DEVTOOLS_EXTENSION__()(createStore)(counter);
|
||||||
);
|
|
||||||
expect(typeof window.store).toBe('object');
|
expect(typeof window.store).toBe('object');
|
||||||
});
|
});
|
||||||
expect(message.type).toBe('INIT_INSTANCE');
|
expect(message.type).toBe('INIT_INSTANCE');
|
||||||
|
|
|
@ -6,7 +6,8 @@ import { switchMonitorTests, delay } from '../utils/e2e';
|
||||||
const port = 9515;
|
const port = 9515;
|
||||||
const path = resolve('build/extension');
|
const path = resolve('build/extension');
|
||||||
const extensionId = 'lmhkpmbekcpmknklioeibfkpmmfibljd';
|
const extensionId = 'lmhkpmbekcpmknklioeibfkpmmfibljd';
|
||||||
const actionsPattern = /^@@INIT(.|\n)+@@reduxReactRouter\/routerDidChange(.|\n)+@@reduxReactRouter\/initRoutes(.|\n)+$/;
|
const actionsPattern =
|
||||||
|
/^@@INIT(.|\n)+@@reduxReactRouter\/routerDidChange(.|\n)+@@reduxReactRouter\/initRoutes(.|\n)+$/;
|
||||||
|
|
||||||
describe('Chrome extension', function () {
|
describe('Chrome extension', function () {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
"html-webpack-plugin": "^4.3.0",
|
"html-webpack-plugin": "^4.3.0",
|
||||||
"jest": "^26.2.2",
|
"jest": "^26.2.2",
|
||||||
"lerna": "^3.22.1",
|
"lerna": "^3.22.1",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.3.1",
|
||||||
"raw-loader": "^4.0.1",
|
"raw-loader": "^4.0.1",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"style-loader": "^1.2.1",
|
"style-loader": "^1.2.1",
|
||||||
|
|
|
@ -214,13 +214,13 @@ export default function (
|
||||||
preserveAspectRatio: 'xMinYMin slice',
|
preserveAspectRatio: 'xMinYMin slice',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!((style as unknown) as { [key: string]: Primitive }).width) {
|
if (!(style as unknown as { [key: string]: Primitive }).width) {
|
||||||
attr.width = fullWidth;
|
attr.width = fullWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!((style as unknown) as { [key: string]: Primitive }).width ||
|
!(style as unknown as { [key: string]: Primitive }).width ||
|
||||||
!((style as unknown) as { [key: string]: Primitive }).height
|
!(style as unknown as { [key: string]: Primitive }).height
|
||||||
) {
|
) {
|
||||||
attr.viewBox = `0 0 ${fullWidth} ${fullHeight}`;
|
attr.viewBox = `0 0 ${fullWidth} ${fullHeight}`;
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ export default function (
|
||||||
const vis = root
|
const vis = root
|
||||||
.append('svg')
|
.append('svg')
|
||||||
.attr(attr)
|
.attr(attr)
|
||||||
.style(({ cursor: '-webkit-grab', ...style } as unknown) as {
|
.style({ cursor: '-webkit-grab', ...style } as unknown as {
|
||||||
[key: string]: Primitive;
|
[key: string]: Primitive;
|
||||||
})
|
})
|
||||||
.call(
|
.call(
|
||||||
|
@ -303,10 +303,10 @@ export default function (
|
||||||
: (nextState as NodeWithId);
|
: (nextState as NodeWithId);
|
||||||
|
|
||||||
if (isEmpty(data) || !data.name) {
|
if (isEmpty(data) || !data.name) {
|
||||||
data = ({
|
data = {
|
||||||
name: 'error',
|
name: 'error',
|
||||||
message: 'Please provide a state map or a tree structure',
|
message: 'Please provide a state map or a tree structure',
|
||||||
} as unknown) as NodeWithId;
|
} as unknown as NodeWithId;
|
||||||
}
|
}
|
||||||
|
|
||||||
let nodeIndex = 0;
|
let nodeIndex = 0;
|
||||||
|
@ -366,10 +366,7 @@ export default function (
|
||||||
const node = vis
|
const node = vis
|
||||||
.selectAll('g.node')
|
.selectAll('g.node')
|
||||||
.property('__oldData__', (d: NodeWithId) => d)
|
.property('__oldData__', (d: NodeWithId) => d)
|
||||||
.data(
|
.data(nodes, (d) => d.id || (d.id = ++nodeIndex as unknown as string));
|
||||||
nodes,
|
|
||||||
(d) => d.id || (d.id = (++nodeIndex as unknown) as string)
|
|
||||||
);
|
|
||||||
const nodeEnter = node
|
const nodeEnter = node
|
||||||
.enter()
|
.enter()
|
||||||
.append('g')
|
.append('g')
|
||||||
|
@ -550,7 +547,7 @@ export default function (
|
||||||
.transition()
|
.transition()
|
||||||
.duration(transitionDuration)
|
.duration(transitionDuration)
|
||||||
.attr({
|
.attr({
|
||||||
d: (diagonal as unknown) as Primitive,
|
d: diagonal as unknown as Primitive,
|
||||||
});
|
});
|
||||||
|
|
||||||
// transition exiting nodes to the parent's new position
|
// transition exiting nodes to the parent's new position
|
||||||
|
|
|
@ -192,7 +192,7 @@ export const tooltipStyle = ({
|
||||||
${commonStyle({ theme, mark, size })}
|
${commonStyle({ theme, mark, size })}
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: "${tooltipTitle}";
|
content: '${tooltipTitle}';
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
color: ${theme.base06};
|
color: ${theme.base06};
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
|
@ -200,9 +200,8 @@ export const tooltipStyle = ({
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
background: ${theme.base01};
|
background: ${theme.base01};
|
||||||
border: 1px solid ${theme.base02};
|
border: 1px solid ${theme.base02};
|
||||||
box-shadow: 1px 1px 2px -1px ${theme.base02}, 1px 1px 2px 0px ${
|
box-shadow: 1px 1px 2px -1px ${theme.base02},
|
||||||
theme.base02
|
1px 1px 2px 0px ${theme.base02};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&:after,
|
&:after,
|
||||||
|
@ -223,18 +222,15 @@ export const tooltipStyle = ({
|
||||||
&:before {
|
&:before {
|
||||||
${before(tooltipPosition)}
|
${before(tooltipPosition)}
|
||||||
${getDirection(tooltipPosition)}: 3px;
|
${getDirection(tooltipPosition)}: 3px;
|
||||||
${
|
${theme.type === 'material'
|
||||||
theme.type === 'material'
|
? css`
|
||||||
? css`
|
animation: ${fadeIn} 500ms;
|
||||||
animation: ${fadeIn} 500ms;
|
`
|
||||||
`
|
: ''}
|
||||||
: ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
${
|
${theme.type !== 'material' &&
|
||||||
theme.type !== 'material' &&
|
`
|
||||||
`
|
|
||||||
&:after {
|
&:after {
|
||||||
content: "";
|
content: "";
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
|
@ -243,8 +239,7 @@ export const tooltipStyle = ({
|
||||||
${after(tooltipPosition, theme.base02)}
|
${after(tooltipPosition, theme.base02)}
|
||||||
${getDirection(tooltipPosition)}: 7px;
|
${getDirection(tooltipPosition)}: 7px;
|
||||||
}
|
}
|
||||||
`
|
`}
|
||||||
}
|
|
||||||
|
|
||||||
&:hover:after,
|
&:hover:after,
|
||||||
&:hover:before {
|
&:hover:before {
|
||||||
|
|
|
@ -21,38 +21,32 @@ export const style = ({
|
||||||
margin: auto 0;
|
margin: auto 0;
|
||||||
border: 1px solid ${theme.base02};
|
border: 1px solid ${theme.base02};
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
${
|
${primary
|
||||||
primary
|
? `
|
||||||
? `
|
|
||||||
background-color: ${theme.base05};
|
background-color: ${theme.base05};
|
||||||
color: ${theme.base00};
|
color: ${theme.base00};
|
||||||
`
|
`
|
||||||
: `
|
: `
|
||||||
background-color: ${theme.base01};
|
background-color: ${theme.base01};
|
||||||
color: ${theme.base05};
|
color: ${theme.base05};
|
||||||
`
|
`}
|
||||||
}
|
${disabled
|
||||||
${
|
? `
|
||||||
disabled
|
|
||||||
? `
|
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
`
|
`
|
||||||
: `
|
: `
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
`
|
`}
|
||||||
}
|
|
||||||
|
|
||||||
${
|
${!disabled &&
|
||||||
!disabled &&
|
`
|
||||||
`
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus {
|
&:focus {
|
||||||
background-color: ${primary ? theme.base07 : theme.base02};
|
background-color: ${primary ? theme.base07 : theme.base02};
|
||||||
box-shadow: 1px 1px 2px ${theme.base03};
|
box-shadow: 1px 1px 2px ${theme.base03};
|
||||||
}
|
}
|
||||||
`
|
`}
|
||||||
}
|
|
||||||
&:focus {
|
&:focus {
|
||||||
border: 1px solid ${theme.base0D};
|
border: 1px solid ${theme.base0D};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { defaultStyle, themedStyle } from './styles';
|
||||||
import { Theme } from '../themes/default';
|
import { Theme } from '../themes/default';
|
||||||
|
|
||||||
const EditorContainer = styled.div(
|
const EditorContainer = styled.div(
|
||||||
('' as unknown) as TemplateStringsArray,
|
'' as unknown as TemplateStringsArray,
|
||||||
({ theme }: { theme: Theme }) =>
|
({ theme }: { theme: Theme }) =>
|
||||||
theme.scheme === 'default' && theme.light
|
theme.scheme === 'default' && theme.light
|
||||||
? defaultStyle
|
? defaultStyle
|
||||||
|
|
|
@ -33,12 +33,12 @@ export default class WithTabs extends Component<WithTabsProps> {
|
||||||
tabs={[
|
tabs={[
|
||||||
{
|
{
|
||||||
name: 'Function 1',
|
name: 'Function 1',
|
||||||
component: (Editor as unknown) as ComponentType<TabProps>,
|
component: Editor as unknown as ComponentType<TabProps>,
|
||||||
selector: () => ({ value: value1, lineNumbers }),
|
selector: () => ({ value: value1, lineNumbers }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Function 2',
|
name: 'Function 2',
|
||||||
component: (Editor as unknown) as ComponentType<TabProps>,
|
component: Editor as unknown as ComponentType<TabProps>,
|
||||||
selector: () => ({ value: value2, lineNumbers }),
|
selector: () => ({ value: value2, lineNumbers }),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
|
|
@ -22,14 +22,8 @@ export interface Props<T> extends FormProps<T> {
|
||||||
*/
|
*/
|
||||||
export default class Form<T> extends (PureComponent || Component)<Props<T>> {
|
export default class Form<T> extends (PureComponent || Component)<Props<T>> {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { widgets, children, submitText, primaryButton, noSubmit, ...rest } =
|
||||||
widgets,
|
this.props;
|
||||||
children,
|
|
||||||
submitText,
|
|
||||||
primaryButton,
|
|
||||||
noSubmit,
|
|
||||||
...rest
|
|
||||||
} = this.props;
|
|
||||||
return (
|
return (
|
||||||
<FormContainer
|
<FormContainer
|
||||||
{...(rest as Props<unknown>)}
|
{...(rest as Props<unknown>)}
|
||||||
|
|
|
@ -36,7 +36,9 @@ export const style = ({
|
||||||
width: 100%;
|
width: 100%;
|
||||||
color: ${theme.base06};
|
color: ${theme.base06};
|
||||||
|
|
||||||
> span { color: ${theme.base04}; }
|
> span {
|
||||||
|
color: ${theme.base04};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
|
@ -54,9 +56,8 @@ export const style = ({
|
||||||
border-radius: 0.8em/1.1em;
|
border-radius: 0.8em/1.1em;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: linear-gradient(${theme.base02}, ${
|
background: linear-gradient(${theme.base02}, ${theme.base00}) padding-box,
|
||||||
theme.base00
|
50% 50% border-box;
|
||||||
}) padding-box, 50% 50% border-box;
|
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +75,10 @@ export const style = ({
|
||||||
}`
|
}`
|
||||||
)}
|
)}
|
||||||
|
|
||||||
${prefixSelectors(
|
${prefixSelectors(
|
||||||
'input',
|
'input',
|
||||||
['webkit-slider-thumb', 'moz-range-thumb', 'ms-thumb'],
|
['webkit-slider-thumb', 'moz-range-thumb', 'ms-thumb'],
|
||||||
`{
|
`{
|
||||||
position: relative;
|
position: relative;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
cursor: ew-resize;
|
cursor: ew-resize;
|
||||||
|
@ -90,15 +91,15 @@ export const style = ({
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}`
|
}`
|
||||||
)}
|
)}
|
||||||
|
|
||||||
${prefixSelectors(
|
${prefixSelectors(
|
||||||
'input:focus:not(:active)',
|
'input:focus:not(:active)',
|
||||||
['webkit-slider-thumb', 'moz-range-thumb', 'ms-thumb'],
|
['webkit-slider-thumb', 'moz-range-thumb', 'ms-thumb'],
|
||||||
`{
|
`{
|
||||||
box-shadow: 0 0 1px 2px ${theme.base0D};
|
box-shadow: 0 0 1px 2px ${theme.base0D};
|
||||||
}`
|
}`
|
||||||
)}
|
)}
|
||||||
|
|
||||||
input::-moz-focus-outer {
|
input::-moz-focus-outer {
|
||||||
border: 0;
|
border: 0;
|
||||||
|
|
|
@ -37,9 +37,9 @@ Default.argTypes = {
|
||||||
onClick: { control: { disable: true } },
|
onClick: { control: { disable: true } },
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithContent = (Template as Story<
|
export const WithContent = (
|
||||||
TabsProps<{ selected: string }>
|
Template as Story<TabsProps<{ selected: string }>>
|
||||||
>).bind({});
|
).bind({});
|
||||||
WithContent.args = {
|
WithContent.args = {
|
||||||
tabs,
|
tabs,
|
||||||
selected: 'Tab2',
|
selected: 'Tab2',
|
||||||
|
|
|
@ -82,9 +82,8 @@ export default class TabsHeader<P> extends Component<Props<P>, State> {
|
||||||
(this.tabsRef!.children[tabButtons.length - 1] as HTMLButtonElement)
|
(this.tabsRef!.children[tabButtons.length - 1] as HTMLButtonElement)
|
||||||
.value === 'expandIcon'
|
.value === 'expandIcon'
|
||||||
) {
|
) {
|
||||||
this.iconWidth = tabButtons[
|
this.iconWidth =
|
||||||
tabButtons.length - 1
|
tabButtons[tabButtons.length - 1].getBoundingClientRect().width;
|
||||||
].getBoundingClientRect().width;
|
|
||||||
shouldCollapse = true;
|
shouldCollapse = true;
|
||||||
}
|
}
|
||||||
} else if (this.state.hiddenTabs.length === 0) {
|
} else if (this.state.hiddenTabs.length === 0) {
|
||||||
|
|
|
@ -15,13 +15,11 @@ export const style = ({
|
||||||
background-color: ${theme.base01};
|
background-color: ${theme.base01};
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
${
|
${!main &&
|
||||||
!main &&
|
`
|
||||||
`
|
|
||||||
border-top: 1px solid ${theme.base01};
|
border-top: 1px solid ${theme.base01};
|
||||||
border-bottom: 1px solid ${theme.base02};
|
border-bottom: 1px solid ${theme.base02};
|
||||||
`
|
`}
|
||||||
}
|
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -50,16 +48,14 @@ export const style = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
> [data-selected] {
|
> [data-selected] {
|
||||||
${
|
${main
|
||||||
main
|
? `border-bottom: 2px solid ${theme.base0D};`
|
||||||
? `border-bottom: 2px solid ${theme.base0D};`
|
: `
|
||||||
: `
|
|
||||||
background-color: ${theme.base00};
|
background-color: ${theme.base00};
|
||||||
border: 1px solid ${theme.base02};
|
border: 1px solid ${theme.base02};
|
||||||
border-bottom: 1px solid ${theme.base00};
|
border-bottom: 1px solid ${theme.base00};
|
||||||
box-shadow: 0 1px ${theme.base00};
|
box-shadow: 0 1px ${theme.base00};
|
||||||
`
|
`}
|
||||||
}
|
|
||||||
color: ${theme.base07};
|
color: ${theme.base07};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,11 @@ export interface Props {
|
||||||
noBorder?: boolean;
|
noBorder?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Toolbar = (styled as ThemedStyledInterface<
|
const Toolbar = (
|
||||||
Base16Theme & { fontFamily?: CSS.Property.FontFamily }
|
styled as ThemedStyledInterface<
|
||||||
>).div<Props>`
|
Base16Theme & { fontFamily?: CSS.Property.FontFamily }
|
||||||
|
>
|
||||||
|
).div<Props>`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
|
@ -44,7 +44,7 @@ describe('Select', function () {
|
||||||
);
|
);
|
||||||
|
|
||||||
const input = wrapper.find('input');
|
const input = wrapper.find('input');
|
||||||
((input.at(0).instance() as unknown) as HTMLInputElement).value = 'two';
|
(input.at(0).instance() as unknown as HTMLInputElement).value = 'two';
|
||||||
input.first().simulate('change');
|
input.first().simulate('change');
|
||||||
expect(mountToJson(wrapper)).toMatchSnapshot();
|
expect(mountToJson(wrapper)).toMatchSnapshot();
|
||||||
input.first().simulate('keyDown', { keyCode: 13 });
|
input.first().simulate('keyDown', { keyCode: 13 });
|
||||||
|
@ -56,7 +56,7 @@ describe('Select', function () {
|
||||||
const wrapper = mount(<Select options={options} onChange={onChange} />);
|
const wrapper = mount(<Select options={options} onChange={onChange} />);
|
||||||
|
|
||||||
const input = wrapper.find('input');
|
const input = wrapper.find('input');
|
||||||
((input.at(0).instance() as unknown) as HTMLInputElement).value = 'text';
|
(input.at(0).instance() as unknown as HTMLInputElement).value = 'text';
|
||||||
input.first().simulate('change');
|
input.first().simulate('change');
|
||||||
expect(mountToJson(wrapper)).toMatchSnapshot(); // 'No results found'
|
expect(mountToJson(wrapper)).toMatchSnapshot(); // 'No results found'
|
||||||
input.first().simulate('keyDown', { keyCode: 13 });
|
input.first().simulate('keyDown', { keyCode: 13 });
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exports[`Slider renders correctly 1`] = `
|
exports[`Slider renders correctly 1`] = `
|
||||||
<div
|
<div
|
||||||
class="sc-AxheI ikoHwk"
|
class="sc-AxheI gaYXK"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
max="100"
|
max="100"
|
||||||
|
@ -15,7 +15,7 @@ exports[`Slider renders correctly 1`] = `
|
||||||
|
|
||||||
exports[`Slider renders with props 1`] = `
|
exports[`Slider renders with props 1`] = `
|
||||||
<div
|
<div
|
||||||
class="sc-AxheI bySZMR"
|
class="sc-AxheI goWhEX"
|
||||||
disabled=""
|
disabled=""
|
||||||
>
|
>
|
||||||
<label>
|
<label>
|
||||||
|
|
|
@ -146,7 +146,7 @@ const getStylingByKeys = (
|
||||||
...args: any[]
|
...args: any[]
|
||||||
): Styling => {
|
): Styling => {
|
||||||
if (keys === null) {
|
if (keys === null) {
|
||||||
return (mergedStyling as unknown) as Styling;
|
return mergedStyling as unknown as Styling;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Array.isArray(keys)) {
|
if (!Array.isArray(keys)) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<body>
|
<body>
|
||||||
<a href="https://github.com/alexkuz/react-dock"
|
<a href="https://github.com/alexkuz/react-dock"
|
||||||
><img
|
><img
|
||||||
style="z-index: 999999999; position: fixed; top: 0; left: 0; border: 0;"
|
style="z-index: 999999999; position: fixed; top: 0; left: 0; border: 0"
|
||||||
src="https://camo.githubusercontent.com/121cd7cbdc3e4855075ea8b558508b91ac463ac2/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f677265656e5f3030373230302e706e67"
|
src="https://camo.githubusercontent.com/121cd7cbdc3e4855075ea8b558508b91ac463ac2/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f677265656e5f3030373230302e706e67"
|
||||||
alt="Fork me on GitHub"
|
alt="Fork me on GitHub"
|
||||||
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_green_007200.png"
|
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_green_007200.png"
|
||||||
|
|
|
@ -378,12 +378,14 @@ export default class Dock extends Component<Props, State> {
|
||||||
/>
|
/>
|
||||||
<div style={styles.dockContent}>
|
<div style={styles.dockContent}>
|
||||||
{typeof children === 'function'
|
{typeof children === 'function'
|
||||||
? (children as React.FunctionComponent<{
|
? (
|
||||||
position: 'left' | 'right' | 'top' | 'bottom';
|
children as React.FunctionComponent<{
|
||||||
isResizing: boolean | undefined;
|
position: 'left' | 'right' | 'top' | 'bottom';
|
||||||
size: number;
|
isResizing: boolean | undefined;
|
||||||
isVisible: boolean | undefined;
|
size: number;
|
||||||
}>)({
|
isVisible: boolean | undefined;
|
||||||
|
}>
|
||||||
|
)({
|
||||||
position,
|
position,
|
||||||
isResizing,
|
isResizing,
|
||||||
size,
|
size,
|
||||||
|
|
|
@ -82,9 +82,10 @@ const getDefaultThemeStyling = (theme: Base16Theme): StylingConfig => {
|
||||||
valueText: ({ style }, nodeType) => ({
|
valueText: ({ style }, nodeType) => ({
|
||||||
style: {
|
style: {
|
||||||
...style,
|
...style,
|
||||||
color: valueColorMap(colors)[
|
color:
|
||||||
nodeType as keyof ReturnType<typeof valueColorMap>
|
valueColorMap(colors)[
|
||||||
],
|
nodeType as keyof ReturnType<typeof valueColorMap>
|
||||||
|
],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ interface JSONValueNodeCircularPropsPassedThroughJSONTree {
|
||||||
...keyPath: (string | number)[]
|
...keyPath: (string | number)[]
|
||||||
) => React.ReactNode;
|
) => React.ReactNode;
|
||||||
}
|
}
|
||||||
export type JSONValueNodeCircularPropsProvidedByJSONNode = SharedCircularPropsProvidedByJSONTree &
|
export type JSONValueNodeCircularPropsProvidedByJSONNode =
|
||||||
JSONValueNodeCircularPropsPassedThroughJSONTree;
|
SharedCircularPropsProvidedByJSONTree &
|
||||||
|
JSONValueNodeCircularPropsPassedThroughJSONTree;
|
||||||
|
|
||||||
interface JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
interface JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
||||||
shouldExpandNode: (
|
shouldExpandNode: (
|
||||||
|
@ -43,9 +44,10 @@ interface JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
||||||
collectionLimit: number;
|
collectionLimit: number;
|
||||||
sortObjectKeys?: ((a: any, b: any) => number) | boolean;
|
sortObjectKeys?: ((a: any, b: any) => number) | boolean;
|
||||||
}
|
}
|
||||||
export type CircularPropsPassedThroughJSONTree = SharedCircularPropsPassedThroughJSONTree &
|
export type CircularPropsPassedThroughJSONTree =
|
||||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
SharedCircularPropsPassedThroughJSONTree &
|
||||||
JSONNestedNodeCircularPropsPassedThroughJSONTree;
|
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||||
|
JSONNestedNodeCircularPropsPassedThroughJSONTree;
|
||||||
|
|
||||||
interface JSONNestedNodeCircularPropsPassedThroughJSONNode
|
interface JSONNestedNodeCircularPropsPassedThroughJSONNode
|
||||||
extends JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
extends JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
||||||
|
@ -53,23 +55,27 @@ interface JSONNestedNodeCircularPropsPassedThroughJSONNode
|
||||||
isCircular?: boolean;
|
isCircular?: boolean;
|
||||||
level?: number;
|
level?: number;
|
||||||
}
|
}
|
||||||
export type CircularPropsPassedThroughJSONNode = SharedCircularPropsProvidedByJSONTree &
|
export type CircularPropsPassedThroughJSONNode =
|
||||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
SharedCircularPropsProvidedByJSONTree &
|
||||||
JSONNestedNodeCircularPropsPassedThroughJSONNode;
|
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||||
|
JSONNestedNodeCircularPropsPassedThroughJSONNode;
|
||||||
|
|
||||||
export interface JSONNestedNodeCircularPropsPassedThroughJSONNestedNode
|
export interface JSONNestedNodeCircularPropsPassedThroughJSONNestedNode
|
||||||
extends JSONNestedNodeCircularPropsPassedThroughJSONNode {
|
extends JSONNestedNodeCircularPropsPassedThroughJSONNode {
|
||||||
circularCache: any[];
|
circularCache: any[];
|
||||||
level: number;
|
level: number;
|
||||||
}
|
}
|
||||||
export type CircularPropsPassedThroughJSONNestedNode = SharedCircularPropsProvidedByJSONTree &
|
export type CircularPropsPassedThroughJSONNestedNode =
|
||||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
SharedCircularPropsProvidedByJSONTree &
|
||||||
JSONNestedNodeCircularPropsPassedThroughJSONNestedNode;
|
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||||
|
JSONNestedNodeCircularPropsPassedThroughJSONNestedNode;
|
||||||
|
|
||||||
export type CircularPropsPassedThroughRenderChildNodes = SharedCircularPropsProvidedByJSONTree &
|
export type CircularPropsPassedThroughRenderChildNodes =
|
||||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
SharedCircularPropsProvidedByJSONTree &
|
||||||
JSONNestedNodeCircularPropsPassedThroughJSONNestedNode;
|
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||||
|
JSONNestedNodeCircularPropsPassedThroughJSONNestedNode;
|
||||||
|
|
||||||
export type CircularPropsPassedThroughItemRange = SharedCircularPropsProvidedByJSONTree &
|
export type CircularPropsPassedThroughItemRange =
|
||||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
SharedCircularPropsProvidedByJSONTree &
|
||||||
JSONNestedNodeCircularPropsPassedThroughJSONNestedNode;
|
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||||
|
JSONNestedNodeCircularPropsPassedThroughJSONNestedNode;
|
||||||
|
|
|
@ -53,12 +53,8 @@ export default class TopButtons extends Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const options = this.props.options;
|
const options = this.props.options;
|
||||||
const features = options.features;
|
const features = options.features;
|
||||||
const {
|
const { computedStates, skippedActionIds, isPaused, isLocked } =
|
||||||
computedStates,
|
this.props.liftedState;
|
||||||
skippedActionIds,
|
|
||||||
isPaused,
|
|
||||||
isLocked,
|
|
||||||
} = this.props.liftedState;
|
|
||||||
const noStates = computedStates.length < 2;
|
const noStates = computedStates.length < 2;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default class PrintButton extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePrint = () => {
|
handlePrint = () => {
|
||||||
const d3svg = (document.getElementById('d3svg') as unknown) as SVGGElement;
|
const d3svg = document.getElementById('d3svg') as unknown as SVGGElement;
|
||||||
if (!d3svg) {
|
if (!d3svg) {
|
||||||
window.print();
|
window.print();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -16,7 +16,7 @@ export const {
|
||||||
AUTHENTICATED,
|
AUTHENTICATED,
|
||||||
PENDING,
|
PENDING,
|
||||||
UNAUTHENTICATED,
|
UNAUTHENTICATED,
|
||||||
} = (socketCluster.SCClientSocket as unknown) as States;
|
} = socketCluster.SCClientSocket as unknown as States;
|
||||||
export const CONNECT_REQUEST = 'socket/CONNECT_REQUEST';
|
export const CONNECT_REQUEST = 'socket/CONNECT_REQUEST';
|
||||||
export const CONNECT_SUCCESS = 'socket/CONNECT_SUCCESS';
|
export const CONNECT_SUCCESS = 'socket/CONNECT_SUCCESS';
|
||||||
export const CONNECT_ERROR = 'socket/CONNECT_ERROR';
|
export const CONNECT_ERROR = 'socket/CONNECT_ERROR';
|
||||||
|
|
|
@ -72,20 +72,20 @@ class ChartTab extends Component<Props> {
|
||||||
style: {
|
style: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
node: ({
|
node: {
|
||||||
colors: {
|
colors: {
|
||||||
default: theme.base0B,
|
default: theme.base0B,
|
||||||
collapsed: theme.base0B,
|
collapsed: theme.base0B,
|
||||||
parent: theme.base0E,
|
parent: theme.base0E,
|
||||||
},
|
},
|
||||||
radius: 7,
|
radius: 7,
|
||||||
} as unknown) as string,
|
} as unknown as string,
|
||||||
text: ({
|
text: {
|
||||||
colors: {
|
colors: {
|
||||||
default: theme.base0D,
|
default: theme.base0D,
|
||||||
hover: theme.base06,
|
hover: theme.base06,
|
||||||
},
|
},
|
||||||
} as unknown) as string,
|
} as unknown as string,
|
||||||
},
|
},
|
||||||
onClickText: this.onClickText,
|
onClickText: this.onClickText,
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,7 +43,7 @@ class InspectorWrapper extends Component<Props> {
|
||||||
if (features && features.test) {
|
if (features && features.test) {
|
||||||
tabs = () => [
|
tabs = () => [
|
||||||
...(DEFAULT_TABS as Tab<unknown, Action<unknown>>[]),
|
...(DEFAULT_TABS as Tab<unknown, Action<unknown>>[]),
|
||||||
({ name: 'Test', component: TestTab } as unknown) as Tab<
|
{ name: 'Test', component: TestTab } as unknown as Tab<
|
||||||
unknown,
|
unknown,
|
||||||
Action<unknown>
|
Action<unknown>
|
||||||
>,
|
>,
|
||||||
|
|
|
@ -109,8 +109,8 @@ function monitoring(request: MonitoringRequest) {
|
||||||
|
|
||||||
store.dispatch({
|
store.dispatch({
|
||||||
type: UPDATE_STATE,
|
type: UPDATE_STATE,
|
||||||
request: ((request as unknown) as RequestWithData).data
|
request: (request as unknown as RequestWithData).data
|
||||||
? { ...((request as unknown) as RequestWithData).data, id: request.id }
|
? { ...(request as unknown as RequestWithData).data, id: request.id }
|
||||||
: request,
|
: request,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,43 +22,46 @@ function download(state: string) {
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportState = (
|
const exportState =
|
||||||
store: MiddlewareAPI<Dispatch<StoreAction>, StoreState>
|
(store: MiddlewareAPI<Dispatch<StoreAction>, StoreState>) =>
|
||||||
) => (next: Dispatch<StoreAction>) => (action: StoreAction) => {
|
(next: Dispatch<StoreAction>) =>
|
||||||
const result = next(action);
|
(action: StoreAction) => {
|
||||||
|
const result = next(action);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
toExport &&
|
toExport &&
|
||||||
action.type === UPDATE_STATE &&
|
action.type === UPDATE_STATE &&
|
||||||
action.request!.type === 'EXPORT'
|
action.request!.type === 'EXPORT'
|
||||||
) {
|
) {
|
||||||
const request = action.request!;
|
const request = action.request!;
|
||||||
const id = request.instanceId || request.id;
|
const id = request.instanceId || request.id;
|
||||||
if (id === toExport) {
|
if (id === toExport) {
|
||||||
toExport = undefined;
|
toExport = undefined;
|
||||||
download(
|
download(
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
{
|
{
|
||||||
payload: request.payload,
|
payload: request.payload,
|
||||||
preloadedState: (request as ExportRequest).committedState,
|
preloadedState: (request as ExportRequest).committedState,
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
'\t'
|
'\t'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
} else if (action.type === EXPORT) {
|
||||||
|
const instances = store.getState().instances;
|
||||||
|
const instanceId = getActiveInstance(instances);
|
||||||
|
const options = instances.options[instanceId];
|
||||||
|
if (options.features.export === true) {
|
||||||
|
download(
|
||||||
|
stringifyJSON(instances.states[instanceId], options.serialize)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
toExport = instanceId;
|
||||||
|
next({ type: LIFTED_ACTION, message: 'EXPORT', toExport: true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (action.type === EXPORT) {
|
return result;
|
||||||
const instances = store.getState().instances;
|
};
|
||||||
const instanceId = getActiveInstance(instances);
|
|
||||||
const options = instances.options[instanceId];
|
|
||||||
if (options.features.export === true) {
|
|
||||||
download(stringifyJSON(instances.states[instanceId], options.serialize));
|
|
||||||
} else {
|
|
||||||
toExport = instanceId;
|
|
||||||
next({ type: LIFTED_ACTION, message: 'EXPORT', toExport: true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exportState;
|
export default exportState;
|
||||||
|
|
|
@ -102,7 +102,7 @@ function updateState(
|
||||||
payload.committedState = payload.computedStates[0].state;
|
payload.committedState = payload.computedStates[0].state;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
payload = parseJSON((payload as unknown) as string, serialize) as State;
|
payload = parseJSON(payload as unknown as string, serialize) as State;
|
||||||
}
|
}
|
||||||
|
|
||||||
let newState;
|
let newState;
|
||||||
|
@ -127,7 +127,7 @@ function updateState(
|
||||||
for (let i = 0; i < action.length; i++) {
|
for (let i = 0; i < action.length; i++) {
|
||||||
newState = recompute(
|
newState = recompute(
|
||||||
newState,
|
newState,
|
||||||
request.batched ? payload : ((payload as unknown) as State[])[i],
|
request.batched ? payload : (payload as unknown as State[])[i],
|
||||||
action[i],
|
action[i],
|
||||||
newState.nextActionId + 1,
|
newState.nextActionId + 1,
|
||||||
maxAge,
|
maxAge,
|
||||||
|
|
|
@ -25,10 +25,7 @@ export default function reports(
|
||||||
...state,
|
...state,
|
||||||
data: state.data.map(d => (d.id === id ? action.data : d))
|
data: state.data.map(d => (d.id === id ? action.data : d))
|
||||||
};
|
};
|
||||||
} else */ if (
|
} else */ if (action.type !== UPDATE_REPORTS) return state;
|
||||||
action.type !== UPDATE_REPORTS
|
|
||||||
)
|
|
||||||
return state;
|
|
||||||
|
|
||||||
const request = action.request;
|
const request = action.request;
|
||||||
switch (request.type) {
|
switch (request.type) {
|
||||||
|
|
|
@ -17,26 +17,30 @@ export default function configureStore(
|
||||||
) => void,
|
) => void,
|
||||||
key?: string
|
key?: string
|
||||||
) {
|
) {
|
||||||
const persistConfig: PersistorConfig = ({
|
const persistConfig: PersistorConfig = {
|
||||||
keyPrefix: `redux-devtools${key || ''}:`,
|
keyPrefix: `redux-devtools${key || ''}:`,
|
||||||
blacklist: ['instances', 'socket'],
|
blacklist: ['instances', 'socket'],
|
||||||
storage: localForage,
|
storage: localForage,
|
||||||
serialize: (data: unknown) => data,
|
serialize: (data: unknown) => data,
|
||||||
deserialize: (data: unknown) => data,
|
deserialize: (data: unknown) => data,
|
||||||
} as unknown) as PersistorConfig;
|
} as unknown as PersistorConfig;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
getStoredState<StoreState>(persistConfig, (err, restoredState) => {
|
getStoredState<StoreState>(persistConfig, (err, restoredState) => {
|
||||||
let composeEnhancers = compose;
|
let composeEnhancers = compose;
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
if (
|
if (
|
||||||
((window as unknown) as {
|
(
|
||||||
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose;
|
window as unknown as {
|
||||||
}).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose;
|
||||||
|
}
|
||||||
|
).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||||
) {
|
) {
|
||||||
composeEnhancers = ((window as unknown) as {
|
composeEnhancers = (
|
||||||
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: typeof compose;
|
window as unknown as {
|
||||||
}).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: typeof compose;
|
||||||
|
}
|
||||||
|
).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
||||||
}
|
}
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
// Enable Webpack hot module replacement for reducers
|
// Enable Webpack hot module replacement for reducers
|
||||||
|
|
|
@ -19,6 +19,6 @@ export default function stringifyJSON(
|
||||||
serialize: boolean | undefined
|
serialize: boolean | undefined
|
||||||
) {
|
) {
|
||||||
return serialize
|
return serialize
|
||||||
? jsan.stringify(data, replacer, (null as unknown) as undefined, true)
|
? jsan.stringify(data, replacer, null as unknown as undefined, true)
|
||||||
: jsan.stringify(data);
|
: jsan.stringify(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ class ChartMonitor<S, A extends Action<unknown>> extends PureComponent<
|
||||||
heightBetweenNodesCoeff: 1,
|
heightBetweenNodesCoeff: 1,
|
||||||
widthBetweenNodesCoeff: 1.3,
|
widthBetweenNodesCoeff: 1.3,
|
||||||
tooltipOptions,
|
tooltipOptions,
|
||||||
style: (this.getChartStyle() as unknown) as
|
style: this.getChartStyle() as unknown as
|
||||||
| { [key: string]: Primitive }
|
| { [key: string]: Primitive }
|
||||||
| undefined,
|
| undefined,
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,9 +12,7 @@ export interface ExtendedOptions extends Options {
|
||||||
allowClientPublish: boolean;
|
allowClientPublish: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (argv: {
|
export default function (argv: { [arg: string]: any }): Promise<{
|
||||||
[arg: string]: any;
|
|
||||||
}): Promise<{
|
|
||||||
portAlreadyUsed?: boolean;
|
portAlreadyUsed?: boolean;
|
||||||
on: (status: 'ready', cb: () => void) => void;
|
on: (status: 'ready', cb: () => void) => void;
|
||||||
}> {
|
}> {
|
||||||
|
|
|
@ -73,19 +73,20 @@ describe('Server', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should login', function () {
|
it('should login', function () {
|
||||||
socket.emit('login', 'master', function (
|
socket.emit(
|
||||||
error: Error | undefined,
|
'login',
|
||||||
channelName: string
|
'master',
|
||||||
) {
|
function (error: Error | undefined, channelName: string) {
|
||||||
if (error) {
|
if (error) {
|
||||||
/* eslint-disable-next-line no-console */
|
/* eslint-disable-next-line no-console */
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
expect(channelName).toBe('respond');
|
||||||
|
channel = socket.subscribe(channelName);
|
||||||
|
expect(channel.SUBSCRIBED).toBe('subscribed');
|
||||||
}
|
}
|
||||||
expect(channelName).toBe('respond');
|
);
|
||||||
channel = socket.subscribe(channelName);
|
|
||||||
expect(channel.SUBSCRIBED).toBe('subscribed');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should send message', function () {
|
it('should send message', function () {
|
||||||
|
@ -107,26 +108,27 @@ describe('Server', function () {
|
||||||
id: 'tAmA7H5fclyWhvizAAAi',
|
id: 'tAmA7H5fclyWhvizAAAi',
|
||||||
};
|
};
|
||||||
|
|
||||||
socket2.emit('login', '', function (
|
socket2.emit(
|
||||||
error: Error | undefined,
|
'login',
|
||||||
channelName: string
|
'',
|
||||||
) {
|
function (error: Error | undefined, channelName: string) {
|
||||||
if (error) {
|
if (error) {
|
||||||
/* eslint-disable-next-line no-console */
|
/* eslint-disable-next-line no-console */
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
expect(channelName).toBe('log');
|
expect(channelName).toBe('log');
|
||||||
const channel2 = socket2.subscribe(channelName);
|
const channel2 = socket2.subscribe(channelName);
|
||||||
expect(channel2.SUBSCRIBED).toBe('subscribed');
|
expect(channel2.SUBSCRIBED).toBe('subscribed');
|
||||||
channel2.on('subscribe', function () {
|
channel2.on('subscribe', function () {
|
||||||
channel2.watch(function (message) {
|
channel2.watch(function (message) {
|
||||||
expect(message).toEqual(data);
|
expect(message).toEqual(data);
|
||||||
done();
|
done();
|
||||||
|
});
|
||||||
|
socket.emit(channelName, data);
|
||||||
});
|
});
|
||||||
socket.emit(channelName, data);
|
}
|
||||||
});
|
);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -235,7 +235,7 @@ class DockMonitor<S, A extends Action<unknown>> extends Component<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (DockMonitor as unknown) as React.ComponentType<
|
export default DockMonitor as unknown as React.ComponentType<
|
||||||
ExternalProps<unknown, Action<unknown>>
|
ExternalProps<unknown, Action<unknown>>
|
||||||
> & {
|
> & {
|
||||||
update(
|
update(
|
||||||
|
|
|
@ -81,7 +81,7 @@ export default function reducer<S, A extends Action<unknown>>(
|
||||||
`(${
|
`(${
|
||||||
child.type.displayName ||
|
child.type.displayName ||
|
||||||
child.type.name ||
|
child.type.name ||
|
||||||
((child.type as unknown) as string)
|
(child.type as unknown as string)
|
||||||
}) ` +
|
}) ` +
|
||||||
'does not appear to be a valid Redux DevTools monitor.'
|
'does not appear to be a valid Redux DevTools monitor.'
|
||||||
);
|
);
|
||||||
|
|
|
@ -35,16 +35,18 @@ const DevTools = getDevTools(window.location);
|
||||||
const history = createBrowserHistory();
|
const history = createBrowserHistory();
|
||||||
|
|
||||||
const useDevtoolsExtension =
|
const useDevtoolsExtension =
|
||||||
!!((window as unknown) as { __REDUX_DEVTOOLS_EXTENSION__: unknown }) &&
|
!!(window as unknown as { __REDUX_DEVTOOLS_EXTENSION__: unknown }) &&
|
||||||
getOptions(window.location).useExtension;
|
getOptions(window.location).useExtension;
|
||||||
|
|
||||||
const enhancer = compose(
|
const enhancer = compose(
|
||||||
applyMiddleware(logger, routerMiddleware(history)),
|
applyMiddleware(logger, routerMiddleware(history)),
|
||||||
(next: StoreEnhancerStoreCreator) => {
|
(next: StoreEnhancerStoreCreator) => {
|
||||||
const instrument = useDevtoolsExtension
|
const instrument = useDevtoolsExtension
|
||||||
? ((window as unknown) as {
|
? (
|
||||||
__REDUX_DEVTOOLS_EXTENSION__(): StoreEnhancer;
|
window as unknown as {
|
||||||
}).__REDUX_DEVTOOLS_EXTENSION__()
|
__REDUX_DEVTOOLS_EXTENSION__(): StoreEnhancer;
|
||||||
|
}
|
||||||
|
).__REDUX_DEVTOOLS_EXTENSION__()
|
||||||
: DevTools.instrument();
|
: DevTools.instrument();
|
||||||
return instrument(next);
|
return instrument(next);
|
||||||
},
|
},
|
||||||
|
|
|
@ -39,7 +39,7 @@ export function compare<S>(
|
||||||
if (paths.length && paths.indexOf(path) !== -1) return;
|
if (paths.length && paths.indexOf(path) !== -1) return;
|
||||||
paths.push(path);
|
paths.push(path);
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
const v = objectPath.get((s2.state as unknown) as object, event.newPath);
|
const v = objectPath.get(s2.state as unknown as object, event.newPath);
|
||||||
curState = v.length;
|
curState = v.length;
|
||||||
path += '.length';
|
path += '.length';
|
||||||
} else if (event.type === 'add-item') {
|
} else if (event.type === 'add-item') {
|
||||||
|
@ -79,8 +79,8 @@ export default class TestGenerator<
|
||||||
getMethod(action: A) {
|
getMethod(action: A) {
|
||||||
let type: string = action.type as string;
|
let type: string = action.type as string;
|
||||||
if (type[0] === '┗') type = type.substr(1).trim();
|
if (type[0] === '┗') type = type.substr(1).trim();
|
||||||
const args = ((action as unknown) as { arguments: unknown[] }).arguments
|
const args = (action as unknown as { arguments: unknown[] }).arguments
|
||||||
? ((action as unknown) as { arguments: unknown[] }).arguments
|
? (action as unknown as { arguments: unknown[] }).arguments
|
||||||
.map((arg) => stringify(arg))
|
.map((arg) => stringify(arg))
|
||||||
.join(',')
|
.join(',')
|
||||||
: '';
|
: '';
|
||||||
|
|
|
@ -66,10 +66,8 @@ export default class TestTab<S, A extends Action<unknown>> extends Component<
|
||||||
};
|
};
|
||||||
|
|
||||||
handleSubmit = ({ formData: template }: { formData: Template }) => {
|
handleSubmit = ({ formData: template }: { formData: Template }) => {
|
||||||
const {
|
const { templates = getDefaultTemplates(), selected = 0 } =
|
||||||
templates = getDefaultTemplates(),
|
this.getPersistedState();
|
||||||
selected = 0,
|
|
||||||
} = this.getPersistedState();
|
|
||||||
if (this.state.dialogStatus === 'Add') {
|
if (this.state.dialogStatus === 'Add') {
|
||||||
this.updateState({
|
this.updateState({
|
||||||
selected: templates.length,
|
selected: templates.length,
|
||||||
|
@ -86,10 +84,8 @@ export default class TestTab<S, A extends Action<unknown>> extends Component<
|
||||||
};
|
};
|
||||||
|
|
||||||
handleRemove = () => {
|
handleRemove = () => {
|
||||||
const {
|
const { templates = getDefaultTemplates(), selected = 0 } =
|
||||||
templates = getDefaultTemplates(),
|
this.getPersistedState();
|
||||||
selected = 0,
|
|
||||||
} = this.getPersistedState();
|
|
||||||
this.updateState({
|
this.updateState({
|
||||||
selected: 0,
|
selected: 0,
|
||||||
templates:
|
templates:
|
||||||
|
@ -111,9 +107,11 @@ export default class TestTab<S, A extends Action<unknown>> extends Component<
|
||||||
updateState = (newState: TestGeneratorMonitorState) => {
|
updateState = (newState: TestGeneratorMonitorState) => {
|
||||||
this.props.updateMonitorState({
|
this.props.updateMonitorState({
|
||||||
testGenerator: {
|
testGenerator: {
|
||||||
...(this.props.monitorState as {
|
...(
|
||||||
testGenerator?: TestGeneratorMonitorState;
|
this.props.monitorState as {
|
||||||
}).testGenerator,
|
testGenerator?: TestGeneratorMonitorState;
|
||||||
|
}
|
||||||
|
).testGenerator,
|
||||||
...newState,
|
...newState,
|
||||||
},
|
},
|
||||||
} as Partial<DevtoolsInspectorState>);
|
} as Partial<DevtoolsInspectorState>);
|
||||||
|
|
|
@ -13,10 +13,8 @@ function openResource(
|
||||||
}) => {
|
}) => {
|
||||||
//console.log("openResource callback args: ", callbackArgs);
|
//console.log("openResource callback args: ", callbackArgs);
|
||||||
if (result.isError) {
|
if (result.isError) {
|
||||||
const {
|
const { fileName: finalFileName, lineNumber: finalLineNumber } =
|
||||||
fileName: finalFileName,
|
stackFrame;
|
||||||
lineNumber: finalLineNumber,
|
|
||||||
} = stackFrame;
|
|
||||||
const adjustedLineNumber = Math.max(finalLineNumber! - 1, 0);
|
const adjustedLineNumber = Math.max(finalLineNumber! - 1, 0);
|
||||||
chrome.devtools.panels.openResource(
|
chrome.devtools.panels.openResource(
|
||||||
finalFileName!,
|
finalFileName!,
|
||||||
|
@ -61,7 +59,7 @@ function openInEditor(editor: string, path: string, stackFrame: StackFrame) {
|
||||||
const projectPath = path.replace(/\/$/, '');
|
const projectPath = path.replace(/\/$/, '');
|
||||||
const file =
|
const file =
|
||||||
stackFrame._originalFileName ||
|
stackFrame._originalFileName ||
|
||||||
((stackFrame as unknown) as { finalFileName: string }).finalFileName ||
|
(stackFrame as unknown as { finalFileName: string }).finalFileName ||
|
||||||
stackFrame.fileName ||
|
stackFrame.fileName ||
|
||||||
'';
|
'';
|
||||||
let filePath = /^https?:\/\//.test(file)
|
let filePath = /^https?:\/\//.test(file)
|
||||||
|
@ -111,38 +109,37 @@ export default function openFile(
|
||||||
const storage = isFF
|
const storage = isFF
|
||||||
? chrome.storage.local
|
? chrome.storage.local
|
||||||
: chrome.storage.sync || chrome.storage.local;
|
: chrome.storage.sync || chrome.storage.local;
|
||||||
storage.get(['useEditor', 'editor', 'projectPath'], function ({
|
storage.get(
|
||||||
useEditor,
|
['useEditor', 'editor', 'projectPath'],
|
||||||
editor,
|
function ({ useEditor, editor, projectPath }) {
|
||||||
projectPath,
|
|
||||||
}) {
|
|
||||||
if (
|
|
||||||
useEditor &&
|
|
||||||
projectPath &&
|
|
||||||
typeof editor === 'string' &&
|
|
||||||
/^\w{1,30}$/.test(editor)
|
|
||||||
) {
|
|
||||||
openInEditor(editor.toLowerCase(), projectPath, stackFrame);
|
|
||||||
} else {
|
|
||||||
if (
|
if (
|
||||||
chrome.devtools &&
|
useEditor &&
|
||||||
chrome.devtools.panels &&
|
projectPath &&
|
||||||
!!chrome.devtools.panels.openResource
|
typeof editor === 'string' &&
|
||||||
|
/^\w{1,30}$/.test(editor)
|
||||||
) {
|
) {
|
||||||
openResource(fileName, lineNumber, stackFrame);
|
openInEditor(editor.toLowerCase(), projectPath, stackFrame);
|
||||||
} else if (chrome.runtime && (chrome.runtime.openOptionsPage || isFF)) {
|
} else {
|
||||||
if (chrome.devtools && isFF) {
|
if (
|
||||||
chrome.devtools.inspectedWindow.eval(
|
chrome.devtools &&
|
||||||
'confirm("Set the editor to open the file in?")',
|
chrome.devtools.panels &&
|
||||||
(result) => {
|
!!chrome.devtools.panels.openResource
|
||||||
if (!result) return;
|
) {
|
||||||
chrome.runtime.sendMessage({ type: 'OPEN_OPTIONS' });
|
openResource(fileName, lineNumber, stackFrame);
|
||||||
}
|
} else if (chrome.runtime && (chrome.runtime.openOptionsPage || isFF)) {
|
||||||
);
|
if (chrome.devtools && isFF) {
|
||||||
} else if (confirm('Set the editor to open the file in?')) {
|
chrome.devtools.inspectedWindow.eval(
|
||||||
chrome.runtime.openOptionsPage();
|
'confirm("Set the editor to open the file in?")',
|
||||||
|
(result) => {
|
||||||
|
if (!result) return;
|
||||||
|
chrome.runtime.sendMessage({ type: 'OPEN_OPTIONS' });
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else if (confirm('Set the editor to open the file in?')) {
|
||||||
|
chrome.runtime.openOptionsPage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,10 +67,8 @@ class StackFrame extends Component<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
getErrorLocation(): ErrorLocation | null {
|
getErrorLocation(): ErrorLocation | null {
|
||||||
const {
|
const { _originalFileName: fileName, _originalLineNumber: lineNumber } =
|
||||||
_originalFileName: fileName,
|
this.props.frame;
|
||||||
_originalLineNumber: lineNumber,
|
|
||||||
} = this.props.frame;
|
|
||||||
// Unknown file
|
// Unknown file
|
||||||
if (!fileName) {
|
if (!fileName) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -70,7 +70,7 @@ class SourceMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSources(): string[] {
|
getSources(): string[] {
|
||||||
return ((this.__source_map as unknown) as { sources: string[] }).sources;
|
return (this.__source_map as unknown as { sources: string[] }).sources;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,9 +115,7 @@ async function getSourceMap(
|
||||||
sm = sm.substring(match2[0].length);
|
sm = sm.substring(match2[0].length);
|
||||||
sm = window.atob(sm);
|
sm = window.atob(sm);
|
||||||
sm = JSON.parse(sm);
|
sm = JSON.parse(sm);
|
||||||
return new SourceMap(
|
return new SourceMap(new SourceMapConsumer(sm as unknown as RawSourceMap));
|
||||||
new SourceMapConsumer((sm as unknown) as RawSourceMap)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
const index = fileUri.lastIndexOf('/');
|
const index = fileUri.lastIndexOf('/');
|
||||||
const url = fileUri.substring(0, index + 1) + sm;
|
const url = fileUri.substring(0, index + 1) + sm;
|
||||||
|
|
|
@ -19,15 +19,19 @@ function getStackFrames(
|
||||||
const parsedFrames = parse(error);
|
const parsedFrames = parse(error);
|
||||||
let enhancedFramesPromise;
|
let enhancedFramesPromise;
|
||||||
if (
|
if (
|
||||||
((error as unknown) as {
|
(
|
||||||
__unmap_source: string | { uri: string; contents: string };
|
error as unknown as {
|
||||||
}).__unmap_source
|
__unmap_source: string | { uri: string; contents: string };
|
||||||
|
}
|
||||||
|
).__unmap_source
|
||||||
) {
|
) {
|
||||||
enhancedFramesPromise = unmap(
|
enhancedFramesPromise = unmap(
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
((error as unknown) as {
|
(
|
||||||
__unmap_source: string | { uri: string; contents: string };
|
error as unknown as {
|
||||||
}).__unmap_source,
|
__unmap_source: string | { uri: string; contents: string };
|
||||||
|
}
|
||||||
|
).__unmap_source,
|
||||||
parsedFrames,
|
parsedFrames,
|
||||||
contextSize
|
contextSize
|
||||||
);
|
);
|
||||||
|
|
|
@ -39,9 +39,8 @@ function parseCompileError(message: string): ErrorLocation | null | undefined {
|
||||||
|
|
||||||
let k = 0;
|
let k = 0;
|
||||||
while (k < lineNumberRegexes.length) {
|
while (k < lineNumberRegexes.length) {
|
||||||
const match: string[] | null | undefined = lineNumberRegexes[k].exec(
|
const match: string[] | null | undefined =
|
||||||
line
|
lineNumberRegexes[k].exec(line);
|
||||||
);
|
|
||||||
if (match) {
|
if (match) {
|
||||||
lineNumber = parseInt(match[1], 10);
|
lineNumber = parseInt(match[1], 10);
|
||||||
// colNumber starts with 0 and hence add 1
|
// colNumber starts with 0 and hence add 1
|
||||||
|
|
|
@ -23,7 +23,8 @@ function extractLocation(token: string): [string, number, number] {
|
||||||
}
|
}
|
||||||
|
|
||||||
const regexValidFrame_Chrome = /^\s*(at|in)\s.+(:\d+)/;
|
const regexValidFrame_Chrome = /^\s*(at|in)\s.+(:\d+)/;
|
||||||
const regexValidFrame_FireFox = /(^|@)\S+:\d+|.+line\s+\d+\s+>\s+(eval|Function).+/;
|
const regexValidFrame_FireFox =
|
||||||
|
/(^|@)\S+:\d+|.+line\s+\d+\s+>\s+(eval|Function).+/;
|
||||||
|
|
||||||
function parseStack(stack: string[]): StackFrame[] {
|
function parseStack(stack: string[]): StackFrame[] {
|
||||||
const frames = stack
|
const frames = stack
|
||||||
|
|
|
@ -42,12 +42,8 @@ async function unmap(
|
||||||
}
|
}
|
||||||
const map = await getSourceMap(fileUri, fileContents!);
|
const map = await getSourceMap(fileUri, fileContents!);
|
||||||
return frames.map((frame) => {
|
return frames.map((frame) => {
|
||||||
const {
|
const { functionName, lineNumber, columnNumber, _originalLineNumber } =
|
||||||
functionName,
|
frame;
|
||||||
lineNumber,
|
|
||||||
columnNumber,
|
|
||||||
_originalLineNumber,
|
|
||||||
} = frame;
|
|
||||||
if (_originalLineNumber != null) {
|
if (_originalLineNumber != null) {
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<body>
|
<body>
|
||||||
<a href="<%= htmlWebpackPlugin.options.package.repository.url %>"
|
<a href="<%= htmlWebpackPlugin.options.package.repository.url %>"
|
||||||
><img
|
><img
|
||||||
style="z-index: 999999999; position: fixed; top: 0; left: 0; border: 0;"
|
style="z-index: 999999999; position: fixed; top: 0; left: 0; border: 0"
|
||||||
src="https://camo.githubusercontent.com/121cd7cbdc3e4855075ea8b558508b91ac463ac2/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f677265656e5f3030373230302e706e67"
|
src="https://camo.githubusercontent.com/121cd7cbdc3e4855075ea8b558508b91ac463ac2/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f677265656e5f3030373230302e706e67"
|
||||||
alt="Fork me on GitHub"
|
alt="Fork me on GitHub"
|
||||||
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_green_007200.png"
|
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_green_007200.png"
|
||||||
|
|
|
@ -33,16 +33,18 @@ const DevTools = getDevTools(window.location);
|
||||||
const history = createBrowserHistory();
|
const history = createBrowserHistory();
|
||||||
|
|
||||||
const useDevtoolsExtension =
|
const useDevtoolsExtension =
|
||||||
!!((window as unknown) as { __REDUX_DEVTOOLS_EXTENSION__: unknown })
|
!!(window as unknown as { __REDUX_DEVTOOLS_EXTENSION__: unknown })
|
||||||
.__REDUX_DEVTOOLS_EXTENSION__ && getOptions(window.location).useExtension;
|
.__REDUX_DEVTOOLS_EXTENSION__ && getOptions(window.location).useExtension;
|
||||||
|
|
||||||
const enhancer = compose(
|
const enhancer = compose(
|
||||||
applyMiddleware(logger, routerMiddleware(history)),
|
applyMiddleware(logger, routerMiddleware(history)),
|
||||||
(next: StoreEnhancerStoreCreator) => {
|
(next: StoreEnhancerStoreCreator) => {
|
||||||
const instrument = useDevtoolsExtension
|
const instrument = useDevtoolsExtension
|
||||||
? ((window as unknown) as {
|
? (
|
||||||
__REDUX_DEVTOOLS_EXTENSION__(): StoreEnhancer;
|
window as unknown as {
|
||||||
}).__REDUX_DEVTOOLS_EXTENSION__()
|
__REDUX_DEVTOOLS_EXTENSION__(): StoreEnhancer;
|
||||||
|
}
|
||||||
|
).__REDUX_DEVTOOLS_EXTENSION__()
|
||||||
: DevTools.instrument();
|
: DevTools.instrument();
|
||||||
return instrument(next);
|
return instrument(next);
|
||||||
},
|
},
|
||||||
|
|
|
@ -78,14 +78,12 @@ export default class ActionListRow<
|
||||||
<div
|
<div
|
||||||
onClick={onSelect}
|
onClick={onSelect}
|
||||||
onMouseEnter={
|
onMouseEnter={
|
||||||
(!hideActionButtons && this.handleMouseEnter) as MouseEventHandler<
|
(!hideActionButtons &&
|
||||||
HTMLDivElement
|
this.handleMouseEnter) as MouseEventHandler<HTMLDivElement>
|
||||||
>
|
|
||||||
}
|
}
|
||||||
onMouseLeave={
|
onMouseLeave={
|
||||||
(!hideActionButtons && this.handleMouseLeave) as MouseEventHandler<
|
(!hideActionButtons &&
|
||||||
HTMLDivElement
|
this.handleMouseLeave) as MouseEventHandler<HTMLDivElement>
|
||||||
>
|
|
||||||
}
|
}
|
||||||
onMouseDown={this.handleMouseDown}
|
onMouseDown={this.handleMouseDown}
|
||||||
onMouseUp={this.handleMouseEnter}
|
onMouseUp={this.handleMouseEnter}
|
||||||
|
@ -193,7 +191,7 @@ export default class ActionListRow<
|
||||||
|
|
||||||
handleMouseDown = (e: MouseEvent<HTMLDivElement>) => {
|
handleMouseDown = (e: MouseEvent<HTMLDivElement>) => {
|
||||||
if (
|
if (
|
||||||
((e.target as unknown) as { className: string[] }).className.indexOf(
|
(e.target as unknown as { className: string[] }).className.indexOf(
|
||||||
'selectorButton'
|
'selectorButton'
|
||||||
) === 0
|
) === 0
|
||||||
)
|
)
|
||||||
|
|
|
@ -121,7 +121,7 @@ class ActionPreview<S, A extends Action<unknown>> extends Component<
|
||||||
return (
|
return (
|
||||||
<div key="actionPreview" {...styling('actionPreview')}>
|
<div key="actionPreview" {...styling('actionPreview')}>
|
||||||
<ActionPreviewHeader
|
<ActionPreviewHeader
|
||||||
tabs={(renderedTabs as unknown) as Tab<unknown, Action<unknown>>[]}
|
tabs={renderedTabs as unknown as Tab<unknown, Action<unknown>>[]}
|
||||||
{...{ styling, inspectedPath, onInspectPath, tabName, onSelectTab }}
|
{...{ styling, inspectedPath, onInspectPath, tabName, onSelectTab }}
|
||||||
/>
|
/>
|
||||||
{!error && (
|
{!error && (
|
||||||
|
|
|
@ -13,65 +13,56 @@ interface Props<S, A extends Action<unknown>> {
|
||||||
onSelectTab: (tabName: string) => void;
|
onSelectTab: (tabName: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ActionPreviewHeader: FunctionComponent<Props<
|
const ActionPreviewHeader: FunctionComponent<Props<unknown, Action<unknown>>> =
|
||||||
unknown,
|
({ styling, inspectedPath, onInspectPath, tabName, onSelectTab, tabs }) => (
|
||||||
Action<unknown>
|
<div key="previewHeader" {...styling('previewHeader')}>
|
||||||
>> = ({
|
<div {...styling('tabSelector')}>
|
||||||
styling,
|
{tabs.map((tab) => (
|
||||||
inspectedPath,
|
<div
|
||||||
onInspectPath,
|
onClick={() => onSelectTab(tab.name)}
|
||||||
tabName,
|
key={tab.name}
|
||||||
onSelectTab,
|
{...styling(
|
||||||
tabs,
|
[
|
||||||
}) => (
|
'selectorButton',
|
||||||
<div key="previewHeader" {...styling('previewHeader')}>
|
tab.name === tabName && 'selectorButtonSelected',
|
||||||
<div {...styling('tabSelector')}>
|
],
|
||||||
{tabs.map((tab) => (
|
tab.name === tabName
|
||||||
<div
|
)}
|
||||||
onClick={() => onSelectTab(tab.name)}
|
|
||||||
key={tab.name}
|
|
||||||
{...styling(
|
|
||||||
[
|
|
||||||
'selectorButton',
|
|
||||||
tab.name === tabName && 'selectorButtonSelected',
|
|
||||||
],
|
|
||||||
tab.name === tabName
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{tab.name}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
<div {...styling('inspectedPath')}>
|
|
||||||
{inspectedPath.length ? (
|
|
||||||
<span {...styling('inspectedPathKey')}>
|
|
||||||
<a
|
|
||||||
onClick={() => onInspectPath([])}
|
|
||||||
{...styling('inspectedPathKeyLink')}
|
|
||||||
>
|
>
|
||||||
{tabName}
|
{tab.name}
|
||||||
</a>
|
</div>
|
||||||
</span>
|
))}
|
||||||
) : (
|
</div>
|
||||||
tabName
|
<div {...styling('inspectedPath')}>
|
||||||
)}
|
{inspectedPath.length ? (
|
||||||
{inspectedPath.map((key, idx) =>
|
<span {...styling('inspectedPathKey')}>
|
||||||
idx === inspectedPath.length - 1 ? (
|
|
||||||
<span key={key}>{key}</span>
|
|
||||||
) : (
|
|
||||||
<span key={key} {...styling('inspectedPathKey')}>
|
|
||||||
<a
|
<a
|
||||||
onClick={() => onInspectPath(inspectedPath.slice(0, idx + 1))}
|
onClick={() => onInspectPath([])}
|
||||||
{...styling('inspectedPathKeyLink')}
|
{...styling('inspectedPathKeyLink')}
|
||||||
>
|
>
|
||||||
{key}
|
{tabName}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
)
|
) : (
|
||||||
)}
|
tabName
|
||||||
|
)}
|
||||||
|
{inspectedPath.map((key, idx) =>
|
||||||
|
idx === inspectedPath.length - 1 ? (
|
||||||
|
<span key={key}>{key}</span>
|
||||||
|
) : (
|
||||||
|
<span key={key} {...styling('inspectedPathKey')}>
|
||||||
|
<a
|
||||||
|
onClick={() => onInspectPath(inspectedPath.slice(0, idx + 1))}
|
||||||
|
{...styling('inspectedPathKeyLink')}
|
||||||
|
>
|
||||||
|
{key}
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
);
|
||||||
);
|
|
||||||
|
|
||||||
ActionPreviewHeader.propTypes = {
|
ActionPreviewHeader.propTypes = {
|
||||||
tabs: PropTypes.array.isRequired,
|
tabs: PropTypes.array.isRequired,
|
||||||
|
|
|
@ -301,22 +301,12 @@ class DevtoolsInspector<S, A extends Action<unknown>> extends PureComponent<
|
||||||
hideMainButtons,
|
hideMainButtons,
|
||||||
hideActionButtons,
|
hideActionButtons,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const {
|
const { selectedActionId, startActionId, searchValue, tabName } =
|
||||||
selectedActionId,
|
monitorState;
|
||||||
startActionId,
|
|
||||||
searchValue,
|
|
||||||
tabName,
|
|
||||||
} = monitorState;
|
|
||||||
const inspectedPathType =
|
const inspectedPathType =
|
||||||
tabName === 'Action' ? 'inspectedActionPath' : 'inspectedStatePath';
|
tabName === 'Action' ? 'inspectedActionPath' : 'inspectedStatePath';
|
||||||
const {
|
const { themeState, isWideLayout, action, nextState, delta, error } =
|
||||||
themeState,
|
this.state;
|
||||||
isWideLayout,
|
|
||||||
action,
|
|
||||||
nextState,
|
|
||||||
delta,
|
|
||||||
error,
|
|
||||||
} = this.state;
|
|
||||||
const { base16Theme, styling } = themeState;
|
const { base16Theme, styling } = themeState;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -467,7 +457,7 @@ class DevtoolsInspector<S, A extends Action<unknown>> extends PureComponent<
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (DevtoolsInspector as unknown) as React.ComponentType<
|
export default DevtoolsInspector as unknown as React.ComponentType<
|
||||||
ExternalProps<unknown, Action<unknown>>
|
ExternalProps<unknown, Action<unknown>>
|
||||||
> & {
|
> & {
|
||||||
update(
|
update(
|
||||||
|
|
|
@ -6,10 +6,9 @@ import getItemString from './getItemString';
|
||||||
import getJsonTreeTheme from './getJsonTreeTheme';
|
import getJsonTreeTheme from './getJsonTreeTheme';
|
||||||
import { TabComponentProps } from '../ActionPreview';
|
import { TabComponentProps } from '../ActionPreview';
|
||||||
|
|
||||||
const ActionTab: FunctionComponent<TabComponentProps<
|
const ActionTab: FunctionComponent<
|
||||||
unknown,
|
TabComponentProps<unknown, Action<unknown>>
|
||||||
Action<unknown>
|
> = ({
|
||||||
>> = ({
|
|
||||||
action,
|
action,
|
||||||
styling,
|
styling,
|
||||||
base16Theme,
|
base16Theme,
|
||||||
|
|
|
@ -4,30 +4,28 @@ import JSONDiff from './JSONDiff';
|
||||||
import { TabComponentProps } from '../ActionPreview';
|
import { TabComponentProps } from '../ActionPreview';
|
||||||
import { Action } from 'redux';
|
import { Action } from 'redux';
|
||||||
|
|
||||||
const DiffTab: FunctionComponent<TabComponentProps<
|
const DiffTab: FunctionComponent<TabComponentProps<unknown, Action<unknown>>> =
|
||||||
unknown,
|
({
|
||||||
Action<unknown>
|
delta,
|
||||||
>> = ({
|
styling,
|
||||||
delta,
|
base16Theme,
|
||||||
styling,
|
invertTheme,
|
||||||
base16Theme,
|
labelRenderer,
|
||||||
invertTheme,
|
isWideLayout,
|
||||||
labelRenderer,
|
dataTypeKey,
|
||||||
isWideLayout,
|
}) => (
|
||||||
dataTypeKey,
|
<JSONDiff
|
||||||
}) => (
|
{...{
|
||||||
<JSONDiff
|
delta,
|
||||||
{...{
|
styling,
|
||||||
delta,
|
base16Theme,
|
||||||
styling,
|
invertTheme,
|
||||||
base16Theme,
|
labelRenderer,
|
||||||
invertTheme,
|
isWideLayout,
|
||||||
labelRenderer,
|
dataTypeKey,
|
||||||
isWideLayout,
|
}}
|
||||||
dataTypeKey,
|
/>
|
||||||
}}
|
);
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
DiffTab.propTypes = {
|
DiffTab.propTypes = {
|
||||||
delta: PropTypes.any,
|
delta: PropTypes.any,
|
||||||
|
|
|
@ -6,10 +6,9 @@ import getItemString from './getItemString';
|
||||||
import getJsonTreeTheme from './getJsonTreeTheme';
|
import getJsonTreeTheme from './getJsonTreeTheme';
|
||||||
import { TabComponentProps } from '../ActionPreview';
|
import { TabComponentProps } from '../ActionPreview';
|
||||||
|
|
||||||
const StateTab: React.FunctionComponent<TabComponentProps<
|
const StateTab: React.FunctionComponent<
|
||||||
any,
|
TabComponentProps<any, Action<unknown>>
|
||||||
Action<unknown>
|
> = ({
|
||||||
>> = ({
|
|
||||||
nextState,
|
nextState,
|
||||||
styling,
|
styling,
|
||||||
base16Theme,
|
base16Theme,
|
||||||
|
|
|
@ -902,7 +902,7 @@ export function unliftStore<
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ({
|
return {
|
||||||
...liftedStore,
|
...liftedStore,
|
||||||
|
|
||||||
liftedStore,
|
liftedStore,
|
||||||
|
@ -913,9 +913,9 @@ export function unliftStore<
|
||||||
|
|
||||||
replaceReducer(nextReducer: Reducer<S & NextStateExt, A>) {
|
replaceReducer(nextReducer: Reducer<S & NextStateExt, A>) {
|
||||||
liftedStore.replaceReducer(
|
liftedStore.replaceReducer(
|
||||||
(liftReducer(
|
liftReducer(
|
||||||
(nextReducer as unknown) as Reducer<S, A>
|
nextReducer as unknown as Reducer<S, A>
|
||||||
) as unknown) as Reducer<
|
) as unknown as Reducer<
|
||||||
LiftedState<S, A, MonitorState> & NextStateExt,
|
LiftedState<S, A, MonitorState> & NextStateExt,
|
||||||
LiftedAction<S, A, MonitorState>
|
LiftedAction<S, A, MonitorState>
|
||||||
>
|
>
|
||||||
|
@ -946,7 +946,7 @@ export function unliftStore<
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
} as unknown) as Store<S & NextStateExt, A> &
|
} as unknown as Store<S & NextStateExt, A> &
|
||||||
NextExt & {
|
NextExt & {
|
||||||
liftedStore: Store<
|
liftedStore: Store<
|
||||||
LiftedState<S, A, MonitorState> & NextStateExt,
|
LiftedState<S, A, MonitorState> & NextStateExt,
|
||||||
|
@ -986,8 +986,8 @@ export default function instrument<
|
||||||
MonitorState = null,
|
MonitorState = null,
|
||||||
MonitorAction extends Action<unknown> = never
|
MonitorAction extends Action<unknown> = never
|
||||||
>(
|
>(
|
||||||
monitorReducer: Reducer<MonitorState, MonitorAction> = ((() =>
|
monitorReducer: Reducer<MonitorState, MonitorAction> = (() =>
|
||||||
null) as unknown) as Reducer<MonitorState, MonitorAction>,
|
null) as unknown as Reducer<MonitorState, MonitorAction>,
|
||||||
options: Options<OptionsS, OptionsA, MonitorState, MonitorAction> = {}
|
options: Options<OptionsS, OptionsA, MonitorState, MonitorAction> = {}
|
||||||
): StoreEnhancer<InstrumentExt<any, any, MonitorState>> {
|
): StoreEnhancer<InstrumentExt<any, any, MonitorState>> {
|
||||||
if (typeof options.maxAge === 'number' && options.maxAge < 2) {
|
if (typeof options.maxAge === 'number' && options.maxAge < 2) {
|
||||||
|
@ -998,61 +998,64 @@ export default function instrument<
|
||||||
}
|
}
|
||||||
|
|
||||||
return <NextExt, NextStateExt>(
|
return <NextExt, NextStateExt>(
|
||||||
createStore: StoreEnhancerStoreCreator<NextExt, NextStateExt>
|
createStore: StoreEnhancerStoreCreator<NextExt, NextStateExt>
|
||||||
) => <S, A extends Action<unknown>>(
|
) =>
|
||||||
reducer: Reducer<S, A>,
|
<S, A extends Action<unknown>>(
|
||||||
initialState?: PreloadedState<S>
|
reducer: Reducer<S, A>,
|
||||||
) => {
|
initialState?: PreloadedState<S>
|
||||||
function liftReducer(r: Reducer<S, A>) {
|
) => {
|
||||||
if (typeof r !== 'function') {
|
function liftReducer(r: Reducer<S, A>) {
|
||||||
if (r && typeof (r as { default: unknown }).default === 'function') {
|
if (typeof r !== 'function') {
|
||||||
throw new Error(
|
if (r && typeof (r as { default: unknown }).default === 'function') {
|
||||||
'Expected the reducer to be a function. ' +
|
throw new Error(
|
||||||
'Instead got an object with a "default" field. ' +
|
'Expected the reducer to be a function. ' +
|
||||||
'Did you pass a module instead of the default export? ' +
|
'Instead got an object with a "default" field. ' +
|
||||||
'Try passing require(...).default instead.'
|
'Did you pass a module instead of the default export? ' +
|
||||||
);
|
'Try passing require(...).default instead.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
throw new Error('Expected the reducer to be a function.');
|
||||||
}
|
}
|
||||||
throw new Error('Expected the reducer to be a function.');
|
return liftReducerWith<S, A, MonitorState, MonitorAction>(
|
||||||
|
r,
|
||||||
|
initialState,
|
||||||
|
monitorReducer,
|
||||||
|
options as unknown as Options<S, A, MonitorState, MonitorAction>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return liftReducerWith<S, A, MonitorState, MonitorAction>(
|
|
||||||
r,
|
|
||||||
initialState,
|
|
||||||
monitorReducer,
|
|
||||||
(options as unknown) as Options<S, A, MonitorState, MonitorAction>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const liftedStore = createStore(liftReducer(reducer));
|
const liftedStore = createStore(liftReducer(reducer));
|
||||||
if (
|
if (
|
||||||
(liftedStore as Store<
|
(
|
||||||
LiftedState<S, A, MonitorState> & NextStateExt,
|
liftedStore as Store<
|
||||||
LiftedAction<S, A, MonitorState>
|
LiftedState<S, A, MonitorState> & NextStateExt,
|
||||||
> &
|
|
||||||
NextExt & {
|
|
||||||
liftedStore: Store<
|
|
||||||
LiftedState<S, A, MonitorState>,
|
|
||||||
LiftedAction<S, A, MonitorState>
|
LiftedAction<S, A, MonitorState>
|
||||||
>;
|
> &
|
||||||
}).liftedStore
|
NextExt & {
|
||||||
) {
|
liftedStore: Store<
|
||||||
throw new Error(
|
LiftedState<S, A, MonitorState>,
|
||||||
'DevTools instrumentation should not be applied more than once. ' +
|
LiftedAction<S, A, MonitorState>
|
||||||
'Check your store configuration.'
|
>;
|
||||||
);
|
}
|
||||||
}
|
).liftedStore
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
'DevTools instrumentation should not be applied more than once. ' +
|
||||||
|
'Check your store configuration.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return unliftStore<
|
return unliftStore<
|
||||||
S,
|
S,
|
||||||
A,
|
A,
|
||||||
MonitorState,
|
MonitorState,
|
||||||
MonitorAction,
|
MonitorAction,
|
||||||
NextExt,
|
NextExt,
|
||||||
NextStateExt
|
NextStateExt
|
||||||
>(
|
>(
|
||||||
liftedStore,
|
liftedStore,
|
||||||
liftReducer,
|
liftReducer,
|
||||||
(options as unknown) as Options<S, A, MonitorState, MonitorAction>
|
options as unknown as Options<S, A, MonitorState, MonitorAction>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ function counterWithBug(state = 0, action: CounterWithBugAction) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return mistake - 1;
|
return mistake - 1;
|
||||||
case 'SET_UNDEFINED':
|
case 'SET_UNDEFINED':
|
||||||
return (undefined as unknown) as number;
|
return undefined as unknown as number;
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ function counterWithAnotherBug(state = 0, action: CounterWithBugAction) {
|
||||||
case 'INCREMENT':
|
case 'INCREMENT':
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return ((mistake as unknown) as number) + 1;
|
return (mistake as unknown as number) + 1;
|
||||||
case 'DECREMENT':
|
case 'DECREMENT':
|
||||||
return state - 1;
|
return state - 1;
|
||||||
case 'SET_UNDEFINED':
|
case 'SET_UNDEFINED':
|
||||||
|
@ -108,7 +108,7 @@ describe('instrument', () => {
|
||||||
let lastValue;
|
let lastValue;
|
||||||
// let calls = 0;
|
// let calls = 0;
|
||||||
|
|
||||||
from((store as unknown) as Observable<number>).subscribe((state) => {
|
from(store as unknown as Observable<number>).subscribe((state) => {
|
||||||
lastValue = state;
|
lastValue = state;
|
||||||
// calls++;
|
// calls++;
|
||||||
});
|
});
|
||||||
|
@ -258,81 +258,49 @@ describe('instrument', () => {
|
||||||
storeWithMultiply.dispatch({ type: 'INCREMENT' });
|
storeWithMultiply.dispatch({ type: 'INCREMENT' });
|
||||||
storeWithMultiply.dispatch({ type: 'MULTIPLY' });
|
storeWithMultiply.dispatch({ type: 'MULTIPLY' });
|
||||||
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
||||||
0,
|
0, 1, 2, 3, 4,
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
4,
|
|
||||||
]);
|
]);
|
||||||
expect(storeWithMultiply.getState()).toBe(2);
|
expect(storeWithMultiply.getState()).toBe(2);
|
||||||
|
|
||||||
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(4, 1));
|
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(4, 1));
|
||||||
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
||||||
0,
|
0, 4, 1, 2, 3,
|
||||||
4,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
]);
|
]);
|
||||||
expect(storeWithMultiply.getState()).toBe(1);
|
expect(storeWithMultiply.getState()).toBe(1);
|
||||||
|
|
||||||
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(4, 1));
|
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(4, 1));
|
||||||
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
||||||
0,
|
0, 4, 1, 2, 3,
|
||||||
4,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
]);
|
]);
|
||||||
expect(storeWithMultiply.getState()).toBe(1);
|
expect(storeWithMultiply.getState()).toBe(1);
|
||||||
|
|
||||||
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(4, 2));
|
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(4, 2));
|
||||||
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
||||||
0,
|
0, 1, 4, 2, 3,
|
||||||
1,
|
|
||||||
4,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
]);
|
]);
|
||||||
expect(storeWithMultiply.getState()).toBe(2);
|
expect(storeWithMultiply.getState()).toBe(2);
|
||||||
|
|
||||||
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(1, 10));
|
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(1, 10));
|
||||||
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
||||||
0,
|
0, 4, 2, 3, 1,
|
||||||
4,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
1,
|
|
||||||
]);
|
]);
|
||||||
expect(storeWithMultiply.getState()).toBe(1);
|
expect(storeWithMultiply.getState()).toBe(1);
|
||||||
|
|
||||||
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(10, 1));
|
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(10, 1));
|
||||||
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
||||||
0,
|
0, 4, 2, 3, 1,
|
||||||
4,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
1,
|
|
||||||
]);
|
]);
|
||||||
expect(storeWithMultiply.getState()).toBe(1);
|
expect(storeWithMultiply.getState()).toBe(1);
|
||||||
|
|
||||||
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(1, -2));
|
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(1, -2));
|
||||||
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
||||||
0,
|
0, 1, 4, 2, 3,
|
||||||
1,
|
|
||||||
4,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
]);
|
]);
|
||||||
expect(storeWithMultiply.getState()).toBe(2);
|
expect(storeWithMultiply.getState()).toBe(2);
|
||||||
|
|
||||||
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(0, 1));
|
storeWithMultiply.liftedStore.dispatch(ActionCreators.reorderAction(0, 1));
|
||||||
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
expect(storeWithMultiply.liftedStore.getState().stagedActionIds).toEqual([
|
||||||
0,
|
0, 1, 4, 2, 3,
|
||||||
1,
|
|
||||||
4,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
]);
|
]);
|
||||||
expect(storeWithMultiply.getState()).toBe(2);
|
expect(storeWithMultiply.getState()).toBe(2);
|
||||||
});
|
});
|
||||||
|
@ -366,7 +334,7 @@ describe('instrument', () => {
|
||||||
store.replaceReducer(
|
store.replaceReducer(
|
||||||
(() => ({ test: true } as unknown)) as Reducer<number, CounterAction>
|
(() => ({ test: true } as unknown)) as Reducer<number, CounterAction>
|
||||||
);
|
);
|
||||||
const newStore = (store as unknown) as Store<{ test: boolean }>;
|
const newStore = store as unknown as Store<{ test: boolean }>;
|
||||||
expect(newStore.getState()).toEqual({ test: true });
|
expect(newStore.getState()).toEqual({ test: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -395,7 +363,7 @@ describe('instrument', () => {
|
||||||
|
|
||||||
it('should catch invalid action type (undefined type)', () => {
|
it('should catch invalid action type (undefined type)', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
store.dispatch(({ type: undefined } as unknown) as CounterAction);
|
store.dispatch({ type: undefined } as unknown as CounterAction);
|
||||||
}).toThrow(
|
}).toThrow(
|
||||||
'Actions may not have an undefined "type" property. ' +
|
'Actions may not have an undefined "type" property. ' +
|
||||||
'Have you misspelled a constant?'
|
'Have you misspelled a constant?'
|
||||||
|
@ -612,11 +580,12 @@ describe('instrument', () => {
|
||||||
storeWithBug.replaceReducer(
|
storeWithBug.replaceReducer(
|
||||||
counterWithAnotherBug as Reducer<number, CounterWithBugAction>
|
counterWithAnotherBug as Reducer<number, CounterWithBugAction>
|
||||||
);
|
);
|
||||||
const liftedStoreWithAnotherBug = (liftedStoreWithBug as unknown) as LiftedStore<
|
const liftedStoreWithAnotherBug =
|
||||||
number,
|
liftedStoreWithBug as unknown as LiftedStore<
|
||||||
CounterWithAnotherBugAction,
|
number,
|
||||||
null
|
CounterWithAnotherBugAction,
|
||||||
>;
|
null
|
||||||
|
>;
|
||||||
expect(liftedStoreWithAnotherBug.getState().stagedActionIds).toHaveLength(
|
expect(liftedStoreWithAnotherBug.getState().stagedActionIds).toHaveLength(
|
||||||
5
|
5
|
||||||
);
|
);
|
||||||
|
@ -1027,7 +996,7 @@ describe('instrument', () => {
|
||||||
it('should include 3 extra frames when Error.captureStackTrace not suported', () => {
|
it('should include 3 extra frames when Error.captureStackTrace not suported', () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
const captureStackTrace = Error.captureStackTrace;
|
const captureStackTrace = Error.captureStackTrace;
|
||||||
Error.captureStackTrace = (undefined as unknown) as () => unknown;
|
Error.captureStackTrace = undefined as unknown as () => unknown;
|
||||||
monitoredStore = createStore(
|
monitoredStore = createStore(
|
||||||
counter,
|
counter,
|
||||||
instrument(undefined, { trace: true, traceLimit: 5 })
|
instrument(undefined, { trace: true, traceLimit: 5 })
|
||||||
|
@ -1395,18 +1364,18 @@ describe('instrument', () => {
|
||||||
|
|
||||||
it('throws if reducer is not a function', () => {
|
it('throws if reducer is not a function', () => {
|
||||||
expect(() =>
|
expect(() =>
|
||||||
createStore((undefined as unknown) as Reducer, instrument())
|
createStore(undefined as unknown as Reducer, instrument())
|
||||||
).toThrow('Expected the reducer to be a function.');
|
).toThrow('Expected the reducer to be a function.');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('warns if the reducer is not a function but has a default field that is', () => {
|
it('warns if the reducer is not a function but has a default field that is', () => {
|
||||||
expect(() =>
|
expect(() =>
|
||||||
createStore(
|
createStore(
|
||||||
({
|
{
|
||||||
default: () => {
|
default: () => {
|
||||||
// noop
|
// noop
|
||||||
},
|
},
|
||||||
} as unknown) as Reducer,
|
} as unknown as Reducer,
|
||||||
instrument()
|
instrument()
|
||||||
)
|
)
|
||||||
).toThrow(
|
).toThrow(
|
||||||
|
|
|
@ -273,7 +273,7 @@ class LogMonitor<S, A extends Action<unknown>> extends PureComponent<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (LogMonitor as unknown) as React.ComponentType<
|
export default LogMonitor as unknown as React.ComponentType<
|
||||||
ExternalProps<unknown, Action<unknown>>
|
ExternalProps<unknown, Action<unknown>>
|
||||||
> & {
|
> & {
|
||||||
update(
|
update(
|
||||||
|
|
|
@ -154,15 +154,8 @@ export default class LogMonitorEntry<
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { actionId, error, action, state, collapsed, selected, inFuture } =
|
||||||
actionId,
|
this.props;
|
||||||
error,
|
|
||||||
action,
|
|
||||||
state,
|
|
||||||
collapsed,
|
|
||||||
selected,
|
|
||||||
inFuture,
|
|
||||||
} = this.props;
|
|
||||||
const styleEntry = {
|
const styleEntry = {
|
||||||
opacity: collapsed ? 0.5 : 1,
|
opacity: collapsed ? 0.5 : 1,
|
||||||
cursor: actionId > 0 ? 'pointer' : 'default',
|
cursor: actionId > 0 ? 'pointer' : 'default',
|
||||||
|
|
|
@ -148,9 +148,11 @@ describe('Immutable', function () {
|
||||||
if (key === 'map' || key === 'orderedMap') {
|
if (key === 'map' || key === 'orderedMap') {
|
||||||
const deserializedDefault = parse(stringified);
|
const deserializedDefault = parse(stringified);
|
||||||
expect(
|
expect(
|
||||||
(deserializedDefault as
|
(
|
||||||
| Map<unknown, unknown>
|
deserializedDefault as
|
||||||
| OrderedMap<unknown, unknown>).get('a')
|
| Map<unknown, unknown>
|
||||||
|
| OrderedMap<unknown, unknown>
|
||||||
|
).get('a')
|
||||||
).toEqual(customOneRepresentation);
|
).toEqual(customOneRepresentation);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,7 +36,7 @@ interface DefaultProps {
|
||||||
keyboardEnabled: boolean;
|
keyboardEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SliderMonitorProps<S, A extends Action<unknown>> // eslint-disable-next-line @typescript-eslint/ban-types
|
interface SliderMonitorProps<S, A extends Action<unknown>> // eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
extends LiftedState<S, A, {}> {
|
extends LiftedState<S, A, {}> {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
dispatch: Dispatch<LiftedAction<S, A, {}>>;
|
dispatch: Dispatch<LiftedAction<S, A, {}>>;
|
||||||
|
@ -374,7 +374,7 @@ class SliderMonitor<S, A extends Action<unknown>> extends (PureComponent ||
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (SliderMonitor as unknown) as React.ComponentType<
|
export default SliderMonitor as unknown as React.ComponentType<
|
||||||
ExternalProps<unknown, Action<unknown>>
|
ExternalProps<unknown, Action<unknown>>
|
||||||
> & {
|
> & {
|
||||||
update(
|
update(
|
||||||
|
|
|
@ -52,27 +52,35 @@ export default function importState(
|
||||||
let preloadedState: State | undefined;
|
let preloadedState: State | undefined;
|
||||||
let nextLiftedState: State = parse(state) as State;
|
let nextLiftedState: State = parse(state) as State;
|
||||||
if (
|
if (
|
||||||
((nextLiftedState as unknown) as {
|
(
|
||||||
payload?: string;
|
nextLiftedState as unknown as {
|
||||||
preloadedState?: string;
|
payload?: string;
|
||||||
}).payload
|
preloadedState?: string;
|
||||||
|
}
|
||||||
|
).payload
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
((nextLiftedState as unknown) as {
|
(
|
||||||
payload: string;
|
nextLiftedState as unknown as {
|
||||||
preloadedState?: string;
|
payload: string;
|
||||||
}).preloadedState
|
preloadedState?: string;
|
||||||
|
}
|
||||||
|
).preloadedState
|
||||||
)
|
)
|
||||||
preloadedState = parse(
|
preloadedState = parse(
|
||||||
((nextLiftedState as unknown) as {
|
(
|
||||||
payload: string;
|
nextLiftedState as unknown as {
|
||||||
preloadedState: string;
|
payload: string;
|
||||||
}).preloadedState
|
preloadedState: string;
|
||||||
|
}
|
||||||
|
).preloadedState
|
||||||
) as State;
|
) as State;
|
||||||
nextLiftedState = parse(
|
nextLiftedState = parse(
|
||||||
((nextLiftedState as unknown) as {
|
(
|
||||||
payload: string;
|
nextLiftedState as unknown as {
|
||||||
}).payload
|
payload: string;
|
||||||
|
}
|
||||||
|
).payload
|
||||||
) as State;
|
) as State;
|
||||||
}
|
}
|
||||||
if (deserializeState) {
|
if (deserializeState) {
|
||||||
|
@ -92,7 +100,7 @@ export default function importState(
|
||||||
}
|
}
|
||||||
if (typeof preloadedState !== 'undefined') {
|
if (typeof preloadedState !== 'undefined') {
|
||||||
preloadedState = deserializeState(
|
preloadedState = deserializeState(
|
||||||
(preloadedState as unknown) as string
|
preloadedState as unknown as string
|
||||||
) as State;
|
) as State;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +110,7 @@ export default function importState(
|
||||||
nextLiftedState.actionsById,
|
nextLiftedState.actionsById,
|
||||||
(liftedAction) => ({
|
(liftedAction) => ({
|
||||||
...liftedAction,
|
...liftedAction,
|
||||||
action: deserializeAction((liftedAction.action as unknown) as string),
|
action: deserializeAction(liftedAction.action as unknown as string),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,11 +124,11 @@ function tryCatchStringify(obj: unknown) {
|
||||||
/* eslint-enable no-console */
|
/* eslint-enable no-console */
|
||||||
return jsan.stringify(
|
return jsan.stringify(
|
||||||
obj,
|
obj,
|
||||||
(null as unknown) as undefined,
|
null as unknown as undefined,
|
||||||
(null as unknown) as undefined,
|
null as unknown as undefined,
|
||||||
({
|
{
|
||||||
circular: '[CIRCULAR]',
|
circular: '[CIRCULAR]',
|
||||||
} as unknown) as boolean
|
} as unknown as boolean
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,14 +153,14 @@ export function stringify(
|
||||||
return (value as any).toJS();
|
return (value as any).toJS();
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
(null as unknown) as undefined,
|
null as unknown as undefined,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return jsan.stringify(
|
return jsan.stringify(
|
||||||
obj,
|
obj,
|
||||||
serialize.replacer,
|
serialize.replacer,
|
||||||
(null as unknown) as undefined,
|
null as unknown as undefined,
|
||||||
serialize.options as boolean
|
serialize.options as boolean
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -195,12 +195,14 @@ export function getSeralizeParameter(
|
||||||
return { replacer: serialize.replacer, options: serialize.options || true };
|
return { replacer: serialize.replacer, options: serialize.options || true };
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = (config as {
|
const value = (
|
||||||
[param: string]: {
|
config as {
|
||||||
replacer?: (key: string, value: unknown) => unknown;
|
[param: string]: {
|
||||||
options: unknown | boolean;
|
replacer?: (key: string, value: unknown) => unknown;
|
||||||
};
|
options: unknown | boolean;
|
||||||
})[param];
|
};
|
||||||
|
}
|
||||||
|
)[param];
|
||||||
if (typeof value === 'undefined') return undefined;
|
if (typeof value === 'undefined') return undefined;
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.warn(
|
console.warn(
|
||||||
|
|
|
@ -136,7 +136,7 @@ export default function createDevTools<
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
!((props.store as unknown) as EnhancedStore<S, A, MonitorState>)
|
!(props.store as unknown as EnhancedStore<S, A, MonitorState>)
|
||||||
.liftedStore
|
.liftedStore
|
||||||
) {
|
) {
|
||||||
logError('NoLiftedStore');
|
logError('NoLiftedStore');
|
||||||
|
@ -145,11 +145,13 @@ export default function createDevTools<
|
||||||
return (
|
return (
|
||||||
<Provider
|
<Provider
|
||||||
store={
|
store={
|
||||||
((props.store as unknown) as EnhancedStore<
|
(
|
||||||
S,
|
props.store as unknown as EnhancedStore<
|
||||||
A,
|
S,
|
||||||
MonitorState
|
A,
|
||||||
>).liftedStore
|
MonitorState
|
||||||
|
>
|
||||||
|
).liftedStore
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ConnectedMonitor {...monitorProps} />
|
<ConnectedMonitor {...monitorProps} />
|
||||||
|
|
|
@ -13,7 +13,9 @@ export default function persistState<
|
||||||
deserializeAction: (action: A) => A = identity
|
deserializeAction: (action: A) => A = identity
|
||||||
): StoreEnhancer {
|
): StoreEnhancer {
|
||||||
if (!sessionId) {
|
if (!sessionId) {
|
||||||
return (next) => (...args) => next(...args);
|
return (next) =>
|
||||||
|
(...args) =>
|
||||||
|
next(...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deserialize(
|
function deserialize(
|
||||||
|
@ -33,46 +35,47 @@ export default function persistState<
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return (next) => <S, A extends Action<unknown>>(
|
return (next) =>
|
||||||
reducer: Reducer<S, A>,
|
<S, A extends Action<unknown>>(
|
||||||
initialState?: PreloadedState<S>
|
reducer: Reducer<S, A>,
|
||||||
) => {
|
initialState?: PreloadedState<S>
|
||||||
const key = `redux-dev-session-${sessionId}`;
|
) => {
|
||||||
|
const key = `redux-dev-session-${sessionId}`;
|
||||||
|
|
||||||
let finalInitialState;
|
let finalInitialState;
|
||||||
try {
|
|
||||||
const json = localStorage.getItem(key);
|
|
||||||
if (json) {
|
|
||||||
finalInitialState = deserialize(JSON.parse(json)) || initialState;
|
|
||||||
next(reducer, initialState);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.warn('Could not read debug session from localStorage:', e); // eslint-disable-line no-console
|
|
||||||
try {
|
try {
|
||||||
localStorage.removeItem(key);
|
const json = localStorage.getItem(key);
|
||||||
} finally {
|
if (json) {
|
||||||
finalInitialState = undefined;
|
finalInitialState = deserialize(JSON.parse(json)) || initialState;
|
||||||
}
|
next(reducer, initialState);
|
||||||
}
|
|
||||||
|
|
||||||
const store = next(
|
|
||||||
reducer,
|
|
||||||
finalInitialState as PreloadedState<S> | undefined
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
...store,
|
|
||||||
dispatch<T extends A>(action: T) {
|
|
||||||
store.dispatch(action);
|
|
||||||
|
|
||||||
try {
|
|
||||||
localStorage.setItem(key, JSON.stringify(store.getState()));
|
|
||||||
} catch (e) {
|
|
||||||
console.warn('Could not write debug session to localStorage:', e); // eslint-disable-line no-console
|
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Could not read debug session from localStorage:', e); // eslint-disable-line no-console
|
||||||
|
try {
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
} finally {
|
||||||
|
finalInitialState = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return action;
|
const store = next(
|
||||||
},
|
reducer,
|
||||||
|
finalInitialState as PreloadedState<S> | undefined
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...store,
|
||||||
|
dispatch<T extends A>(action: T) {
|
||||||
|
store.dispatch(action);
|
||||||
|
|
||||||
|
try {
|
||||||
|
localStorage.setItem(key, JSON.stringify(store.getState()));
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Could not write debug session to localStorage:', e); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
|
||||||
|
return action;
|
||||||
|
},
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
13
yarn.lock
13
yarn.lock
|
@ -19323,7 +19323,16 @@ fsevents@^1.2.7:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"prettier@npm:^2.0.5, prettier@npm:~2.0.5":
|
"prettier@npm:^2.3.1":
|
||||||
|
version: 2.3.1
|
||||||
|
resolution: "prettier@npm:2.3.1"
|
||||||
|
bin:
|
||||||
|
prettier: bin-prettier.js
|
||||||
|
checksum: 9b4a695b87ce5f510fc20feec01cce7371f0fa0b92ffe79d543f6be52e2004c532861629de4d7ab1c577e1f649dce3cfccd62cb2ca6526b1da8d9c63eb84bf36
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"prettier@npm:~2.0.5":
|
||||||
version: 2.0.5
|
version: 2.0.5
|
||||||
resolution: "prettier@npm:2.0.5"
|
resolution: "prettier@npm:2.0.5"
|
||||||
bin:
|
bin:
|
||||||
|
@ -21265,7 +21274,7 @@ fsevents@^1.2.7:
|
||||||
html-webpack-plugin: ^4.3.0
|
html-webpack-plugin: ^4.3.0
|
||||||
jest: ^26.2.2
|
jest: ^26.2.2
|
||||||
lerna: ^3.22.1
|
lerna: ^3.22.1
|
||||||
prettier: ^2.0.5
|
prettier: ^2.3.1
|
||||||
raw-loader: ^4.0.1
|
raw-loader: ^4.0.1
|
||||||
rimraf: ^3.0.2
|
rimraf: ^3.0.2
|
||||||
style-loader: ^1.2.1
|
style-loader: ^1.2.1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user