@nordicsemiconductor/pc-nrfconnect-shared 60.0.0-pre1 → 60.0.0-pre2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap.css +8951 -0
- package/dist/index.css +1451 -0
- package/dist/index.js +122119 -0
- package/{src/Logo/nordic-logo-blue-icon-only.png → dist/nordic-logo-blue-icon-only-H7BABN6D.png} +0 -0
- package/{src/Logo/nordic-logo-gray-icon-only.png → dist/nordic-logo-gray-icon-only-GATOTR3L.png} +0 -0
- package/package.json +12 -3
- package/typings/generated/src/Device/deviceInfo/deviceInfo.d.ts +1 -2
- package/.github/ISSUE_TEMPLATE/custom.md +0 -10
- package/.husky/pre-push +0 -3
- package/.renovaterc.json +0 -10
- package/Changelog.md +0 -2973
- package/azure-pipelines.yml +0 -34
- package/config/eslintrc.js +0 -190
- package/config/jest.config.js +0 -41
- package/config/prettier.config.js +0 -13
- package/config/tsconfig.json +0 -15
- package/fw/bootloader/graviton_bootloader_v1.0.1-[nRF5_SDK_15.0.1-1.alpha_f76d012].zip +0 -0
- package/jest.config.js +0 -7
- package/main/index.ts +0 -32
- package/mocks/deviceLibMock.ts +0 -21
- package/mocks/electronMock.ts +0 -15
- package/mocks/electronStoreMock.ts +0 -19
- package/mocks/emptyMock.ts +0 -7
- package/mocks/fileMock.ts +0 -13
- package/mocks/gaMock.ts +0 -9
- package/mocks/mockTests.test.ts +0 -15
- package/mocks/packageJsonMock.ts +0 -10
- package/mocks/remoteMock.ts +0 -17
- package/scripts/esbuild-bootstrap.js +0 -15
- package/scripts/esbuild-renderer.js +0 -131
- package/scripts/installHusky.ts +0 -17
- package/scripts/prepare-shared-release.ts +0 -122
- package/scripts/release-shared.test.ts +0 -132
- package/scripts/release-shared.ts +0 -207
- package/src/About/About.tsx +0 -25
- package/src/About/AboutButton.tsx +0 -28
- package/src/About/ApplicationCard.tsx +0 -83
- package/src/About/DeviceCard.tsx +0 -74
- package/src/About/DocumentationCard.tsx +0 -18
- package/src/About/DocumentationSection.tsx +0 -24
- package/src/About/Section.tsx +0 -21
- package/src/About/ShortcutButton.tsx +0 -41
- package/src/About/SupportCard.tsx +0 -97
- package/src/About/about.scss +0 -40
- package/src/About/documentationSlice.ts +0 -41
- package/src/About/section.scss +0 -15
- package/src/About/shortcutSlice.ts +0 -52
- package/src/Alert/Alert.module.scss +0 -29
- package/src/Alert/Alert.tsx +0 -37
- package/src/App/App.test.tsx +0 -47
- package/src/App/App.tsx +0 -227
- package/src/App/ConnectedToStore.tsx +0 -19
- package/src/App/VisibilityBar.tsx +0 -103
- package/src/App/app.scss +0 -83
- package/src/App/appLayout.ts +0 -95
- package/src/App/shared.scss +0 -49
- package/src/App/visibility-bar.scss +0 -55
- package/src/Button/Button.tsx +0 -66
- package/src/Button/button.module.scss +0 -154
- package/src/Card/Card.tsx +0 -26
- package/src/Card/card.module.scss +0 -28
- package/src/Device/BrokenDeviceDialog/BrokenDeviceDialog.tsx +0 -58
- package/src/Device/BrokenDeviceDialog/broken-device-dialog.scss +0 -18
- package/src/Device/BrokenDeviceDialog/brokenDeviceDialogSlice.tsx +0 -48
- package/src/Device/DeviceSelector/BasicDeviceInfo.tsx +0 -115
- package/src/Device/DeviceSelector/DeviceIcon.tsx +0 -27
- package/src/Device/DeviceSelector/DeviceList/AnimatedList.tsx +0 -62
- package/src/Device/DeviceSelector/DeviceList/BrokenDevice.tsx +0 -34
- package/src/Device/DeviceSelector/DeviceList/Device.tsx +0 -84
- package/src/Device/DeviceSelector/DeviceList/DeviceList.tsx +0 -113
- package/src/Device/DeviceSelector/DeviceList/EditDeviceButtons.tsx +0 -28
- package/src/Device/DeviceSelector/DeviceList/MoreDeviceInfo.tsx +0 -65
- package/src/Device/DeviceSelector/DeviceList/RenameDevice.tsx +0 -22
- package/src/Device/DeviceSelector/DeviceList/broken-device.scss +0 -32
- package/src/Device/DeviceSelector/DeviceList/device-list.scss +0 -64
- package/src/Device/DeviceSelector/DeviceList/device.scss +0 -28
- package/src/Device/DeviceSelector/DeviceList/edit-device-buttons.scss +0 -31
- package/src/Device/DeviceSelector/DeviceList/more-device-info.scss +0 -33
- package/src/Device/DeviceSelector/DeviceList/rename-device.scss +0 -13
- package/src/Device/DeviceSelector/DeviceSelector.test.tsx +0 -342
- package/src/Device/DeviceSelector/DeviceSelector.tsx +0 -173
- package/src/Device/DeviceSelector/Favorite.tsx +0 -49
- package/src/Device/DeviceSelector/SelectDevice.tsx +0 -36
- package/src/Device/DeviceSelector/SelectedDevice.tsx +0 -65
- package/src/Device/DeviceSelector/arrow-down.svg +0 -1
- package/src/Device/DeviceSelector/basic-device-info.scss +0 -62
- package/src/Device/DeviceSelector/device-icon.scss +0 -27
- package/src/Device/DeviceSelector/favorite.scss +0 -17
- package/src/Device/DeviceSelector/select-device.scss +0 -38
- package/src/Device/DeviceSelector/selected-device.scss +0 -57
- package/src/Device/DeviceSetup/DeviceSetupView.tsx +0 -102
- package/src/Device/deviceAutoSelectSlice.ts +0 -144
- package/src/Device/deviceInfo/deviceInfo.ts +0 -254
- package/src/Device/deviceInfo/nRF51-Series-logo.svg +0 -1
- package/src/Device/deviceInfo/nRF52-Series-logo.svg +0 -1
- package/src/Device/deviceInfo/nRF53-Series-logo.svg +0 -1
- package/src/Device/deviceInfo/nRF70-Series_no-background_RGB.svg +0 -36
- package/src/Device/deviceInfo/nRF91-Series-logo.svg +0 -1
- package/src/Device/deviceInfo/ppk-logo.svg +0 -1
- package/src/Device/deviceInfo/unknown-logo.svg +0 -30
- package/src/Device/deviceInfo/unknown-nordic-logo.svg +0 -25
- package/src/Device/deviceLibWrapper.test.ts +0 -97
- package/src/Device/deviceLibWrapper.ts +0 -133
- package/src/Device/deviceLister.test.ts +0 -89
- package/src/Device/deviceLister.ts +0 -396
- package/src/Device/deviceSetup.ts +0 -264
- package/src/Device/deviceSetupSlice.ts +0 -94
- package/src/Device/deviceSlice.ts +0 -248
- package/src/Device/dfu-cc.ts +0 -162
- package/src/Device/initPacket.ts +0 -402
- package/src/Device/jprogOperations.ts +0 -206
- package/src/Device/sdfuOperations.ts +0 -601
- package/src/Dialog/Dialog.test.tsx +0 -134
- package/src/Dialog/Dialog.tsx +0 -236
- package/src/Dialog/dialog.scss +0 -60
- package/src/Dropdown/Dropdown.module.scss +0 -83
- package/src/Dropdown/Dropdown.test.tsx +0 -62
- package/src/Dropdown/Dropdown.tsx +0 -106
- package/src/ErrorBoundary/ErrorBoundary.test.tsx +0 -105
- package/src/ErrorBoundary/ErrorBoundary.tsx +0 -186
- package/src/ErrorBoundary/bug.svg +0 -1
- package/src/ErrorBoundary/error-boundary.scss +0 -102
- package/src/ErrorDialog/ErrorDialog.test.tsx +0 -70
- package/src/ErrorDialog/ErrorDialog.tsx +0 -94
- package/src/ErrorDialog/error.scss +0 -14
- package/src/ErrorDialog/errorDialogSlice.test.ts +0 -64
- package/src/ErrorDialog/errorDialogSlice.ts +0 -80
- package/src/FactoryReset/FactoryResetButton.test.tsx +0 -46
- package/src/FactoryReset/FactoryResetButton.tsx +0 -81
- package/src/InlineInput/InlineInput.tsx +0 -170
- package/src/InlineInput/NumberInlineInput.tsx +0 -107
- package/src/InlineInput/inline-input.scss +0 -38
- package/src/InlineInput/number-inline-input.scss +0 -15
- package/src/Log/LogEntry.tsx +0 -62
- package/src/Log/LogViewer.tsx +0 -54
- package/src/Log/log-entry.scss +0 -30
- package/src/Log/log-viewer.scss +0 -24
- package/src/Log/logSlice.ts +0 -73
- package/src/Log/syncLogToStore.ts +0 -36
- package/src/Logo/Logo.tsx +0 -48
- package/src/Logo/logo.scss +0 -11
- package/src/Main/Main.tsx +0 -13
- package/src/Main/main.scss +0 -13
- package/src/MasonryLayout/MasonryLayout.tsx +0 -234
- package/src/MasonryLayout/masonryLayout.module.scss +0 -46
- package/src/NavBar/NavBar.tsx +0 -22
- package/src/NavBar/NavMenu.test.tsx +0 -41
- package/src/NavBar/NavMenu.tsx +0 -53
- package/src/NavBar/NavMenuItem.tsx +0 -41
- package/src/NavBar/nav-bar.scss +0 -26
- package/src/NavBar/nav-menu-item.scss +0 -34
- package/src/OpenApp/openApp.ts +0 -18
- package/src/Panes/FeedbackPane.tsx +0 -149
- package/src/PseudoButton/PseudoButton.tsx +0 -56
- package/src/PseudoButton/pseudo-button.scss +0 -11
- package/src/SerialPort/ConflictingSettingsDialog.tsx +0 -242
- package/src/SerialPort/SerialPort.test.ts +0 -54
- package/src/SerialPort/SerialPort.ts +0 -202
- package/src/Shortcuts/Shortcut-item.scss +0 -33
- package/src/Shortcuts/Shortcut-modal.scss +0 -20
- package/src/Shortcuts/ShortcutItem.tsx +0 -48
- package/src/Shortcuts/ShortcutModal.tsx +0 -67
- package/src/SidePanel/Group.tsx +0 -106
- package/src/SidePanel/SidePanel.tsx +0 -19
- package/src/SidePanel/group.scss +0 -42
- package/src/SidePanel/sidepanel.scss +0 -20
- package/src/Slider/Bar.tsx +0 -24
- package/src/Slider/Factor.test.ts +0 -48
- package/src/Slider/Handle.tsx +0 -121
- package/src/Slider/Slider.test.tsx +0 -25
- package/src/Slider/Slider.tsx +0 -91
- package/src/Slider/Ticks.tsx +0 -54
- package/src/Slider/__snapshots__/Slider.test.tsx.snap +0 -50
- package/src/Slider/bar.scss +0 -24
- package/src/Slider/factor.ts +0 -24
- package/src/Slider/handle.scss +0 -32
- package/src/Slider/percentage.ts +0 -67
- package/src/Slider/range.ts +0 -92
- package/src/Slider/slider.scss +0 -14
- package/src/Slider/ticks.scss +0 -28
- package/src/Slider/variables.scss +0 -16
- package/src/StartStopButton/StartStopButton.tsx +0 -60
- package/src/StartStopButton/play-circle.svg +0 -1
- package/src/StartStopButton/start-stop-button.scss +0 -47
- package/src/StartStopButton/stop-circle.svg +0 -1
- package/src/StateSelector/StateSelector.tsx +0 -64
- package/src/StateSelector/state-selector.scss +0 -38
- package/src/Stepper/Stepper.tsx +0 -139
- package/src/Stepper/stepper.scss +0 -127
- package/src/Toggle/Toggle.tsx +0 -120
- package/src/Toggle/toggle.scss +0 -109
- package/src/bootstrap.scss +0 -14
- package/src/index.ts +0 -146
- package/src/logging/appTransport.test.ts +0 -78
- package/src/logging/appTransport.ts +0 -41
- package/src/logging/describeError.test.ts +0 -38
- package/src/logging/describeError.ts +0 -56
- package/src/logging/index.ts +0 -103
- package/src/logging/logBuffer.test.ts +0 -41
- package/src/logging/logBuffer.ts +0 -24
- package/src/logging/sendInitialLogMessages.ts +0 -64
- package/src/store.ts +0 -60
- package/src/svg.d.ts +0 -15
- package/src/utils/AppTypes.ts +0 -60
- package/src/utils/appDirs.ts +0 -78
- package/src/utils/bleChannels.ts +0 -16
- package/src/utils/classNames.test.ts +0 -29
- package/src/utils/classNames.ts +0 -25
- package/src/utils/colors.scss +0 -46
- package/src/utils/colors.ts +0 -38
- package/src/utils/describeVersion.ts +0 -21
- package/src/utils/environment.ts +0 -6
- package/src/utils/logLibVersions.ts +0 -103
- package/src/utils/open.ts +0 -46
- package/src/utils/packageJson.ts +0 -60
- package/src/utils/persistentStore.ts +0 -144
- package/src/utils/systemReport.ts +0 -160
- package/src/utils/truncateMiddle.test.ts +0 -21
- package/src/utils/truncateMiddle.ts +0 -20
- package/src/utils/usageData.ts +0 -189
- package/src/utils/useHotKey.ts +0 -62
- package/src/utils/useStopwatch.test.tsx +0 -311
- package/src/utils/useStopwatch.ts +0 -140
- package/src/variables.scss +0 -820
- package/styles.scss +0 -88
- package/test/dispatchTo.ts +0 -23
- package/test/index.ts +0 -7
- package/test/jestResolver.js +0 -28
- package/test/setupTests.ts +0 -27
- package/test/testUtil.ts +0 -20
- package/test/testrenderer.tsx +0 -39
- /package/{src/Logo/nordic-logo-white-icon-only.png → dist/nordic-logo-white-icon-only-XIZBW537.png} +0 -0
package/src/Log/log-viewer.scss
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
@import "../variables";
|
|
8
|
-
|
|
9
|
-
.core19-log {
|
|
10
|
-
position: relative;
|
|
11
|
-
overflow: auto;
|
|
12
|
-
height: $log-viewer-height;
|
|
13
|
-
|
|
14
|
-
scroll-snap-type: y mandatory;
|
|
15
|
-
|
|
16
|
-
> div {
|
|
17
|
-
display: table;
|
|
18
|
-
min-width: 100%;
|
|
19
|
-
|
|
20
|
-
scroll-snap-align: start;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@include scrollbars($gray-900);
|
|
24
|
-
}
|
package/src/Log/logSlice.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
8
|
-
import { LogEntry } from 'winston';
|
|
9
|
-
|
|
10
|
-
import type { RootState } from '../store';
|
|
11
|
-
import { getIsLoggingVerbose } from '../utils/persistentStore';
|
|
12
|
-
|
|
13
|
-
const MAX_ENTRIES = 1000;
|
|
14
|
-
|
|
15
|
-
export interface Log {
|
|
16
|
-
autoScroll: boolean;
|
|
17
|
-
logEntries: LogEntry[];
|
|
18
|
-
isLoggingVerbose: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const initialState: Log = {
|
|
22
|
-
autoScroll: true,
|
|
23
|
-
logEntries: [],
|
|
24
|
-
isLoggingVerbose: getIsLoggingVerbose(),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const infoEntry = () => ({
|
|
28
|
-
id: -1,
|
|
29
|
-
level: 'info',
|
|
30
|
-
timestamp: new Date().toISOString(),
|
|
31
|
-
message:
|
|
32
|
-
'The log in this view has been shortened. Open the log file to see the full content.',
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const limitedToMaxSize = (entries: LogEntry[]) =>
|
|
36
|
-
entries.length <= MAX_ENTRIES
|
|
37
|
-
? entries
|
|
38
|
-
: [infoEntry(), ...entries.slice(-MAX_ENTRIES)];
|
|
39
|
-
|
|
40
|
-
export const autoScroll = (state: RootState) => state.log.autoScroll;
|
|
41
|
-
export const logEntries = (state: RootState) => state.log.logEntries;
|
|
42
|
-
let isLoggingVerboseLocal = initialState.isLoggingVerbose;
|
|
43
|
-
export const isLoggingVerbose = () => isLoggingVerboseLocal;
|
|
44
|
-
export const isLoggingVerboseSelector = (state: RootState) =>
|
|
45
|
-
state.log.isLoggingVerbose;
|
|
46
|
-
|
|
47
|
-
const slice = createSlice({
|
|
48
|
-
name: 'log',
|
|
49
|
-
initialState,
|
|
50
|
-
reducers: {
|
|
51
|
-
addEntries: (state, action: PayloadAction<LogEntry[]>) => {
|
|
52
|
-
state.logEntries = limitedToMaxSize([
|
|
53
|
-
...state.logEntries,
|
|
54
|
-
...action.payload,
|
|
55
|
-
]);
|
|
56
|
-
},
|
|
57
|
-
clear: state => {
|
|
58
|
-
state.logEntries = [];
|
|
59
|
-
},
|
|
60
|
-
toggleAutoScroll: state => {
|
|
61
|
-
state.autoScroll = !state.autoScroll;
|
|
62
|
-
},
|
|
63
|
-
toggleIsLoggingVerbose: state => {
|
|
64
|
-
state.isLoggingVerbose = !state.isLoggingVerbose;
|
|
65
|
-
isLoggingVerboseLocal = state.isLoggingVerbose;
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
export const {
|
|
71
|
-
reducer,
|
|
72
|
-
actions: { addEntries, clear, toggleAutoScroll, toggleIsLoggingVerbose },
|
|
73
|
-
} = slice;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import logger from '../logging';
|
|
8
|
-
import { AppDispatch } from '../store';
|
|
9
|
-
import { addEntries } from './logSlice';
|
|
10
|
-
|
|
11
|
-
const addLogEntriesToStore = (dispatch: AppDispatch) => () => {
|
|
12
|
-
const entries = logger.getAndClearEntries();
|
|
13
|
-
if (entries.length > 0) {
|
|
14
|
-
dispatch(addEntries(entries));
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Starts syncing to new log entries from the application's log buffer.
|
|
20
|
-
* Incoming entries are added to the state, so that they can be displayed
|
|
21
|
-
* in the UI.
|
|
22
|
-
*
|
|
23
|
-
* @param {function} dispatch The redux dispatch function.
|
|
24
|
-
* @returns {function(*)} Function that stops the listener.
|
|
25
|
-
*/
|
|
26
|
-
export default (dispatch: AppDispatch) => {
|
|
27
|
-
const LOG_UPDATE_INTERVAL = 400;
|
|
28
|
-
const logListener = setInterval(
|
|
29
|
-
addLogEntriesToStore(dispatch),
|
|
30
|
-
LOG_UPDATE_INTERVAL
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
return () => {
|
|
34
|
-
clearInterval(logListener);
|
|
35
|
-
};
|
|
36
|
-
};
|
package/src/Logo/Logo.tsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { FC } from 'react';
|
|
8
|
-
import { useSelector } from 'react-redux';
|
|
9
|
-
|
|
10
|
-
import { deviceIsSelected as deviceIsSelectedSelector } from '../Device/deviceSlice';
|
|
11
|
-
import { openUrl } from '../utils/open';
|
|
12
|
-
import logoConnected from './nordic-logo-blue-icon-only.png';
|
|
13
|
-
import logoDisconnected from './nordic-logo-gray-icon-only.png';
|
|
14
|
-
import logoUniform from './nordic-logo-white-icon-only.png';
|
|
15
|
-
|
|
16
|
-
import './logo.scss';
|
|
17
|
-
|
|
18
|
-
const goToNRFConnectWebsite = () =>
|
|
19
|
-
openUrl('http://www.nordicsemi.com/nRFConnect');
|
|
20
|
-
|
|
21
|
-
const LogoImage: FC<{ src: string }> = ({ src }) => (
|
|
22
|
-
<img
|
|
23
|
-
className="core19-logo"
|
|
24
|
-
src={src}
|
|
25
|
-
alt="Nordic Semiconductor logo"
|
|
26
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
|
|
27
|
-
role="link"
|
|
28
|
-
onClick={goToNRFConnectWebsite}
|
|
29
|
-
onKeyPress={() => {}}
|
|
30
|
-
tabIndex={0}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const DynamicLogo = () => {
|
|
35
|
-
const deviceIsSelected = useSelector(deviceIsSelectedSelector);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<LogoImage src={deviceIsSelected ? logoConnected : logoDisconnected} />
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const StaticLogo = () => <LogoImage src={logoUniform} />;
|
|
43
|
-
|
|
44
|
-
const Logo: FC<{ changeWithDeviceState?: boolean }> = ({
|
|
45
|
-
changeWithDeviceState = false,
|
|
46
|
-
}) => (changeWithDeviceState ? <DynamicLogo /> : <StaticLogo />);
|
|
47
|
-
|
|
48
|
-
export default Logo;
|
package/src/Logo/logo.scss
DELETED
package/src/Main/Main.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { ReactNode } from 'react';
|
|
8
|
-
|
|
9
|
-
import './main.scss';
|
|
10
|
-
|
|
11
|
-
export default ({ children }: { children?: ReactNode }) => (
|
|
12
|
-
<div className="core19-main-view">{children}</div>
|
|
13
|
-
);
|
package/src/Main/main.scss
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
import React, { PropsWithChildren, useEffect, useRef, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import classNames from '../utils/classNames';
|
|
9
|
-
|
|
10
|
-
import styles from './masonryLayout.module.scss';
|
|
11
|
-
|
|
12
|
-
interface MasonryLayoutProperties {
|
|
13
|
-
minWidth: number;
|
|
14
|
-
className?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface WrappedChildrenProperties {
|
|
18
|
-
hiddenChildren: boolean[];
|
|
19
|
-
width: number;
|
|
20
|
-
columns: number;
|
|
21
|
-
minWidth: number;
|
|
22
|
-
orders: number[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const WrappedChildren = ({
|
|
26
|
-
children,
|
|
27
|
-
hiddenChildren,
|
|
28
|
-
width,
|
|
29
|
-
columns,
|
|
30
|
-
minWidth,
|
|
31
|
-
orders,
|
|
32
|
-
}: PropsWithChildren<WrappedChildrenProperties>) => (
|
|
33
|
-
<>
|
|
34
|
-
{React.Children.map(children, (child, i) => (
|
|
35
|
-
<div
|
|
36
|
-
data-hidden={hiddenChildren[i] === true ? 'true' : 'false'}
|
|
37
|
-
style={{
|
|
38
|
-
width: `${width / columns}px`,
|
|
39
|
-
minWidth,
|
|
40
|
-
order: `${orders[i] ?? 1}`,
|
|
41
|
-
pageBreakBefore: `${i < columns ? 'always' : 'auto'}`,
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
{child}
|
|
45
|
-
</div>
|
|
46
|
-
))}
|
|
47
|
-
</>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
interface FillersProperties {
|
|
51
|
-
maxHeight: number;
|
|
52
|
-
columns: number;
|
|
53
|
-
width: number;
|
|
54
|
-
columnHeights: number[];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const Fillers = ({
|
|
58
|
-
maxHeight,
|
|
59
|
-
columns,
|
|
60
|
-
width,
|
|
61
|
-
columnHeights,
|
|
62
|
-
}: FillersProperties) => (
|
|
63
|
-
<>
|
|
64
|
-
{columnHeights.map((h, i) =>
|
|
65
|
-
h !== maxHeight ? (
|
|
66
|
-
<div
|
|
67
|
-
data-filler="true"
|
|
68
|
-
key={`filler_${i + 0}`}
|
|
69
|
-
style={{
|
|
70
|
-
height: `${maxHeight - h}px`,
|
|
71
|
-
order: `${i + 1}`,
|
|
72
|
-
width: `${width / columns}px`,
|
|
73
|
-
}}
|
|
74
|
-
/>
|
|
75
|
-
) : null
|
|
76
|
-
)}
|
|
77
|
-
</>
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Builds a masonry layout around all depth 1 child components.
|
|
82
|
-
* Note: only depth 1 children are considered for the layout.
|
|
83
|
-
* This also applies for React.Fragment wrapped components.
|
|
84
|
-
* @param {number} minWidth minimum width of every item in this layout.
|
|
85
|
-
* @returns {React.FC<MasonryLayoutProperties>} React Component.
|
|
86
|
-
*/
|
|
87
|
-
export default ({
|
|
88
|
-
children,
|
|
89
|
-
minWidth,
|
|
90
|
-
className,
|
|
91
|
-
}: PropsWithChildren<MasonryLayoutProperties>) => {
|
|
92
|
-
const [width, setWidth] = useState(-1);
|
|
93
|
-
const [maxHeight, setMaxHeight] = useState(0);
|
|
94
|
-
const [columns, setColumns] = useState(-1);
|
|
95
|
-
const [orders, setOrders] = useState<number[]>([]);
|
|
96
|
-
const [hiddenChildren, setHiddenChildren] = useState<boolean[]>([]);
|
|
97
|
-
const [columnHeights, setColumnHeights] = useState<number[]>([]);
|
|
98
|
-
|
|
99
|
-
const masonryLayoutRef = useRef<HTMLDivElement>(null);
|
|
100
|
-
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
if (masonryLayoutRef.current === null) return;
|
|
103
|
-
|
|
104
|
-
const generateMetaData = (col: number) => {
|
|
105
|
-
let child = masonryLayoutRef.current?.firstElementChild;
|
|
106
|
-
const heightMatrix: number[][] = [];
|
|
107
|
-
const zeroHeightChildren: boolean[] = [];
|
|
108
|
-
|
|
109
|
-
let i = 0;
|
|
110
|
-
while (child) {
|
|
111
|
-
if (child instanceof HTMLElement) {
|
|
112
|
-
if (!child.hasAttribute('data-filler')) {
|
|
113
|
-
const rowIndex = Math.floor(i / col);
|
|
114
|
-
|
|
115
|
-
if (heightMatrix[rowIndex] === undefined) {
|
|
116
|
-
heightMatrix[rowIndex] = [];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const row = heightMatrix[rowIndex];
|
|
120
|
-
const columnIndex = i % col;
|
|
121
|
-
|
|
122
|
-
i += 1;
|
|
123
|
-
if (
|
|
124
|
-
child.offsetHeight <=
|
|
125
|
-
Number.parseInt(styles.margin, 10)
|
|
126
|
-
) {
|
|
127
|
-
row[columnIndex] = 0;
|
|
128
|
-
zeroHeightChildren.push(true);
|
|
129
|
-
} else {
|
|
130
|
-
row[columnIndex] = child.offsetHeight + 1;
|
|
131
|
-
zeroHeightChildren.push(false);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
child = child.nextElementSibling;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return { heightMatrix, hiddenChildren: zeroHeightChildren };
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const calcData = (col: number) => {
|
|
143
|
-
const metaData = generateMetaData(col);
|
|
144
|
-
const heights: number[] = Array(col).fill(0);
|
|
145
|
-
const newOrder: number[] = [];
|
|
146
|
-
|
|
147
|
-
metaData.heightMatrix.forEach(row => {
|
|
148
|
-
row.forEach(itemHeight => {
|
|
149
|
-
const smallest =
|
|
150
|
-
heights.findIndex(h => h === Math.min(...heights)) ?? 0;
|
|
151
|
-
heights[smallest] += itemHeight;
|
|
152
|
-
newOrder.push(smallest + 1);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
return {
|
|
157
|
-
maxHeight: Math.max(
|
|
158
|
-
...heights,
|
|
159
|
-
masonryLayoutRef.current?.scrollHeight ?? 0
|
|
160
|
-
),
|
|
161
|
-
order: newOrder,
|
|
162
|
-
columnHeights: heights,
|
|
163
|
-
columns: Math.min(
|
|
164
|
-
metaData.hiddenChildren.filter(v => !v).length,
|
|
165
|
-
col
|
|
166
|
-
),
|
|
167
|
-
maxColums: col,
|
|
168
|
-
hiddenChildren: metaData.hiddenChildren,
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const action = () => {
|
|
173
|
-
const noOfColumns = Math.floor(
|
|
174
|
-
current.clientWidth /
|
|
175
|
-
(minWidth + Number.parseInt(styles.margin, 10))
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
if (current.clientWidth !== width) {
|
|
179
|
-
setWidth(current.clientWidth);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const data = calcData(noOfColumns);
|
|
183
|
-
if (data) {
|
|
184
|
-
setOrders(data.order);
|
|
185
|
-
setColumnHeights(data.columnHeights);
|
|
186
|
-
setMaxHeight(data.maxHeight);
|
|
187
|
-
setHiddenChildren(data.hiddenChildren);
|
|
188
|
-
setColumns(data.columns);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const current = masonryLayoutRef.current;
|
|
193
|
-
|
|
194
|
-
const observer = new ResizeObserver(action);
|
|
195
|
-
observer.observe(masonryLayoutRef.current);
|
|
196
|
-
const mutationObserver = new MutationObserver(action);
|
|
197
|
-
mutationObserver.observe(masonryLayoutRef.current, {
|
|
198
|
-
childList: true,
|
|
199
|
-
subtree: true,
|
|
200
|
-
attributes: true,
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
return () => {
|
|
204
|
-
current && observer.unobserve(current);
|
|
205
|
-
current && mutationObserver.disconnect();
|
|
206
|
-
};
|
|
207
|
-
}, [columns, maxHeight, minWidth, width]);
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<div className={styles.masonryLayoutOut}>
|
|
211
|
-
<div
|
|
212
|
-
ref={masonryLayoutRef}
|
|
213
|
-
className={classNames(styles.masonryLayout, className)}
|
|
214
|
-
style={{ maxHeight: `${maxHeight}px` }}
|
|
215
|
-
>
|
|
216
|
-
<WrappedChildren
|
|
217
|
-
hiddenChildren={hiddenChildren}
|
|
218
|
-
width={width}
|
|
219
|
-
columns={columns}
|
|
220
|
-
minWidth={minWidth}
|
|
221
|
-
orders={orders}
|
|
222
|
-
>
|
|
223
|
-
{children}
|
|
224
|
-
</WrappedChildren>
|
|
225
|
-
<Fillers
|
|
226
|
-
maxHeight={maxHeight}
|
|
227
|
-
columns={columns}
|
|
228
|
-
width={width}
|
|
229
|
-
columnHeights={columnHeights}
|
|
230
|
-
/>
|
|
231
|
-
</div>
|
|
232
|
-
</div>
|
|
233
|
-
);
|
|
234
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
$margin: 8px; //px unit dependency in dropdown.tsx
|
|
8
|
-
|
|
9
|
-
:export {
|
|
10
|
-
margin: $margin;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.masonryLayoutOut {
|
|
14
|
-
overflow-x: hidden;
|
|
15
|
-
|
|
16
|
-
.masonryLayout {
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-flow: column wrap;
|
|
19
|
-
align-content: stretch;
|
|
20
|
-
height: fit-content;
|
|
21
|
-
width: calc(100% + $margin);
|
|
22
|
-
position: relative;
|
|
23
|
-
right: 4px;
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
|
|
26
|
-
> div {
|
|
27
|
-
border-bottom: $margin solid transparent;
|
|
28
|
-
border-left: calc($margin / 2) solid transparent;
|
|
29
|
-
border-right: calc($margin / 2) solid transparent;
|
|
30
|
-
border-color: transparent;
|
|
31
|
-
background-clip: padding-box;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
> div[data-filler='true'] {
|
|
35
|
-
border: none !important;
|
|
36
|
-
padding: 0 !important;
|
|
37
|
-
margin: 0 !important;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
> div[data-hidden='true'] {
|
|
41
|
-
border-bottom: 0 !important;
|
|
42
|
-
border-left: 0 !important;
|
|
43
|
-
border-right: 0 !important;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
package/src/NavBar/NavBar.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { ReactNode } from 'react';
|
|
8
|
-
|
|
9
|
-
import Logo from '../Logo/Logo';
|
|
10
|
-
import NavMenu from './NavMenu';
|
|
11
|
-
|
|
12
|
-
import './nav-bar.scss';
|
|
13
|
-
|
|
14
|
-
export default ({ deviceSelect }: { deviceSelect?: ReactNode }) => (
|
|
15
|
-
<div className="core19-nav-bar">
|
|
16
|
-
{deviceSelect && (
|
|
17
|
-
<div className="core19-nav-bar-device-selector">{deviceSelect}</div>
|
|
18
|
-
)}
|
|
19
|
-
<NavMenu />
|
|
20
|
-
<Logo changeWithDeviceState />
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { screen } from '@testing-library/react';
|
|
9
|
-
|
|
10
|
-
import render from '../../test/testrenderer';
|
|
11
|
-
import { setPanes } from '../App/appLayout';
|
|
12
|
-
import NavMenu from './NavMenu';
|
|
13
|
-
|
|
14
|
-
const aPane = {
|
|
15
|
-
name: 'an menu item',
|
|
16
|
-
Main: () => <div>A pane</div>,
|
|
17
|
-
};
|
|
18
|
-
const anotherPane = {
|
|
19
|
-
name: 'another menu item',
|
|
20
|
-
Main: () => <div>Another pane</div>,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
expect.extend({
|
|
24
|
-
toBeHighlighted(element) {
|
|
25
|
-
const pass = element.classList.contains('selected');
|
|
26
|
-
const not = pass ? 'not ' : '';
|
|
27
|
-
const message = () =>
|
|
28
|
-
`Expected the element to ${not}contain a class 'selected' to signify that ` +
|
|
29
|
-
`it is ${not}highlighted. It actually contained: ${element.className}`;
|
|
30
|
-
return { pass, message };
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe('NavMenu', () => {
|
|
35
|
-
it('displays multiple items', () => {
|
|
36
|
-
render(<NavMenu />, [setPanes([aPane, anotherPane])]);
|
|
37
|
-
|
|
38
|
-
expect(screen.getByText('an menu item')).toBeInTheDocument();
|
|
39
|
-
expect(screen.getByText('another menu item')).toBeInTheDocument();
|
|
40
|
-
});
|
|
41
|
-
});
|
package/src/NavBar/NavMenu.tsx
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
currentPane as currentPaneSelector,
|
|
12
|
-
paneNames as paneNamesSelector,
|
|
13
|
-
switchToNextPane,
|
|
14
|
-
switchToPreviousPane,
|
|
15
|
-
} from '../App/appLayout';
|
|
16
|
-
import useHotKey from '../utils/useHotKey';
|
|
17
|
-
import NavMenuItem from './NavMenuItem';
|
|
18
|
-
|
|
19
|
-
const NavMenu = () => {
|
|
20
|
-
const currentPane = useSelector(currentPaneSelector);
|
|
21
|
-
const paneNames = useSelector(paneNamesSelector);
|
|
22
|
-
const dispatch = useDispatch();
|
|
23
|
-
|
|
24
|
-
useHotKey({
|
|
25
|
-
hotKey: 'ctrl+tab',
|
|
26
|
-
title: 'Switch pane right',
|
|
27
|
-
isGlobal: true,
|
|
28
|
-
action: () => dispatch(switchToNextPane()),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
useHotKey({
|
|
32
|
-
hotKey: 'ctrl+shift+tab',
|
|
33
|
-
title: 'Switch pane left',
|
|
34
|
-
isGlobal: true,
|
|
35
|
-
action: () => dispatch(switchToPreviousPane()),
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<div data-testid="nav-menu">
|
|
40
|
-
{paneNames.map((name, index: number) => (
|
|
41
|
-
<NavMenuItem
|
|
42
|
-
key={name}
|
|
43
|
-
index={index}
|
|
44
|
-
isFirst={index === 0}
|
|
45
|
-
isSelected={currentPane === index}
|
|
46
|
-
label={name}
|
|
47
|
-
/>
|
|
48
|
-
))}
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export default NavMenu;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { FC } from 'react';
|
|
8
|
-
import { useDispatch } from 'react-redux';
|
|
9
|
-
|
|
10
|
-
import { setCurrentPane } from '../App/appLayout';
|
|
11
|
-
import Button from '../Button/Button';
|
|
12
|
-
import classNames from '../utils/classNames';
|
|
13
|
-
|
|
14
|
-
import './nav-menu-item.scss';
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
index: number;
|
|
18
|
-
isFirst: boolean;
|
|
19
|
-
isSelected: boolean;
|
|
20
|
-
label: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const NavMenuItem: FC<Props> = ({ index, isFirst, isSelected, label }) => {
|
|
24
|
-
const dispatch = useDispatch();
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<Button
|
|
28
|
-
variant="custom"
|
|
29
|
-
className={classNames(
|
|
30
|
-
'core19-nav-menu-item',
|
|
31
|
-
isSelected && 'selected',
|
|
32
|
-
isFirst && 'first'
|
|
33
|
-
)}
|
|
34
|
-
onClick={() => dispatch(setCurrentPane(index))}
|
|
35
|
-
>
|
|
36
|
-
{label}
|
|
37
|
-
</Button>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default NavMenuItem;
|
package/src/NavBar/nav-bar.scss
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
@import "../variables";
|
|
8
|
-
|
|
9
|
-
.core19-nav-bar {
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: $nav-bar-height;
|
|
12
|
-
|
|
13
|
-
background-color: $white;
|
|
14
|
-
|
|
15
|
-
display: flex;
|
|
16
|
-
flex: none;
|
|
17
|
-
flex-direction: row;
|
|
18
|
-
align-items: center;
|
|
19
|
-
|
|
20
|
-
z-index: 100;
|
|
21
|
-
|
|
22
|
-
.core19-nav-bar-device-selector {
|
|
23
|
-
width: $side-panel-width;
|
|
24
|
-
align-self: start;
|
|
25
|
-
}
|
|
26
|
-
}
|