@dra2020/dra-types 1.8.127 → 1.8.129

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/lib/colormgr.ts CHANGED
@@ -174,7 +174,8 @@ export function ToAllEthnicColor(agg: PF.PackedFields, dc: PF.DatasetContext, pd
174
174
  // Use VAP/CVAP if it exists
175
175
  const dataset: string = dc.primeVDS ? dc.primeVDS : dc.primeDDS
176
176
  const did = PF.toDatasetID(dataset);
177
- return AggregateEthnicColor(PF.ToGetter(agg, dc, did, dataset), pd, dataset.endsWith('NH'));
177
+ const builtin = dc.dsMeta[did]?.builtin || dataset;
178
+ return AggregateEthnicColor(PF.ToGetter(agg, dc, did, dataset), pd, builtin.endsWith('NH'));
178
179
  }
179
180
 
180
181
  export function ToPartisanColorStr(agg: PF.PackedFields, dc: PF.DatasetContext, pd: PaletteDefaults): string
@@ -241,6 +242,7 @@ export function ToEthnicColorStr(agg: PF.PackedFields, dc: PF.DatasetContext, pd
241
242
  let bInvert: boolean = false;
242
243
  const dataset = dc.primeVDS ? dc.primeVDS : dc.primeDDS;
243
244
  const did = PF.toDatasetID(dataset);
245
+ const builtin = dc.dsMeta[did]?.builtin || dataset;
244
246
  switch (detail)
245
247
  {
246
248
  case null: case '': case 'all':
@@ -248,12 +250,12 @@ export function ToEthnicColorStr(agg: PF.PackedFields, dc: PF.DatasetContext, pd
248
250
  return c >= 0 ? ethnicBackgroundColor(c, pd) : '#ffffff';
249
251
  case 'white': ethnic = 'Wh'; break;
250
252
  case 'nonwhite': ethnic = 'Wh'; bInvert = true; break;
251
- case 'black': ethnic = dataset.endsWith('NH') ? 'Bl' : 'BlC'; break;
253
+ case 'black': ethnic = builtin.endsWith('NH') ? 'Bl' : 'BlC'; break;
252
254
  case 'hisp': ethnic = 'His'; break;
253
- case 'native': ethnic = dataset.endsWith('NH') ? 'Nat' : 'NatC'; break;
255
+ case 'native': ethnic = builtin.endsWith('NH') ? 'Nat' : 'NatC'; break;
254
256
  case 'asianpi': ethnic = 'AsnPI'; break;
255
- case 'asian': ethnic = dataset.endsWith('NH') ? 'Asn' : 'AsnC'; break;
256
- case 'pac': ethnic = dataset.endsWith('NH') ? 'Pac' : 'PacC'; break;
257
+ case 'asian': ethnic = builtin.endsWith('NH') ? 'Asn' : 'AsnC'; break;
258
+ case 'pac': ethnic = builtin.endsWith('NH') ? 'Pac' : 'PacC'; break;
257
259
  case 'other': ethnic = 'OthAl'; break;
258
260
  case 'mix': ethnic = 'Mix'; break;
259
261
  default: break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/dra-types",
3
- "version": "1.8.127",
3
+ "version": "1.8.129",
4
4
  "description": "Shared types used between client, server and tools.",
5
5
  "main": "dist/dra-types.js",
6
6
  "types": "./dist/all.d.ts",
@@ -34,7 +34,7 @@
34
34
  "webpack-cli": "^5.1.4"
35
35
  },
36
36
  "dependencies": {
37
- "@dra2020/baseclient": "^1.0.146",
37
+ "@dra2020/baseclient": "^1.0.147",
38
38
  "geojson": "^0.5.0",
39
39
  "object-hash": "^3.0.0"
40
40
  }
@@ -1,35 +0,0 @@
1
- export declare const DefaultColorNames: string[];
2
- export interface ColorLookup {
3
- [key: string]: string;
4
- }
5
- export declare const ColorValues: ColorLookup;
6
- export declare const ColorBySolidWhite = 0;
7
- export declare const ColorBySolidBlack = 1;
8
- export declare const ColorBySolidHispanic = 2;
9
- export declare const ColorBySolidAsian = 3;
10
- export declare const ColorByMostlyWhite = 4;
11
- export declare const ColorByMostlyBlack = 5;
12
- export declare const ColorByMostlyHispanic = 6;
13
- export declare const ColorByMostlyAsian = 7;
14
- export declare const ColorByMostlyNative = 8;
15
- export declare const ColorByMix = 9;
16
- export declare const ColorByHispanicWhite = 10;
17
- export declare const ColorByBlackWhite = 11;
18
- export declare const ColorByHispanicBlack = 12;
19
- export declare const ColorByAsianWhite = 13;
20
- export declare const ColorByAsianHispanic = 14;
21
- export declare const ColorByBlackAsian = 15;
22
- export declare const EthnicBackgroundColor: string[];
23
- export declare const EthnicTextColor: string[];
24
- export declare const EthnicLabel: string[];
25
- export declare const ColorByGreatR = 0;
26
- export declare const ColorByGoodR = 1;
27
- export declare const ColorByFairR = 2;
28
- export declare const ColorByEven = 3;
29
- export declare const ColorByFairD = 4;
30
- export declare const ColorByGoodD = 5;
31
- export declare const ColorByGreatD = 6;
32
- export declare const ElectionBackgroundColor: string[];
33
- export declare const ElectionTextColor: string[];
34
- export declare const ElectionLabel: string[];
35
- export declare let IntensityBackgroundColor: string[];
@@ -1 +0,0 @@
1
- export declare function genColor(i: number, useFirstColor: boolean): string;