@vitessce/vit-s 2.0.1 → 2.0.3-beta.0

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,22 @@
1
+ import { CoordinationType } from '@vitessce/constants-internal';
2
+ import viewConfigSchema from './config-1.0.16.schema.json';
3
+ describe('view config schema', () => {
4
+ describe('coordination types', () => {
5
+ it('defines schema for all valid coordination types', () => {
6
+ const allCoordinationTypes = Object.values(CoordinationType);
7
+ const inCoordinationSpace = Object.keys(viewConfigSchema.properties.coordinationSpace.properties);
8
+ const inCoordinationScopes = Object.keys(viewConfigSchema.definitions.components.items.properties
9
+ .coordinationScopes.properties);
10
+ expect(inCoordinationSpace).toEqual(expect.arrayContaining(allCoordinationTypes));
11
+ expect(inCoordinationScopes).toEqual(expect.arrayContaining(allCoordinationTypes));
12
+ });
13
+ it('defines schema for only valid coordination types (does not have extra)', () => {
14
+ const allCoordinationTypes = Object.values(CoordinationType);
15
+ const inCoordinationSpace = Object.keys(viewConfigSchema.properties.coordinationSpace.properties);
16
+ const inCoordinationScopes = Object.keys(viewConfigSchema.definitions.components.items.properties
17
+ .coordinationScopes.properties);
18
+ expect(allCoordinationTypes).toEqual(expect.arrayContaining(inCoordinationSpace));
19
+ expect(allCoordinationTypes).toEqual(expect.arrayContaining(inCoordinationScopes));
20
+ });
21
+ });
22
+ });
@@ -0,0 +1,37 @@
1
+ export const obsSetsTabularSchema = {
2
+ $schema: 'http://json-schema.org/draft-07/schema#',
3
+ $id: 'https://github.com/vitessce/vitessce/#obsSetsTabular',
4
+ title: 'Vitessce obs sets data, tabular format',
5
+ definitions: {
6
+ colorArray: {
7
+ type: 'array',
8
+ items: { type: 'integer', minimum: 0, maximum: 255 },
9
+ minItems: 3,
10
+ maxItems: 3,
11
+ },
12
+ },
13
+ type: 'array',
14
+ items: {
15
+ type: 'object',
16
+ additionalProperties: false,
17
+ required: ['groupName', 'setName', 'obsId'],
18
+ properties: {
19
+ groupName: { type: 'string' },
20
+ setName: { type: 'string' },
21
+ setColor: { $ref: '#/definitions/colorArray' },
22
+ obsId: { type: 'string' },
23
+ predictionScore: {
24
+ oneOf: [
25
+ {
26
+ type: 'number',
27
+ minimum: 0.0,
28
+ maximum: 1.0,
29
+ },
30
+ {
31
+ type: 'null',
32
+ },
33
+ ],
34
+ },
35
+ },
36
+ },
37
+ };
@@ -0,0 +1,194 @@
1
+ export const obsSetsSchema = {
2
+ $schema: 'http://json-schema.org/draft-07/schema#',
3
+ $id: 'https://github.com/vitessce/vitessce/#cell-sets',
4
+ title: 'Vitessce obs sets data',
5
+ type: 'object',
6
+ definitions: {
7
+ stringArray: {
8
+ type: 'array',
9
+ items: {
10
+ type: 'string',
11
+ },
12
+ },
13
+ stringProbabilityTupleArray: {
14
+ type: 'array',
15
+ items: {
16
+ type: 'array',
17
+ additionalItems: false,
18
+ items: [
19
+ {
20
+ type: 'string',
21
+ },
22
+ {
23
+ oneOf: [
24
+ {
25
+ type: 'number',
26
+ minimum: 0.0,
27
+ maximum: 1.0,
28
+ },
29
+ {
30
+ type: 'null',
31
+ },
32
+ ],
33
+ },
34
+ ],
35
+ },
36
+ },
37
+ colorArray: {
38
+ type: 'array',
39
+ items: {
40
+ type: 'integer',
41
+ minimum: 0,
42
+ maximum: 255,
43
+ },
44
+ minItems: 3,
45
+ maxItems: 3,
46
+ },
47
+ treeNodeLeaf: {
48
+ type: 'object',
49
+ additionalProperties: false,
50
+ required: ['name'],
51
+ properties: {
52
+ name: {
53
+ type: 'string',
54
+ },
55
+ color: {
56
+ $ref: '#/definitions/colorArray',
57
+ },
58
+ set: {
59
+ $ref: '#/definitions/stringArray',
60
+ },
61
+ },
62
+ },
63
+ treeNodeNonLeaf: {
64
+ type: 'object',
65
+ additionalProperties: false,
66
+ required: ['name'],
67
+ properties: {
68
+ name: {
69
+ type: 'string',
70
+ },
71
+ color: {
72
+ $ref: '#/definitions/colorArray',
73
+ },
74
+ children: {
75
+ type: 'array',
76
+ items: {
77
+ $ref: '#/definitions/treeNode',
78
+ },
79
+ },
80
+ },
81
+ },
82
+ treeNode: {
83
+ oneOf: [
84
+ {
85
+ $ref: '#/definitions/treeNodeNonLeaf',
86
+ },
87
+ {
88
+ $ref: '#/definitions/treeNodeLeaf',
89
+ },
90
+ ],
91
+ },
92
+ 'version0.1.2': {
93
+ type: 'object',
94
+ additionalProperties: false,
95
+ required: ['version', 'datatype', 'tree'],
96
+ properties: {
97
+ dataset: {
98
+ type: 'string',
99
+ },
100
+ version: {
101
+ type: 'string',
102
+ enum: ['0.1.2'],
103
+ },
104
+ datatype: {
105
+ type: 'string',
106
+ enum: ['cell', 'obs'],
107
+ },
108
+ tree: {
109
+ type: 'array',
110
+ items: {
111
+ $ref: '#/definitions/treeNodeNonLeaf',
112
+ },
113
+ },
114
+ },
115
+ },
116
+ treeNodeLeafProbabilistic: {
117
+ type: 'object',
118
+ additionalProperties: false,
119
+ required: ['name'],
120
+ properties: {
121
+ name: {
122
+ type: 'string',
123
+ },
124
+ color: {
125
+ $ref: '#/definitions/colorArray',
126
+ },
127
+ set: {
128
+ $ref: '#/definitions/stringProbabilityTupleArray',
129
+ },
130
+ },
131
+ },
132
+ treeNodeNonLeafProbabilistic: {
133
+ type: 'object',
134
+ additionalProperties: false,
135
+ required: ['name'],
136
+ properties: {
137
+ name: {
138
+ type: 'string',
139
+ },
140
+ color: {
141
+ $ref: '#/definitions/colorArray',
142
+ },
143
+ children: {
144
+ type: 'array',
145
+ items: {
146
+ $ref: '#/definitions/treeNodeProbabilistic',
147
+ },
148
+ },
149
+ },
150
+ },
151
+ treeNodeProbabilistic: {
152
+ oneOf: [
153
+ {
154
+ $ref: '#/definitions/treeNodeNonLeafProbabilistic',
155
+ },
156
+ {
157
+ $ref: '#/definitions/treeNodeLeafProbabilistic',
158
+ },
159
+ ],
160
+ },
161
+ 'version0.1.3': {
162
+ type: 'object',
163
+ additionalProperties: false,
164
+ required: ['version', 'datatype', 'tree'],
165
+ properties: {
166
+ dataset: {
167
+ type: 'string',
168
+ },
169
+ version: {
170
+ type: 'string',
171
+ enum: ['0.1.3'],
172
+ },
173
+ datatype: {
174
+ type: 'string',
175
+ enum: ['cell', 'obs'],
176
+ },
177
+ tree: {
178
+ type: 'array',
179
+ items: {
180
+ $ref: '#/definitions/treeNodeNonLeafProbabilistic',
181
+ },
182
+ },
183
+ },
184
+ },
185
+ },
186
+ oneOf: [
187
+ {
188
+ $ref: '#/definitions/version0.1.2',
189
+ },
190
+ {
191
+ $ref: '#/definitions/version0.1.3',
192
+ },
193
+ ],
194
+ };
@@ -0,0 +1,46 @@
1
+ import Ajv from 'ajv';
2
+ /* eslint-disable import/no-dynamic-require */
3
+ /* eslint-disable global-require */
4
+ describe('schemas', () => {
5
+ [
6
+ 'config-1.0.1',
7
+ 'obsSets',
8
+ 'obsSetsTabular',
9
+ 'raster',
10
+ ].forEach((type) => {
11
+ const schemaFile = `${type}.schema.json`;
12
+ describe(schemaFile, () => {
13
+ const schema = require(`./${schemaFile}`);
14
+ let validate;
15
+ if (type === 'config-1.0.1') {
16
+ const obsSets = require('./obsSets.schema.json');
17
+ const raster = require('./raster.schema.json');
18
+ validate = new Ajv()
19
+ .addSchema(obsSets)
20
+ .addSchema(raster)
21
+ .compile(schema);
22
+ }
23
+ else {
24
+ validate = new Ajv().compile(schema);
25
+ }
26
+ const [goodFixture, badFixture, badMessage] = [
27
+ 'good', 'bad', 'bad.message',
28
+ ].map(stem => `${type}.${stem}.json`);
29
+ it(`passes ${goodFixture}`, () => {
30
+ const data = require(`./fixtures/${goodFixture}`);
31
+ const valid = validate(data);
32
+ if (!valid) {
33
+ console.warn(validate.errors);
34
+ }
35
+ expect(valid).toEqual(true);
36
+ });
37
+ it(`fails ${badFixture}`, () => {
38
+ const data = require(`./fixtures/${badFixture}`);
39
+ const message = require(`./fixtures/${badMessage}`);
40
+ const valid = validate(data);
41
+ expect(valid).toEqual(false);
42
+ expect(validate.errors).toEqual(message);
43
+ });
44
+ });
45
+ });
46
+ });
@@ -0,0 +1,3 @@
1
+ export { schema as rasterSchema } from './schemas/raster.schema';
2
+ export { schema as obsSetsSchema } from './schemas/obs-sets.schema';
3
+ export { schema as obsSetsTabularSchema } from './schemas/obs-sets-tabular.schema';
@@ -7,14 +7,14 @@ export const useVitessceContainerStyles = makeStyles(theme => ({
7
7
  backgroundColor: theme.palette.gridLayoutBackground,
8
8
  '& div': {
9
9
  fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"',
10
- fontSize: '1rem',
10
+ fontSize: '16px',
11
11
  fontWeight: '400',
12
12
  lineHeight: '1.5',
13
13
  textAlign: 'left',
14
14
  },
15
15
  '& p': {
16
16
  marginTop: '0',
17
- marginBottom: '1rem',
17
+ marginBottom: '16px',
18
18
  },
19
19
  '& *, ::after, ::before': {
20
20
  boxSizing: 'border-box',
@@ -11,6 +11,48 @@ const globalColors = {
11
11
  grayMidL10: 'rgb(154, 154, 154)',
12
12
  grayLightL10: 'rgb(237, 237, 237)', // lighten(map-get($global-colors, "gray-light"), 10%);
13
13
  };
14
+ const sharedThemeOptions = {
15
+ // Use px instead of rem, so that sizing is consistent despite the root element font-size.
16
+ // Reference: https://github.com/mui/material-ui/blob/627c08fc/src/styles/createTypography.js
17
+ typography: {
18
+ pxToRem: size => `${size}px`,
19
+ display4: {
20
+ fontSize: '112px',
21
+ },
22
+ display3: {
23
+ fontSize: '56px',
24
+ },
25
+ display2: {
26
+ fontSize: '45px',
27
+ },
28
+ display1: {
29
+ fontSize: '34px',
30
+ },
31
+ headline: {
32
+ fontSize: '24px',
33
+ },
34
+ title: {
35
+ fontSize: '21px',
36
+ },
37
+ subheading: {
38
+ fontSize: '16px',
39
+ },
40
+ body2: {
41
+ fontSize: '14px',
42
+ },
43
+ body1: {
44
+ fontSize: '14px',
45
+ },
46
+ caption: {
47
+ fontSize: '12px',
48
+ },
49
+ },
50
+ props: {
51
+ MuiButtonBase: {
52
+ disableRipple: true,
53
+ },
54
+ },
55
+ };
14
56
  export const muiTheme = {
15
57
  dark: createTheme({
16
58
  palette: {
@@ -35,11 +77,7 @@ export const muiTheme = {
35
77
  cardBorder: 'rgba(0, 0, 0, 0.125)',
36
78
  ...globalColors,
37
79
  },
38
- props: {
39
- MuiButtonBase: {
40
- disableRipple: true,
41
- },
42
- },
80
+ ...sharedThemeOptions,
43
81
  }),
44
82
  light: createTheme({
45
83
  palette: {
@@ -64,10 +102,6 @@ export const muiTheme = {
64
102
  cardBorder: 'rgba(241, 241, 241, 0.125)',
65
103
  ...globalColors,
66
104
  },
67
- props: {
68
- MuiButtonBase: {
69
- disableRipple: true,
70
- },
71
- },
105
+ ...sharedThemeOptions,
72
106
  }),
73
107
  };
@@ -38,7 +38,7 @@ export const useStyles = makeStyles(theme => ({
38
38
  },
39
39
  select: {
40
40
  '& select': {
41
- fontSize: '.875rem',
41
+ fontSize: '14px',
42
42
  },
43
43
  },
44
44
  selectRoot: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/vit-s",
3
- "version": "2.0.1",
3
+ "version": "2.0.3-beta.0",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "react-grid-layout-with-lodash": "^1.3.5",
25
25
  "uuid": "^3.3.2",
26
26
  "zustand": "^3.5.10",
27
- "@vitessce/constants-internal": "2.0.1",
28
- "@vitessce/utils": "2.0.1"
27
+ "@vitessce/constants-internal": "2.0.3-beta.0",
28
+ "@vitessce/utils": "2.0.3-beta.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "react": "^18.0.0",