data-navigator 1.1.0 → 1.2.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,142 @@
1
+ // StructureOptions is still under development!
2
+ // Our next major step is to build functions to automatically produce Structure
3
+ type StructureOptions = {
4
+ [key: string | number]: any
5
+ }
6
+
7
+ type InputOptions = {
8
+ structure: Structure,
9
+ navigationRules: NavigationRules,
10
+ entryPoint?: NodeId,
11
+ exitPoint?: RenderId
12
+ }
13
+
14
+ type RenderingOptions = {
15
+ elementData: ElementData | Nodes,
16
+ suffixId: string,
17
+ root: RootObject,
18
+ defaults?: RenderObject,
19
+ entryButton?: EntryObject,
20
+ exitElement?: ExitObject
21
+ }
22
+
23
+ type Structure = {
24
+ nodes: Nodes,
25
+ edges: Edges,
26
+ navigationRules?: NavigationRules,
27
+ elementData?: ElementData
28
+ }
29
+
30
+ type Nodes = Record<NodeId, NodeObject>
31
+ type Edges = Record<EdgeId, EdgeObject>
32
+ type NavigationRules = Record<NavId, NavObject>
33
+ type ElementData = Record<RenderId, RenderObject>
34
+
35
+ type EdgeList = Array<EdgeId>
36
+ type NavigationList = Array<NavId>
37
+
38
+ type Semantics = ((RenderObject?,DatumObject?) => SemanticsObject) | SemanticsObject
39
+ type Dimensions = ((RenderObject?,DatumObject?) => DimensionsObject) | DimensionsObject
40
+ type Attributes = ((RenderObject?,DatumObject?) => AttributesObject) | AttributesObject
41
+
42
+ type NodeObject = {
43
+ id: NodeId,
44
+ edges: EdgeList,
45
+ renderId?: RenderId,
46
+ [key: string | number]: any // NodeObjects can be lazily used as generic objects (like ElementObjects) too
47
+ }
48
+
49
+ type EdgeObject = {
50
+ source: (() => EdgeId) | EdgeId;
51
+ target: (() => EdgeId) | EdgeId;
52
+ navigationRules: NavigationList;
53
+ }
54
+
55
+ type NavObject = {
56
+ direction: Direction;
57
+ key?: string;
58
+ }
59
+
60
+ type RenderObject = {
61
+ cssClass?: DynamicString,
62
+ dimensions?: Dimensions,
63
+ semantics?: Semantics,
64
+ parentSemantics?: Semantics,
65
+ existingElement?: ExistingElement,
66
+ showText?: boolean
67
+ }
68
+
69
+ type RootObject = {
70
+ id: string,
71
+ cssClass?: string,
72
+ description?: string,
73
+ width?: string | number,
74
+ height?: string | number
75
+ }
76
+
77
+ type EntryObject = {
78
+ include: boolean,
79
+ callbacks?: EntryCallbacks
80
+ }
81
+
82
+ type ExitObject = {
83
+ include: boolean,
84
+ callbacks?: ExitCallbacks
85
+ }
86
+
87
+ type SemanticsObject = {
88
+ label?: DynamicString,
89
+ elementType?: DynamicString,
90
+ role?: DynamicString,
91
+ attributes?: Attributes
92
+ }
93
+
94
+ type DimensionsObject = {
95
+ x?: DynamicNumber,
96
+ y?: DynamicNumber,
97
+ width?: DynamicNumber,
98
+ height?: DynamicNumber,
99
+ path?: DynamicString
100
+ }
101
+
102
+ type DescriptionOptions = {
103
+ omitKeyNames?: boolean,
104
+ semanticLabel?: string
105
+ }
106
+
107
+ type ExistingElement = {
108
+ useForDimensions: boolean,
109
+ dimensions?: Dimensions
110
+ }
111
+
112
+ type EntryCallbacks = {
113
+ focus?: Function,
114
+ click?: Function
115
+ }
116
+
117
+ type ExitCallbacks = {
118
+ focus?: Function,
119
+ blur?: Function
120
+ }
121
+
122
+ type DatumObject = {
123
+ [key: string | number]: any
124
+ }
125
+
126
+ type AttributesObject = {
127
+ [key: string]: string
128
+ }
129
+
130
+ type DynamicNumber = ((RenderObject?,DatumObject?) => number) | number
131
+
132
+ type DynamicString = ((RenderObject?,DatumObject?) => string) | string
133
+
134
+ type NodeId = string
135
+
136
+ type EdgeId = string
137
+
138
+ type RenderId = string
139
+
140
+ type NavId = string
141
+
142
+ type Direction = "target" | "source"
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "data-navigator",
3
3
  "author": "Frank Elavsky",
4
- "version": "1.1.0",
5
- "main": "dist/index.jsm",
6
- "module": "dist/index",
7
- "types": "data-navigator.d.ts",
4
+ "version": "1.2.1",
5
+ "main": "./dist/index.jsm",
6
+ "module": "./dist/index",
7
+ "types": "./dist/data-navigator.d.ts",
8
8
  "files": [
9
9
  "dist/**/*"
10
10
  ],
11
11
  "exports": {
12
12
  ".": {
13
13
  "import": {
14
- "types": "./data-navigator.d.ts",
14
+ "types": "./dist/data-navigator.d.ts",
15
15
  "default": "./dist/index.js"
16
16
  },
17
17
  "require": {
18
- "types": "./data-navigator.d.ts",
18
+ "types": "./dist/data-navigator.d.ts",
19
19
  "default": "./dist/index.mjs"
20
20
  }
21
21
  }
@@ -29,9 +29,10 @@
29
29
  "description": "Data-navigator is a JavaScript library that allows for serial navigation of data structures using a variety of input modalities and assistive technologies.",
30
30
  "scripts": {
31
31
  "clean": "rm -rf ./dist && rm -rf ./app",
32
- "build": "yarn build:app && yarn build:index && yarn build:modules",
32
+ "build": "yarn build:app && yarn build:index && yarn build:types && yarn build:modules",
33
33
  "build:app": "webpack",
34
34
  "build:index": "tsup src/index.ts --format cjs,esm",
35
+ "build:types": "cp data-navigator.d.ts ./dist/",
35
36
  "build:modules": "tsup src/structure.ts src/input.ts src/rendering.ts src/utilities.ts src/consts.ts --format cjs,esm --minify",
36
37
  "server": "python -m http.server",
37
38
  "prettier-all-check": "prettier --config ./.prettierrc --ignore ./.prettierignore --debug-check \"**/*.{js,jsx,ts,tsx,html,jsx,json,css,scss,md}\"",