cloudmr-ux 4.7.8 → 4.7.9
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/CmrComponents/niivue-viewer/Switch.js +3 -1
- package/dist/CmrComponents/niivue-viewer/Toolbar.js +6 -4
- package/dist/CmrComponents/niivue-viewer/niivueViewerTheme.d.ts +7 -3
- package/dist/CmrComponents/niivue-viewer/niivueViewerTheme.js +19 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,9 @@ import { Box } from "@mui/material";
|
|
|
14
14
|
import { Typography } from "@mui/material";
|
|
15
15
|
import { Switch } from "@mui/material";
|
|
16
16
|
import React from "react";
|
|
17
|
+
import { useNiivueViewerTheme } from "./NiivueViewerThemeContext";
|
|
17
18
|
export default function NVSwitch(props) {
|
|
19
|
+
var viewerTheme = useNiivueViewerTheme();
|
|
18
20
|
function handleChange() {
|
|
19
21
|
props.onChange();
|
|
20
22
|
}
|
|
@@ -23,5 +25,5 @@ export default function NVSwitch(props) {
|
|
|
23
25
|
alignItems: 'center'
|
|
24
26
|
}, m: 1 }, { children: [_jsx(Typography, __assign({ onClick: handleChange, style: {
|
|
25
27
|
marginRight: 'auto'
|
|
26
|
-
} }, { children: props.title })), _jsx(Switch, { checked: props.checked, onChange: handleChange,
|
|
28
|
+
} }, { children: props.title })), _jsx(Switch, { checked: props.checked, onChange: handleChange, sx: viewerTheme.muiSwitchSx })] })));
|
|
27
29
|
}
|
|
@@ -59,9 +59,11 @@ import Brightness6Icon from '@mui/icons-material/Brightness6';
|
|
|
59
59
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
60
60
|
import CmrConfirmation from "../dialogue/Confirmation";
|
|
61
61
|
import axios from "axios";
|
|
62
|
+
import { useNiivueViewerTheme } from "./NiivueViewerThemeContext";
|
|
62
63
|
export default function Toolbar(props) {
|
|
63
64
|
var _this = this;
|
|
64
65
|
var saving = props.saving, setSaving = props.setSaving;
|
|
66
|
+
var viewerTheme = useNiivueViewerTheme();
|
|
65
67
|
function handleSliceTypeChange(e) {
|
|
66
68
|
var newSliceType = e.target.value;
|
|
67
69
|
var nvUpdateSliceType = props.nvUpdateSliceType;
|
|
@@ -222,22 +224,22 @@ export default function Toolbar(props) {
|
|
|
222
224
|
alignItems: 'center'
|
|
223
225
|
}, m: 1 }, { children: [_jsx(Typography, __assign({ style: {
|
|
224
226
|
marginRight: 'auto'
|
|
225
|
-
} }, { children: "Neurological" })), _jsx(Switch, { defaultChecked: false, checked: !props.radiological, onChange: props.toggleRadiological,
|
|
227
|
+
} }, { children: "Neurological" })), _jsx(Switch, { defaultChecked: false, checked: !props.radiological, onChange: props.toggleRadiological, sx: viewerTheme.muiSwitchSx })] })), _jsxs(Box, __assign({ sx: {
|
|
226
228
|
display: 'flex',
|
|
227
229
|
alignItems: 'center'
|
|
228
230
|
}, m: 1 }, { children: [_jsx(Typography, __assign({ style: {
|
|
229
231
|
marginRight: 'auto'
|
|
230
|
-
} }, { children: "Show Crosshair" })), _jsx(Switch, { defaultChecked: true, checked: props.showCrosshair, onChange: props.toggleShowCrosshair,
|
|
232
|
+
} }, { children: "Show Crosshair" })), _jsx(Switch, { defaultChecked: true, checked: props.showCrosshair, onChange: props.toggleShowCrosshair, sx: viewerTheme.muiSwitchSx })] })), _jsxs(Box, __assign({ sx: {
|
|
231
233
|
display: 'flex',
|
|
232
234
|
alignItems: 'center'
|
|
233
235
|
}, m: 1 }, { children: [_jsx(Typography, __assign({ style: {
|
|
234
236
|
marginRight: 'auto'
|
|
235
|
-
} }, { children: "Show Color Bar" })), _jsx(Switch, { checked: props.showColorBar, onChange: props.toggleColorBar,
|
|
237
|
+
} }, { children: "Show Color Bar" })), _jsx(Switch, { checked: props.showColorBar, onChange: props.toggleColorBar, sx: viewerTheme.muiSwitchSx })] })), _jsxs(Box, __assign({ sx: {
|
|
236
238
|
display: 'flex',
|
|
237
239
|
alignItems: 'center'
|
|
238
240
|
}, m: 1 }, { children: [_jsx(Typography, __assign({ style: {
|
|
239
241
|
marginRight: 'auto'
|
|
240
|
-
} }, { children: "Labels Visible" })), _jsx(Switch, { defaultChecked: false, checked: props.labelsVisible, onChange: props.toggleLabelsVisible,
|
|
242
|
+
} }, { children: "Labels Visible" })), _jsx(Switch, { defaultChecked: false, checked: props.labelsVisible, onChange: props.toggleLabelsVisible, sx: viewerTheme.muiSwitchSx })] })), _jsx(Box, { sx: { flex: 1 } }), _jsxs(Stack, __assign({ flexDirection: 'row', alignItems: 'center', sx: { m: 2, gap: 0.5 } }, { children: [_jsx(Tooltip, __assign({ title: 'Reset Views', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.resetScene(); } }, { children: _jsx(HomeIcon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Recenter Views', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.recenter(); } }, { children: _jsx(CenterFocusStrongIcon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Reset Zooms', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.resetZoom(); } }, { children: _jsx(ZoomInMapIcon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Reset Contrast', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () {
|
|
241
243
|
var _a, _b;
|
|
242
244
|
props.nv.resetContrast();
|
|
243
245
|
props.nv.setGamma(1.0); // engine reset
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
+
/** Host apps may set this on a root wrapper so linked cloudmr-ux reads the brand color without a shared MUI context. */
|
|
3
|
+
export declare const CMR_APP_PRIMARY_CSS_VAR = "--cmr-app-primary";
|
|
2
4
|
/** Default MROptimum / package purple accent for the Niivue viewer. */
|
|
3
5
|
export declare const CLOUDMR_NIIVUE_DEFAULT_ACCENT = "#580f8b";
|
|
6
|
+
/** Read brand primary exposed by the host shell (see {@link CMR_APP_PRIMARY_CSS_VAR}). */
|
|
7
|
+
export declare function readHostPrimaryFromCss(): string | undefined;
|
|
4
8
|
/**
|
|
5
9
|
* Resolve Niivue viewer accent color:
|
|
6
10
|
* 1. Explicit `accentColor` prop on {@link CloudMrNiivueViewer}
|
|
7
|
-
* 2. Host
|
|
8
|
-
*
|
|
9
|
-
*
|
|
11
|
+
* 2. Host CSS var {@link CMR_APP_PRIMARY_CSS_VAR} (works with npm link / duplicate MUI)
|
|
12
|
+
* 3. Host MUI `palette.primary.main` when it differs from stock MUI primary
|
|
13
|
+
* 4. Package default purple {@link CLOUDMR_NIIVUE_DEFAULT_ACCENT}
|
|
10
14
|
*/
|
|
11
15
|
export declare function resolveViewerAccentColor(accentColorProp?: string, muiPrimaryMain?: string): string;
|
|
12
16
|
export interface NiivueViewerThemeTokens {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { createTheme } from "@mui/material/styles";
|
|
2
|
+
/** Host apps may set this on a root wrapper so linked cloudmr-ux reads the brand color without a shared MUI context. */
|
|
3
|
+
export var CMR_APP_PRIMARY_CSS_VAR = "--cmr-app-primary";
|
|
2
4
|
/** Default MROptimum / package purple accent for the Niivue viewer. */
|
|
3
5
|
export var CLOUDMR_NIIVUE_DEFAULT_ACCENT = "#580f8b";
|
|
4
6
|
/** MUI stock `palette.primary.main` when the host does not customize primary. */
|
|
@@ -12,17 +14,31 @@ function getMuiDefaultPrimaryMain() {
|
|
|
12
14
|
function normalizeHex(color) {
|
|
13
15
|
return color.trim().toLowerCase();
|
|
14
16
|
}
|
|
17
|
+
/** Read brand primary exposed by the host shell (see {@link CMR_APP_PRIMARY_CSS_VAR}). */
|
|
18
|
+
export function readHostPrimaryFromCss() {
|
|
19
|
+
if (typeof document === "undefined") {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
var val = getComputedStyle(document.documentElement)
|
|
23
|
+
.getPropertyValue(CMR_APP_PRIMARY_CSS_VAR)
|
|
24
|
+
.trim();
|
|
25
|
+
return val || undefined;
|
|
26
|
+
}
|
|
15
27
|
/**
|
|
16
28
|
* Resolve Niivue viewer accent color:
|
|
17
29
|
* 1. Explicit `accentColor` prop on {@link CloudMrNiivueViewer}
|
|
18
|
-
* 2. Host
|
|
19
|
-
*
|
|
20
|
-
*
|
|
30
|
+
* 2. Host CSS var {@link CMR_APP_PRIMARY_CSS_VAR} (works with npm link / duplicate MUI)
|
|
31
|
+
* 3. Host MUI `palette.primary.main` when it differs from stock MUI primary
|
|
32
|
+
* 4. Package default purple {@link CLOUDMR_NIIVUE_DEFAULT_ACCENT}
|
|
21
33
|
*/
|
|
22
34
|
export function resolveViewerAccentColor(accentColorProp, muiPrimaryMain) {
|
|
23
35
|
if (accentColorProp) {
|
|
24
36
|
return accentColorProp;
|
|
25
37
|
}
|
|
38
|
+
var cssPrimary = readHostPrimaryFromCss();
|
|
39
|
+
if (cssPrimary) {
|
|
40
|
+
return cssPrimary;
|
|
41
|
+
}
|
|
26
42
|
var primary = muiPrimaryMain === null || muiPrimaryMain === void 0 ? void 0 : muiPrimaryMain.trim();
|
|
27
43
|
if (primary &&
|
|
28
44
|
normalizeHex(primary) !== normalizeHex(getMuiDefaultPrimaryMain())) {
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type { NiivueRoiTableProps } from "./CmrComponents/niivue-roi-table/Niivu
|
|
|
36
36
|
export { default as CloudMrNiivueViewer, nv } from "./CmrComponents/niivue-viewer/CloudMrNiivueViewer.js";
|
|
37
37
|
export { CloudMrNiivuePanel } from "./CmrComponents/niivue-viewer/CloudMrNiivuePanel";
|
|
38
38
|
export { NiivueViewerThemeProvider, useNiivueViewerTheme, } from "./CmrComponents/niivue-viewer/NiivueViewerThemeContext";
|
|
39
|
-
export { CLOUDMR_NIIVUE_DEFAULT_ACCENT, buildNiivueViewerTheme, resolveViewerAccentColor, } from "./CmrComponents/niivue-viewer/niivueViewerTheme";
|
|
39
|
+
export { CLOUDMR_NIIVUE_DEFAULT_ACCENT, CMR_APP_PRIMARY_CSS_VAR, buildNiivueViewerTheme, resolveViewerAccentColor, readHostPrimaryFromCss, } from "./CmrComponents/niivue-viewer/niivueViewerTheme";
|
|
40
40
|
export type { NiivueViewerThemeTokens } from "./CmrComponents/niivue-viewer/niivueViewerTheme";
|
|
41
41
|
export type { CloudMrNiivuePanelProps, CloudMrDrawToolkitProps, } from "./CmrComponents/niivue-viewer/CloudMrNiivuePanel";
|
|
42
42
|
import type { FC } from "react";
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ export { NiivueRoiTable, DEFAULT_ROI_GROUP_TARGET_LABEL, } from "./CmrComponents
|
|
|
32
32
|
export { default as CloudMrNiivueViewer, nv } from "./CmrComponents/niivue-viewer/CloudMrNiivueViewer.js";
|
|
33
33
|
export { CloudMrNiivuePanel } from "./CmrComponents/niivue-viewer/CloudMrNiivuePanel";
|
|
34
34
|
export { NiivueViewerThemeProvider, useNiivueViewerTheme, } from "./CmrComponents/niivue-viewer/NiivueViewerThemeContext";
|
|
35
|
-
export { CLOUDMR_NIIVUE_DEFAULT_ACCENT, buildNiivueViewerTheme, resolveViewerAccentColor, } from "./CmrComponents/niivue-viewer/niivueViewerTheme";
|
|
35
|
+
export { CLOUDMR_NIIVUE_DEFAULT_ACCENT, CMR_APP_PRIMARY_CSS_VAR, buildNiivueViewerTheme, resolveViewerAccentColor, readHostPrimaryFromCss, } from "./CmrComponents/niivue-viewer/niivueViewerTheme";
|
|
36
36
|
import CmrTableComponent, { CMR_TABLE_DEFAULT_HEADER_ICON } from "./CmrTable/CmrTable";
|
|
37
37
|
export var CmrTable = CmrTableComponent;
|
|
38
38
|
export { CMR_TABLE_DEFAULT_HEADER_ICON };
|