@dra2020/dra-types 1.8.103 → 1.8.104

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
@@ -608,3 +608,87 @@ export function computeDistrictColors(params: DistrictColorParams): DistrictCach
608
608
  }
609
609
  return dcNew;
610
610
  }
611
+
612
+ // Dotmap support
613
+ export interface RGB { r: number, g: number, b: number };
614
+
615
+ export const BinRed = 0
616
+ export const BinOrangeRed = 1;
617
+ export const BinBrown = 2;
618
+ export const BinOrange = 3;
619
+ export const BinGold = 4;
620
+ export const BinYellow = 5;
621
+ export const BinGreenish = 6;
622
+ export const BinChartreuse = 7;
623
+ export const BinLime = 8;
624
+ export const BinMediumSpringGreen = 9;
625
+ export const BinCyan = 10;
626
+ export const BinLightBlue = 11;
627
+ export const BinBlue = 12;
628
+ export const BinBlueViolet = 13;
629
+ export const BinDarkViolet = 14;
630
+ export const BinMagenta = 15;
631
+ export const BinDeepPink = 16;
632
+
633
+ export const BinColorLookup: RGB[] = [
634
+ { r: 0xff, g: 0x00, b: 0x00 }, // 0 - red
635
+ { r: 0xff, g: 0x45, b: 0x00 }, // 1 - orange red
636
+ { r: 0x99, g: 0x66, b: 0x33 }, // 2 - brown
637
+ { r: 0xff, g: 0xaa, b: 0x00 }, // 3 - orange
638
+ { r: 0xff, g: 0xd7, b: 0x00 }, // 4 - gold
639
+ { r: 0xff, g: 0xd7, b: 0x00 }, // 5 - yellow
640
+ { r: 0x9f, g: 0xd4, b: 0x00 }, // 6 - greenish
641
+ { r: 0x7f, g: 0xff, b: 0x00 }, // 7 - chartreuse
642
+ { r: 0x00, g: 0xff, b: 0x00 }, // 8 - lime
643
+ { r: 0x00, g: 0xfa, b: 0x9a }, // 9 - medium spring green
644
+ { r: 0x00, g: 0xff, b: 0xff }, // 10 - cyan
645
+ { r: 0x73, g: 0xb2, b: 0xff }, // 11 - light blue
646
+ { r: 0x00, g: 0x00, b: 0xff }, // 12 - blue
647
+ { r: 0x8a, g: 0x2b, b: 0xe2 }, // 13 - blue violet
648
+ { r: 0x94, g: 0x00, b: 0xd3 }, // 14 - dark violet
649
+ { r: 0xff, g: 0x00, b: 0xff }, // 15 - magenta
650
+ { r: 0xff, g: 0x14, b: 0x93 }, // 16 - deep pink
651
+ ];
652
+
653
+ // Map ordering to Bin* lookup values
654
+ const ColorOrderEthnic = 'wbaho'; // abcde
655
+
656
+ // Map number of fields to color selection
657
+ export const FieldCountToColors: { [nfields: number]: number[] } = {
658
+ [1]: [ BinBrown ],
659
+ [2]: [ BinRed, BinBlue ],
660
+ [3]: [ BinRed, BinBlue, BinBrown ],
661
+ [4]: [ BinRed, BinBlue, BinBrown, BinGreenish ],
662
+ [5]: [ BinLightBlue, BinGreenish, BinRed, BinOrange, BinBrown ],
663
+ [6]: [ BinRed, BinBrown, BinGold, BinGreenish, BinLightBlue, BinBlueViolet ],
664
+ [7]: [ BinRed, BinBrown, BinGold, BinGreenish, BinLightBlue, BinBlueViolet, BinMagenta ],
665
+ [8]: [ BinRed, BinBrown, BinGold, BinGreenish, BinLightBlue, BinBlueViolet, BinMagenta, BinDeepPink ],
666
+ [9]: [ BinRed, BinBrown, BinGold, BinGreenish, BinLightBlue, BinBlue, BinBlueViolet, BinMagenta, BinDeepPink ],
667
+ [10]: [ BinRed, BinBrown, BinGold, BinGreenish, BinCyan, BinLightBlue, BinBlue, BinBlueViolet, BinMagenta, BinDeepPink ],
668
+ [11]: [ BinRed, BinBrown, BinGold, BinGreenish, BinLime, BinCyan, BinLightBlue, BinBlue, BinBlueViolet, BinMagenta, BinDeepPink ],
669
+ [12]: [ BinRed, BinBrown, BinOrange, BinGold, BinGreenish, BinLime, BinCyan, BinLightBlue, BinBlue, BinBlueViolet, BinMagenta, BinDeepPink ],
670
+ [13]: [ BinRed, BinBrown, BinOrange, BinGold, BinGreenish, BinLime, BinMediumSpringGreen, BinCyan, BinLightBlue, BinBlue, BinBlueViolet, BinMagenta, BinDeepPink ],
671
+ [14]: [ BinRed, BinOrangeRed, BinBrown, BinOrange, BinGold, BinGreenish, BinLime, BinMediumSpringGreen, BinCyan, BinLightBlue, BinBlue, BinBlueViolet, BinMagenta, BinDeepPink ],
672
+ [15]: [ BinRed, BinOrangeRed, BinBrown, BinOrange, BinGold, BinGreenish, BinLime, BinMediumSpringGreen, BinCyan, BinLightBlue, BinBlue, BinBlueViolet, BinDarkViolet, BinMagenta, BinDeepPink ],
673
+ [16]: [ BinRed, BinOrangeRed, BinBrown, BinOrange, BinGold, BinYellow, BinGreenish, BinLime, BinMediumSpringGreen, BinCyan, BinLightBlue, BinBlue, BinBlueViolet, BinDarkViolet, BinMagenta, BinDeepPink ],
674
+ };
675
+ const MaxFields = 16;
676
+
677
+
678
+ export function colorindexToRGB(colorindex: number): RGB
679
+ {
680
+ return BinColorLookup[colorindex] || BinColorLookup[BinBrown];
681
+ }
682
+
683
+ export const ColorFlags = 'abcdefghijklmnopqrstuvwxyz';
684
+
685
+ export function colorflagToColorindex(nfields: number, colorflag: string): number
686
+ {
687
+ let i = ColorFlags.indexOf(colorflag);
688
+ return i >= 0 && nfields > 0 && nfields <= MaxFields ? FieldCountToColors[nfields][i] : BinBrown;
689
+ }
690
+
691
+ export function colororderToColorindex(nfields: number, order: number): number
692
+ {
693
+ return order >= 0 && nfields > 0 && nfields <= MaxFields ? FieldCountToColors[nfields][order] : BinBrown;
694
+ }
package/lib/schemas.ts CHANGED
@@ -235,6 +235,7 @@ export let Schemas: any = {
235
235
  official: 'BOOL',
236
236
  state: 'S',
237
237
  datasource: 'S',
238
+ groups: 'M',
238
239
  // meta: { dataset metadata structure },
239
240
  // dotmap: 'BOOL',
240
241
  },
@@ -274,6 +275,16 @@ export let Schemas: any = {
274
275
  },
275
276
  KeySchema: { id: 'HASH', sid: 'RANGE' },
276
277
  },
278
+ 'groupsdatasets':
279
+ {
280
+ FileOptions: { map: true },
281
+ Schema: {
282
+ id: 'S',
283
+ sid: 'S',
284
+ permission: 'N',
285
+ },
286
+ KeySchema: { id: 'HASH', sid: 'RANGE' },
287
+ },
277
288
  'notifications':
278
289
  {
279
290
  FileOptions: { map: true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/dra-types",
3
- "version": "1.8.103",
3
+ "version": "1.8.104",
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",