gps-global-types 1.0.0 → 1.0.1

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.
@@ -0,0 +1,18 @@
1
+ export type StringDictionary = {
2
+ [key: string]: string;
3
+ };
4
+
5
+ export type RegexMatchedString<Pattern extends string> =
6
+ `${string & { __brand: Pattern }}`;
7
+ //TYPES OF STRINGS
8
+
9
+
10
+ export type armordAccessionNumber = string // who KNOWS the format of these
11
+ export type ObjectId = RegexMatchedString<'[a-zA-Z0-9]{12}'> //12 byte string meant to index mongo docs
12
+ export type armordMrsnId = string // 6 o/* */r 7 digit number typically, but the bi-db is a cesspool
13
+ export type mrsnId = string // ###### ('MRSN' + 6 or 7 digit number) typically, but the bi-db is a cesspool
14
+ export type armordPatientId = RegexMatchedString<'M\d+'> // M###### ('M'+6 digit number), but the bi-db is a cesspool
15
+ export type Hex = RegexMatchedString<'#\d{6}'> // 6 digit String hexadecimal w/ '#' prepended
16
+ export type Rgb = RegexMatchedString<'rgb\([1-256],[1-256],[1-256]\)'> // format rgb(\d[1-256],\d[1-256],\d[1-256])
17
+ export type Color = Hex | Rgb | String
18
+
package/link.types.tsx ADDED
@@ -0,0 +1,22 @@
1
+ import {BaseType,Selection, SimulationLinkDatum, SimulationNodeDatum} from 'd3';
2
+ import { mstGlobalTypes } from './mst.types';
3
+ interface coords {
4
+ x:number,
5
+ y:number
6
+ }
7
+ export interface EdgeType { // extends SimulationLinkDatum<NodeType>} anything not defined here was added by d3 (or i fucked up)
8
+ source:coords // node _id edge to
9
+ target:coords // node _id edge from
10
+ value:number // distance between source and target
11
+ }
12
+
13
+ export type gLinkType = Selection<SVGGElement, EdgeType, BaseType, unknown>
14
+ export interface LinkType {
15
+ g:gLinkType
16
+ }
17
+
18
+ export interface LinkProps {
19
+ data: EdgeType[],
20
+ force:mstGlobalTypes
21
+ }
22
+ export type svgSelection = Selection<BaseType, gLinkType, Element, LinkType>; //Selection<Element,LinkType,Element,any>
package/mst.types.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ import { armordAccessionNumber, Color, mrsnId, ObjectId, RegexMatchedString } from "./global.types";
1
2
 
2
3
  export interface mstGlobalTypes {
3
4
  //form values
@@ -24,19 +25,6 @@ export type colorKey = typeof colorFields[number];
24
25
  export type dateKey = typeof dateFields[number];
25
26
  export type labelKey = typeof labelFields[number];
26
27
 
27
- type RegexMatchedString<Pattern extends string> =
28
- `${string & { __brand: Pattern }}`;
29
- //TYPES OF STRINGS
30
- type armordAccessionNumber = string // who KNOWS the format of these
31
- type ObjectId = RegexMatchedString<'[a-zA-Z0-9]{12}'> //12 byte string meant to index mongo docs
32
- type armordMrsnId = string // 6 o/* */r 7 digit number typically, but the bi-db is a cesspool
33
- type mrsnId = string // ###### ('MRSN' + 6 or 7 digit number) typically, but the bi-db is a cesspool
34
- type armordPatientId = RegexMatchedString<'M\d+'> // M###### ('M'+6 digit number), but the bi-db is a cesspool
35
- type Hex = RegexMatchedString<'#\d{6}'> // 6 digit String hexadecimal w/ '#' prepended
36
- type Rgb = RegexMatchedString<'rgb\([1-256],[1-256],[1-256]\)'> // format rgb(\d[1-256],\d[1-256],\d[1-256])
37
- type Color = Hex|Rgb|String
38
-
39
-
40
28
 
41
29
 
42
30
 
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "gps-global-types",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "types shared between front-end and back-end",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "author": "lizz",
10
- "type":"module",
11
- "license": "ISC"
10
+ "type": "module",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "d3": "^7.9.0",
14
+ "react": "^19.1.1"
15
+ }
12
16
  }
package/pie.types.tsx CHANGED
@@ -1,8 +1,6 @@
1
1
  import { BaseType, Selection, SimulationNodeDatum } from "d3"
2
- import { Ref, RefObject } from "react"
3
- import { EdgeType, svgSelection } from "../../Link/link.types"
4
- import { ObjectId, Color, RegexMatchedString } from "@/assets/types/global.types"
5
- import { colorKey, dateKey, labelKey } from "../../mst.types"
2
+ import { ObjectId, Color, RegexMatchedString } from "./global.types"
3
+ import { colorKey, dateKey, labelKey } from "./mst.types"
6
4
 
7
5
  export interface ColorField {//TYPES OF GRAPH FIELDS ColorField datefields become colorFields but require additional processing
8
6
  color: string, // unique hex or rgb of parameter
@@ -19,7 +17,7 @@ type LabelType = RegexMatchedString<'(\w&)*'> // if many, seperated by '&' qhich
19
17
  type DateType = string | Date // must be able to be interpreted as date type by Date js object
20
18
 
21
19
 
22
- interface ExtraNodeTypeFields extends d3.SimulationNodeDatum {
20
+ interface ExtraNodeTypeFields extends SimulationNodeDatum {
23
21
  id: ObjectId,//unique identifier referenced by Graph.links and d3 Force. String but it's a string of a mongo id
24
22
  beforeAndAfter?: ColorType[], //[=[{color:'#fff',value:1}]] so it doesnt break on recalculation
25
23
  dateArr: DateType[], // array of armordCultureDates used for beforeAndAfter coloring
@@ -48,13 +46,13 @@ export interface SelectionObj {
48
46
  mrsnIds: string[],
49
47
  active: boolean
50
48
  }
51
- export interface InitializeDragProps {
52
- sticky: boolean,
53
- sim: RefObject<d3.Simulation<d3.SimulationNodeDatum, any>>,
54
- setSelected: React.Dispatch<React.SetStateAction<SelectionObj>>,
55
- height: number,
56
- width: number// todo can this be a global const somewhere instead?
57
- }
49
+ // export interface InitializeDragProps {
50
+ // sticky: boolean,
51
+ // sim: RefObject<Simulation<SimulationNodeDatum, any>>,
52
+ // setSelected: Dispatch<SetStateAction<SelectionObj>>,
53
+ // height: number,
54
+ // width: number// todo can this be a global const somewhere instead?
55
+ // }
58
56
  export interface NodeColorProps {
59
57
  colorField: keyof NodeType,
60
58
  svg: ParentSelection,
package/line.types.tsx DELETED
File without changes