@dra2020/dra-types 1.8.88 → 1.8.89
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/all.d.ts +6 -14
- package/dist/alldt.d.ts +14 -0
- package/dist/colormgr.d.ts +69 -0
- package/dist/dra-types.d.ts +1 -0
- package/dist/dra-types.js +801 -13
- package/dist/dra-types.js.map +1 -1
- package/dist/packedfields.d.ts +103 -1
- package/lib/all.ts +6 -14
- package/lib/alldt.ts +14 -0
- package/lib/colormgr.ts +563 -0
- package/lib/dra-types.ts +1 -0
- package/lib/packedfields.ts +396 -1
- package/package.json +1 -1
package/dist/all.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export * from './layer';
|
|
8
|
-
export * from './stateinfo';
|
|
9
|
-
export * from './workqueue';
|
|
10
|
-
export * from './landmark';
|
|
11
|
-
export * from './splittogeofeature';
|
|
12
|
-
export * from './reverse';
|
|
13
|
-
export * from './groups';
|
|
14
|
-
export * from './precincts';
|
|
1
|
+
import * as DT from './alldt';
|
|
2
|
+
export { DT };
|
|
3
|
+
import * as PF from './packedfields';
|
|
4
|
+
export { PF };
|
|
5
|
+
import * as CM from './colormgr';
|
|
6
|
+
export { CM };
|
package/dist/alldt.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './dra-types';
|
|
2
|
+
export * from './schemas';
|
|
3
|
+
export * from './bucketmap';
|
|
4
|
+
export * from './vfeature';
|
|
5
|
+
export * from './csv';
|
|
6
|
+
export * from './stats';
|
|
7
|
+
export * from './layer';
|
|
8
|
+
export * from './stateinfo';
|
|
9
|
+
export * from './workqueue';
|
|
10
|
+
export * from './landmark';
|
|
11
|
+
export * from './splittogeofeature';
|
|
12
|
+
export * from './reverse';
|
|
13
|
+
export * from './groups';
|
|
14
|
+
export * from './precincts';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as PF from "./packedfields";
|
|
2
|
+
import { Util } from '@dra2020/baseclient';
|
|
3
|
+
export declare const ColorBySolidWhite = 0;
|
|
4
|
+
export declare const ColorBySolidBlack = 1;
|
|
5
|
+
export declare const ColorBySolidHispanic = 2;
|
|
6
|
+
export declare const ColorBySolidAsian = 3;
|
|
7
|
+
export declare const ColorByMostlyWhite = 4;
|
|
8
|
+
export declare const ColorByMostlyBlack = 5;
|
|
9
|
+
export declare const ColorByMostlyHispanic = 6;
|
|
10
|
+
export declare const ColorByMostlyAsian = 7;
|
|
11
|
+
export declare const ColorByMostlyNative = 8;
|
|
12
|
+
export declare const ColorByMix = 9;
|
|
13
|
+
export declare const ColorByHispanicWhite = 10;
|
|
14
|
+
export declare const ColorByBlackWhite = 11;
|
|
15
|
+
export declare const ColorByHispanicBlack = 12;
|
|
16
|
+
export declare const ColorByAsianWhite = 13;
|
|
17
|
+
export declare const ColorByAsianHispanic = 14;
|
|
18
|
+
export declare const ColorByBlackAsian = 15;
|
|
19
|
+
export declare const EthnicTextColor: string[];
|
|
20
|
+
export declare const ColorByGreatR = 0;
|
|
21
|
+
export declare const ColorByGoodR = 1;
|
|
22
|
+
export declare const ColorByFairR = 2;
|
|
23
|
+
export declare const ColorByEven = 3;
|
|
24
|
+
export declare const ColorByFairD = 4;
|
|
25
|
+
export declare const ColorByGoodD = 5;
|
|
26
|
+
export declare const ColorByGreatD = 6;
|
|
27
|
+
export declare let PartisanDistrictStops: number[];
|
|
28
|
+
export declare let PartisanPrecinctStops: number[];
|
|
29
|
+
export declare let EthnicFewStops: number[];
|
|
30
|
+
export type PaletteDefaults = {
|
|
31
|
+
[key: string]: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const DefaultPaletteDefaults: PaletteDefaults;
|
|
34
|
+
export declare function makeStops(stops: number[], colors: string[]): Util.Stop[];
|
|
35
|
+
export declare function ethnicBackgroundColor(index: number, pd: PaletteDefaults): string;
|
|
36
|
+
export declare function ToAllEthnicColor(agg: PF.PackedFields, dc: PF.DatasetContext, pd: PaletteDefaults): number;
|
|
37
|
+
export declare function ToPartisanColorStr(agg: PF.PackedFields, dc: PF.DatasetContext, pd: PaletteDefaults): string;
|
|
38
|
+
export declare function ToPartisanDistrictColor(agg: PF.PackedFields, dc: PF.DatasetContext, pd: PaletteDefaults): string;
|
|
39
|
+
export declare function ToPartisanShiftColor(agg: PF.PackedFields, dc: PF.DatasetContext, datasets: string[], pd: PaletteDefaults): string;
|
|
40
|
+
export declare function ToEthnicColorStr(agg: PF.PackedFields, dc: PF.DatasetContext, pd: PaletteDefaults, detail: string): string;
|
|
41
|
+
export declare function AggregateEthnicColor(getter: PF.FieldGetter, pd: PaletteDefaults, nhAlone: boolean): number;
|
|
42
|
+
export declare function AggregatePartisanColor(getter: PF.FieldGetter): number;
|
|
43
|
+
export declare function AggregatePartisanColorStr(getter: PF.FieldGetter, stops: Util.GradientStops): string;
|
|
44
|
+
export declare function ColorFromRGBPcts(pctRed: number, pctGreen: number, pctBlue: number, stops: Util.GradientStops): string;
|
|
45
|
+
export type ColorUse = 'districts' | 'partisanScale' | 'demographicsScale' | 'demographicsAllGroups' | 'partisanDistrictsScale';
|
|
46
|
+
export declare const PaletteNames: readonly ["jet_r", "turbo_r", "inferno_r", "viridis_r", "magma_r", "plasma_r", "Greys", "bone_r", "draclassic", "demographicsclassic", "partisanclassic", "allgroupsclassic", "partisandistrictsclassic"];
|
|
47
|
+
export type PaletteName = typeof PaletteNames[number];
|
|
48
|
+
export declare function colorsFromStops(palette: PaletteName, stops: number[], classicColors: string[]): string[];
|
|
49
|
+
export declare function colorsFromStopsPartisan(palette: PaletteName, colorUse: ColorUse, stops: number[]): string[];
|
|
50
|
+
export declare function allGroups16Colors(palette: PaletteName, colors: string[]): string[];
|
|
51
|
+
export interface DistrictCache {
|
|
52
|
+
colorElection?: string;
|
|
53
|
+
colorEthnic?: string;
|
|
54
|
+
colorSolid?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ColorProp {
|
|
57
|
+
color: string;
|
|
58
|
+
}
|
|
59
|
+
export type ColorProps = Array<ColorProp>;
|
|
60
|
+
export interface DistrictColorParams {
|
|
61
|
+
datasetContext: PF.DatasetContext;
|
|
62
|
+
mapColors: ColorProps;
|
|
63
|
+
aggregates: PF.PackedFields[];
|
|
64
|
+
paletteDefaults: PaletteDefaults;
|
|
65
|
+
useFirstColor: boolean;
|
|
66
|
+
usePalette: string;
|
|
67
|
+
colorDistrictsBy: string;
|
|
68
|
+
}
|
|
69
|
+
export declare function computeDistrictColors(params: DistrictColorParams): DistrictCache[];
|
package/dist/dra-types.d.ts
CHANGED
|
@@ -22,4 +22,5 @@ export interface UserLikes {
|
|
|
22
22
|
[aid: string]: Like | string;
|
|
23
23
|
}
|
|
24
24
|
export type PlanType = 'congress' | 'upper' | 'lower' | 'county' | 'city' | 'coi' | 'other';
|
|
25
|
+
export type PlanTypeOrEmpty = PlanType | '';
|
|
25
26
|
export type ContactState = 'notcontacted' | 'optedin' | 'optedout' | 'implicitoptedin' | 'invalidemail' | 'blockedemail' | 'blockedoptedin';
|