@dra2020/dra-types 1.8.103 → 1.8.105
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/colormgr.d.ts +30 -0
- package/dist/datasets.d.ts +2 -0
- package/dist/dra-types.js +85 -1
- package/dist/dra-types.js.map +1 -1
- package/lib/colormgr.ts +84 -0
- package/lib/datasets.ts +3 -0
- package/lib/schemas.ts +11 -0
- package/package.json +1 -1
package/dist/colormgr.d.ts
CHANGED
|
@@ -69,3 +69,33 @@ export interface DistrictColorParams {
|
|
|
69
69
|
}
|
|
70
70
|
export declare function ToExtendedColor(agg: PF.PackedFields, dc: PF.DatasetContext, colorBy: string): string;
|
|
71
71
|
export declare function computeDistrictColors(params: DistrictColorParams): DistrictCache[];
|
|
72
|
+
export interface RGB {
|
|
73
|
+
r: number;
|
|
74
|
+
g: number;
|
|
75
|
+
b: number;
|
|
76
|
+
}
|
|
77
|
+
export declare const BinRed = 0;
|
|
78
|
+
export declare const BinOrangeRed = 1;
|
|
79
|
+
export declare const BinBrown = 2;
|
|
80
|
+
export declare const BinOrange = 3;
|
|
81
|
+
export declare const BinGold = 4;
|
|
82
|
+
export declare const BinYellow = 5;
|
|
83
|
+
export declare const BinGreenish = 6;
|
|
84
|
+
export declare const BinChartreuse = 7;
|
|
85
|
+
export declare const BinLime = 8;
|
|
86
|
+
export declare const BinMediumSpringGreen = 9;
|
|
87
|
+
export declare const BinCyan = 10;
|
|
88
|
+
export declare const BinLightBlue = 11;
|
|
89
|
+
export declare const BinBlue = 12;
|
|
90
|
+
export declare const BinBlueViolet = 13;
|
|
91
|
+
export declare const BinDarkViolet = 14;
|
|
92
|
+
export declare const BinMagenta = 15;
|
|
93
|
+
export declare const BinDeepPink = 16;
|
|
94
|
+
export declare const BinColorLookup: RGB[];
|
|
95
|
+
export declare const FieldCountToColors: {
|
|
96
|
+
[nfields: number]: number[];
|
|
97
|
+
};
|
|
98
|
+
export declare function colorindexToRGB(colorindex: number): RGB;
|
|
99
|
+
export declare const ColorFlags = "abcdefghijklmnopqrstuvwxyz";
|
|
100
|
+
export declare function colorflagToColorindex(nfields: number, colorflag: string): number;
|
|
101
|
+
export declare function colororderToColorindex(nfields: number, order: number): number;
|
package/dist/datasets.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as G from './groups';
|
|
1
2
|
export interface DatasetField {
|
|
2
3
|
shortCaption: string;
|
|
3
4
|
longCaption: string;
|
|
@@ -51,6 +52,7 @@ export interface Dataset {
|
|
|
51
52
|
dotmap?: boolean;
|
|
52
53
|
blobid?: string;
|
|
53
54
|
meta?: DatasetsMeta;
|
|
55
|
+
groups?: G.GroupMapIndex;
|
|
54
56
|
}
|
|
55
57
|
export type DatasetIndex = {
|
|
56
58
|
[id: string]: Dataset;
|
package/dist/dra-types.js
CHANGED
|
@@ -107,7 +107,8 @@ exports.BucketMap = {
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
110
|
-
exports.computeDistrictColors = exports.ToExtendedColor = exports.allGroups16Colors = exports.colorsFromStopsPartisan = exports.colorsFromStops = exports.PaletteNames = exports.ColorFromRGBPcts = exports.AggregatePartisanColorStr = exports.AggregatePartisanColor = exports.AggregateEthnicColor = exports.ToEthnicColorStr = exports.ToPartisanShiftColor = exports.ToPartisanDistrictColor = exports.ToPartisanColorStr = exports.ToAllEthnicColor = exports.ethnicBackgroundColor = exports.makeStops = exports.DefaultPaletteDefaults = exports.EthnicFewStops = exports.PartisanPrecinctStops = exports.PartisanDistrictStops = exports.ColorByGreatD = exports.ColorByGoodD = exports.ColorByFairD = exports.ColorByEven = exports.ColorByFairR = exports.ColorByGoodR = exports.ColorByGreatR = exports.EthnicTextColor = exports.ColorByBlackAsian = exports.ColorByAsianHispanic = exports.ColorByAsianWhite = exports.ColorByHispanicBlack = exports.ColorByBlackWhite = exports.ColorByHispanicWhite = exports.ColorByMix = exports.ColorByMostlyNative = exports.ColorByMostlyAsian = exports.ColorByMostlyHispanic = exports.ColorByMostlyBlack = exports.ColorByMostlyWhite = exports.ColorBySolidAsian = exports.ColorBySolidHispanic = exports.ColorBySolidBlack = exports.ColorBySolidWhite = void 0;
|
|
110
|
+
exports.BinGold = exports.BinOrange = exports.BinBrown = exports.BinOrangeRed = exports.BinRed = exports.computeDistrictColors = exports.ToExtendedColor = exports.allGroups16Colors = exports.colorsFromStopsPartisan = exports.colorsFromStops = exports.PaletteNames = exports.ColorFromRGBPcts = exports.AggregatePartisanColorStr = exports.AggregatePartisanColor = exports.AggregateEthnicColor = exports.ToEthnicColorStr = exports.ToPartisanShiftColor = exports.ToPartisanDistrictColor = exports.ToPartisanColorStr = exports.ToAllEthnicColor = exports.ethnicBackgroundColor = exports.makeStops = exports.DefaultPaletteDefaults = exports.EthnicFewStops = exports.PartisanPrecinctStops = exports.PartisanDistrictStops = exports.ColorByGreatD = exports.ColorByGoodD = exports.ColorByFairD = exports.ColorByEven = exports.ColorByFairR = exports.ColorByGoodR = exports.ColorByGreatR = exports.EthnicTextColor = exports.ColorByBlackAsian = exports.ColorByAsianHispanic = exports.ColorByAsianWhite = exports.ColorByHispanicBlack = exports.ColorByBlackWhite = exports.ColorByHispanicWhite = exports.ColorByMix = exports.ColorByMostlyNative = exports.ColorByMostlyAsian = exports.ColorByMostlyHispanic = exports.ColorByMostlyBlack = exports.ColorByMostlyWhite = exports.ColorBySolidAsian = exports.ColorBySolidHispanic = exports.ColorBySolidBlack = exports.ColorBySolidWhite = void 0;
|
|
111
|
+
exports.colororderToColorindex = exports.colorflagToColorindex = exports.ColorFlags = exports.colorindexToRGB = exports.FieldCountToColors = exports.BinColorLookup = exports.BinDeepPink = exports.BinMagenta = exports.BinDarkViolet = exports.BinBlueViolet = exports.BinBlue = exports.BinLightBlue = exports.BinCyan = exports.BinMediumSpringGreen = exports.BinLime = exports.BinChartreuse = exports.BinGreenish = exports.BinYellow = void 0;
|
|
111
112
|
// App libraries
|
|
112
113
|
const PF = __webpack_require__(/*! ./packedfields */ "./lib/packedfields.ts");
|
|
113
114
|
const datasets_1 = __webpack_require__(/*! ./datasets */ "./lib/datasets.ts");
|
|
@@ -642,6 +643,79 @@ function computeDistrictColors(params) {
|
|
|
642
643
|
return dcNew;
|
|
643
644
|
}
|
|
644
645
|
exports.computeDistrictColors = computeDistrictColors;
|
|
646
|
+
;
|
|
647
|
+
exports.BinRed = 0;
|
|
648
|
+
exports.BinOrangeRed = 1;
|
|
649
|
+
exports.BinBrown = 2;
|
|
650
|
+
exports.BinOrange = 3;
|
|
651
|
+
exports.BinGold = 4;
|
|
652
|
+
exports.BinYellow = 5;
|
|
653
|
+
exports.BinGreenish = 6;
|
|
654
|
+
exports.BinChartreuse = 7;
|
|
655
|
+
exports.BinLime = 8;
|
|
656
|
+
exports.BinMediumSpringGreen = 9;
|
|
657
|
+
exports.BinCyan = 10;
|
|
658
|
+
exports.BinLightBlue = 11;
|
|
659
|
+
exports.BinBlue = 12;
|
|
660
|
+
exports.BinBlueViolet = 13;
|
|
661
|
+
exports.BinDarkViolet = 14;
|
|
662
|
+
exports.BinMagenta = 15;
|
|
663
|
+
exports.BinDeepPink = 16;
|
|
664
|
+
exports.BinColorLookup = [
|
|
665
|
+
{ r: 0xff, g: 0x00, b: 0x00 },
|
|
666
|
+
{ r: 0xff, g: 0x45, b: 0x00 },
|
|
667
|
+
{ r: 0x99, g: 0x66, b: 0x33 },
|
|
668
|
+
{ r: 0xff, g: 0xaa, b: 0x00 },
|
|
669
|
+
{ r: 0xff, g: 0xd7, b: 0x00 },
|
|
670
|
+
{ r: 0xff, g: 0xd7, b: 0x00 },
|
|
671
|
+
{ r: 0x9f, g: 0xd4, b: 0x00 },
|
|
672
|
+
{ r: 0x7f, g: 0xff, b: 0x00 },
|
|
673
|
+
{ r: 0x00, g: 0xff, b: 0x00 },
|
|
674
|
+
{ r: 0x00, g: 0xfa, b: 0x9a },
|
|
675
|
+
{ r: 0x00, g: 0xff, b: 0xff },
|
|
676
|
+
{ r: 0x73, g: 0xb2, b: 0xff },
|
|
677
|
+
{ r: 0x00, g: 0x00, b: 0xff },
|
|
678
|
+
{ r: 0x8a, g: 0x2b, b: 0xe2 },
|
|
679
|
+
{ r: 0x94, g: 0x00, b: 0xd3 },
|
|
680
|
+
{ r: 0xff, g: 0x00, b: 0xff },
|
|
681
|
+
{ r: 0xff, g: 0x14, b: 0x93 }, // 16 - deep pink
|
|
682
|
+
];
|
|
683
|
+
// Map ordering to Bin* lookup values
|
|
684
|
+
const ColorOrderEthnic = 'wbaho'; // abcde
|
|
685
|
+
// Map number of fields to color selection
|
|
686
|
+
exports.FieldCountToColors = {
|
|
687
|
+
[1]: [exports.BinBrown],
|
|
688
|
+
[2]: [exports.BinRed, exports.BinBlue],
|
|
689
|
+
[3]: [exports.BinRed, exports.BinBlue, exports.BinBrown],
|
|
690
|
+
[4]: [exports.BinRed, exports.BinBlue, exports.BinBrown, exports.BinGreenish],
|
|
691
|
+
[5]: [exports.BinLightBlue, exports.BinGreenish, exports.BinRed, exports.BinOrange, exports.BinBrown],
|
|
692
|
+
[6]: [exports.BinRed, exports.BinBrown, exports.BinGold, exports.BinGreenish, exports.BinLightBlue, exports.BinBlueViolet],
|
|
693
|
+
[7]: [exports.BinRed, exports.BinBrown, exports.BinGold, exports.BinGreenish, exports.BinLightBlue, exports.BinBlueViolet, exports.BinMagenta],
|
|
694
|
+
[8]: [exports.BinRed, exports.BinBrown, exports.BinGold, exports.BinGreenish, exports.BinLightBlue, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink],
|
|
695
|
+
[9]: [exports.BinRed, exports.BinBrown, exports.BinGold, exports.BinGreenish, exports.BinLightBlue, exports.BinBlue, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink],
|
|
696
|
+
[10]: [exports.BinRed, exports.BinBrown, exports.BinGold, exports.BinGreenish, exports.BinCyan, exports.BinLightBlue, exports.BinBlue, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink],
|
|
697
|
+
[11]: [exports.BinRed, exports.BinBrown, exports.BinGold, exports.BinGreenish, exports.BinLime, exports.BinCyan, exports.BinLightBlue, exports.BinBlue, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink],
|
|
698
|
+
[12]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinGreenish, exports.BinLime, exports.BinCyan, exports.BinLightBlue, exports.BinBlue, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink],
|
|
699
|
+
[13]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinGreenish, exports.BinLime, exports.BinMediumSpringGreen, exports.BinCyan, exports.BinLightBlue, exports.BinBlue, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink],
|
|
700
|
+
[14]: [exports.BinRed, exports.BinOrangeRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinGreenish, exports.BinLime, exports.BinMediumSpringGreen, exports.BinCyan, exports.BinLightBlue, exports.BinBlue, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink],
|
|
701
|
+
[15]: [exports.BinRed, exports.BinOrangeRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinGreenish, exports.BinLime, exports.BinMediumSpringGreen, exports.BinCyan, exports.BinLightBlue, exports.BinBlue, exports.BinBlueViolet, exports.BinDarkViolet, exports.BinMagenta, exports.BinDeepPink],
|
|
702
|
+
[16]: [exports.BinRed, exports.BinOrangeRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinYellow, exports.BinGreenish, exports.BinLime, exports.BinMediumSpringGreen, exports.BinCyan, exports.BinLightBlue, exports.BinBlue, exports.BinBlueViolet, exports.BinDarkViolet, exports.BinMagenta, exports.BinDeepPink],
|
|
703
|
+
};
|
|
704
|
+
const MaxFields = 16;
|
|
705
|
+
function colorindexToRGB(colorindex) {
|
|
706
|
+
return exports.BinColorLookup[colorindex] || exports.BinColorLookup[exports.BinBrown];
|
|
707
|
+
}
|
|
708
|
+
exports.colorindexToRGB = colorindexToRGB;
|
|
709
|
+
exports.ColorFlags = 'abcdefghijklmnopqrstuvwxyz';
|
|
710
|
+
function colorflagToColorindex(nfields, colorflag) {
|
|
711
|
+
let i = exports.ColorFlags.indexOf(colorflag);
|
|
712
|
+
return i >= 0 && nfields > 0 && nfields <= MaxFields ? exports.FieldCountToColors[nfields][i] : exports.BinBrown;
|
|
713
|
+
}
|
|
714
|
+
exports.colorflagToColorindex = colorflagToColorindex;
|
|
715
|
+
function colororderToColorindex(nfields, order) {
|
|
716
|
+
return order >= 0 && nfields > 0 && nfields <= MaxFields ? exports.FieldCountToColors[nfields][order] : exports.BinBrown;
|
|
717
|
+
}
|
|
718
|
+
exports.colororderToColorindex = colororderToColorindex;
|
|
645
719
|
|
|
646
720
|
|
|
647
721
|
/***/ }),
|
|
@@ -2101,6 +2175,7 @@ exports.Schemas = {
|
|
|
2101
2175
|
official: 'BOOL',
|
|
2102
2176
|
state: 'S',
|
|
2103
2177
|
datasource: 'S',
|
|
2178
|
+
groups: 'M',
|
|
2104
2179
|
// meta: { dataset metadata structure },
|
|
2105
2180
|
// dotmap: 'BOOL',
|
|
2106
2181
|
},
|
|
@@ -2137,6 +2212,15 @@ exports.Schemas = {
|
|
|
2137
2212
|
},
|
|
2138
2213
|
KeySchema: { id: 'HASH', sid: 'RANGE' },
|
|
2139
2214
|
},
|
|
2215
|
+
'groupsdatasets': {
|
|
2216
|
+
FileOptions: { map: true },
|
|
2217
|
+
Schema: {
|
|
2218
|
+
id: 'S',
|
|
2219
|
+
sid: 'S',
|
|
2220
|
+
permission: 'N',
|
|
2221
|
+
},
|
|
2222
|
+
KeySchema: { id: 'HASH', sid: 'RANGE' },
|
|
2223
|
+
},
|
|
2140
2224
|
'notifications': {
|
|
2141
2225
|
FileOptions: { map: true },
|
|
2142
2226
|
Schema: {
|