@rfkit/charts 1.10.4 → 1.10.5

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/index.js CHANGED
@@ -23175,6 +23175,18 @@ function getUnifiedSignalKey(item) {
23175
23175
  }
23176
23176
  const buildSignalTree = (signalItems)=>{
23177
23177
  const leafKeysWithData = new Set(signalItems.map(getSignalLeafKey));
23178
+ const explicitLeafColors = new Map();
23179
+ for (const item of signalItems){
23180
+ if ('string' != typeof item.color || '' === item.color.trim()) continue;
23181
+ const leafKey = getSignalLeafKey(item);
23182
+ if (!explicitLeafColors.has(leafKey)) explicitLeafColors.set(leafKey, item.color);
23183
+ }
23184
+ const resolveSharedExplicitColor = (leafKeys)=>{
23185
+ const colors = new Set(leafKeys.map((leafKey)=>explicitLeafColors.get(leafKey)).filter((color)=>null != color));
23186
+ return 1 === colors.size ? [
23187
+ ...colors
23188
+ ][0] : void 0;
23189
+ };
23178
23190
  const sources = [];
23179
23191
  for (const source of SIGNAL_SOURCE_ORDER){
23180
23192
  const sourceDataLeafKeys = [
@@ -23199,7 +23211,8 @@ const buildSignalTree = (signalItems)=>{
23199
23211
  level,
23200
23212
  label: SIGNAL_LEVEL_MAP[level].name,
23201
23213
  leafKey,
23202
- hasData: leafKeysWithData.has(leafKey)
23214
+ hasData: leafKeysWithData.has(leafKey),
23215
+ color: explicitLeafColors.get(leafKey)
23203
23216
  };
23204
23217
  });
23205
23218
  const leafKeys = levels.map((level)=>level.leafKey);
@@ -23211,6 +23224,7 @@ const buildSignalTree = (signalItems)=>{
23211
23224
  leafKeys,
23212
23225
  dataLeafKeys,
23213
23226
  hasData: dataLeafKeys.length > 0,
23227
+ color: resolveSharedExplicitColor(dataLeafKeys),
23214
23228
  levels: signalType === SignalType.LEGITIMATE ? levels.filter((level)=>level.hasData) : []
23215
23229
  };
23216
23230
  });
@@ -29253,7 +29267,7 @@ const SignalTypeRow = ({ source, type, leafKeysWithData, hiddenKeys, expanded, o
29253
29267
  className: cn_cn('size-2 shrink-0 rounded-full ring-1 ring-inset ring-background/30', 'disabled' === state && 'opacity-35'),
29254
29268
  "data-testid": `signal-tree-type-color-${source.source}-${type.signalType}`,
29255
29269
  style: {
29256
- backgroundColor: SIGNAL_TYPE_MAP[type.signalType].color
29270
+ backgroundColor: type.color ?? SIGNAL_TYPE_MAP[type.signalType].color
29257
29271
  }
29258
29272
  }),
29259
29273
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
@@ -29304,7 +29318,7 @@ const SignalLevelRow = ({ source, signalType, level, leafKeysWithData, hiddenKey
29304
29318
  className: cn_cn('size-2 shrink-0 rounded-full ring-1 ring-inset ring-background/30', 'disabled' === state && 'opacity-35'),
29305
29319
  "data-testid": `signal-tree-level-color-${source}-${signalType}-${level.level}`,
29306
29320
  style: {
29307
- backgroundColor: SIGNAL_LEVEL_MAP[level.level].color
29321
+ backgroundColor: level.color ?? SIGNAL_LEVEL_MAP[level.level].color
29308
29322
  }
29309
29323
  }),
29310
29324
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
@@ -27,6 +27,7 @@ export interface SignalTreeLevelNode {
27
27
  label: string;
28
28
  leafKey: string;
29
29
  hasData: boolean;
30
+ color?: string;
30
31
  }
31
32
  export interface SignalTreeTypeNode {
32
33
  signalType: string;
@@ -34,6 +35,7 @@ export interface SignalTreeTypeNode {
34
35
  leafKeys: string[];
35
36
  dataLeafKeys: string[];
36
37
  hasData: boolean;
38
+ color?: string;
37
39
  levels: SignalTreeLevelNode[];
38
40
  }
39
41
  export interface SignalTreeSourceNode {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rfkit/charts",
3
- "version": "1.10.4",
3
+ "version": "1.10.5",
4
4
  "type": "module",
5
5
  "description": "Chart components for wireless monitoring web applications",
6
6
  "exports": {