mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-21 17:16:42 +03:00
chore(deps): update dependency prettier to v3 (#1434)
* chore(deps): update dependency prettier to v3 * Format --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Nathan Bierema <nbierema@gmail.com>
This commit is contained in:
parent
d73787b172
commit
922985f9ea
|
@ -52,7 +52,7 @@ const DevTools = createDevTools(
|
||||||
defaultIsVisible={true}
|
defaultIsVisible={true}
|
||||||
>
|
>
|
||||||
<LogMonitor theme="tomorrow" />
|
<LogMonitor theme="tomorrow" />
|
||||||
</DockMonitor>
|
</DockMonitor>,
|
||||||
);
|
);
|
||||||
|
|
||||||
export default DevTools;
|
export default DevTools;
|
||||||
|
@ -88,7 +88,7 @@ const enhancer = compose(
|
||||||
// Middleware you want to use in development:
|
// Middleware you want to use in development:
|
||||||
applyMiddleware(d1, d2, d3),
|
applyMiddleware(d1, d2, d3),
|
||||||
// Required! Enable Redux DevTools with the monitors you chose
|
// Required! Enable Redux DevTools with the monitors you chose
|
||||||
DevTools.instrument()
|
DevTools.instrument(),
|
||||||
);
|
);
|
||||||
|
|
||||||
export default function configureStore(initialState) {
|
export default function configureStore(initialState) {
|
||||||
|
@ -100,8 +100,8 @@ export default function configureStore(initialState) {
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
module.hot.accept('../reducers', () =>
|
module.hot.accept('../reducers', () =>
|
||||||
store.replaceReducer(
|
store.replaceReducer(
|
||||||
require('../reducers') /*.default if you use Babel 6+ */
|
require('../reducers') /*.default if you use Babel 6+ */,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ const enhancer = compose(
|
||||||
// Required! Enable Redux DevTools with the monitors you chose
|
// Required! Enable Redux DevTools with the monitors you chose
|
||||||
DevTools.instrument(),
|
DevTools.instrument(),
|
||||||
// Optional. Lets you write ?debug_session=<key> in address bar to persist debug sessions
|
// Optional. Lets you write ?debug_session=<key> in address bar to persist debug sessions
|
||||||
persistState(getDebugSessionKey())
|
persistState(getDebugSessionKey()),
|
||||||
);
|
);
|
||||||
|
|
||||||
function getDebugSessionKey() {
|
function getDebugSessionKey() {
|
||||||
|
@ -200,7 +200,7 @@ const enhancer = compose(
|
||||||
// Required! Enable Redux DevTools with the monitors you chose
|
// Required! Enable Redux DevTools with the monitors you chose
|
||||||
DevTools.instrument(),
|
DevTools.instrument(),
|
||||||
// Optional. Lets you write ?debug_session=<key> in address bar to persist debug sessions
|
// Optional. Lets you write ?debug_session=<key> in address bar to persist debug sessions
|
||||||
persistState(getDebugSessionKey())
|
persistState(getDebugSessionKey()),
|
||||||
);
|
);
|
||||||
|
|
||||||
function getDebugSessionKey() {
|
function getDebugSessionKey() {
|
||||||
|
@ -219,8 +219,8 @@ export default function configureStore(initialState) {
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
module.hot.accept('../reducers', () =>
|
module.hot.accept('../reducers', () =>
|
||||||
store.replaceReducer(
|
store.replaceReducer(
|
||||||
require('../reducers') /*.default if you use Babel 6+ */
|
require('../reducers') /*.default if you use Babel 6+ */,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<App />
|
<App />
|
||||||
</Provider>,
|
</Provider>,
|
||||||
document.getElementById('root')
|
document.getElementById('root'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
|
@ -353,7 +353,7 @@ export default function showDevTools(store) {
|
||||||
const popup = window.open(
|
const popup = window.open(
|
||||||
null,
|
null,
|
||||||
'Redux DevTools',
|
'Redux DevTools',
|
||||||
'menubar=no,location=no,resizable=yes,scrollbars=no,status=no'
|
'menubar=no,location=no,resizable=yes,scrollbars=no,status=no',
|
||||||
);
|
);
|
||||||
// Reload in case it already exists
|
// Reload in case it already exists
|
||||||
popup.location.reload();
|
popup.location.reload();
|
||||||
|
@ -362,7 +362,7 @@ export default function showDevTools(store) {
|
||||||
popup.document.write('<div id="react-devtools-root"></div>');
|
popup.document.write('<div id="react-devtools-root"></div>');
|
||||||
render(
|
render(
|
||||||
<DevTools store={store} />,
|
<DevTools store={store} />,
|
||||||
popup.document.getElementById('react-devtools-root')
|
popup.document.getElementById('react-devtools-root'),
|
||||||
);
|
);
|
||||||
}, 10);
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ const composeEnhancers =
|
||||||
: compose;
|
: compose;
|
||||||
|
|
||||||
const enhancer = composeEnhancers(
|
const enhancer = composeEnhancers(
|
||||||
applyMiddleware(...middleware)
|
applyMiddleware(...middleware),
|
||||||
// other store enhancers if any
|
// other store enhancers if any
|
||||||
);
|
);
|
||||||
const store = createStore(reducer, enhancer);
|
const store = createStore(reducer, enhancer);
|
||||||
|
@ -130,9 +130,9 @@ import { composeWithDevTools } from '@redux-devtools/extension';
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
reducer,
|
reducer,
|
||||||
composeWithDevTools(
|
composeWithDevTools(
|
||||||
applyMiddleware(...middleware)
|
applyMiddleware(...middleware),
|
||||||
// other store enhancers if any
|
// other store enhancers if any
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ const composeEnhancers = composeWithDevTools({
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
reducer,
|
reducer,
|
||||||
/* preloadedState, */ composeEnhancers(
|
/* preloadedState, */ composeEnhancers(
|
||||||
applyMiddleware(...middleware)
|
applyMiddleware(...middleware),
|
||||||
// other store enhancers if any
|
// other store enhancers if any
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ import { devToolsEnhancer } from '@redux-devtools/extension';
|
||||||
|
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
reducer,
|
reducer,
|
||||||
/* preloadedState, */ devToolsEnhancer()
|
/* preloadedState, */ devToolsEnhancer(),
|
||||||
// Specify name here, actionsDenylist, actionsCreators and other options if needed
|
// Specify name here, actionsDenylist, actionsCreators and other options if needed
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -181,7 +181,7 @@ import { devToolsEnhancerLogOnlyInProduction } from '@redux-devtools/extension';
|
||||||
|
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
reducer,
|
reducer,
|
||||||
/* preloadedState, */ devToolsEnhancerLogOnlyInProduction()
|
/* preloadedState, */ devToolsEnhancerLogOnlyInProduction(),
|
||||||
// options like actionSanitizer, stateSanitizer
|
// options like actionSanitizer, stateSanitizer
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -198,9 +198,9 @@ const composeEnhancers = composeWithDevToolsLogOnlyInProduction({
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
reducer,
|
reducer,
|
||||||
/* preloadedState, */ composeEnhancers(
|
/* preloadedState, */ composeEnhancers(
|
||||||
applyMiddleware(...middleware)
|
applyMiddleware(...middleware),
|
||||||
// other store enhancers if any
|
// other store enhancers if any
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ const composeEnhancers = composeWithDevTools(options);
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
reducer,
|
reducer,
|
||||||
/* preloadedState, */ composeEnhancers(
|
/* preloadedState, */ composeEnhancers(
|
||||||
applyMiddleware(...middleware)
|
applyMiddleware(...middleware),
|
||||||
// other store enhancers if any
|
// other store enhancers if any
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ _boolean_ or _object_ which contains:
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ _boolean_ or _object_ which contains:
|
||||||
replacer: (key, value) =>
|
replacer: (key, value) =>
|
||||||
value && mori.isMap(value) ? mori.toJs(value) : value,
|
value && mori.isMap(value) ? mori.toJs(value) : value,
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ _boolean_ or _object_ which contains:
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ _boolean_ or _object_ which contains:
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ _boolean_ or _object_ which contains:
|
||||||
immutable: Immutable,
|
immutable: Immutable,
|
||||||
refs: [ABRecord],
|
refs: [ABRecord],
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ In the example bellow it will always send `{ component: '[React]' }`, regardless
|
||||||
```js
|
```js
|
||||||
function component(
|
function component(
|
||||||
state = { component: null, toJSON: () => ({ component: '[React]' }) },
|
state = { component: null, toJSON: () => ({ component: '[React]' }) },
|
||||||
action
|
action,
|
||||||
) {
|
) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'ADD_COMPONENT':
|
case 'ADD_COMPONENT':
|
||||||
|
@ -206,7 +206,7 @@ function counter(
|
||||||
return { conter: this.count * 10 };
|
return { conter: this.count * 10 };
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
action
|
action,
|
||||||
) {
|
) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'INCREMENT':
|
case 'INCREMENT':
|
||||||
|
@ -236,7 +236,7 @@ const store = createStore(
|
||||||
actionSanitizer,
|
actionSanitizer,
|
||||||
stateSanitizer: (state) =>
|
stateSanitizer: (state) =>
|
||||||
state.data ? { ...state, data: '<<LONG_BLOB>>' } : state,
|
state.data ? { ...state, data: '<<LONG_BLOB>>' } : state,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ createStore(
|
||||||
actionsDenylist: 'SOME_ACTION',
|
actionsDenylist: 'SOME_ACTION',
|
||||||
// or actionsDenylist: ['SOME_ACTION', 'SOME_OTHER_ACTION']
|
// or actionsDenylist: ['SOME_ACTION', 'SOME_OTHER_ACTION']
|
||||||
// or just actionsDenylist: 'SOME_' to omit both
|
// or just actionsDenylist: 'SOME_' to omit both
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ const store = createStore(
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__({
|
window.__REDUX_DEVTOOLS_EXTENSION__({
|
||||||
predicate: (state, action) =>
|
predicate: (state, action) =>
|
||||||
state.dev.logLevel === VERBOSE && !action.forwarded,
|
state.dev.logLevel === VERBOSE && !action.forwarded,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import { inspectProps } from 'react-inspect-props';
|
||||||
|
|
||||||
compose(
|
compose(
|
||||||
withState('count', 'setCount', 0),
|
withState('count', 'setCount', 0),
|
||||||
inspectProps('Counter inspector')
|
inspectProps('Counter inspector'),
|
||||||
)(Counter);
|
)(Counter);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ run(App, {
|
||||||
{ id: newId(), num: 0 },
|
{ id: newId(), num: 0 },
|
||||||
{ id: newId(), num: 0 },
|
{ id: newId(), num: 0 },
|
||||||
],
|
],
|
||||||
})
|
}),
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
|
@ -28,7 +28,7 @@ type WindowWithDevTools = Window & {
|
||||||
};
|
};
|
||||||
|
|
||||||
const isReduxDevtoolsExtenstionExist = (
|
const isReduxDevtoolsExtenstionExist = (
|
||||||
arg: Window | WindowWithDevTools
|
arg: Window | WindowWithDevTools,
|
||||||
): arg is WindowWithDevTools => {
|
): arg is WindowWithDevTools => {
|
||||||
return '__REDUX_DEVTOOLS_EXTENSION__' in arg;
|
return '__REDUX_DEVTOOLS_EXTENSION__' in arg;
|
||||||
};
|
};
|
||||||
|
@ -40,7 +40,7 @@ const store = createStore(
|
||||||
initialState,
|
initialState,
|
||||||
isReduxDevtoolsExtenstionExist(window)
|
isReduxDevtoolsExtenstionExist(window)
|
||||||
? window.__REDUX_DEVTOOLS_EXTENSION__()
|
? window.__REDUX_DEVTOOLS_EXTENSION__()
|
||||||
: undefined
|
: undefined,
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ const store = createStore(
|
||||||
instaceID: 2,
|
instaceID: 2,
|
||||||
name: 'Allowlisted',
|
name: 'Allowlisted',
|
||||||
actionsAllowlist: '...',
|
actionsAllowlist: '...',
|
||||||
})
|
}),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
|
@ -35,8 +35,8 @@ const store = createStore(
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__
|
window.__REDUX_DEVTOOLS_EXTENSION__
|
||||||
? window.__REDUX_DEVTOOLS_EXTENSION__()
|
? window.__REDUX_DEVTOOLS_EXTENSION__()
|
||||||
: (noop) => noop,
|
: (noop) => noop,
|
||||||
batchedSubscribe(/* ... */)
|
batchedSubscribe(/* ... */),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ const store = createStore(
|
||||||
actionSanitizer,
|
actionSanitizer,
|
||||||
stateSanitizer: (state) =>
|
stateSanitizer: (state) =>
|
||||||
state.data ? { ...state, data: '<<LONG_BLOB>>' } : state,
|
state.data ? { ...state, data: '<<LONG_BLOB>>' } : state,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ const store = Redux.createStore(
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__ &&
|
window.__REDUX_DEVTOOLS_EXTENSION__ &&
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__({
|
window.__REDUX_DEVTOOLS_EXTENSION__({
|
||||||
serialize: true,
|
serialize: true,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Redux counter example</title>
|
<title>Redux counter example</title>
|
||||||
|
|
|
@ -10,5 +10,5 @@ render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<App />
|
<App />
|
||||||
</Provider>,
|
</Provider>,
|
||||||
document.getElementById('root')
|
document.getElementById('root'),
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,7 +11,7 @@ app.use(
|
||||||
webpackDevMiddleware(compiler, {
|
webpackDevMiddleware(compiler, {
|
||||||
noInfo: true,
|
noInfo: true,
|
||||||
publicPath: config.output.publicPath,
|
publicPath: config.output.publicPath,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
app.use(webpackHotMiddleware(compiler));
|
app.use(webpackHotMiddleware(compiler));
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ app.listen(port, function (error) {
|
||||||
console.info(
|
console.info(
|
||||||
'==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.',
|
'==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.',
|
||||||
port,
|
port,
|
||||||
port
|
port,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default function configureStore(preloadedState) {
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
reducer,
|
reducer,
|
||||||
preloadedState,
|
preloadedState,
|
||||||
composeEnhancers(applyMiddleware(invariant(), thunk))
|
composeEnhancers(applyMiddleware(invariant(), thunk)),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ function mockStore(getState, expectedActions, onLastAction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mockStoreWithMiddleware = applyMiddleware(...middlewares)(
|
const mockStoreWithMiddleware = applyMiddleware(...middlewares)(
|
||||||
mockStoreWithoutMiddleware
|
mockStoreWithoutMiddleware,
|
||||||
);
|
);
|
||||||
|
|
||||||
return mockStoreWithMiddleware();
|
return mockStoreWithMiddleware();
|
||||||
|
|
|
@ -11,7 +11,7 @@ function setup() {
|
||||||
decrement: expect.createSpy(),
|
decrement: expect.createSpy(),
|
||||||
};
|
};
|
||||||
const component = TestUtils.renderIntoDocument(
|
const component = TestUtils.renderIntoDocument(
|
||||||
<Counter counter={1} {...actions} />
|
<Counter counter={1} {...actions} />,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
component: component,
|
component: component,
|
||||||
|
|
|
@ -10,7 +10,7 @@ function setup(initialState) {
|
||||||
const app = TestUtils.renderIntoDocument(
|
const app = TestUtils.renderIntoDocument(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<App />
|
<App />
|
||||||
</Provider>
|
</Provider>,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
app: app,
|
app: app,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>React counter example</title>
|
<title>React counter example</title>
|
||||||
|
|
|
@ -69,7 +69,7 @@ class MainSection extends Component {
|
||||||
const filteredTodos = todos.filter(TODO_FILTERS[filter]);
|
const filteredTodos = todos.filter(TODO_FILTERS[filter]);
|
||||||
const completedCount = todos.reduce(
|
const completedCount = todos.reduce(
|
||||||
(count, todo) => (todo.completed ? count + 1 : count),
|
(count, todo) => (todo.completed ? count + 1 : count),
|
||||||
0
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Redux TodoMVC example</title>
|
<title>Redux TodoMVC example</title>
|
||||||
|
|
|
@ -12,5 +12,5 @@ render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<Root />
|
<Root />
|
||||||
</Provider>,
|
</Provider>,
|
||||||
document.getElementById('root')
|
document.getElementById('root'),
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,14 +34,14 @@ export default function todos(state = initialState, action) {
|
||||||
return state.map((todo) =>
|
return state.map((todo) =>
|
||||||
todo.id === action.id
|
todo.id === action.id
|
||||||
? Object.assign({}, todo, { text: action.text })
|
? Object.assign({}, todo, { text: action.text })
|
||||||
: todo
|
: todo,
|
||||||
);
|
);
|
||||||
|
|
||||||
case COMPLETE_TODO:
|
case COMPLETE_TODO:
|
||||||
return state.map((todo) =>
|
return state.map((todo) =>
|
||||||
todo.id === action.id
|
todo.id === action.id
|
||||||
? Object.assign({}, todo, { completed: !todo.completed })
|
? Object.assign({}, todo, { completed: !todo.completed })
|
||||||
: todo
|
: todo,
|
||||||
);
|
);
|
||||||
|
|
||||||
case COMPLETE_ALL:
|
case COMPLETE_ALL:
|
||||||
|
@ -49,7 +49,7 @@ export default function todos(state = initialState, action) {
|
||||||
return state.map((todo) =>
|
return state.map((todo) =>
|
||||||
Object.assign({}, todo, {
|
Object.assign({}, todo, {
|
||||||
completed: !areAllMarked,
|
completed: !areAllMarked,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
case CLEAR_COMPLETED:
|
case CLEAR_COMPLETED:
|
||||||
|
|
|
@ -11,7 +11,7 @@ app.use(
|
||||||
webpackDevMiddleware(compiler, {
|
webpackDevMiddleware(compiler, {
|
||||||
noInfo: true,
|
noInfo: true,
|
||||||
publicPath: config.output.publicPath,
|
publicPath: config.output.publicPath,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
app.use(webpackHotMiddleware(compiler));
|
app.use(webpackHotMiddleware(compiler));
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ app.listen(port, function (error) {
|
||||||
console.info(
|
console.info(
|
||||||
'==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.',
|
'==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.',
|
||||||
port,
|
port,
|
||||||
port
|
port,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ import rootReducer from '../reducers';
|
||||||
export default function configureStore(initialState) {
|
export default function configureStore(initialState) {
|
||||||
let finalCreateStore = compose(
|
let finalCreateStore = compose(
|
||||||
reduxReactRouter({ createHistory }),
|
reduxReactRouter({ createHistory }),
|
||||||
global.devToolsExtension ? global.devToolsExtension() : (f) => f
|
global.devToolsExtension ? global.devToolsExtension() : (f) => f,
|
||||||
)(createStore);
|
)(createStore);
|
||||||
|
|
||||||
const store = finalCreateStore(rootReducer, initialState);
|
const store = finalCreateStore(rootReducer, initialState);
|
||||||
|
|
|
@ -13,7 +13,7 @@ function setup(propOverrides) {
|
||||||
onClearCompleted: expect.createSpy(),
|
onClearCompleted: expect.createSpy(),
|
||||||
onShow: expect.createSpy(),
|
onShow: expect.createSpy(),
|
||||||
},
|
},
|
||||||
propOverrides
|
propOverrides,
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderer = TestUtils.createRenderer();
|
const renderer = TestUtils.createRenderer();
|
||||||
|
@ -72,7 +72,7 @@ describe('components', () => {
|
||||||
0: 'All',
|
0: 'All',
|
||||||
1: 'Active',
|
1: 'Active',
|
||||||
2: 'Completed',
|
2: 'Completed',
|
||||||
}[i]
|
}[i],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,7 +29,7 @@ function setup(propOverrides) {
|
||||||
clearCompleted: expect.createSpy(),
|
clearCompleted: expect.createSpy(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
propOverrides
|
propOverrides,
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderer = TestUtils.createRenderer();
|
const renderer = TestUtils.createRenderer();
|
||||||
|
|
|
@ -12,7 +12,7 @@ function setup(propOverrides) {
|
||||||
editing: false,
|
editing: false,
|
||||||
newTodo: false,
|
newTodo: false,
|
||||||
},
|
},
|
||||||
propOverrides
|
propOverrides,
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderer = TestUtils.createRenderer();
|
const renderer = TestUtils.createRenderer();
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe('todos reducer', () => {
|
||||||
todos([], {
|
todos([], {
|
||||||
type: types.ADD_TODO,
|
type: types.ADD_TODO,
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
})
|
}),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -39,8 +39,8 @@ describe('todos reducer', () => {
|
||||||
{
|
{
|
||||||
type: types.ADD_TODO,
|
type: types.ADD_TODO,
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -71,8 +71,8 @@ describe('todos reducer', () => {
|
||||||
{
|
{
|
||||||
type: types.ADD_TODO,
|
type: types.ADD_TODO,
|
||||||
text: 'Fix the tests',
|
text: 'Fix the tests',
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Fix the tests',
|
text: 'Fix the tests',
|
||||||
|
@ -110,8 +110,8 @@ describe('todos reducer', () => {
|
||||||
{
|
{
|
||||||
type: types.DELETE_TODO,
|
type: types.DELETE_TODO,
|
||||||
id: 1,
|
id: 1,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Use Redux',
|
text: 'Use Redux',
|
||||||
|
@ -140,8 +140,8 @@ describe('todos reducer', () => {
|
||||||
type: types.EDIT_TODO,
|
type: types.EDIT_TODO,
|
||||||
text: 'Fix the tests',
|
text: 'Fix the tests',
|
||||||
id: 1,
|
id: 1,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Fix the tests',
|
text: 'Fix the tests',
|
||||||
|
@ -174,8 +174,8 @@ describe('todos reducer', () => {
|
||||||
{
|
{
|
||||||
type: types.COMPLETE_TODO,
|
type: types.COMPLETE_TODO,
|
||||||
id: 1,
|
id: 1,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -207,8 +207,8 @@ describe('todos reducer', () => {
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
type: types.COMPLETE_ALL,
|
type: types.COMPLETE_ALL,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -239,8 +239,8 @@ describe('todos reducer', () => {
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
type: types.COMPLETE_ALL,
|
type: types.COMPLETE_ALL,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -272,8 +272,8 @@ describe('todos reducer', () => {
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
type: types.CLEAR_COMPLETED,
|
type: types.CLEAR_COMPLETED,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Use Redux',
|
text: 'Use Redux',
|
||||||
|
@ -308,7 +308,7 @@ describe('todos reducer', () => {
|
||||||
completed: false,
|
completed: false,
|
||||||
text: 'Write tests',
|
text: 'Write tests',
|
||||||
},
|
},
|
||||||
])
|
]),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Write more tests',
|
text: 'Write more tests',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
|
|
@ -20,7 +20,7 @@ const composeEnhancers =
|
||||||
compose;
|
compose;
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
reducer,
|
reducer,
|
||||||
composeEnhancers(applyMiddleware(sagaMiddleware))
|
composeEnhancers(applyMiddleware(sagaMiddleware)),
|
||||||
);
|
);
|
||||||
sagaMiddleware.run(rootSaga);
|
sagaMiddleware.run(rootSaga);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ function render() {
|
||||||
onIncrementIfOdd={() => action('INCREMENT_IF_ODD')}
|
onIncrementIfOdd={() => action('INCREMENT_IF_ODD')}
|
||||||
onIncrementAsync={() => action('INCREMENT_ASYNC')}
|
onIncrementAsync={() => action('INCREMENT_ASYNC')}
|
||||||
/>,
|
/>,
|
||||||
document.getElementById('root')
|
document.getElementById('root'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ class MainSection extends Component {
|
||||||
const filteredTodos = todos.filter(TODO_FILTERS[filter]);
|
const filteredTodos = todos.filter(TODO_FILTERS[filter]);
|
||||||
const completedCount = todos.reduce(
|
const completedCount = todos.reduce(
|
||||||
(count, todo) => (todo.completed ? count + 1 : count),
|
(count, todo) => (todo.completed ? count + 1 : count),
|
||||||
0
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Redux TodoMVC example</title>
|
<title>Redux TodoMVC example</title>
|
||||||
|
|
|
@ -12,5 +12,5 @@ render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<App />
|
<App />
|
||||||
</Provider>,
|
</Provider>,
|
||||||
document.getElementById('root')
|
document.getElementById('root'),
|
||||||
);
|
);
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default function todos(state = initialState, action) {
|
||||||
return state.map((todo) =>
|
return state.map((todo) =>
|
||||||
todo.id === action.id
|
todo.id === action.id
|
||||||
? Object.assign({}, todo, { text: action.text, modified: new Date() })
|
? Object.assign({}, todo, { text: action.text, modified: new Date() })
|
||||||
: todo
|
: todo,
|
||||||
);
|
);
|
||||||
|
|
||||||
case COMPLETE_TODO:
|
case COMPLETE_TODO:
|
||||||
|
@ -46,7 +46,7 @@ export default function todos(state = initialState, action) {
|
||||||
completed: !todo.completed,
|
completed: !todo.completed,
|
||||||
modified: new Date(),
|
modified: new Date(),
|
||||||
})
|
})
|
||||||
: todo
|
: todo,
|
||||||
);
|
);
|
||||||
|
|
||||||
case COMPLETE_ALL:
|
case COMPLETE_ALL:
|
||||||
|
@ -55,7 +55,7 @@ export default function todos(state = initialState, action) {
|
||||||
Object.assign({}, todo, {
|
Object.assign({}, todo, {
|
||||||
completed: !areAllMarked,
|
completed: !areAllMarked,
|
||||||
modified: new Date(),
|
modified: new Date(),
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
case CLEAR_COMPLETED:
|
case CLEAR_COMPLETED:
|
||||||
|
|
|
@ -11,7 +11,7 @@ app.use(
|
||||||
webpackDevMiddleware(compiler, {
|
webpackDevMiddleware(compiler, {
|
||||||
noInfo: true,
|
noInfo: true,
|
||||||
publicPath: config.output.publicPath,
|
publicPath: config.output.publicPath,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
app.use(webpackHotMiddleware(compiler));
|
app.use(webpackHotMiddleware(compiler));
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ app.listen(port, function (error) {
|
||||||
console.info(
|
console.info(
|
||||||
'==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.',
|
'==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.',
|
||||||
port,
|
port,
|
||||||
port
|
port,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default function configureStore(preloadedState) {
|
||||||
if (!enhancer) {
|
if (!enhancer) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'Install Redux DevTools Extension to inspect the app state: ' +
|
'Install Redux DevTools Extension to inspect the app state: ' +
|
||||||
'https://github.com/zalmoxisus/redux-devtools-extension#installation'
|
'https://github.com/zalmoxisus/redux-devtools-extension#installation',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ function setup(propOverrides) {
|
||||||
onClearCompleted: expect.createSpy(),
|
onClearCompleted: expect.createSpy(),
|
||||||
onShow: expect.createSpy(),
|
onShow: expect.createSpy(),
|
||||||
},
|
},
|
||||||
propOverrides
|
propOverrides,
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderer = TestUtils.createRenderer();
|
const renderer = TestUtils.createRenderer();
|
||||||
|
@ -72,7 +72,7 @@ describe('components', () => {
|
||||||
0: 'All',
|
0: 'All',
|
||||||
1: 'Active',
|
1: 'Active',
|
||||||
2: 'Completed',
|
2: 'Completed',
|
||||||
}[i]
|
}[i],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,7 +29,7 @@ function setup(propOverrides) {
|
||||||
clearCompleted: expect.createSpy(),
|
clearCompleted: expect.createSpy(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
propOverrides
|
propOverrides,
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderer = TestUtils.createRenderer();
|
const renderer = TestUtils.createRenderer();
|
||||||
|
|
|
@ -12,7 +12,7 @@ function setup(propOverrides) {
|
||||||
editing: false,
|
editing: false,
|
||||||
newTodo: false,
|
newTodo: false,
|
||||||
},
|
},
|
||||||
propOverrides
|
propOverrides,
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderer = TestUtils.createRenderer();
|
const renderer = TestUtils.createRenderer();
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe('todos reducer', () => {
|
||||||
todos([], {
|
todos([], {
|
||||||
type: types.ADD_TODO,
|
type: types.ADD_TODO,
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
})
|
}),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -39,8 +39,8 @@ describe('todos reducer', () => {
|
||||||
{
|
{
|
||||||
type: types.ADD_TODO,
|
type: types.ADD_TODO,
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -71,8 +71,8 @@ describe('todos reducer', () => {
|
||||||
{
|
{
|
||||||
type: types.ADD_TODO,
|
type: types.ADD_TODO,
|
||||||
text: 'Fix the tests',
|
text: 'Fix the tests',
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Fix the tests',
|
text: 'Fix the tests',
|
||||||
|
@ -110,8 +110,8 @@ describe('todos reducer', () => {
|
||||||
{
|
{
|
||||||
type: types.DELETE_TODO,
|
type: types.DELETE_TODO,
|
||||||
id: 1,
|
id: 1,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Use Redux',
|
text: 'Use Redux',
|
||||||
|
@ -140,8 +140,8 @@ describe('todos reducer', () => {
|
||||||
type: types.EDIT_TODO,
|
type: types.EDIT_TODO,
|
||||||
text: 'Fix the tests',
|
text: 'Fix the tests',
|
||||||
id: 1,
|
id: 1,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Fix the tests',
|
text: 'Fix the tests',
|
||||||
|
@ -174,8 +174,8 @@ describe('todos reducer', () => {
|
||||||
{
|
{
|
||||||
type: types.COMPLETE_TODO,
|
type: types.COMPLETE_TODO,
|
||||||
id: 1,
|
id: 1,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -207,8 +207,8 @@ describe('todos reducer', () => {
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
type: types.COMPLETE_ALL,
|
type: types.COMPLETE_ALL,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -239,8 +239,8 @@ describe('todos reducer', () => {
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
type: types.COMPLETE_ALL,
|
type: types.COMPLETE_ALL,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Run the tests',
|
text: 'Run the tests',
|
||||||
|
@ -272,8 +272,8 @@ describe('todos reducer', () => {
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
type: types.CLEAR_COMPLETED,
|
type: types.CLEAR_COMPLETED,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Use Redux',
|
text: 'Use Redux',
|
||||||
|
@ -308,7 +308,7 @@ describe('todos reducer', () => {
|
||||||
completed: false,
|
completed: false,
|
||||||
text: 'Write tests',
|
text: 'Write tests',
|
||||||
},
|
},
|
||||||
])
|
]),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
text: 'Write more tests',
|
text: 'Write more tests',
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { LIFTED_ACTION } from '@redux-devtools/app';
|
||||||
export function getReport(
|
export function getReport(
|
||||||
reportId: string,
|
reportId: string,
|
||||||
tabId: string | number,
|
tabId: string | number,
|
||||||
instanceId: number
|
instanceId: number,
|
||||||
) {
|
) {
|
||||||
chrome.storage.local.get(['s:hostname', 's:port', 's:secure'], (options) => {
|
chrome.storage.local.get(['s:hostname', 's:port', 's:secure'], (options) => {
|
||||||
if (!options['s:hostname'] || !options['s:port']) return;
|
if (!options['s:hostname'] || !options['s:port']) return;
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default function openDevToolsWindow(position: DevToolsPosition) {
|
||||||
function popWindow(
|
function popWindow(
|
||||||
action: string,
|
action: string,
|
||||||
url: string,
|
url: string,
|
||||||
customOptions: chrome.windows.CreateData & chrome.windows.UpdateInfo
|
customOptions: chrome.windows.CreateData & chrome.windows.UpdateInfo,
|
||||||
) {
|
) {
|
||||||
function focusIfExist(callback: () => void) {
|
function focusIfExist(callback: () => void) {
|
||||||
if (!windows[position]) {
|
if (!windows[position]) {
|
||||||
|
@ -37,7 +37,7 @@ export default function openDevToolsWindow(position: DevToolsPosition) {
|
||||||
};
|
};
|
||||||
if (action === 'open') {
|
if (action === 'open') {
|
||||||
options.url = chrome.extension.getURL(
|
options.url = chrome.extension.getURL(
|
||||||
url + '#' + position.substr(position.indexOf('-') + 1)
|
url + '#' + position.substr(position.indexOf('-') + 1),
|
||||||
);
|
);
|
||||||
chrome.windows.create(options, (win) => {
|
chrome.windows.create(options, (win) => {
|
||||||
windows[position] = win!.id;
|
windows[position] = win!.id;
|
||||||
|
|
|
@ -193,7 +193,7 @@ type TabPort = Omit<chrome.runtime.Port, 'postMessage'> & {
|
||||||
};
|
};
|
||||||
type PanelPort = Omit<chrome.runtime.Port, 'postMessage'> & {
|
type PanelPort = Omit<chrome.runtime.Port, 'postMessage'> & {
|
||||||
postMessage: <S, A extends Action<unknown>>(
|
postMessage: <S, A extends Action<unknown>>(
|
||||||
message: PanelMessage<S, A>
|
message: PanelMessage<S, A>,
|
||||||
) => void;
|
) => void;
|
||||||
};
|
};
|
||||||
type MonitorPort = Omit<chrome.runtime.Port, 'postMessage'> & {
|
type MonitorPort = Omit<chrome.runtime.Port, 'postMessage'> & {
|
||||||
|
@ -232,13 +232,13 @@ type MonitorAction<S, A extends Action<unknown>> =
|
||||||
function toMonitors<S, A extends Action<unknown>>(
|
function toMonitors<S, A extends Action<unknown>>(
|
||||||
action: MonitorAction<S, A>,
|
action: MonitorAction<S, A>,
|
||||||
tabId?: string | number,
|
tabId?: string | number,
|
||||||
verbose?: boolean
|
verbose?: boolean,
|
||||||
) {
|
) {
|
||||||
Object.keys(connections.monitor).forEach((id) => {
|
Object.keys(connections.monitor).forEach((id) => {
|
||||||
connections.monitor[id].postMessage(
|
connections.monitor[id].postMessage(
|
||||||
verbose || action.type === 'ERROR' || action.type === SET_PERSIST
|
verbose || action.type === 'ERROR' || action.type === SET_PERSIST
|
||||||
? action
|
? action
|
||||||
: { type: UPDATE_STATE }
|
: { type: UPDATE_STATE },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
Object.keys(connections.panel).forEach((id) => {
|
Object.keys(connections.panel).forEach((id) => {
|
||||||
|
@ -267,7 +267,7 @@ function toContentScript(messageBody: ToContentScriptMessage) {
|
||||||
message,
|
message,
|
||||||
instanceId,
|
instanceId,
|
||||||
action as AppDispatchAction,
|
action as AppDispatchAction,
|
||||||
state
|
state,
|
||||||
),
|
),
|
||||||
id: instanceId.toString().replace(/^[^\/]+\//, ''),
|
id: instanceId.toString().replace(/^[^\/]+\//, ''),
|
||||||
});
|
});
|
||||||
|
@ -281,7 +281,7 @@ function toContentScript(messageBody: ToContentScriptMessage) {
|
||||||
message,
|
message,
|
||||||
instanceId,
|
instanceId,
|
||||||
action as unknown as AppDispatchAction,
|
action as unknown as AppDispatchAction,
|
||||||
state
|
state,
|
||||||
),
|
),
|
||||||
id: instanceId.toString().replace(/^[^\/]+\//, ''),
|
id: instanceId.toString().replace(/^[^\/]+\//, ''),
|
||||||
});
|
});
|
||||||
|
@ -295,7 +295,7 @@ function toContentScript(messageBody: ToContentScriptMessage) {
|
||||||
message,
|
message,
|
||||||
instanceId,
|
instanceId,
|
||||||
action as unknown as AppDispatchAction,
|
action as unknown as AppDispatchAction,
|
||||||
state
|
state,
|
||||||
),
|
),
|
||||||
id: instanceId.toString().replace(/^[^\/]+\//, ''),
|
id: instanceId.toString().replace(/^[^\/]+\//, ''),
|
||||||
});
|
});
|
||||||
|
@ -309,7 +309,7 @@ function toContentScript(messageBody: ToContentScriptMessage) {
|
||||||
message,
|
message,
|
||||||
instanceId,
|
instanceId,
|
||||||
action as unknown as AppDispatchAction,
|
action as unknown as AppDispatchAction,
|
||||||
state
|
state,
|
||||||
),
|
),
|
||||||
id: instanceId.toString().replace(/^[^\/]+\//, ''),
|
id: instanceId.toString().replace(/^[^\/]+\//, ''),
|
||||||
});
|
});
|
||||||
|
@ -323,7 +323,7 @@ function toContentScript(messageBody: ToContentScriptMessage) {
|
||||||
message,
|
message,
|
||||||
instanceId,
|
instanceId,
|
||||||
action as AppDispatchAction,
|
action as AppDispatchAction,
|
||||||
state
|
state,
|
||||||
),
|
),
|
||||||
id: (instanceId as number).toString().replace(/^[^\/]+\//, ''),
|
id: (instanceId as number).toString().replace(/^[^\/]+\//, ''),
|
||||||
});
|
});
|
||||||
|
@ -397,7 +397,7 @@ type BackgroundStoreResponse = { readonly options: Options };
|
||||||
function messaging<S, A extends Action<unknown>>(
|
function messaging<S, A extends Action<unknown>>(
|
||||||
request: BackgroundStoreMessage<S, A>,
|
request: BackgroundStoreMessage<S, A>,
|
||||||
sender: chrome.runtime.MessageSender,
|
sender: chrome.runtime.MessageSender,
|
||||||
sendResponse?: (response?: BackgroundStoreResponse) => void
|
sendResponse?: (response?: BackgroundStoreResponse) => void,
|
||||||
) {
|
) {
|
||||||
let tabId = getId(sender);
|
let tabId = getId(sender);
|
||||||
if (!tabId) return;
|
if (!tabId) return;
|
||||||
|
@ -427,7 +427,7 @@ function messaging<S, A extends Action<unknown>>(
|
||||||
let position: DevToolsPosition = 'devtools-left';
|
let position: DevToolsPosition = 'devtools-left';
|
||||||
if (
|
if (
|
||||||
['remote', 'panel', 'left', 'right', 'bottom'].indexOf(
|
['remote', 'panel', 'left', 'right', 'bottom'].indexOf(
|
||||||
request.position
|
request.position,
|
||||||
) !== -1
|
) !== -1
|
||||||
) {
|
) {
|
||||||
position = ('devtools-' + request.position) as DevToolsPosition;
|
position = ('devtools-' + request.position) as DevToolsPosition;
|
||||||
|
@ -489,7 +489,7 @@ function messaging<S, A extends Action<unknown>>(
|
||||||
function disconnect(
|
function disconnect(
|
||||||
type: 'tab' | 'monitor' | 'panel',
|
type: 'tab' | 'monitor' | 'panel',
|
||||||
id: number | string,
|
id: number | string,
|
||||||
listener?: (message: any, port: chrome.runtime.Port) => void
|
listener?: (message: any, port: chrome.runtime.Port) => void,
|
||||||
) {
|
) {
|
||||||
return function disconnectListener() {
|
return function disconnectListener() {
|
||||||
const p = connections[type][id];
|
const p = connections[type][id];
|
||||||
|
@ -537,7 +537,7 @@ function onConnect<S, A extends Action<unknown>>(port: chrome.runtime.Port) {
|
||||||
instanceId,
|
instanceId,
|
||||||
state: stringifyJSON(
|
state: stringifyJSON(
|
||||||
persistedState,
|
persistedState,
|
||||||
state.instances.options[instanceId].serialize
|
state.instances.options[instanceId].serialize,
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -588,7 +588,7 @@ declare global {
|
||||||
window.syncOptions = syncOptions(toAllTabs); // Expose to the options page
|
window.syncOptions = syncOptions(toAllTabs); // Expose to the options page
|
||||||
|
|
||||||
export default function api(
|
export default function api(
|
||||||
store: MiddlewareAPI<Dispatch<BackgroundAction>, BackgroundState>
|
store: MiddlewareAPI<Dispatch<BackgroundAction>, BackgroundState>,
|
||||||
) {
|
) {
|
||||||
return (next: Dispatch<BackgroundAction>) => (action: BackgroundAction) => {
|
return (next: Dispatch<BackgroundAction>) => (action: BackgroundAction) => {
|
||||||
if (action.type === LIFTED_ACTION) toContentScript(action);
|
if (action.type === LIFTED_ACTION) toContentScript(action);
|
||||||
|
|
|
@ -60,7 +60,7 @@ export type BackgroundAction =
|
||||||
| DisconnectedAction;
|
| DisconnectedAction;
|
||||||
|
|
||||||
export default function configureStore(
|
export default function configureStore(
|
||||||
preloadedState?: PreloadedState<BackgroundState>
|
preloadedState?: PreloadedState<BackgroundState>,
|
||||||
) {
|
) {
|
||||||
return createStore(rootReducer, preloadedState, applyMiddleware(api));
|
return createStore(rootReducer, preloadedState, applyMiddleware(api));
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -205,9 +205,11 @@ export type SplitMessage =
|
||||||
|
|
||||||
function tryCatch<S, A extends Action<unknown>>(
|
function tryCatch<S, A extends Action<unknown>>(
|
||||||
fn: (
|
fn: (
|
||||||
args: PageScriptToContentScriptMessageWithoutDisconnect<S, A> | SplitMessage
|
args:
|
||||||
|
| PageScriptToContentScriptMessageWithoutDisconnect<S, A>
|
||||||
|
| SplitMessage,
|
||||||
) => void,
|
) => void,
|
||||||
args: PageScriptToContentScriptMessageWithoutDisconnect<S, A>
|
args: PageScriptToContentScriptMessageWithoutDisconnect<S, A>,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
return fn(args);
|
return fn(args);
|
||||||
|
@ -273,7 +275,7 @@ export type ContentScriptToBackgroundMessage<S, A extends Action<unknown>> =
|
||||||
| RelayMessage<S, A>;
|
| RelayMessage<S, A>;
|
||||||
|
|
||||||
function postToBackground<S, A extends Action<unknown>>(
|
function postToBackground<S, A extends Action<unknown>>(
|
||||||
message: ContentScriptToBackgroundMessage<S, A>
|
message: ContentScriptToBackgroundMessage<S, A>,
|
||||||
) {
|
) {
|
||||||
bg!.postMessage(message);
|
bg!.postMessage(message);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +283,7 @@ function postToBackground<S, A extends Action<unknown>>(
|
||||||
function send<S, A extends Action<unknown>>(
|
function send<S, A extends Action<unknown>>(
|
||||||
message:
|
message:
|
||||||
| PageScriptToContentScriptMessageWithoutDisconnect<S, A>
|
| PageScriptToContentScriptMessageWithoutDisconnect<S, A>
|
||||||
| SplitMessage
|
| SplitMessage,
|
||||||
) {
|
) {
|
||||||
if (!connected) connect();
|
if (!connected) connect();
|
||||||
if (message.type === 'INIT_INSTANCE') {
|
if (message.type === 'INIT_INSTANCE') {
|
||||||
|
@ -294,7 +296,7 @@ function send<S, A extends Action<unknown>>(
|
||||||
|
|
||||||
// Resend messages from the page to the background script
|
// Resend messages from the page to the background script
|
||||||
function handleMessages<S, A extends Action<unknown>>(
|
function handleMessages<S, A extends Action<unknown>>(
|
||||||
event: MessageEvent<PageScriptToContentScriptMessage<S, A>>
|
event: MessageEvent<PageScriptToContentScriptMessage<S, A>>,
|
||||||
) {
|
) {
|
||||||
if (!isAllowed()) return;
|
if (!isAllowed()) return;
|
||||||
if (!event || event.source !== window || typeof event.data !== 'object') {
|
if (!event || event.source !== window || typeof event.data !== 'object') {
|
||||||
|
|
|
@ -42,7 +42,7 @@ function renderDevTools() {
|
||||||
<PersistGate loading={null} persistor={persistor}>
|
<PersistGate loading={null} persistor={persistor}>
|
||||||
<App position={position} />
|
<App position={position} />
|
||||||
</PersistGate>
|
</PersistGate>
|
||||||
</Provider>
|
</Provider>,
|
||||||
);
|
);
|
||||||
rendered = true;
|
rendered = true;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ function init(id: number) {
|
||||||
if (!rendered) renderDevTools();
|
if (!rendered) renderDevTools();
|
||||||
store!.dispatch(message);
|
store!.dispatch(message);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@ const persistedReducer: Reducer<StoreStateWithoutSocket, StoreAction> =
|
||||||
|
|
||||||
export default function configureStore(
|
export default function configureStore(
|
||||||
position: string,
|
position: string,
|
||||||
bgConnection: chrome.runtime.Port
|
bgConnection: chrome.runtime.Port,
|
||||||
) {
|
) {
|
||||||
const enhancer = applyMiddleware(
|
const enhancer = applyMiddleware(
|
||||||
exportStateMiddleware,
|
exportStateMiddleware,
|
||||||
panelDispatcher(bgConnection)
|
panelDispatcher(bgConnection),
|
||||||
);
|
);
|
||||||
const store = createStore(persistedReducer, enhancer);
|
const store = createStore(persistedReducer, enhancer);
|
||||||
const persistor = persistStore(store);
|
const persistor = persistStore(store);
|
||||||
|
|
|
@ -5,7 +5,7 @@ function createPanel(url: string) {
|
||||||
'Redux',
|
'Redux',
|
||||||
'img/logo/scalable.png',
|
'img/logo/scalable.png',
|
||||||
url,
|
url,
|
||||||
function () {}
|
function () {},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ export interface OptionsProps {
|
||||||
readonly options: Options;
|
readonly options: Options;
|
||||||
readonly saveOption: <K extends keyof Options>(
|
readonly saveOption: <K extends keyof Options>(
|
||||||
name: K,
|
name: K,
|
||||||
value: Options[K]
|
value: Options[K],
|
||||||
) => void;
|
) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ const get = (callback: (options: Options) => void) => {
|
||||||
function (items) {
|
function (items) {
|
||||||
options = migrateOldOptions(items as OldOrNewOptions);
|
options = migrateOldOptions(items as OldOrNewOptions);
|
||||||
callback(options);
|
callback(options);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -125,8 +125,8 @@ export const injectOptions = (newOptions: Options) => {
|
||||||
document.createTextNode(
|
document.createTextNode(
|
||||||
'window.devToolsOptions = Object.assign(window.devToolsOptions||{},' +
|
'window.devToolsOptions = Object.assign(window.devToolsOptions||{},' +
|
||||||
JSON.stringify(options) +
|
JSON.stringify(options) +
|
||||||
');'
|
');',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
(document.head || document.documentElement).appendChild(s);
|
(document.head || document.documentElement).appendChild(s);
|
||||||
s.parentNode!.removeChild(s);
|
s.parentNode!.removeChild(s);
|
||||||
|
|
|
@ -11,7 +11,7 @@ declare global {
|
||||||
export default class Monitor<S, A extends Action<unknown>> {
|
export default class Monitor<S, A extends Action<unknown>> {
|
||||||
update: (
|
update: (
|
||||||
liftedState?: LiftedState<S, A, unknown> | undefined,
|
liftedState?: LiftedState<S, A, unknown> | undefined,
|
||||||
libConfig?: LibConfig
|
libConfig?: LibConfig,
|
||||||
) => void;
|
) => void;
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
paused?: boolean;
|
paused?: boolean;
|
||||||
|
@ -21,8 +21,8 @@ export default class Monitor<S, A extends Action<unknown>> {
|
||||||
constructor(
|
constructor(
|
||||||
update: (
|
update: (
|
||||||
liftedState?: LiftedState<S, A, unknown> | undefined,
|
liftedState?: LiftedState<S, A, unknown> | undefined,
|
||||||
libConfig?: LibConfig
|
libConfig?: LibConfig,
|
||||||
) => void
|
) => void,
|
||||||
) {
|
) {
|
||||||
this.update = update;
|
this.update = update;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ export const noFiltersApplied = (localFilter: LocalFilter | undefined) =>
|
||||||
|
|
||||||
export function isFiltered<A extends Action<unknown>>(
|
export function isFiltered<A extends Action<unknown>>(
|
||||||
action: A | string,
|
action: A | string,
|
||||||
localFilter: LocalFilter | undefined
|
localFilter: LocalFilter | undefined,
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
noFiltersApplied(localFilter) ||
|
noFiltersApplied(localFilter) ||
|
||||||
|
@ -43,7 +43,7 @@ export function isFiltered<A extends Action<unknown>>(
|
||||||
|
|
||||||
function filterActions<A extends Action<unknown>>(
|
function filterActions<A extends Action<unknown>>(
|
||||||
actionsById: { [p: number]: PerformAction<A> },
|
actionsById: { [p: number]: PerformAction<A> },
|
||||||
actionSanitizer: ((action: A, id: number) => A) | undefined
|
actionSanitizer: ((action: A, id: number) => A) | undefined,
|
||||||
): { [p: number]: PerformAction<A> } {
|
): { [p: number]: PerformAction<A> } {
|
||||||
if (!actionSanitizer) return actionsById;
|
if (!actionSanitizer) return actionsById;
|
||||||
return mapValues(actionsById, (action, id) => ({
|
return mapValues(actionsById, (action, id) => ({
|
||||||
|
@ -54,7 +54,7 @@ function filterActions<A extends Action<unknown>>(
|
||||||
|
|
||||||
function filterStates<S>(
|
function filterStates<S>(
|
||||||
computedStates: { state: S; error?: string | undefined }[],
|
computedStates: { state: S; error?: string | undefined }[],
|
||||||
stateSanitizer: ((state: S, index: number) => S) | undefined
|
stateSanitizer: ((state: S, index: number) => S) | undefined,
|
||||||
) {
|
) {
|
||||||
if (!stateSanitizer) return computedStates;
|
if (!stateSanitizer) return computedStates;
|
||||||
return computedStates.map((state, idx) => ({
|
return computedStates.map((state, idx) => ({
|
||||||
|
@ -68,7 +68,7 @@ export function filterState<S, A extends Action<unknown>>(
|
||||||
localFilter: LocalFilter | undefined,
|
localFilter: LocalFilter | undefined,
|
||||||
stateSanitizer: ((state: S, index: number) => S) | undefined,
|
stateSanitizer: ((state: S, index: number) => S) | undefined,
|
||||||
actionSanitizer: ((action: A, id: number) => A) | undefined,
|
actionSanitizer: ((action: A, id: number) => A) | undefined,
|
||||||
predicate: ((state: S, action: A) => boolean) | undefined
|
predicate: ((state: S, action: A) => boolean) | undefined,
|
||||||
): LiftedState<S, A, unknown> {
|
): LiftedState<S, A, unknown> {
|
||||||
if (predicate || !noFiltersApplied(localFilter)) {
|
if (predicate || !noFiltersApplied(localFilter)) {
|
||||||
const filteredStagedActionIds: number[] = [];
|
const filteredStagedActionIds: number[] = [];
|
||||||
|
@ -94,7 +94,7 @@ export function filterState<S, A extends Action<unknown>>(
|
||||||
filteredComputedStates.push(
|
filteredComputedStates.push(
|
||||||
stateSanitizer
|
stateSanitizer
|
||||||
? { ...liftedState, state: stateSanitizer(currState, idx) }
|
? { ...liftedState, state: stateSanitizer(currState, idx) }
|
||||||
: liftedState
|
: liftedState,
|
||||||
);
|
);
|
||||||
if (actionSanitizer) {
|
if (actionSanitizer) {
|
||||||
sanitizedActionsById![id] = {
|
sanitizedActionsById![id] = {
|
||||||
|
@ -139,7 +139,7 @@ export function startingFrom<S, A extends Action<unknown>>(
|
||||||
| undefined,
|
| undefined,
|
||||||
predicate:
|
predicate:
|
||||||
| (<S, A extends Action<unknown>>(state: S, action: A) => boolean)
|
| (<S, A extends Action<unknown>>(state: S, action: A) => boolean)
|
||||||
| undefined
|
| undefined,
|
||||||
): LiftedState<S, A, unknown> | PartialLiftedState<S, A> | undefined {
|
): LiftedState<S, A, unknown> | PartialLiftedState<S, A> | undefined {
|
||||||
const stagedActionIds = state.stagedActionIds;
|
const stagedActionIds = state.stagedActionIds;
|
||||||
if (sendingActionId <= stagedActionIds[1]) return state;
|
if (sendingActionId <= stagedActionIds[1]) return state;
|
||||||
|
@ -178,7 +178,7 @@ export function startingFrom<S, A extends Action<unknown>>(
|
||||||
newComputedStates.push(
|
newComputedStates.push(
|
||||||
!stateSanitizer
|
!stateSanitizer
|
||||||
? currState
|
? currState
|
||||||
: { ...currState, state: stateSanitizer(currState.state, i) }
|
: { ...currState, state: stateSanitizer(currState.state, i) },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ interface SerializeWithRequiredImmutable extends SerializeWithImmutable {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSerializeWithImmutable(
|
function isSerializeWithImmutable(
|
||||||
serialize: boolean | SerializeWithImmutable
|
serialize: boolean | SerializeWithImmutable,
|
||||||
): serialize is SerializeWithRequiredImmutable {
|
): serialize is SerializeWithRequiredImmutable {
|
||||||
return !!(serialize as SerializeWithImmutable).immutable;
|
return !!(serialize as SerializeWithImmutable).immutable;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ interface SerializeWithRequiredReviver extends SerializeWithImmutable {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSerializeWithReviver(
|
function isSerializeWithReviver(
|
||||||
serialize: boolean | SerializeWithImmutable
|
serialize: boolean | SerializeWithImmutable,
|
||||||
): serialize is SerializeWithRequiredReviver {
|
): serialize is SerializeWithRequiredReviver {
|
||||||
return !!(serialize as SerializeWithImmutable).immutable;
|
return !!(serialize as SerializeWithImmutable).immutable;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ interface ParsedSerializedLiftedState {
|
||||||
|
|
||||||
export default function importState<S, A extends Action<unknown>>(
|
export default function importState<S, A extends Action<unknown>>(
|
||||||
state: string | undefined,
|
state: string | undefined,
|
||||||
{ serialize }: Config
|
{ serialize }: Config,
|
||||||
) {
|
) {
|
||||||
if (!state) return undefined;
|
if (!state) return undefined;
|
||||||
let parse = jsan.parse;
|
let parse = jsan.parse;
|
||||||
|
@ -45,8 +45,8 @@ export default function importState<S, A extends Action<unknown>>(
|
||||||
serialize.immutable,
|
serialize.immutable,
|
||||||
serialize.refs,
|
serialize.refs,
|
||||||
serialize.replacer,
|
serialize.replacer,
|
||||||
serialize.reviver
|
serialize.reviver,
|
||||||
).reviver
|
).reviver,
|
||||||
);
|
);
|
||||||
} else if (isSerializeWithReviver(serialize)) {
|
} else if (isSerializeWithReviver(serialize)) {
|
||||||
parse = (v) => jsan.parse(v, serialize.reviver);
|
parse = (v) => jsan.parse(v, serialize.reviver);
|
||||||
|
|
|
@ -56,7 +56,7 @@ function stringify(obj: unknown, serialize?: Serialize | undefined) {
|
||||||
// 16 MB
|
// 16 MB
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
console.warn(
|
console.warn(
|
||||||
'Application state or actions payloads are too large making Redux DevTools serialization slow and consuming a lot of memory. See https://github.com/reduxjs/redux-devtools-extension/blob/master/docs/Troubleshooting.md#excessive-use-of-memory-and-cpu on how to configure it.'
|
'Application state or actions payloads are too large making Redux DevTools serialization slow and consuming a lot of memory. See https://github.com/reduxjs/redux-devtools-extension/blob/master/docs/Troubleshooting.md#excessive-use-of-memory-and-cpu on how to configure it.',
|
||||||
);
|
);
|
||||||
/* eslint-enable no-console */
|
/* eslint-enable no-console */
|
||||||
stringifyWarned = true;
|
stringifyWarned = true;
|
||||||
|
@ -80,7 +80,7 @@ export function getSerializeParameter(config: Config) {
|
||||||
serialize.immutable,
|
serialize.immutable,
|
||||||
serialize.refs,
|
serialize.refs,
|
||||||
serialize.replacer,
|
serialize.replacer,
|
||||||
serialize.reviver
|
serialize.reviver,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
replacer: immutableSerializer.replacer,
|
replacer: immutableSerializer.replacer,
|
||||||
|
@ -183,7 +183,7 @@ interface OpenMessage {
|
||||||
|
|
||||||
export type PageScriptToContentScriptMessageForwardedToMonitors<
|
export type PageScriptToContentScriptMessageForwardedToMonitors<
|
||||||
S,
|
S,
|
||||||
A extends Action<unknown>
|
A extends Action<unknown>,
|
||||||
> =
|
> =
|
||||||
| InitMessage<S, A>
|
| InitMessage<S, A>
|
||||||
| LiftedMessage
|
| LiftedMessage
|
||||||
|
@ -194,7 +194,7 @@ export type PageScriptToContentScriptMessageForwardedToMonitors<
|
||||||
|
|
||||||
export type PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance<
|
export type PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance<
|
||||||
S,
|
S,
|
||||||
A extends Action<unknown>
|
A extends Action<unknown>,
|
||||||
> =
|
> =
|
||||||
| PageScriptToContentScriptMessageForwardedToMonitors<S, A>
|
| PageScriptToContentScriptMessageForwardedToMonitors<S, A>
|
||||||
| ErrorMessage
|
| ErrorMessage
|
||||||
|
@ -204,7 +204,7 @@ export type PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance<
|
||||||
|
|
||||||
export type PageScriptToContentScriptMessageWithoutDisconnect<
|
export type PageScriptToContentScriptMessageWithoutDisconnect<
|
||||||
S,
|
S,
|
||||||
A extends Action<unknown>
|
A extends Action<unknown>,
|
||||||
> =
|
> =
|
||||||
| PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance<S, A>
|
| PageScriptToContentScriptMessageWithoutDisconnectOrInitInstance<S, A>
|
||||||
| InitInstancePageScriptToContentScriptMessage
|
| InitInstancePageScriptToContentScriptMessage
|
||||||
|
@ -215,14 +215,14 @@ export type PageScriptToContentScriptMessage<S, A extends Action<unknown>> =
|
||||||
| DisconnectMessage;
|
| DisconnectMessage;
|
||||||
|
|
||||||
function post<S, A extends Action<unknown>>(
|
function post<S, A extends Action<unknown>>(
|
||||||
message: PageScriptToContentScriptMessage<S, A>
|
message: PageScriptToContentScriptMessage<S, A>,
|
||||||
) {
|
) {
|
||||||
window.postMessage(message, '*');
|
window.postMessage(message, '*');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStackTrace(
|
function getStackTrace(
|
||||||
config: Config,
|
config: Config,
|
||||||
toExcludeFromTrace: Function | undefined
|
toExcludeFromTrace: Function | undefined,
|
||||||
) {
|
) {
|
||||||
if (!config.trace) return undefined;
|
if (!config.trace) return undefined;
|
||||||
if (typeof config.trace === 'function') return config.trace();
|
if (typeof config.trace === 'function') return config.trace();
|
||||||
|
@ -265,7 +265,7 @@ function amendActionType<A extends Action<unknown>>(
|
||||||
| StructuralPerformAction<A>[]
|
| StructuralPerformAction<A>[]
|
||||||
| string,
|
| string,
|
||||||
config: Config,
|
config: Config,
|
||||||
toExcludeFromTrace: Function | undefined
|
toExcludeFromTrace: Function | undefined,
|
||||||
): StructuralPerformAction<A> {
|
): StructuralPerformAction<A> {
|
||||||
let timestamp = Date.now();
|
let timestamp = Date.now();
|
||||||
let stack = getStackTrace(config, toExcludeFromTrace);
|
let stack = getStackTrace(config, toExcludeFromTrace);
|
||||||
|
@ -383,7 +383,7 @@ type ToContentScriptMessage<S, A extends Action<unknown>> =
|
||||||
export function toContentScript<S, A extends Action<unknown>>(
|
export function toContentScript<S, A extends Action<unknown>>(
|
||||||
message: ToContentScriptMessage<S, A>,
|
message: ToContentScriptMessage<S, A>,
|
||||||
serializeState?: Serialize | undefined,
|
serializeState?: Serialize | undefined,
|
||||||
serializeAction?: Serialize | undefined
|
serializeAction?: Serialize | undefined,
|
||||||
) {
|
) {
|
||||||
if (message.type === 'ACTION') {
|
if (message.type === 'ACTION') {
|
||||||
post({
|
post({
|
||||||
|
@ -430,7 +430,7 @@ export function sendMessage<S, A extends Action<unknown>>(
|
||||||
state: LiftedState<S, A, unknown>,
|
state: LiftedState<S, A, unknown>,
|
||||||
config: Config,
|
config: Config,
|
||||||
instanceId?: number,
|
instanceId?: number,
|
||||||
name?: string
|
name?: string,
|
||||||
) {
|
) {
|
||||||
let amendedAction = action;
|
let amendedAction = action;
|
||||||
if (typeof config !== 'object') {
|
if (typeof config !== 'object') {
|
||||||
|
@ -450,7 +450,7 @@ export function sendMessage<S, A extends Action<unknown>>(
|
||||||
instanceId: config.instanceId || instanceId || 1,
|
instanceId: config.instanceId || instanceId || 1,
|
||||||
},
|
},
|
||||||
config.serialize as Serialize | undefined,
|
config.serialize as Serialize | undefined,
|
||||||
config.serialize as Serialize | undefined
|
config.serialize as Serialize | undefined,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
toContentScript<S, A>(
|
toContentScript<S, A>(
|
||||||
|
@ -464,7 +464,7 @@ export function sendMessage<S, A extends Action<unknown>>(
|
||||||
instanceId: config.instanceId || instanceId || 1,
|
instanceId: config.instanceId || instanceId || 1,
|
||||||
},
|
},
|
||||||
config.serialize as Serialize | undefined,
|
config.serialize as Serialize | undefined,
|
||||||
config.serialize as Serialize | undefined
|
config.serialize as Serialize | undefined,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,7 @@ function handleMessages(event: MessageEvent<ContentScriptToPageScriptMessage>) {
|
||||||
|
|
||||||
export function setListener(
|
export function setListener(
|
||||||
onMessage: (message: ContentScriptToPageScriptMessage) => void,
|
onMessage: (message: ContentScriptToPageScriptMessage) => void,
|
||||||
instanceId: number
|
instanceId: number,
|
||||||
) {
|
) {
|
||||||
listeners[instanceId] = onMessage;
|
listeners[instanceId] = onMessage;
|
||||||
window.addEventListener('message', handleMessages, false);
|
window.addEventListener('message', handleMessages, false);
|
||||||
|
@ -498,7 +498,7 @@ export function setListener(
|
||||||
const liftListener =
|
const liftListener =
|
||||||
<S, A extends Action<unknown>>(
|
<S, A extends Action<unknown>>(
|
||||||
listener: (message: ListenerMessage<S, A>) => void,
|
listener: (message: ListenerMessage<S, A>) => void,
|
||||||
config: Config
|
config: Config,
|
||||||
) =>
|
) =>
|
||||||
(message: ContentScriptToPageScriptMessage) => {
|
(message: ContentScriptToPageScriptMessage) => {
|
||||||
if (message.type === 'IMPORT') {
|
if (message.type === 'IMPORT') {
|
||||||
|
@ -522,15 +522,15 @@ export function disconnect() {
|
||||||
export interface ConnectResponse {
|
export interface ConnectResponse {
|
||||||
init: <S, A extends Action<unknown>>(
|
init: <S, A extends Action<unknown>>(
|
||||||
state: S,
|
state: S,
|
||||||
liftedData?: LiftedState<S, A, unknown>
|
liftedData?: LiftedState<S, A, unknown>,
|
||||||
) => void;
|
) => void;
|
||||||
subscribe: <S, A extends Action<unknown>>(
|
subscribe: <S, A extends Action<unknown>>(
|
||||||
listener: (message: ListenerMessage<S, A>) => void
|
listener: (message: ListenerMessage<S, A>) => void,
|
||||||
) => (() => void) | undefined;
|
) => (() => void) | undefined;
|
||||||
unsubscribe: () => void;
|
unsubscribe: () => void;
|
||||||
send: <S, A extends Action<unknown>>(
|
send: <S, A extends Action<unknown>>(
|
||||||
action: A,
|
action: A,
|
||||||
state: LiftedState<S, A, unknown>
|
state: LiftedState<S, A, unknown>,
|
||||||
) => void;
|
) => void;
|
||||||
error: (payload: string) => void;
|
error: (payload: string) => void;
|
||||||
}
|
}
|
||||||
|
@ -575,12 +575,12 @@ export function connect(preConfig: Config): ConnectResponse {
|
||||||
listeners[id] = [rootListener];
|
listeners[id] = [rootListener];
|
||||||
|
|
||||||
const subscribe = <S, A extends Action<unknown>>(
|
const subscribe = <S, A extends Action<unknown>>(
|
||||||
listener: (message: ListenerMessage<S, A>) => void
|
listener: (message: ListenerMessage<S, A>) => void,
|
||||||
) => {
|
) => {
|
||||||
if (!listener) return undefined;
|
if (!listener) return undefined;
|
||||||
const liftedListener = liftListener(listener, config);
|
const liftedListener = liftListener(listener, config);
|
||||||
const listenersForId = listeners[id] as ((
|
const listenersForId = listeners[id] as ((
|
||||||
message: ContentScriptToPageScriptMessage
|
message: ContentScriptToPageScriptMessage,
|
||||||
) => void)[];
|
) => void)[];
|
||||||
listenersForId.push(liftedListener);
|
listenersForId.push(liftedListener);
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ export function connect(preConfig: Config): ConnectResponse {
|
||||||
|
|
||||||
const send = <S, A extends Action<unknown>>(
|
const send = <S, A extends Action<unknown>>(
|
||||||
action: A,
|
action: A,
|
||||||
state: LiftedState<S, A, unknown>
|
state: LiftedState<S, A, unknown>,
|
||||||
) => {
|
) => {
|
||||||
if (
|
if (
|
||||||
isPaused ||
|
isPaused ||
|
||||||
|
@ -639,13 +639,13 @@ export function connect(preConfig: Config): ConnectResponse {
|
||||||
sendMessage(
|
sendMessage(
|
||||||
amendedAction as StructuralPerformAction<A>,
|
amendedAction as StructuralPerformAction<A>,
|
||||||
amendedState,
|
amendedState,
|
||||||
config
|
config,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const init = <S, A extends Action<unknown>>(
|
const init = <S, A extends Action<unknown>>(
|
||||||
state: S,
|
state: S,
|
||||||
liftedData?: LiftedState<S, A, unknown>
|
liftedData?: LiftedState<S, A, unknown>,
|
||||||
) => {
|
) => {
|
||||||
const message: InitMessage<S, A> = {
|
const message: InitMessage<S, A> = {
|
||||||
type: 'INIT',
|
type: 'INIT',
|
||||||
|
|
|
@ -26,7 +26,7 @@ function postError(message: string) {
|
||||||
type: 'ERROR',
|
type: 'ERROR',
|
||||||
message: message,
|
message: message,
|
||||||
},
|
},
|
||||||
'*'
|
'*',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type { PageScriptToContentScriptMessage } from './index';
|
||||||
export type Position = 'left' | 'right' | 'bottom' | 'panel' | 'remote';
|
export type Position = 'left' | 'right' | 'bottom' | 'panel' | 'remote';
|
||||||
|
|
||||||
function post<S, A extends Action<unknown>>(
|
function post<S, A extends Action<unknown>>(
|
||||||
message: PageScriptToContentScriptMessage<S, A>
|
message: PageScriptToContentScriptMessage<S, A>,
|
||||||
) {
|
) {
|
||||||
window.postMessage(message, '*');
|
window.postMessage(message, '*');
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type { ConfigWithExpandedMaxAge } from './index';
|
||||||
|
|
||||||
export function getUrlParam(key: string) {
|
export function getUrlParam(key: string) {
|
||||||
const matches = window.location.href.match(
|
const matches = window.location.href.match(
|
||||||
new RegExp(`[?&]${key}=([^&#]+)\\b`)
|
new RegExp(`[?&]${key}=([^&#]+)\\b`),
|
||||||
);
|
);
|
||||||
return matches && matches.length > 0 ? matches[1] : null;
|
return matches && matches.length > 0 ? matches[1] : null;
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,11 @@ export default function configureStore<
|
||||||
S,
|
S,
|
||||||
A extends Action<unknown>,
|
A extends Action<unknown>,
|
||||||
MonitorState,
|
MonitorState,
|
||||||
MonitorAction extends Action<unknown>
|
MonitorAction extends Action<unknown>,
|
||||||
>(
|
>(
|
||||||
next: StoreEnhancerStoreCreator,
|
next: StoreEnhancerStoreCreator,
|
||||||
monitorReducer: Reducer<MonitorState, MonitorAction>,
|
monitorReducer: Reducer<MonitorState, MonitorAction>,
|
||||||
config: ConfigWithExpandedMaxAge
|
config: ConfigWithExpandedMaxAge,
|
||||||
) {
|
) {
|
||||||
return compose(
|
return compose(
|
||||||
instrument(monitorReducer, {
|
instrument(monitorReducer, {
|
||||||
|
@ -37,6 +37,6 @@ export default function configureStore<
|
||||||
shouldStartLocked: config.shouldStartLocked,
|
shouldStartLocked: config.shouldStartLocked,
|
||||||
pauseActionType: config.pauseActionType || '@@PAUSED',
|
pauseActionType: config.pauseActionType || '@@PAUSED',
|
||||||
}),
|
}),
|
||||||
persistState(getUrlParam('debug_session'))
|
persistState(getUrlParam('debug_session')),
|
||||||
)(next);
|
)(next);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ import type { ContentScriptToPageScriptMessage } from '../contentScript';
|
||||||
type EnhancedStoreWithInitialDispatch<
|
type EnhancedStoreWithInitialDispatch<
|
||||||
S,
|
S,
|
||||||
A extends Action<unknown>,
|
A extends Action<unknown>,
|
||||||
MonitorState
|
MonitorState,
|
||||||
> = EnhancedStore<S, A, MonitorState> & { initialDispatch: Dispatch<A> };
|
> = EnhancedStore<S, A, MonitorState> & { initialDispatch: Dispatch<A> };
|
||||||
|
|
||||||
const source = '@devtools-page';
|
const source = '@devtools-page';
|
||||||
|
@ -73,7 +73,7 @@ let reportId: string | null | undefined;
|
||||||
function deprecateParam(oldParam: string, newParam: string) {
|
function deprecateParam(oldParam: string, newParam: string) {
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
console.warn(
|
console.warn(
|
||||||
`${oldParam} parameter is deprecated, use ${newParam} instead: https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md`
|
`${oldParam} parameter is deprecated, use ${newParam} instead: https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md`,
|
||||||
);
|
);
|
||||||
/* eslint-enable no-console */
|
/* eslint-enable no-console */
|
||||||
}
|
}
|
||||||
|
@ -99,18 +99,18 @@ export interface ConfigWithExpandedMaxAge {
|
||||||
readonly stateSanitizer?: <S>(state: S, index?: number) => S;
|
readonly stateSanitizer?: <S>(state: S, index?: number) => S;
|
||||||
readonly actionSanitizer?: <A extends Action<unknown>>(
|
readonly actionSanitizer?: <A extends Action<unknown>>(
|
||||||
action: A,
|
action: A,
|
||||||
id?: number
|
id?: number,
|
||||||
) => A;
|
) => A;
|
||||||
readonly predicate?: <S, A extends Action<unknown>>(
|
readonly predicate?: <S, A extends Action<unknown>>(
|
||||||
state: S,
|
state: S,
|
||||||
action: A
|
action: A,
|
||||||
) => boolean;
|
) => boolean;
|
||||||
readonly latency?: number;
|
readonly latency?: number;
|
||||||
readonly maxAge?:
|
readonly maxAge?:
|
||||||
| number
|
| number
|
||||||
| (<S, A extends Action<unknown>>(
|
| (<S, A extends Action<unknown>>(
|
||||||
currentLiftedAction: LiftedAction<S, A, unknown>,
|
currentLiftedAction: LiftedAction<S, A, unknown>,
|
||||||
previousLiftedState: LiftedState<S, A, unknown> | undefined
|
previousLiftedState: LiftedState<S, A, unknown> | undefined,
|
||||||
) => number);
|
) => number);
|
||||||
readonly trace?: boolean | (() => string | undefined);
|
readonly trace?: boolean | (() => string | undefined);
|
||||||
readonly traceLimit?: number;
|
readonly traceLimit?: number;
|
||||||
|
@ -142,11 +142,11 @@ interface ReduxDevtoolsExtension {
|
||||||
state: LiftedState<S, A, unknown>,
|
state: LiftedState<S, A, unknown>,
|
||||||
config: Config,
|
config: Config,
|
||||||
instanceId?: number,
|
instanceId?: number,
|
||||||
name?: string
|
name?: string,
|
||||||
) => void;
|
) => void;
|
||||||
listen: (
|
listen: (
|
||||||
onMessage: (message: ContentScriptToPageScriptMessage) => void,
|
onMessage: (message: ContentScriptToPageScriptMessage) => void,
|
||||||
instanceId: number
|
instanceId: number,
|
||||||
) => void;
|
) => void;
|
||||||
connect: (preConfig: Config) => ConnectResponse;
|
connect: (preConfig: Config) => ConnectResponse;
|
||||||
disconnect: () => void;
|
disconnect: () => void;
|
||||||
|
@ -159,7 +159,7 @@ declare global {
|
||||||
}
|
}
|
||||||
|
|
||||||
function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
config?: Config
|
config?: Config,
|
||||||
): StoreEnhancer {
|
): StoreEnhancer {
|
||||||
/* eslint-disable no-param-reassign */
|
/* eslint-disable no-param-reassign */
|
||||||
if (typeof config !== 'object') config = {};
|
if (typeof config !== 'object') config = {};
|
||||||
|
@ -188,7 +188,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
const relayState = throttle(
|
const relayState = throttle(
|
||||||
(
|
(
|
||||||
liftedState?: LiftedState<S, A, unknown> | undefined,
|
liftedState?: LiftedState<S, A, unknown> | undefined,
|
||||||
libConfig?: LibConfig
|
libConfig?: LibConfig,
|
||||||
) => {
|
) => {
|
||||||
relayAction.cancel();
|
relayAction.cancel();
|
||||||
const state = liftedState || store.liftedStore.getState();
|
const state = liftedState || store.liftedStore.getState();
|
||||||
|
@ -201,17 +201,17 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
localFilter,
|
localFilter,
|
||||||
stateSanitizer,
|
stateSanitizer,
|
||||||
actionSanitizer,
|
actionSanitizer,
|
||||||
predicate
|
predicate,
|
||||||
),
|
),
|
||||||
source,
|
source,
|
||||||
instanceId,
|
instanceId,
|
||||||
libConfig,
|
libConfig,
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
latency
|
latency,
|
||||||
);
|
);
|
||||||
|
|
||||||
const monitor = new Monitor(relayState);
|
const monitor = new Monitor(relayState);
|
||||||
|
@ -233,7 +233,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
instanceId,
|
instanceId,
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,13 +269,13 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
? liftedState.actionsById[nextActionId - 1]
|
? liftedState.actionsById[nextActionId - 1]
|
||||||
: actionSanitizer(
|
: actionSanitizer(
|
||||||
liftedState.actionsById[nextActionId - 1].action,
|
liftedState.actionsById[nextActionId - 1].action,
|
||||||
nextActionId - 1
|
nextActionId - 1,
|
||||||
),
|
),
|
||||||
maxAge: getMaxAge(),
|
maxAge: getMaxAge(),
|
||||||
nextActionId,
|
nextActionId,
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
localFilter,
|
localFilter,
|
||||||
stateSanitizer,
|
stateSanitizer,
|
||||||
actionSanitizer,
|
actionSanitizer,
|
||||||
predicate
|
predicate,
|
||||||
);
|
);
|
||||||
sendingActionId = nextActionId;
|
sendingActionId = nextActionId;
|
||||||
if (typeof payload === 'undefined') return;
|
if (typeof payload === 'undefined') return;
|
||||||
|
@ -300,13 +300,13 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
localFilter,
|
localFilter,
|
||||||
stateSanitizer,
|
stateSanitizer,
|
||||||
actionSanitizer,
|
actionSanitizer,
|
||||||
predicate
|
predicate,
|
||||||
),
|
),
|
||||||
source,
|
source,
|
||||||
instanceId,
|
instanceId,
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
maxAge: getMaxAge(),
|
maxAge: getMaxAge(),
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
}, latency);
|
}, latency);
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
instanceId,
|
instanceId,
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
instanceId,
|
instanceId,
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,7 +419,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
instanceId,
|
instanceId,
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
reportId = null;
|
reportId = null;
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
instanceId,
|
instanceId,
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
const filteredActionIds: number[] = []; // simple circular buffer of non-excluded actions with fixed maxAge-1 length
|
const filteredActionIds: number[] = []; // simple circular buffer of non-excluded actions with fixed maxAge-1 length
|
||||||
const getMaxAge = (
|
const getMaxAge = (
|
||||||
liftedAction?: LiftedAction<S, A, unknown>,
|
liftedAction?: LiftedAction<S, A, unknown>,
|
||||||
liftedState?: LiftedState<S, A, unknown> | undefined
|
liftedState?: LiftedState<S, A, unknown> | undefined,
|
||||||
) => {
|
) => {
|
||||||
let m = (config && config.maxAge) || window.devToolsOptions.maxAge || 50;
|
let m = (config && config.maxAge) || window.devToolsOptions.maxAge || 50;
|
||||||
if (
|
if (
|
||||||
|
@ -497,7 +497,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
instanceId,
|
instanceId,
|
||||||
},
|
},
|
||||||
serializeState,
|
serializeState,
|
||||||
serializeAction
|
serializeAction,
|
||||||
);
|
);
|
||||||
store.subscribe(handleChange);
|
store.subscribe(handleChange);
|
||||||
|
|
||||||
|
@ -529,11 +529,11 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
const enhance =
|
const enhance =
|
||||||
(): StoreEnhancer =>
|
(): StoreEnhancer =>
|
||||||
<NextExt, NextStateExt>(
|
<NextExt, NextStateExt>(
|
||||||
next: StoreEnhancerStoreCreator<NextExt, NextStateExt>
|
next: StoreEnhancerStoreCreator<NextExt, NextStateExt>,
|
||||||
): any => {
|
): any => {
|
||||||
return <S2 extends S, A2 extends A>(
|
return <S2 extends S, A2 extends A>(
|
||||||
reducer_: Reducer<S2, A2>,
|
reducer_: Reducer<S2, A2>,
|
||||||
initialState_?: PreloadedState<S2>
|
initialState_?: PreloadedState<S2>,
|
||||||
) => {
|
) => {
|
||||||
if (!isAllowed(window.devToolsOptions)) {
|
if (!isAllowed(window.devToolsOptions)) {
|
||||||
return next(reducer_, initialState_);
|
return next(reducer_, initialState_);
|
||||||
|
@ -545,7 +545,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
{
|
{
|
||||||
...config,
|
...config,
|
||||||
maxAge: getMaxAge as any,
|
maxAge: getMaxAge as any,
|
||||||
}
|
},
|
||||||
)(reducer_, initialState_) as any;
|
)(reducer_, initialState_) as any;
|
||||||
|
|
||||||
if (isInIframe()) setTimeout(init, 3000);
|
if (isInIframe()) setTimeout(init, 3000);
|
||||||
|
@ -593,7 +593,7 @@ const preEnhancer =
|
||||||
|
|
||||||
export type InferComposedStoreExt<StoreEnhancers> = StoreEnhancers extends [
|
export type InferComposedStoreExt<StoreEnhancers> = StoreEnhancers extends [
|
||||||
infer HeadStoreEnhancer,
|
infer HeadStoreEnhancer,
|
||||||
...infer RestStoreEnhancers
|
...infer RestStoreEnhancers,
|
||||||
]
|
]
|
||||||
? HeadStoreEnhancer extends StoreEnhancer<infer StoreExt>
|
? HeadStoreEnhancer extends StoreEnhancer<infer StoreExt>
|
||||||
? StoreExt & InferComposedStoreExt<RestStoreEnhancers>
|
? StoreExt & InferComposedStoreExt<RestStoreEnhancers>
|
||||||
|
@ -611,13 +611,15 @@ const extensionCompose =
|
||||||
return [preEnhancer(instanceId), ...funcs].reduceRight(
|
return [preEnhancer(instanceId), ...funcs].reduceRight(
|
||||||
// @ts-ignore FIXME
|
// @ts-ignore FIXME
|
||||||
(composed, f) => f(composed),
|
(composed, f) => f(composed),
|
||||||
__REDUX_DEVTOOLS_EXTENSION__({ ...config, instanceId })(...args)
|
__REDUX_DEVTOOLS_EXTENSION__({ ...config, instanceId })(...args),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
interface ReduxDevtoolsExtensionCompose {
|
interface ReduxDevtoolsExtensionCompose {
|
||||||
(config: Config): <StoreEnhancers extends readonly StoreEnhancer<unknown>[]>(
|
(
|
||||||
|
config: Config,
|
||||||
|
): <StoreEnhancers extends readonly StoreEnhancer<unknown>[]>(
|
||||||
...funcs: StoreEnhancers
|
...funcs: StoreEnhancers
|
||||||
) => StoreEnhancer<InferComposedStoreExt<StoreEnhancers>>;
|
) => StoreEnhancer<InferComposedStoreExt<StoreEnhancers>>;
|
||||||
<StoreEnhancers extends readonly StoreEnhancer<unknown>[]>(
|
<StoreEnhancers extends readonly StoreEnhancer<unknown>[]>(
|
||||||
|
@ -632,12 +634,12 @@ declare global {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reduxDevtoolsExtensionCompose(
|
function reduxDevtoolsExtensionCompose(
|
||||||
config: Config
|
config: Config,
|
||||||
): <StoreEnhancers extends readonly StoreEnhancer<unknown>[]>(
|
): <StoreEnhancers extends readonly StoreEnhancer<unknown>[]>(
|
||||||
...funcs: StoreEnhancers
|
...funcs: StoreEnhancers
|
||||||
) => StoreEnhancer<InferComposedStoreExt<StoreEnhancers>>;
|
) => StoreEnhancer<InferComposedStoreExt<StoreEnhancers>>;
|
||||||
function reduxDevtoolsExtensionCompose<
|
function reduxDevtoolsExtensionCompose<
|
||||||
StoreEnhancers extends readonly StoreEnhancer<unknown>[]
|
StoreEnhancers extends readonly StoreEnhancer<unknown>[],
|
||||||
>(
|
>(
|
||||||
...funcs: StoreEnhancers
|
...funcs: StoreEnhancers
|
||||||
): StoreEnhancer<InferComposedStoreExt<StoreEnhancers>>;
|
): StoreEnhancer<InferComposedStoreExt<StoreEnhancers>>;
|
||||||
|
|
|
@ -10,7 +10,7 @@ if (process.env.NODE_ENV === 'production') {
|
||||||
s.src = chrome.extension.getURL('page.bundle.js');
|
s.src = chrome.extension.getURL('page.bundle.js');
|
||||||
s.onload = function () {
|
s.onload = function () {
|
||||||
(this as HTMLScriptElement).parentNode!.removeChild(
|
(this as HTMLScriptElement).parentNode!.removeChild(
|
||||||
this as HTMLScriptElement
|
this as HTMLScriptElement,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
(document.head || document.documentElement).appendChild(s);
|
(document.head || document.documentElement).appendChild(s);
|
||||||
|
|
|
@ -31,7 +31,7 @@ chrome.storage.local.get(
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -31,7 +31,7 @@ chrome.runtime.getBackgroundPage((window) => {
|
||||||
<PersistGate loading={null} persistor={persistor}>
|
<PersistGate loading={null} persistor={persistor}>
|
||||||
<App position={position} />
|
<App position={position} />
|
||||||
</PersistGate>
|
</PersistGate>
|
||||||
</Provider>
|
</Provider>,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
function selectInstance(
|
function selectInstance(
|
||||||
tabId: number,
|
tabId: number,
|
||||||
store: MiddlewareAPI<Dispatch<StoreAction>, StoreState>,
|
store: MiddlewareAPI<Dispatch<StoreAction>, StoreState>,
|
||||||
next: Dispatch<StoreAction>
|
next: Dispatch<StoreAction>,
|
||||||
) {
|
) {
|
||||||
const instances = store.getState().instances;
|
const instances = store.getState().instances;
|
||||||
if (instances.current === 'default') return;
|
if (instances.current === 'default') return;
|
||||||
|
@ -29,12 +29,12 @@ function getCurrentTabId(next: (tabId: number) => void) {
|
||||||
const tab = tabs[0];
|
const tab = tabs[0];
|
||||||
if (!tab) return;
|
if (!tab) return;
|
||||||
next(tab.id!);
|
next(tab.id!);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function popupSelector(
|
export default function popupSelector(
|
||||||
store: MiddlewareAPI<Dispatch<StoreAction>, StoreState>
|
store: MiddlewareAPI<Dispatch<StoreAction>, StoreState>,
|
||||||
) {
|
) {
|
||||||
return (next: Dispatch<StoreAction>) => (action: StoreAction) => {
|
return (next: Dispatch<StoreAction>) => (action: StoreAction) => {
|
||||||
const result = next(action);
|
const result = next(action);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import type {
|
||||||
|
|
||||||
export default function instances(
|
export default function instances(
|
||||||
state = instancesInitialState,
|
state = instancesInitialState,
|
||||||
action: WindowStoreAction
|
action: WindowStoreAction,
|
||||||
) {
|
) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case UPDATE_STATE:
|
case UPDATE_STATE:
|
||||||
|
|
|
@ -45,12 +45,12 @@ const persistConfig = {
|
||||||
|
|
||||||
const persistedReducer: Reducer<StoreState, WindowStoreAction> = persistReducer(
|
const persistedReducer: Reducer<StoreState, WindowStoreAction> = persistReducer(
|
||||||
persistConfig,
|
persistConfig,
|
||||||
rootReducer
|
rootReducer,
|
||||||
) as any;
|
) as any;
|
||||||
|
|
||||||
export default function configureStore(
|
export default function configureStore(
|
||||||
baseStore: Store<BackgroundState, BackgroundAction>,
|
baseStore: Store<BackgroundState, BackgroundAction>,
|
||||||
position: string
|
position: string,
|
||||||
) {
|
) {
|
||||||
let enhancer: StoreEnhancer;
|
let enhancer: StoreEnhancer;
|
||||||
const middlewares = [exportStateMiddleware, api, syncStores(baseStore)];
|
const middlewares = [exportStateMiddleware, api, syncStores(baseStore)];
|
||||||
|
@ -65,7 +65,7 @@ export default function configureStore(
|
||||||
applyMiddleware(...middlewares),
|
applyMiddleware(...middlewares),
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__
|
window.__REDUX_DEVTOOLS_EXTENSION__
|
||||||
? window.__REDUX_DEVTOOLS_EXTENSION__()
|
? window.__REDUX_DEVTOOLS_EXTENSION__()
|
||||||
: (noop: unknown) => noop
|
: (noop: unknown) => noop,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const store = createStore(persistedReducer, enhancer);
|
const store = createStore(persistedReducer, enhancer);
|
||||||
|
|
|
@ -25,7 +25,7 @@ describe('App container', () => {
|
||||||
render(
|
render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<App position="devtools-left" />
|
<App position="devtools-left" />
|
||||||
</Provider>
|
</Provider>,
|
||||||
);
|
);
|
||||||
expect(screen.getByTestId('inspector')).toBeDefined();
|
expect(screen.getByTestId('inspector')).toBeDefined();
|
||||||
});
|
});
|
||||||
|
@ -34,11 +34,11 @@ describe('App container', () => {
|
||||||
render(
|
render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<App position="devtools-left" />
|
<App position="devtools-left" />
|
||||||
</Provider>
|
</Provider>,
|
||||||
);
|
);
|
||||||
const actionList = screen.getByTestId('actionList');
|
const actionList = screen.getByTestId('actionList');
|
||||||
expect(
|
expect(
|
||||||
within(actionList).getByTestId('actionListRows')
|
within(actionList).getByTestId('actionListRows'),
|
||||||
).toBeEmptyDOMElement();
|
).toBeEmptyDOMElement();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,7 +50,7 @@ describe('API', () => {
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__.send(
|
window.__REDUX_DEVTOOLS_EXTENSION__.send(
|
||||||
{ type: 'hi' },
|
{ type: 'hi' },
|
||||||
{ counter: 1 },
|
{ counter: 1 },
|
||||||
1
|
1,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
expect(message).toMatchObject({
|
expect(message).toMatchObject({
|
||||||
|
@ -66,7 +66,7 @@ describe('API', () => {
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__.send(
|
window.__REDUX_DEVTOOLS_EXTENSION__.send(
|
||||||
{ type: 'hi' },
|
{ type: 'hi' },
|
||||||
{ counter: 1 },
|
{ counter: 1 },
|
||||||
1
|
1,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
expect(message).toMatchObject({
|
expect(message).toMatchObject({
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('Redux enhancer', () => {
|
||||||
const message = await listenMessage(() => {
|
const message = await listenMessage(() => {
|
||||||
window.store = createStore(
|
window.store = createStore(
|
||||||
counter,
|
counter,
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__()
|
window.__REDUX_DEVTOOLS_EXTENSION__(),
|
||||||
);
|
);
|
||||||
expect(typeof window.store).toBe('object');
|
expect(typeof window.store).toBe('object');
|
||||||
});
|
});
|
||||||
|
@ -37,7 +37,7 @@ describe('Redux enhancer', () => {
|
||||||
message = await listenMessage();
|
message = await listenMessage();
|
||||||
expect(message.type).toBe('STATE');
|
expect(message.type).toBe('STATE');
|
||||||
expect(message.actionsById).toMatch(
|
expect(message.actionsById).toMatch(
|
||||||
/{"0":{"type":"PERFORM_ACTION","action":{"type":"@@INIT"},"/
|
/{"0":{"type":"PERFORM_ACTION","action":{"type":"@@INIT"},"/,
|
||||||
);
|
);
|
||||||
expect(message.computedStates).toBe('[{"state":0}]');
|
expect(message.computedStates).toBe('[{"state":0}]');
|
||||||
});
|
});
|
||||||
|
@ -49,7 +49,7 @@ describe('Redux enhancer', () => {
|
||||||
});
|
});
|
||||||
expect(message.type).toBe('ACTION');
|
expect(message.type).toBe('ACTION');
|
||||||
expect(message.action).toMatch(
|
expect(message.action).toMatch(
|
||||||
/{"type":"PERFORM_ACTION","action":{"type":"INCREMENT"},/
|
/{"type":"PERFORM_ACTION","action":{"type":"INCREMENT"},/,
|
||||||
);
|
);
|
||||||
expect(message.payload).toBe('1');
|
expect(message.payload).toBe('1');
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ describe('Redux enhancer', () => {
|
||||||
});
|
});
|
||||||
expect(message.type).toBe('ACTION');
|
expect(message.type).toBe('ACTION');
|
||||||
expect(message.action).toMatch(
|
expect(message.action).toMatch(
|
||||||
/{"type":"PERFORM_ACTION","action":{"type":"INCREMENT"},/
|
/{"type":"PERFORM_ACTION","action":{"type":"INCREMENT"},/,
|
||||||
);
|
);
|
||||||
expect(message.payload).toBe('2');
|
expect(message.payload).toBe('2');
|
||||||
});
|
});
|
||||||
|
@ -72,7 +72,7 @@ describe('Redux enhancer', () => {
|
||||||
payload: "{ type: 'INCREMENT' }",
|
payload: "{ type: 'INCREMENT' }",
|
||||||
source: '@devtools-extension',
|
source: '@devtools-extension',
|
||||||
},
|
},
|
||||||
'*'
|
'*',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
expect(message.type).toBe('ACTION');
|
expect(message.type).toBe('ACTION');
|
||||||
|
@ -80,7 +80,7 @@ describe('Redux enhancer', () => {
|
||||||
message = await listenMessage();
|
message = await listenMessage();
|
||||||
expect(message.type).toBe('ACTION');
|
expect(message.type).toBe('ACTION');
|
||||||
expect(message.action).toMatch(
|
expect(message.action).toMatch(
|
||||||
/{"type":"PERFORM_ACTION","action":{"type":"INCREMENT"},/
|
/{"type":"PERFORM_ACTION","action":{"type":"INCREMENT"},/,
|
||||||
);
|
);
|
||||||
expect(message.payload).toBe('3');
|
expect(message.payload).toBe('3');
|
||||||
});
|
});
|
||||||
|
@ -93,7 +93,7 @@ describe('Redux enhancer', () => {
|
||||||
payload: { type: 'TOGGLE_ACTION', id: 1 },
|
payload: { type: 'TOGGLE_ACTION', id: 1 },
|
||||||
source: '@devtools-extension',
|
source: '@devtools-extension',
|
||||||
},
|
},
|
||||||
'*'
|
'*',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
expect(message.type).toBe('DISPATCH');
|
expect(message.type).toBe('DISPATCH');
|
||||||
|
@ -109,7 +109,7 @@ describe('Redux enhancer', () => {
|
||||||
payload: { type: 'TOGGLE_ACTION', id: 1 },
|
payload: { type: 'TOGGLE_ACTION', id: 1 },
|
||||||
source: '@devtools-extension',
|
source: '@devtools-extension',
|
||||||
},
|
},
|
||||||
'*'
|
'*',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
expect(message.type).toBe('DISPATCH');
|
expect(message.type).toBe('DISPATCH');
|
||||||
|
@ -127,7 +127,7 @@ describe('Redux enhancer', () => {
|
||||||
payload: { type: 'JUMP_TO_STATE', index: 2, actionId: 2 },
|
payload: { type: 'JUMP_TO_STATE', index: 2, actionId: 2 },
|
||||||
source: '@devtools-extension',
|
source: '@devtools-extension',
|
||||||
},
|
},
|
||||||
'*'
|
'*',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
expect(message.type).toBe('DISPATCH');
|
expect(message.type).toBe('DISPATCH');
|
||||||
|
@ -140,7 +140,7 @@ describe('Redux enhancer', () => {
|
||||||
payload: { type: 'JUMP_TO_STATE', index: 3, actionId: 3 },
|
payload: { type: 'JUMP_TO_STATE', index: 3, actionId: 3 },
|
||||||
source: '@devtools-extension',
|
source: '@devtools-extension',
|
||||||
},
|
},
|
||||||
'*'
|
'*',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
expect(message.type).toBe('DISPATCH');
|
expect(message.type).toBe('DISPATCH');
|
||||||
|
@ -167,7 +167,7 @@ describe('Redux enhancer', () => {
|
||||||
}),
|
}),
|
||||||
source: '@devtools-extension',
|
source: '@devtools-extension',
|
||||||
},
|
},
|
||||||
'*'
|
'*',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
expect(message.type).toBe('IMPORT');
|
expect(message.type).toBe('IMPORT');
|
||||||
|
@ -182,7 +182,7 @@ describe('Redux enhancer', () => {
|
||||||
counter,
|
counter,
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__({
|
window.__REDUX_DEVTOOLS_EXTENSION__({
|
||||||
actionsDenylist: ['SOME_ACTION'],
|
actionsDenylist: ['SOME_ACTION'],
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
expect(typeof window.store).toBe('object');
|
expect(typeof window.store).toBe('object');
|
||||||
});
|
});
|
||||||
|
@ -204,7 +204,7 @@ describe('Redux enhancer', () => {
|
||||||
const message = await listenMessage(() => {
|
const message = await listenMessage(() => {
|
||||||
window.store = createStore(
|
window.store = createStore(
|
||||||
counter,
|
counter,
|
||||||
compose(testEnhancer, window.__REDUX_DEVTOOLS_EXTENSION__())
|
compose(testEnhancer, window.__REDUX_DEVTOOLS_EXTENSION__()),
|
||||||
);
|
);
|
||||||
expect(typeof window.store).toBe('object');
|
expect(typeof window.store).toBe('object');
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('Chrome extension', function () {
|
||||||
driver = new webdriver.Builder()
|
driver = new webdriver.Builder()
|
||||||
.usingServer(`http://localhost:${port}`)
|
.usingServer(`http://localhost:${port}`)
|
||||||
.setChromeOptions(
|
.setChromeOptions(
|
||||||
new chrome.Options().addArguments(`load-extension=${path}`)
|
new chrome.Options().addArguments(`load-extension=${path}`),
|
||||||
)
|
)
|
||||||
.forBrowser('chrome')
|
.forBrowser('chrome')
|
||||||
.build();
|
.build();
|
||||||
|
@ -52,14 +52,14 @@ describe('Chrome extension', function () {
|
||||||
it('should contain an empty actions list', async () => {
|
it('should contain an empty actions list', async () => {
|
||||||
const val = await driver
|
const val = await driver
|
||||||
.findElement(
|
.findElement(
|
||||||
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]')
|
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]'),
|
||||||
)
|
)
|
||||||
.getText();
|
.getText();
|
||||||
expect(val).toBe('');
|
expect(val).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.keys(switchMonitorTests).forEach((description) =>
|
Object.keys(switchMonitorTests).forEach((description) =>
|
||||||
it(description, () => switchMonitorTests[description](driver))
|
it(description, () => switchMonitorTests[description](driver)),
|
||||||
);
|
);
|
||||||
|
|
||||||
it('should get actions list', async () => {
|
it('should get actions list', async () => {
|
||||||
|
@ -77,14 +77,14 @@ describe('Chrome extension', function () {
|
||||||
const result = await driver.wait(
|
const result = await driver.wait(
|
||||||
driver
|
driver
|
||||||
.findElement(
|
.findElement(
|
||||||
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]')
|
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]'),
|
||||||
)
|
)
|
||||||
.getText()
|
.getText()
|
||||||
.then((val) => {
|
.then((val) => {
|
||||||
return actionsPattern.test(val);
|
return actionsPattern.test(val);
|
||||||
}),
|
}),
|
||||||
15000,
|
15000,
|
||||||
"it doesn't match actions pattern"
|
"it doesn't match actions pattern",
|
||||||
);
|
);
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,7 +20,7 @@ describe('DevTools panel for Electron', function () {
|
||||||
.setChromeOptions(
|
.setChromeOptions(
|
||||||
new chrome.Options()
|
new chrome.Options()
|
||||||
.setChromeBinaryPath(electronPath)
|
.setChromeBinaryPath(electronPath)
|
||||||
.addArguments(`app=${join(__dirname, 'fixture')}`)
|
.addArguments(`app=${join(__dirname, 'fixture')}`),
|
||||||
)
|
)
|
||||||
.forBrowser('chrome')
|
.forBrowser('chrome')
|
||||||
.build();
|
.build();
|
||||||
|
@ -44,7 +44,7 @@ describe('DevTools panel for Electron', function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expect(await driver.getCurrentUrl()).toMatch(
|
expect(await driver.getCurrentUrl()).toMatch(
|
||||||
/devtools:\/\/devtools\/bundled\/devtools_app.html/
|
/devtools:\/\/devtools\/bundled\/devtools_app.html/,
|
||||||
);
|
);
|
||||||
|
|
||||||
const id = await driver.executeAsyncScript(function (callback) {
|
const id = await driver.executeAsyncScript(function (callback) {
|
||||||
|
@ -81,8 +81,8 @@ describe('DevTools panel for Electron', function () {
|
||||||
.switchTo()
|
.switchTo()
|
||||||
.frame(
|
.frame(
|
||||||
driver.findElement(
|
driver.findElement(
|
||||||
webdriver.By.xpath(`//iframe[@src='${devPanelPath}']`)
|
webdriver.By.xpath(`//iframe[@src='${devPanelPath}']`),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
await delay(1000);
|
await delay(1000);
|
||||||
});
|
});
|
||||||
|
@ -90,10 +90,10 @@ describe('DevTools panel for Electron', function () {
|
||||||
it('should contain INIT action', async () => {
|
it('should contain INIT action', async () => {
|
||||||
const element = await driver.wait(
|
const element = await driver.wait(
|
||||||
webdriver.until.elementLocated(
|
webdriver.until.elementLocated(
|
||||||
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]')
|
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]'),
|
||||||
),
|
),
|
||||||
5000,
|
5000,
|
||||||
'Element not found'
|
'Element not found',
|
||||||
);
|
);
|
||||||
const val = await element.getText();
|
const val = await element.getText();
|
||||||
expect(val).toMatch(/@@INIT/);
|
expect(val).toMatch(/@@INIT/);
|
||||||
|
@ -107,7 +107,7 @@ describe('DevTools panel for Electron', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.keys(switchMonitorTests).forEach((description) =>
|
Object.keys(switchMonitorTests).forEach((description) =>
|
||||||
it(description, () => switchMonitorTests[description](driver))
|
it(description, () => switchMonitorTests[description](driver)),
|
||||||
);
|
);
|
||||||
|
|
||||||
/* it('should be no logs in console of main window', async () => {
|
/* it('should be no logs in console of main window', async () => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
|
|
@ -5,7 +5,7 @@ app.on('window-all-closed', app.quit);
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
await session.defaultSession.loadExtension(
|
await session.defaultSession.loadExtension(
|
||||||
path.join(__dirname, '../../../dist'),
|
path.join(__dirname, '../../../dist'),
|
||||||
{ allowFileAccess: true }
|
{ allowFileAccess: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const mainWindow = new BrowserWindow({
|
const mainWindow = new BrowserWindow({
|
||||||
|
|
|
@ -19,7 +19,7 @@ const store = createStore(
|
||||||
initialState,
|
initialState,
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__
|
window.__REDUX_DEVTOOLS_EXTENSION__
|
||||||
? window.__REDUX_DEVTOOLS_EXTENSION__()
|
? window.__REDUX_DEVTOOLS_EXTENSION__()
|
||||||
: (noop) => noop
|
: (noop) => noop,
|
||||||
);
|
);
|
||||||
|
|
||||||
const el = document.getElementById('counter');
|
const el = document.getElementById('counter');
|
||||||
|
|
|
@ -9,7 +9,7 @@ function test(title, data, maxTime = 100) {
|
||||||
await listenMessage(() => {
|
await listenMessage(() => {
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__.send(
|
window.__REDUX_DEVTOOLS_EXTENSION__.send(
|
||||||
{ type: 'TEST_ACTION', data },
|
{ type: 'TEST_ACTION', data },
|
||||||
data
|
data,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
const ms = new Date() - start;
|
const ms = new Date() - start;
|
||||||
|
|
|
@ -15,8 +15,8 @@ export const switchMonitorTests = {
|
||||||
await delay(500);
|
await delay(500);
|
||||||
await driver.findElement(
|
await driver.findElement(
|
||||||
webdriver.By.xpath(
|
webdriver.By.xpath(
|
||||||
'//div[div[button[text()="Reset"]] and .//div[button[text()="Revert"]]]'
|
'//div[div[button[text()="Reset"]] and .//div[button[text()="Revert"]]]',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
await delay(500);
|
await delay(500);
|
||||||
},
|
},
|
||||||
|
@ -31,7 +31,7 @@ export const switchMonitorTests = {
|
||||||
.click();
|
.click();
|
||||||
await delay(500);
|
await delay(500);
|
||||||
await driver.findElement(
|
await driver.findElement(
|
||||||
webdriver.By.xpath('//*[@class="nodeText" and text()="state"]')
|
webdriver.By.xpath('//*[@class="nodeText" and text()="state"]'),
|
||||||
);
|
);
|
||||||
await delay(500); // Wait till menu is closed
|
await delay(500); // Wait till menu is closed
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"eslint-plugin-react": "^7.32.2",
|
"eslint-plugin-react": "^7.32.2",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
"prettier": "2.8.8",
|
"prettier": "3.0.0",
|
||||||
"typescript": "~5.0.4",
|
"typescript": "~5.0.4",
|
||||||
"nx": "^16.3.2",
|
"nx": "^16.3.2",
|
||||||
"@nrwl/nx-cloud": "^16.0.5"
|
"@nrwl/nx-cloud": "^16.0.5"
|
||||||
|
|
|
@ -189,14 +189,14 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
zoom.on('zoom', (event) => {
|
zoom.on('zoom', (event) => {
|
||||||
const { transform } = event as D3ZoomEvent<SVGSVGElement, unknown>;
|
const { transform } = event as D3ZoomEvent<SVGSVGElement, unknown>;
|
||||||
vis.attr('transform', transform.toString());
|
vis.attr('transform', transform.toString());
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.append('g')
|
.append('g')
|
||||||
.attr(
|
.attr(
|
||||||
'transform',
|
'transform',
|
||||||
`translate(${margin.left + nodeStyleOptions.radius}, ${
|
`translate(${margin.left + nodeStyleOptions.radius}, ${
|
||||||
margin.top
|
margin.top
|
||||||
}) scale(${initialZoom})`
|
}) scale(${initialZoom})`,
|
||||||
);
|
);
|
||||||
|
|
||||||
// previousNodePositionsById stores node x and y
|
// previousNodePositionsById stores node x and y
|
||||||
|
@ -217,7 +217,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
function findParentNodePosition(
|
function findParentNodePosition(
|
||||||
nodePositionsById: { [nodeId: string | number]: NodePosition },
|
nodePositionsById: { [nodeId: string | number]: NodePosition },
|
||||||
nodeId: string | number,
|
nodeId: string | number,
|
||||||
filter: (nodePosition: NodePosition) => boolean
|
filter: (nodePosition: NodePosition) => boolean,
|
||||||
) {
|
) {
|
||||||
let currentPosition = nodePositionsById[nodeId];
|
let currentPosition = nodePositionsById[nodeId];
|
||||||
while (currentPosition) {
|
while (currentPosition) {
|
||||||
|
@ -264,7 +264,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
c.id = `${node.id || ''}|${c.name}`;
|
c.id = `${node.id || ''}|${c.name}`;
|
||||||
return c;
|
return c;
|
||||||
})
|
})
|
||||||
: null
|
: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
@ -291,7 +291,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
const rootNode = d3.hierarchy(data);
|
const rootNode = d3.hierarchy(data);
|
||||||
if (isSorted) {
|
if (isSorted) {
|
||||||
rootNode.sort((a, b) =>
|
rootNode.sort((a, b) =>
|
||||||
b.data.name.toLowerCase() < a.data.name.toLowerCase() ? 1 : -1
|
b.data.name.toLowerCase() < a.data.name.toLowerCase() ? 1 : -1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
|
|
||||||
rootPointNode.each(
|
rootPointNode.each(
|
||||||
(node) =>
|
(node) =>
|
||||||
(node.y = node.depth * (maxLabelLength * 7 * widthBetweenNodesCoeff))
|
(node.y = node.depth * (maxLabelLength * 7 * widthBetweenNodesCoeff)),
|
||||||
);
|
);
|
||||||
|
|
||||||
const nodes = rootPointNode.descendants();
|
const nodes = rootPointNode.descendants();
|
||||||
|
@ -327,7 +327,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
const position = findParentNodePosition(
|
const position = findParentNodePosition(
|
||||||
nodePositionsById,
|
nodePositionsById,
|
||||||
d.data.id,
|
d.data.id,
|
||||||
(n) => !!previousNodePositionsById[n.id]
|
(n) => !!previousNodePositionsById[n.id],
|
||||||
);
|
);
|
||||||
const previousPosition =
|
const previousPosition =
|
||||||
(position && previousNodePositionsById[position.id]) ||
|
(position && previousNodePositionsById[position.id]) ||
|
||||||
|
@ -358,7 +358,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
...tooltipOptions,
|
...tooltipOptions,
|
||||||
root,
|
root,
|
||||||
text: (d) => getTooltipString(d.data, tooltipOptions),
|
text: (d) => getTooltipString(d.data, tooltipOptions),
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
? nodeStyleOptions.colors.collapsed
|
? nodeStyleOptions.colors.collapsed
|
||||||
: d.data.children && d.data.children.length > 0
|
: d.data.children && d.data.children.length > 0
|
||||||
? nodeStyleOptions.colors.parent
|
? nodeStyleOptions.colors.parent
|
||||||
: nodeStyleOptions.colors.default
|
: nodeStyleOptions.colors.default,
|
||||||
);
|
);
|
||||||
|
|
||||||
// transition nodes to their new position
|
// transition nodes to their new position
|
||||||
|
@ -433,7 +433,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
this: SVGGElement & {
|
this: SVGGElement & {
|
||||||
__oldData__?: HierarchyPointNode<InternalNode>;
|
__oldData__?: HierarchyPointNode<InternalNode>;
|
||||||
},
|
},
|
||||||
d
|
d,
|
||||||
) {
|
) {
|
||||||
// test whether the relevant properties of d match
|
// test whether the relevant properties of d match
|
||||||
// the equivalent property of the oldData
|
// the equivalent property of the oldData
|
||||||
|
@ -458,7 +458,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
const position = findParentNodePosition(
|
const position = findParentNodePosition(
|
||||||
previousNodePositionsById,
|
previousNodePositionsById,
|
||||||
d.data.id,
|
d.data.id,
|
||||||
(n) => !!nodePositionsById[n.id]
|
(n) => !!nodePositionsById[n.id],
|
||||||
);
|
);
|
||||||
const futurePosition =
|
const futurePosition =
|
||||||
(position && nodePositionsById[position.id]) ||
|
(position && nodePositionsById[position.id]) ||
|
||||||
|
@ -474,7 +474,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
// update the links
|
// update the links
|
||||||
const link = vis
|
const link = vis
|
||||||
.selectAll<SVGPathElement, HierarchyPointLink<InternalNode>>(
|
.selectAll<SVGPathElement, HierarchyPointLink<InternalNode>>(
|
||||||
'path.link'
|
'path.link',
|
||||||
)
|
)
|
||||||
.data(links, (d) => d.target.data.id);
|
.data(links, (d) => d.target.data.id);
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
const position = findParentNodePosition(
|
const position = findParentNodePosition(
|
||||||
nodePositionsById,
|
nodePositionsById,
|
||||||
d.target.data.id,
|
d.target.data.id,
|
||||||
(n) => !!previousNodePositionsById[n.id]
|
(n) => !!previousNodePositionsById[n.id],
|
||||||
);
|
);
|
||||||
const previousPosition =
|
const previousPosition =
|
||||||
(position && previousNodePositionsById[position.id]) ||
|
(position && previousNodePositionsById[position.id]) ||
|
||||||
|
@ -519,7 +519,7 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
|
||||||
const position = findParentNodePosition(
|
const position = findParentNodePosition(
|
||||||
previousNodePositionsById,
|
previousNodePositionsById,
|
||||||
d.target.data.id,
|
d.target.data.id,
|
||||||
(n) => !!nodePositionsById[n.id]
|
(n) => !!nodePositionsById[n.id],
|
||||||
);
|
);
|
||||||
const futurePosition =
|
const futurePosition =
|
||||||
(position && nodePositionsById[position.id]) ||
|
(position && nodePositionsById[position.id]) ||
|
||||||
|
|
|
@ -32,7 +32,7 @@ export function toggleChildren(node: InternalNode) {
|
||||||
export function visit(
|
export function visit(
|
||||||
parent: InternalNode,
|
parent: InternalNode,
|
||||||
visitFn: (parent: InternalNode) => void,
|
visitFn: (parent: InternalNode) => void,
|
||||||
childrenFn: (parent: InternalNode) => InternalNode[] | null | undefined
|
childrenFn: (parent: InternalNode) => InternalNode[] | null | undefined,
|
||||||
) {
|
) {
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -32,7 +32,7 @@ vis
|
||||||
d3tooltip('tooltipClassName', {
|
d3tooltip('tooltipClassName', {
|
||||||
...options,
|
...options,
|
||||||
text: (d) => toStringOrHtml(d),
|
text: (d) => toStringOrHtml(d),
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.on('mouseover', function () {
|
.on('mouseover', function () {
|
||||||
d3.select(this).style('fill', 'skyblue');
|
d3.select(this).style('fill', 'skyblue');
|
||||||
|
|
|
@ -8,7 +8,7 @@ interface Options<
|
||||||
RootGElement extends BaseType,
|
RootGElement extends BaseType,
|
||||||
RootDatum,
|
RootDatum,
|
||||||
RootPElement extends BaseType,
|
RootPElement extends BaseType,
|
||||||
RootPDatum
|
RootPDatum,
|
||||||
> {
|
> {
|
||||||
left: number | undefined;
|
left: number | undefined;
|
||||||
top: number | undefined;
|
top: number | undefined;
|
||||||
|
@ -40,12 +40,12 @@ export function tooltip<
|
||||||
RootGElement extends BaseType,
|
RootGElement extends BaseType,
|
||||||
RootDatum,
|
RootDatum,
|
||||||
RootPElement extends BaseType,
|
RootPElement extends BaseType,
|
||||||
RootPDatum
|
RootPDatum,
|
||||||
>(
|
>(
|
||||||
className = 'tooltip',
|
className = 'tooltip',
|
||||||
options: Partial<
|
options: Partial<
|
||||||
Options<Datum, RootGElement, RootDatum, RootPElement, RootPDatum>
|
Options<Datum, RootGElement, RootDatum, RootPElement, RootPDatum>
|
||||||
> = {}
|
> = {},
|
||||||
) {
|
) {
|
||||||
const { left, top, offset, root, styles, text } = {
|
const { left, top, offset, root, styles, text } = {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
|
|
|
@ -13,7 +13,7 @@ map2tree(
|
||||||
(options = {
|
(options = {
|
||||||
key: 'state', // the name you want for as the root node of the output tree
|
key: 'state', // the name you want for as the root node of the output tree
|
||||||
pushMethod: 'push', // use 'unshift' to change the order children nodes are added
|
pushMethod: 'push', // use 'unshift' to change the order children nodes are added
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ export interface Node {
|
||||||
function visit(
|
function visit(
|
||||||
parent: Node,
|
parent: Node,
|
||||||
visitFn: (parent: Node) => void,
|
visitFn: (parent: Node) => void,
|
||||||
childrenFn: (parent: Node) => Node[] | undefined | null
|
childrenFn: (parent: Node) => Node[] | undefined | null,
|
||||||
) {
|
) {
|
||||||
if (!parent) return;
|
if (!parent) return;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ function getNode(tree: Node, key: string): Node | null {
|
||||||
node = d;
|
node = d;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(d) => d.children
|
(d) => d.children,
|
||||||
);
|
);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
@ -46,7 +46,7 @@ function getNode(tree: Node, key: string): Node | null {
|
||||||
export function map2tree(
|
export function map2tree(
|
||||||
root: unknown,
|
root: unknown,
|
||||||
options: { key?: string; pushMethod?: 'push' | 'unshift' } = {},
|
options: { key?: string; pushMethod?: 'push' | 'unshift' } = {},
|
||||||
tree: Node = { name: options.key || 'state', children: [] }
|
tree: Node = { name: options.key || 'state', children: [] },
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
): Node | {} {
|
): Node | {} {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
|
@ -94,7 +94,7 @@ export function map2tree(
|
||||||
currentNode.children![pushMethod](newNode);
|
currentNode.children![pushMethod](newNode);
|
||||||
|
|
||||||
map2tree(value, { key, pushMethod }, tree);
|
map2tree(value, { key, pushMethod }, tree);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return tree;
|
return tree;
|
||||||
|
|
|
@ -41,7 +41,7 @@ const merger = (styling: Partial<Styling>) => {
|
||||||
|
|
||||||
const mergeStyling = (
|
const mergeStyling = (
|
||||||
customStyling: StylingValue,
|
customStyling: StylingValue,
|
||||||
defaultStyling: StylingValue
|
defaultStyling: StylingValue,
|
||||||
): StylingValue | undefined => {
|
): StylingValue | undefined => {
|
||||||
if (customStyling === undefined) {
|
if (customStyling === undefined) {
|
||||||
return defaultStyling;
|
return defaultStyling;
|
||||||
|
@ -97,7 +97,7 @@ const mergeStyling = (
|
||||||
merger(styling)({
|
merger(styling)({
|
||||||
className: defaultStyling as string,
|
className: defaultStyling as string,
|
||||||
}),
|
}),
|
||||||
...args
|
...args,
|
||||||
);
|
);
|
||||||
case 'object':
|
case 'object':
|
||||||
return (styling, ...args) =>
|
return (styling, ...args) =>
|
||||||
|
@ -105,16 +105,16 @@ const mergeStyling = (
|
||||||
merger(styling)({
|
merger(styling)({
|
||||||
style: defaultStyling as CSS.Properties<string | number>,
|
style: defaultStyling as CSS.Properties<string | number>,
|
||||||
}),
|
}),
|
||||||
...args
|
...args,
|
||||||
);
|
);
|
||||||
case 'function':
|
case 'function':
|
||||||
return (styling, ...args) =>
|
return (styling, ...args) =>
|
||||||
(customStyling as StylingValueFunction)(
|
(customStyling as StylingValueFunction)(
|
||||||
(defaultStyling as StylingValueFunction)(
|
(defaultStyling as StylingValueFunction)(
|
||||||
styling,
|
styling,
|
||||||
...args
|
...args,
|
||||||
) as Styling,
|
) as Styling,
|
||||||
...args
|
...args,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ const mergeStyling = (
|
||||||
|
|
||||||
const mergeStylings = (
|
const mergeStylings = (
|
||||||
customStylings: StylingConfig,
|
customStylings: StylingConfig,
|
||||||
defaultStylings: StylingConfig
|
defaultStylings: StylingConfig,
|
||||||
): StylingConfig => {
|
): StylingConfig => {
|
||||||
const keys = Object.keys(defaultStylings);
|
const keys = Object.keys(defaultStylings);
|
||||||
for (const key in customStylings) {
|
for (const key in customStylings) {
|
||||||
|
@ -133,11 +133,11 @@ const mergeStylings = (
|
||||||
(mergedStyling, key) => (
|
(mergedStyling, key) => (
|
||||||
(mergedStyling[key as keyof StylingConfig] = mergeStyling(
|
(mergedStyling[key as keyof StylingConfig] = mergeStyling(
|
||||||
customStylings[key] as StylingValue,
|
customStylings[key] as StylingValue,
|
||||||
defaultStylings[key] as StylingValue
|
defaultStylings[key] as StylingValue,
|
||||||
) as StylingValue),
|
) as StylingValue),
|
||||||
mergedStyling
|
mergedStyling
|
||||||
),
|
),
|
||||||
{} as StylingConfig
|
{} as StylingConfig,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ const getStylingByKeys = (
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
{ className: '', style: {} }
|
{ className: '', style: {} },
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!props.className) {
|
if (!props.className) {
|
||||||
|
@ -194,7 +194,7 @@ export const invertBase16Theme = (base16Theme: Base16Theme): Base16Theme =>
|
||||||
: base16Theme[key as keyof Base16Theme]),
|
: base16Theme[key as keyof Base16Theme]),
|
||||||
t
|
t
|
||||||
),
|
),
|
||||||
{} as Base16Theme
|
{} as Base16Theme,
|
||||||
);
|
);
|
||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
|
@ -236,7 +236,7 @@ export const createStyling: CurriedFunction3<
|
||||||
defaultBase16[key as keyof Base16Theme]),
|
defaultBase16[key as keyof Base16Theme]),
|
||||||
t
|
t
|
||||||
),
|
),
|
||||||
{} as Base16Theme
|
{} as Base16Theme,
|
||||||
);
|
);
|
||||||
|
|
||||||
const customStyling = Object.keys(themeOrStyling).reduce(
|
const customStyling = Object.keys(themeOrStyling).reduce(
|
||||||
|
@ -244,7 +244,7 @@ export const createStyling: CurriedFunction3<
|
||||||
BASE16_KEYS.indexOf(key) === -1
|
BASE16_KEYS.indexOf(key) === -1
|
||||||
? ((s[key] = (themeOrStyling as StylingConfig)[key]), s)
|
? ((s[key] = (themeOrStyling as StylingConfig)[key]), s)
|
||||||
: s,
|
: s,
|
||||||
{} as StylingConfig
|
{} as StylingConfig,
|
||||||
);
|
);
|
||||||
|
|
||||||
const defaultStyling = getStylingFromBase16(theme);
|
const defaultStyling = getStylingFromBase16(theme);
|
||||||
|
@ -253,7 +253,7 @@ export const createStyling: CurriedFunction3<
|
||||||
|
|
||||||
return curry(getStylingByKeys, 2)(mergedStyling, ...args);
|
return curry(getStylingByKeys, 2)(mergedStyling, ...args);
|
||||||
},
|
},
|
||||||
3
|
3,
|
||||||
);
|
);
|
||||||
|
|
||||||
const isStylingConfig = (theme: Theme): theme is StylingConfig =>
|
const isStylingConfig = (theme: Theme): theme is StylingConfig =>
|
||||||
|
@ -261,7 +261,7 @@ const isStylingConfig = (theme: Theme): theme is StylingConfig =>
|
||||||
|
|
||||||
export const getBase16Theme = (
|
export const getBase16Theme = (
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
base16Themes?: { [themeName: string]: Base16Theme } | null
|
base16Themes?: { [themeName: string]: Base16Theme } | null,
|
||||||
): Base16Theme | undefined => {
|
): Base16Theme | undefined => {
|
||||||
if (theme && isStylingConfig(theme) && theme.extend) {
|
if (theme && isStylingConfig(theme) && theme.extend) {
|
||||||
theme = theme.extend as string | Base16Theme;
|
theme = theme.extend as string | Base16Theme;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>React Dock</title>
|
<title>React Dock</title>
|
||||||
|
|
|
@ -11,7 +11,7 @@ interface Styles {
|
||||||
function autoprefixes(styles: Styles) {
|
function autoprefixes(styles: Styles) {
|
||||||
return Object.keys(styles).reduce<Styles>(
|
return Object.keys(styles).reduce<Styles>(
|
||||||
(obj, key) => ((obj[key] = autoprefix(styles[key])), obj),
|
(obj, key) => ((obj[key] = autoprefix(styles[key])), obj),
|
||||||
{}
|
{},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,13 +81,13 @@ const styles = autoprefixes({
|
||||||
|
|
||||||
function getTransitions(duration: number) {
|
function getTransitions(duration: number) {
|
||||||
return ['left', 'top', 'width', 'height'].map(
|
return ['left', 'top', 'width', 'height'].map(
|
||||||
(p) => `${p} ${duration / 1000}s ease-out`
|
(p) => `${p} ${duration / 1000}s ease-out`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDockStyles(
|
function getDockStyles(
|
||||||
{ fluid, dockStyle, dockHiddenStyle, duration, position, isVisible }: Props,
|
{ fluid, dockStyle, dockHiddenStyle, duration, position, isVisible }: Props,
|
||||||
{ size, isResizing, fullWidth, fullHeight }: State
|
{ size, isResizing, fullWidth, fullHeight }: State,
|
||||||
) {
|
) {
|
||||||
let posStyle;
|
let posStyle;
|
||||||
const absSize = fluid ? `${size * 100}%` : `${size}px`;
|
const absSize = fluid ? `${size * 100}%` : `${size}px`;
|
||||||
|
@ -145,7 +145,7 @@ function getDockStyles(
|
||||||
|
|
||||||
function getDimStyles(
|
function getDimStyles(
|
||||||
{ dimMode, dimStyle, duration, isVisible }: Props,
|
{ dimMode, dimStyle, duration, isVisible }: Props,
|
||||||
{ isTransitionStarted }: State
|
{ isTransitionStarted }: State,
|
||||||
) {
|
) {
|
||||||
return [
|
return [
|
||||||
styles.dim,
|
styles.dim,
|
||||||
|
@ -209,7 +209,7 @@ function getResizerStyles(position: 'left' | 'right' | 'top' | 'bottom') {
|
||||||
function getFullSize(
|
function getFullSize(
|
||||||
position: 'left' | 'right' | 'top' | 'bottom',
|
position: 'left' | 'right' | 'top' | 'bottom',
|
||||||
fullWidth: number,
|
fullWidth: number,
|
||||||
fullHeight: number
|
fullHeight: number,
|
||||||
) {
|
) {
|
||||||
return position === 'left' || position === 'right' ? fullWidth : fullHeight;
|
return position === 'left' || position === 'right' ? fullWidth : fullHeight;
|
||||||
}
|
}
|
||||||
|
@ -358,11 +358,11 @@ export default class Dock extends Component<Props, State> {
|
||||||
|
|
||||||
const dimStyles = Object.assign(
|
const dimStyles = Object.assign(
|
||||||
{},
|
{},
|
||||||
...getDimStyles(this.props, this.state)
|
...getDimStyles(this.props, this.state),
|
||||||
);
|
);
|
||||||
const dockStyles = Object.assign(
|
const dockStyles = Object.assign(
|
||||||
{},
|
{},
|
||||||
...getDockStyles(this.props, this.state)
|
...getDockStyles(this.props, this.state),
|
||||||
);
|
);
|
||||||
const resizerStyles = Object.assign({}, ...getResizerStyles(position));
|
const resizerStyles = Object.assign({}, ...getResizerStyles(position));
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ export default class Dock extends Component<Props, State> {
|
||||||
|
|
||||||
debouncedUpdateWindowSizeEnd: DebouncedFunc<() => void> = debounce(
|
debouncedUpdateWindowSizeEnd: DebouncedFunc<() => void> = debounce(
|
||||||
this.updateWindowSizeEnd,
|
this.updateWindowSizeEnd,
|
||||||
30
|
30,
|
||||||
);
|
);
|
||||||
|
|
||||||
handleWrapperLeave = () => {
|
handleWrapperLeave = () => {
|
||||||
|
|
|
@ -41,7 +41,7 @@ function prefixProp<Value>(key: string, value: Value) {
|
||||||
(obj, pre) => (
|
(obj, pre) => (
|
||||||
(obj[pre + key[0].toUpperCase() + key.substr(1)] = value), obj
|
(obj[pre + key[0].toUpperCase() + key.substr(1)] = value), obj
|
||||||
),
|
),
|
||||||
{}
|
{},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,6 @@ export default function autoprefix(style: CSSProperties) {
|
||||||
...prefixProp(key, style[key as keyof CSSProperties]),
|
...prefixProp(key, style[key as keyof CSSProperties]),
|
||||||
}
|
}
|
||||||
: obj,
|
: obj,
|
||||||
style
|
style,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,12 @@
|
||||||
<title>Sample App</title>
|
<title>Sample App</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: SF UI Text, Roboto, Helvetica Neue, Helvetica, sans-serif;
|
font-family:
|
||||||
|
SF UI Text,
|
||||||
|
Roboto,
|
||||||
|
Helvetica Neue,
|
||||||
|
Helvetica,
|
||||||
|
sans-serif;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ function isRange(rangeOrEntry: Range | Entry): rangeOrEntry is Range {
|
||||||
function renderChildNodes(
|
function renderChildNodes(
|
||||||
props: RenderChildNodesProps,
|
props: RenderChildNodesProps,
|
||||||
from?: number,
|
from?: number,
|
||||||
to?: number
|
to?: number,
|
||||||
) {
|
) {
|
||||||
const {
|
const {
|
||||||
nodeType,
|
nodeType,
|
||||||
|
@ -52,7 +52,7 @@ function renderChildNodes(
|
||||||
sortObjectKeys,
|
sortObjectKeys,
|
||||||
collectionLimit,
|
collectionLimit,
|
||||||
from,
|
from,
|
||||||
to
|
to,
|
||||||
).forEach((entry) => {
|
).forEach((entry) => {
|
||||||
if (isRange(entry)) {
|
if (isRange(entry)) {
|
||||||
childNodes.push(
|
childNodes.push(
|
||||||
|
@ -62,7 +62,7 @@ function renderChildNodes(
|
||||||
from={entry.from}
|
from={entry.from}
|
||||||
to={entry.to}
|
to={entry.to}
|
||||||
renderChildNodes={renderChildNodes}
|
renderChildNodes={renderChildNodes}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const { key, value } = entry;
|
const { key, value } = entry;
|
||||||
|
@ -78,7 +78,7 @@ function renderChildNodes(
|
||||||
circularCache={[...circularCache, value]}
|
circularCache={[...circularCache, value]}
|
||||||
isCircular={isCircular}
|
isCircular={isCircular}
|
||||||
hideRoot={false}
|
hideRoot={false}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -115,7 +115,7 @@ export default function JSONNestedNode(props: Props) {
|
||||||
|
|
||||||
const [expanded, setExpanded] = useState<boolean>(
|
const [expanded, setExpanded] = useState<boolean>(
|
||||||
// calculate individual node expansion if necessary
|
// calculate individual node expansion if necessary
|
||||||
isCircular ? false : shouldExpandNodeInitially(keyPath, data, level)
|
isCircular ? false : shouldExpandNodeInitially(keyPath, data, level),
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => {
|
||||||
|
@ -137,7 +137,7 @@ export default function JSONNestedNode(props: Props) {
|
||||||
data,
|
data,
|
||||||
itemType,
|
itemType,
|
||||||
createItemString(data, collectionLimit),
|
createItemString(data, collectionLimit),
|
||||||
keyPath
|
keyPath,
|
||||||
);
|
);
|
||||||
const stylingArgs = [keyPath, nodeType, expanded, expandable] as const;
|
const stylingArgs = [keyPath, nodeType, expanded, expandable] as const;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ function getEntries(
|
||||||
collection: any,
|
collection: any,
|
||||||
sortObjectKeys: SortObjectKeys,
|
sortObjectKeys: SortObjectKeys,
|
||||||
from = 0,
|
from = 0,
|
||||||
to = Infinity
|
to = Infinity,
|
||||||
): { entries: { key: string | number; value: unknown }[]; hasMore?: boolean } {
|
): { entries: { key: string | number; value: unknown }[]; hasMore?: boolean } {
|
||||||
let res;
|
let res;
|
||||||
|
|
||||||
|
@ -101,13 +101,13 @@ export default function getCollectionEntries(
|
||||||
sortObjectKeys: SortObjectKeys,
|
sortObjectKeys: SortObjectKeys,
|
||||||
limit: number,
|
limit: number,
|
||||||
from = 0,
|
from = 0,
|
||||||
to = Infinity
|
to = Infinity,
|
||||||
) {
|
) {
|
||||||
const getEntriesBound = getEntries.bind(
|
const getEntriesBound = getEntries.bind(
|
||||||
null,
|
null,
|
||||||
type,
|
type,
|
||||||
collection,
|
collection,
|
||||||
sortObjectKeys
|
sortObjectKeys,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!limit) {
|
if (!limit) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ export function JSONTree({
|
||||||
const styling = useMemo(
|
const styling = useMemo(
|
||||||
() =>
|
() =>
|
||||||
createStylingFromTheme(shouldInvertTheme ? invertTheme(theme) : theme),
|
createStylingFromTheme(shouldInvertTheme ? invertTheme(theme) : theme),
|
||||||
[theme, shouldInvertTheme]
|
[theme, shouldInvertTheme],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -10,14 +10,14 @@ export type GetItemString = (
|
||||||
data: unknown,
|
data: unknown,
|
||||||
itemType: React.ReactNode,
|
itemType: React.ReactNode,
|
||||||
itemString: string,
|
itemString: string,
|
||||||
keyPath: KeyPath
|
keyPath: KeyPath,
|
||||||
) => React.ReactNode;
|
) => React.ReactNode;
|
||||||
|
|
||||||
export type LabelRenderer = (
|
export type LabelRenderer = (
|
||||||
keyPath: KeyPath,
|
keyPath: KeyPath,
|
||||||
nodeType: string,
|
nodeType: string,
|
||||||
expanded: boolean,
|
expanded: boolean,
|
||||||
expandable: boolean
|
expandable: boolean,
|
||||||
) => React.ReactNode;
|
) => React.ReactNode;
|
||||||
|
|
||||||
export type ValueRenderer = (
|
export type ValueRenderer = (
|
||||||
|
@ -29,7 +29,7 @@ export type ValueRenderer = (
|
||||||
export type ShouldExpandNodeInitially = (
|
export type ShouldExpandNodeInitially = (
|
||||||
keyPath: KeyPath,
|
keyPath: KeyPath,
|
||||||
data: unknown,
|
data: unknown,
|
||||||
level: number
|
level: number,
|
||||||
) => boolean;
|
) => boolean;
|
||||||
|
|
||||||
export type PostprocessValue = (value: unknown) => unknown;
|
export type PostprocessValue = (value: unknown) => unknown;
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe('objType', () => {
|
||||||
expect(
|
expect(
|
||||||
objType(() => {
|
objType(() => {
|
||||||
// noop
|
// noop
|
||||||
})
|
}),
|
||||||
).toBe('Function');
|
).toBe('Function');
|
||||||
expect(objType('')).toBe('String');
|
expect(objType('')).toBe('String');
|
||||||
expect(objType(true)).toBe('Boolean');
|
expect(objType(true)).toBe('Boolean');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||||
|
|
|
@ -53,7 +53,7 @@ import { LiftedState } from '@redux-devtools/core';
|
||||||
let monitorReducer: (
|
let monitorReducer: (
|
||||||
monitorProps: unknown,
|
monitorProps: unknown,
|
||||||
state: unknown | undefined,
|
state: unknown | undefined,
|
||||||
action: Action<unknown>
|
action: Action<unknown>,
|
||||||
) => unknown;
|
) => unknown;
|
||||||
let monitorProps: unknown = {};
|
let monitorProps: unknown = {};
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ export interface ChangeStateTreeSettingsAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function changeStateTreeSettings(
|
export function changeStateTreeSettings(
|
||||||
data: ChangeStateTreeSettingsData
|
data: ChangeStateTreeSettingsData,
|
||||||
): ChangeStateTreeSettingsAction {
|
): ChangeStateTreeSettingsAction {
|
||||||
return { type: CHANGE_STATE_TREE_SETTINGS, ...data.formData };
|
return { type: CHANGE_STATE_TREE_SETTINGS, ...data.formData };
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ export interface InitMonitorAction {
|
||||||
update: (
|
update: (
|
||||||
monitorProps: unknown,
|
monitorProps: unknown,
|
||||||
state: unknown | undefined,
|
state: unknown | undefined,
|
||||||
action: Action<unknown>
|
action: Action<unknown>,
|
||||||
) => unknown;
|
) => unknown;
|
||||||
monitorProps: unknown;
|
monitorProps: unknown;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ export interface MonitorActionAction {
|
||||||
monitorReducer: (
|
monitorReducer: (
|
||||||
monitorProps: unknown,
|
monitorProps: unknown,
|
||||||
state: unknown | undefined,
|
state: unknown | undefined,
|
||||||
action: Action<unknown>
|
action: Action<unknown>,
|
||||||
) => unknown;
|
) => unknown;
|
||||||
monitorProps: unknown;
|
monitorProps: unknown;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ export function liftedDispatch(
|
||||||
| InitMonitorAction
|
| InitMonitorAction
|
||||||
| JumpToStateAction
|
| JumpToStateAction
|
||||||
| JumpToActionAction
|
| JumpToActionAction
|
||||||
| LiftedAction<unknown, Action<unknown>, unknown>
|
| LiftedAction<unknown, Action<unknown>, unknown>,
|
||||||
): MonitorActionAction | LiftedActionDispatchAction {
|
): MonitorActionAction | LiftedActionDispatchAction {
|
||||||
if (action.type[0] === '@') {
|
if (action.type[0] === '@') {
|
||||||
if (action.type === '@@INIT_MONITOR') {
|
if (action.type === '@@INIT_MONITOR') {
|
||||||
|
@ -250,7 +250,7 @@ export function selectMonitor(monitor: string): SelectMonitorAction {
|
||||||
}
|
}
|
||||||
export function selectMonitorWithState(
|
export function selectMonitorWithState(
|
||||||
value: string,
|
value: string,
|
||||||
monitorState: MonitorStateMonitorState
|
monitorState: MonitorStateMonitorState,
|
||||||
): SelectMonitorAction {
|
): SelectMonitorAction {
|
||||||
return { type: SELECT_MONITOR, monitor: value, monitorState };
|
return { type: SELECT_MONITOR, monitor: value, monitorState };
|
||||||
}
|
}
|
||||||
|
@ -268,14 +268,14 @@ export function selectMonitorTab(subTabName: string): UpdateMonitorStateAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateMonitorState(
|
export function updateMonitorState(
|
||||||
nextState: NextState
|
nextState: NextState,
|
||||||
): UpdateMonitorStateAction {
|
): UpdateMonitorStateAction {
|
||||||
return { type: UPDATE_MONITOR_STATE, nextState };
|
return { type: UPDATE_MONITOR_STATE, nextState };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function importState(
|
export function importState(
|
||||||
state: string,
|
state: string,
|
||||||
preloadedState?: unknown
|
preloadedState?: unknown,
|
||||||
): LiftedActionImportAction {
|
): LiftedActionImportAction {
|
||||||
return { type: LIFTED_ACTION, message: 'IMPORT', state, preloadedState };
|
return { type: LIFTED_ACTION, message: 'IMPORT', state, preloadedState };
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ export interface CustomAction {
|
||||||
rest: string;
|
rest: string;
|
||||||
}
|
}
|
||||||
export function dispatchRemotely(
|
export function dispatchRemotely(
|
||||||
action: string | CustomAction
|
action: string | CustomAction,
|
||||||
): LiftedActionActionAction {
|
): LiftedActionActionAction {
|
||||||
return { type: LIFTED_ACTION, message: 'ACTION', action };
|
return { type: LIFTED_ACTION, message: 'ACTION', action };
|
||||||
}
|
}
|
||||||
|
@ -365,7 +365,7 @@ export interface ReconnectAction {
|
||||||
readonly options: ConnectionOptions;
|
readonly options: ConnectionOptions;
|
||||||
}
|
}
|
||||||
export function saveSocketSettings(
|
export function saveSocketSettings(
|
||||||
options: ConnectionOptions
|
options: ConnectionOptions,
|
||||||
): ReconnectAction {
|
): ReconnectAction {
|
||||||
return { type: RECONNECT, options };
|
return { type: RECONNECT, options };
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Header extends Component<Props> {
|
||||||
title="Documentation"
|
title="Documentation"
|
||||||
tooltipPosition="bottom"
|
tooltipPosition="bottom"
|
||||||
onClick={this.openLink(
|
onClick={this.openLink(
|
||||||
'https://github.com/reduxjs/redux-devtools/blob/main/README.md'
|
'https://github.com/reduxjs/redux-devtools/blob/main/README.md',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<GoBook />
|
<GoBook />
|
||||||
|
@ -44,7 +44,7 @@ class Header extends Component<Props> {
|
||||||
title="Feedback"
|
title="Feedback"
|
||||||
tooltipPosition="bottom"
|
tooltipPosition="bottom"
|
||||||
onClick={this.openLink(
|
onClick={this.openLink(
|
||||||
'https://github.com/reduxjs/redux-devtools/discussions'
|
'https://github.com/reduxjs/redux-devtools/discussions',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<IoMdText />
|
<IoMdText />
|
||||||
|
@ -60,7 +60,7 @@ class Header extends Component<Props> {
|
||||||
title="Support us"
|
title="Support us"
|
||||||
tooltipPosition="bottom-left"
|
tooltipPosition="bottom-left"
|
||||||
onClick={this.openLink(
|
onClick={this.openLink(
|
||||||
'https://opencollective.com/redux-devtools-extension'
|
'https://opencollective.com/redux-devtools-extension',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<TiHeartFullOutline />
|
<TiHeartFullOutline />
|
||||||
|
|
|
@ -25,7 +25,7 @@ class InstanceSelector extends Component<Props> {
|
||||||
options={this.select}
|
options={this.select}
|
||||||
onChange={(option) => this.props.onSelect(option!.value)}
|
onChange={(option) => this.props.onSelect(option!.value)}
|
||||||
value={this.select.find(
|
value={this.select.find(
|
||||||
(option) => option.value === this.props.selected
|
(option) => option.value === this.props.selected,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,7 +34,7 @@ class LockButton extends Component<Props> {
|
||||||
|
|
||||||
function mapDispatchToProps(
|
function mapDispatchToProps(
|
||||||
dispatch: Dispatch<StoreAction>,
|
dispatch: Dispatch<StoreAction>,
|
||||||
ownProps: OwnProps
|
ownProps: OwnProps,
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
lockChanges: () => dispatch(lockChanges(!ownProps.locked)),
|
lockChanges: () => dispatch(lockChanges(!ownProps.locked)),
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default class PrintButton extends Component {
|
||||||
const initTransform = g.getAttribute('transform')!;
|
const initTransform = g.getAttribute('transform')!;
|
||||||
g.setAttribute(
|
g.setAttribute(
|
||||||
'transform',
|
'transform',
|
||||||
initTransform.replace(/.+scale\(/, 'translate(57, 10) scale(')
|
initTransform.replace(/.+scale\(/, 'translate(57, 10) scale('),
|
||||||
);
|
);
|
||||||
|
|
||||||
window.print();
|
window.print();
|
||||||
|
|
|
@ -32,7 +32,7 @@ class RecordButton extends Component<Props> {
|
||||||
|
|
||||||
function mapDispatchToProps(
|
function mapDispatchToProps(
|
||||||
dispatch: Dispatch<StoreAction>,
|
dispatch: Dispatch<StoreAction>,
|
||||||
ownProps: OwnProps
|
ownProps: OwnProps,
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
pauseRecording: () => dispatch(pauseRecording(!ownProps.paused)),
|
pauseRecording: () => dispatch(pauseRecording(!ownProps.paused)),
|
||||||
|
|
|
@ -14,7 +14,7 @@ interface Props {
|
||||||
liftedState: State;
|
liftedState: State;
|
||||||
monitorState: MonitorStateMonitorState | undefined;
|
monitorState: MonitorStateMonitorState | undefined;
|
||||||
dispatch: (
|
dispatch: (
|
||||||
action: LiftedAction<unknown, Action<unknown>, unknown> | InitMonitorAction
|
action: LiftedAction<unknown, Action<unknown>, unknown> | InitMonitorAction,
|
||||||
) => void;
|
) => void;
|
||||||
features: Features | undefined;
|
features: Features | undefined;
|
||||||
theme: ThemeFromProvider;
|
theme: ThemeFromProvider;
|
||||||
|
@ -29,7 +29,7 @@ class DevTools extends Component<Props> {
|
||||||
update(
|
update(
|
||||||
monitorProps: unknown,
|
monitorProps: unknown,
|
||||||
state: unknown | undefined,
|
state: unknown | undefined,
|
||||||
action: Action<unknown>
|
action: Action<unknown>,
|
||||||
): unknown;
|
): unknown;
|
||||||
};
|
};
|
||||||
preventRender?: boolean;
|
preventRender?: boolean;
|
||||||
|
@ -58,7 +58,7 @@ class DevTools extends Component<Props> {
|
||||||
newMonitorState = update(
|
newMonitorState = update(
|
||||||
this.monitorProps,
|
this.monitorProps,
|
||||||
undefined,
|
undefined,
|
||||||
{} as Action<unknown>
|
{} as Action<unknown>,
|
||||||
);
|
);
|
||||||
if (newMonitorState !== monitorState) {
|
if (newMonitorState !== monitorState) {
|
||||||
this.preventRender = true;
|
this.preventRender = true;
|
||||||
|
@ -88,7 +88,7 @@ class DevTools extends Component<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch = (
|
dispatch = (
|
||||||
action: LiftedAction<unknown, Action<unknown>, unknown> | InitMonitorAction
|
action: LiftedAction<unknown, Action<unknown>, unknown> | InitMonitorAction,
|
||||||
) => {
|
) => {
|
||||||
this.props.dispatch(action);
|
this.props.dispatch(action);
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { selectMonitorWithState } from '../../actions';
|
||||||
|
|
||||||
export function getPath(
|
export function getPath(
|
||||||
obj: HierarchyPointNode<Node>,
|
obj: HierarchyPointNode<Node>,
|
||||||
inspectedStatePath: string[]
|
inspectedStatePath: string[],
|
||||||
) {
|
) {
|
||||||
const parent = obj.parent;
|
const parent = obj.parent;
|
||||||
if (!parent) return;
|
if (!parent) return;
|
||||||
|
|
|
@ -93,7 +93,7 @@ class Dispatcher extends Component<Props, State> {
|
||||||
if (selected === 'actions-help') {
|
if (selected === 'actions-help') {
|
||||||
window.open(
|
window.open(
|
||||||
'https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/' +
|
'https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/' +
|
||||||
'API/Arguments.md#actioncreators'
|
'API/Arguments.md#actioncreators',
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ class Dispatcher extends Component<Props, State> {
|
||||||
actionCreators.map(({ name, args }, i) => ({
|
actionCreators.map(({ name, args }, i) => ({
|
||||||
value: i,
|
value: i,
|
||||||
label: `${name}(${args.join(', ')})`,
|
label: `${name}(${args.join(', ')})`,
|
||||||
}))
|
})),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
options.push({
|
options.push({
|
||||||
|
|
|
@ -21,7 +21,7 @@ export class Root extends Component {
|
||||||
type: CONNECT_REQUEST,
|
type: CONNECT_REQUEST,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
this.store = store;
|
this.store = store;
|
||||||
this.persistor = persistor;
|
this.persistor = persistor;
|
||||||
|
|
|
@ -61,7 +61,7 @@ function dispatchRemoteAction({
|
||||||
instanceId,
|
instanceId,
|
||||||
action as DispatchAction,
|
action as DispatchAction,
|
||||||
state,
|
state,
|
||||||
instances
|
instances,
|
||||||
),
|
),
|
||||||
instanceId,
|
instanceId,
|
||||||
id,
|
id,
|
||||||
|
@ -136,7 +136,7 @@ function monitoring(request: MonitoringRequest) {
|
||||||
|
|
||||||
function subscribe(
|
function subscribe(
|
||||||
channelName: string,
|
channelName: string,
|
||||||
subscription: typeof UPDATE_STATE | typeof UPDATE_REPORTS
|
subscription: typeof UPDATE_STATE | typeof UPDATE_REPORTS,
|
||||||
) {
|
) {
|
||||||
const channel = socket.subscribe(channelName);
|
const channel = socket.subscribe(channelName);
|
||||||
if (subscription === UPDATE_STATE) {
|
if (subscription === UPDATE_STATE) {
|
||||||
|
@ -221,7 +221,7 @@ function connect() {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
store.dispatch({ type: actions.CONNECT_ERROR, error: error as Error });
|
store.dispatch({ type: actions.CONNECT_ERROR, error: error as Error });
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
showNotification((error as Error).message || (error as string))
|
showNotification((error as Error).message || (error as string)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ export const exportStateMiddleware =
|
||||||
preloadedState: request.committedState,
|
preloadedState: request.committedState,
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
'\t'
|
'\t',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (action.type === EXPORT) {
|
} else if (action.type === EXPORT) {
|
||||||
|
@ -54,7 +54,7 @@ export const exportStateMiddleware =
|
||||||
const options = instances.options[instanceId];
|
const options = instances.options[instanceId];
|
||||||
if (options.features.export === true) {
|
if (options.features.export === true) {
|
||||||
download(
|
download(
|
||||||
stringifyJSON(instances.states[instanceId], options.serialize)
|
stringifyJSON(instances.states[instanceId], options.serialize),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
toExport = instanceId;
|
toExport = instanceId;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user