@genome-spy/core 0.49.0 → 0.50.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.
Files changed (57) hide show
  1. package/dist/bundle/index.es.js +2617 -2593
  2. package/dist/bundle/index.js +91 -91
  3. package/dist/schema.json +1752 -1090
  4. package/dist/src/gl/includes/common.glsl.js +1 -1
  5. package/dist/src/marks/link.d.ts +8 -1
  6. package/dist/src/marks/link.d.ts.map +1 -1
  7. package/dist/src/marks/link.fragment.glsl.js +1 -1
  8. package/dist/src/marks/link.js +38 -32
  9. package/dist/src/marks/link.vertex.glsl.js +1 -1
  10. package/dist/src/marks/mark.d.ts +18 -16
  11. package/dist/src/marks/mark.d.ts.map +1 -1
  12. package/dist/src/marks/mark.js +34 -23
  13. package/dist/src/marks/markUtils.d.ts +25 -0
  14. package/dist/src/marks/markUtils.d.ts.map +1 -1
  15. package/dist/src/marks/markUtils.js +41 -1
  16. package/dist/src/marks/point.common.glsl.js +1 -1
  17. package/dist/src/marks/point.d.ts +8 -1
  18. package/dist/src/marks/point.d.ts.map +1 -1
  19. package/dist/src/marks/point.js +29 -24
  20. package/dist/src/marks/point.vertex.glsl.js +1 -1
  21. package/dist/src/marks/rect.d.ts +8 -1
  22. package/dist/src/marks/rect.d.ts.map +1 -1
  23. package/dist/src/marks/rect.js +19 -19
  24. package/dist/src/marks/rule.d.ts +8 -1
  25. package/dist/src/marks/rule.d.ts.map +1 -1
  26. package/dist/src/marks/rule.js +19 -16
  27. package/dist/src/marks/text.d.ts +10 -1
  28. package/dist/src/marks/text.d.ts.map +1 -1
  29. package/dist/src/marks/text.fragment.glsl.js +1 -1
  30. package/dist/src/marks/text.js +48 -46
  31. package/dist/src/marks/text.vertex.glsl.js +1 -1
  32. package/dist/src/spec/channel.d.ts +14 -1
  33. package/dist/src/spec/mark.d.ts +128 -82
  34. package/dist/src/spec/view.d.ts +2 -7
  35. package/dist/src/tooltip/dataTooltipHandler.d.ts +1 -1
  36. package/dist/src/tooltip/dataTooltipHandler.d.ts.map +1 -1
  37. package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts +1 -1
  38. package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts.map +1 -1
  39. package/dist/src/view/axisResolution.d.ts +1 -1
  40. package/dist/src/view/axisResolution.d.ts.map +1 -1
  41. package/dist/src/view/axisResolution.js +1 -1
  42. package/dist/src/view/axisView.js +2 -2
  43. package/dist/src/view/flowBuilder.test.js +1 -1
  44. package/dist/src/view/gridView.js +1 -1
  45. package/dist/src/view/paramMediator.d.ts +7 -0
  46. package/dist/src/view/paramMediator.d.ts.map +1 -1
  47. package/dist/src/view/paramMediator.js +23 -0
  48. package/dist/src/view/paramMediator.test.js +20 -0
  49. package/dist/src/view/scaleResolution.d.ts +1 -7
  50. package/dist/src/view/scaleResolution.d.ts.map +1 -1
  51. package/dist/src/view/scaleResolution.js +24 -39
  52. package/dist/src/view/unitView.d.ts +3 -5
  53. package/dist/src/view/unitView.d.ts.map +1 -1
  54. package/dist/src/view/unitView.js +22 -4
  55. package/dist/src/view/viewUtils.d.ts +1 -1
  56. package/dist/src/view/viewUtils.d.ts.map +1 -1
  57. package/package.json +2 -2
@@ -11,6 +11,9 @@ import { isValueDef } from "../encoder/encoder.js";
11
11
  import { getCachedOrCall } from "../utils/propertyCacher.js";
12
12
  import { isDiscrete } from "vega-scale";
13
13
 
14
+ /**
15
+ * @extends {Mark<import("../spec/mark.js").RectProps>}
16
+ */
14
17
  export default class RectMark extends Mark {
15
18
  /**
16
19
  * @param {import("../view/unitView.js").default} unitView
@@ -18,27 +21,24 @@ export default class RectMark extends Mark {
18
21
  constructor(unitView) {
19
22
  super(unitView);
20
23
 
21
- Object.defineProperties(
22
- this.defaultProperties,
23
- Object.getOwnPropertyDescriptors({
24
- x2: undefined,
25
- y2: undefined,
26
- filled: true,
27
- color: "#4c78a8",
28
- opacity: 1.0,
29
- strokeWidth: 3,
30
- cornerRadius: 0.0,
31
-
32
- minWidth: 0.5, // Minimum width/height prevents annoying flickering when zooming
33
- minHeight: 0.5,
34
- minOpacity: 1.0,
35
-
36
- tessellationZoomThreshold: 10, // This works with genomes, but likely breaks with other data. TODO: Fix, TODO: log2
37
- tessellationTiles: 35, // TODO: Tiles per unit (bp)
38
- })
39
- );
24
+ this.augmentDefaultProperties({
25
+ x2: undefined,
26
+ y2: undefined,
27
+ filled: true,
28
+ color: "#4c78a8",
29
+ opacity: 1.0,
30
+ strokeWidth: 3,
31
+ cornerRadius: 0.0,
32
+
33
+ minWidth: 0.5, // Minimum width/height prevents annoying flickering when zooming
34
+ minHeight: 0.5,
35
+ minOpacity: 1.0,
36
+ });
40
37
  }
41
38
 
39
+ /**
40
+ * @returns {import("../spec/channel.js").Channel[]}
41
+ */
42
42
  getAttributes() {
43
43
  return [
44
44
  "uniqueId",
@@ -1,4 +1,11 @@
1
- export default class RuleMark extends Mark {
1
+ /**
2
+ * @extends {Mark<import("../spec/mark.js").RuleProps>}
3
+ */
4
+ export default class RuleMark extends Mark<import("../spec/mark.js").RuleProps> {
5
+ /**
6
+ * @param {import("../view/unitView.js").default} unitView
7
+ */
8
+ constructor(unitView: import("../view/unitView.js").default);
2
9
  dashTextureSize: number;
3
10
  dashTexture: WebGLTexture;
4
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../src/marks/rule.js"],"names":[],"mappings":"AAcA;IAOQ,wBAAwB;IA4GpB,0BAOE;CAgGb;iBAxOgB,WAAW"}
1
+ {"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../src/marks/rule.js"],"names":[],"mappings":"AAcA;;GAEG;AACH;IACI;;OAEG;IACH,sBAFW,OAAO,qBAAqB,EAAE,OAAO,EAoB/C;IAfG,wBAAwB;IA4GpB,0BAOE;CAgGb;iBA3OgB,WAAW"}
@@ -12,6 +12,9 @@ import COMMON_SHADER from "./rule.common.glsl.js";
12
12
  import { RuleVertexBuilder } from "../gl/dataToVertices.js";
13
13
  import { isChannelDefWithScale } from "../encoder/encoder.js";
14
14
 
15
+ /**
16
+ * @extends {Mark<import("../spec/mark.js").RuleProps>}
17
+ */
15
18
  export default class RuleMark extends Mark {
16
19
  /**
17
20
  * @param {import("../view/unitView.js").default} unitView
@@ -21,24 +24,24 @@ export default class RuleMark extends Mark {
21
24
 
22
25
  this.dashTextureSize = 0;
23
26
 
24
- Object.defineProperties(
25
- this.defaultProperties,
26
- Object.getOwnPropertyDescriptors({
27
- x2: undefined,
28
- y2: undefined,
29
- size: 1,
30
- color: "black",
31
- opacity: 1.0,
32
-
33
- minLength: 0.0,
34
- /** @type {number[]} */
35
- strokeDash: null,
36
- strokeDashOffset: 0,
37
- strokeCap: "butt",
38
- })
39
- );
27
+ this.augmentDefaultProperties({
28
+ x2: undefined,
29
+ y2: undefined,
30
+ size: 1,
31
+ color: "black",
32
+ opacity: 1.0,
33
+
34
+ minLength: 0.0,
35
+ /** @type {number[]} */
36
+ strokeDash: null,
37
+ strokeDashOffset: 0,
38
+ strokeCap: "butt",
39
+ });
40
40
  }
41
41
 
42
+ /**
43
+ * @returns {import("../spec/channel.js").Channel[]}
44
+ */
42
45
  getAttributes() {
43
46
  return [
44
47
  "uniqueId",
@@ -5,8 +5,17 @@
5
5
  * - Valve's SDF paper: https://doi.org/10.1145/1281500.1281665
6
6
  * - Multi-channel SDF fonts: https://github.com/Chlumsky/msdfgen
7
7
  * - Google's web fonts as SDFs: https://github.com/etiennepinchon/aframe-fonts
8
+ *
9
+ * @extends {Mark<import("../spec/mark.js").TextProps>}
8
10
  */
9
- export default class TextMark extends Mark {
11
+ export default class TextMark extends Mark<import("../spec/mark.js").TextProps> {
12
+ /**
13
+ * @typedef {import("../spec/mark.js").MarkProps} MarkProps
14
+ */
15
+ /**
16
+ * @param {import("../view/unitView.js").default} unitView
17
+ */
18
+ constructor(unitView: import("../view/unitView.js").default);
10
19
  font: import("../fonts/bmFontManager.js").FontEntry;
11
20
  }
12
21
  import Mark from "./mark.js";
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/marks/text.js"],"names":[],"mappings":"AAgCA;;;;;;;GAOG;AACH;IAyDQ,oDAMmD;CA4M1D;iBAtSgB,WAAW"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/marks/text.js"],"names":[],"mappings":"AAgCA;;;;;;;;;GASG;AACH;IACI;;OAEG;IACH;;OAEG;IACH,sBAFW,OAAO,qBAAqB,EAAE,OAAO,EA8D/C;IAbG,oDAMmD;CA+M1D;iBAxSgB,WAAW"}
@@ -1,2 +1,2 @@
1
- const shader = "uniform sampler2D uTexture;in vec2 vTexCoord;in float vEdgeFadeOpacity;in vec4 vColor;in float vSlope;out lowp vec4 fragColor;float median(float r,float g,float b){return max(min(r,g),min(max(r,g),b));}void main(){vec3 c=texture(uTexture,vTexCoord).rgb;float sigDist=1.0-median(c.r,c.g,c.b);float slope=uLogoLetter? 0.7/length(vec2(dFdy(sigDist),dFdx(sigDist))): vSlope;float opa=clamp((sigDist-0.5)*slope+0.5,0.0,1.0);opa*=pow(clamp(vEdgeFadeOpacity,0.0,1.0),2.2);fragColor=vColor*opa;if(uPickingEnabled){fragColor=vPickingColor;}}";
1
+ const shader = "uniform sampler2D uTexture;in vec2 vTexCoord;in float vEdgeFadeOpacity;in vec4 vColor;in float vSlope;in float vGamma;out lowp vec4 fragColor;float median(float r,float g,float b){return max(min(r,g),min(max(r,g),b));}void main(){vec3 c=texture(uTexture,vTexCoord).rgb;float sigDist=1.0-median(c.r,c.g,c.b);float slope=uLogoLetter? 0.7/length(vec2(dFdy(sigDist),dFdx(sigDist))): vSlope;float opa=clamp((sigDist-0.5)*slope+0.5,0.0,1.0);opa*=clamp(vEdgeFadeOpacity,0.0,1.0);opa=pow(opa,vGamma);fragColor=vColor*opa;if(uPickingEnabled){fragColor=vPickingColor;}}";
2
2
  export default shader;
@@ -37,6 +37,8 @@ const baselines = {
37
37
  * - Valve's SDF paper: https://doi.org/10.1145/1281500.1281665
38
38
  * - Multi-channel SDF fonts: https://github.com/Chlumsky/msdfgen
39
39
  * - Google's web fonts as SDFs: https://github.com/etiennepinchon/aframe-fonts
40
+ *
41
+ * @extends {Mark<import("../spec/mark.js").TextProps>}
40
42
  */
41
43
  export default class TextMark extends Mark {
42
44
  /**
@@ -48,52 +50,49 @@ export default class TextMark extends Mark {
48
50
  constructor(unitView) {
49
51
  super(unitView);
50
52
 
51
- Object.defineProperties(
52
- this.defaultProperties,
53
- Object.getOwnPropertyDescriptors({
54
- x: 0.5,
55
- y: 0.5,
56
- x2: undefined,
57
- y2: undefined,
58
- text: "",
59
- size: 11.0,
60
- color: "black",
61
- opacity: 1.0,
62
-
63
- // Use the built-in default
64
- font: undefined,
65
- fontStyle: undefined,
66
- fontWeight: undefined,
67
-
68
- align: "center",
69
- baseline: "middle",
70
- dx: 0,
71
- dy: 0,
72
- angle: 0,
73
-
74
- /** When only primary channel is defined with band/locus scale */
75
- fitToBand: false,
76
-
77
- squeeze: true,
78
- paddingX: 0,
79
- paddingY: 0,
80
- flushX: true,
81
- flushY: true,
82
-
83
- /** Stretch letters so that they can be used with sequence logos etc... */
84
- logoLetters: false,
85
-
86
- viewportEdgeFadeWidthTop: 0,
87
- viewportEdgeFadeWidthRight: 0,
88
- viewportEdgeFadeWidthBottom: 0,
89
- viewportEdgeFadeWidthLeft: 0,
90
-
91
- viewportEdgeFadeDistanceTop: -Infinity,
92
- viewportEdgeFadeDistanceRight: -Infinity,
93
- viewportEdgeFadeDistanceBottom: -Infinity,
94
- viewportEdgeFadeDistanceLeft: -Infinity,
95
- })
96
- );
53
+ this.augmentDefaultProperties({
54
+ x: 0.5,
55
+ y: 0.5,
56
+ x2: undefined,
57
+ y2: undefined,
58
+ text: "",
59
+ size: 11.0,
60
+ color: "black",
61
+ opacity: 1.0,
62
+
63
+ // Use the built-in default
64
+ font: undefined,
65
+ fontStyle: undefined,
66
+ fontWeight: undefined,
67
+
68
+ align: "center",
69
+ baseline: "middle",
70
+ dx: 0,
71
+ dy: 0,
72
+ angle: 0,
73
+
74
+ /** When only primary channel is defined with band/locus scale */
75
+ fitToBand: false,
76
+
77
+ squeeze: true,
78
+ paddingX: 0,
79
+ paddingY: 0,
80
+ flushX: true,
81
+ flushY: true,
82
+
83
+ /** Stretch letters so that they can be used with sequence logos etc... */
84
+ logoLetters: false,
85
+
86
+ viewportEdgeFadeWidthTop: 0,
87
+ viewportEdgeFadeWidthRight: 0,
88
+ viewportEdgeFadeWidthBottom: 0,
89
+ viewportEdgeFadeWidthLeft: 0,
90
+
91
+ viewportEdgeFadeDistanceTop: -Infinity,
92
+ viewportEdgeFadeDistanceRight: -Infinity,
93
+ viewportEdgeFadeDistanceBottom: -Infinity,
94
+ viewportEdgeFadeDistanceLeft: -Infinity,
95
+ });
97
96
 
98
97
  this.font = this.properties.font
99
98
  ? unitView.context.fontManager.getFont(
@@ -110,6 +109,9 @@ export default class TextMark extends Mark {
110
109
  ]);
111
110
  }
112
111
 
112
+ /**
113
+ * @returns {import("../spec/channel.js").Channel[]}
114
+ */
113
115
  getAttributes() {
114
116
  return [
115
117
  "uniqueId",
@@ -1,2 +1,2 @@
1
- const shader = "in mediump vec2 vertexCoord;in lowp vec2 textureCoord;in float width;out vec2 vTexCoord;out vec4 vColor;out float vSlope;out float vEdgeFadeOpacity;struct RangeResult{float pos;float scale;};float minValue(vec4 v){return min(min(v.x,v.y),min(v.z,v.w));}float maxValue(vec4 v){return max(max(v.x,v.y),max(v.z,v.w));}/***All measures are in[0,1]*/RangeResult positionInsideRange(float a,float b,float width,float padding,int align,bool flush){float span=b-a;float paddedWidth=width+2.0*padding;if(a>1.0||b<0.0){return RangeResult(0.0,0.0);}float extra=max(0.0,span-paddedWidth);float pos;if(align==0){float centre=a+b;if(flush){float leftOver=max(0.0,paddedWidth-centre);centre+=min(leftOver,extra);float rightOver=max(0.0,paddedWidth+centre-2.0);centre-=min(rightOver,extra);}pos=centre/2.0;}else if(align<0){float edge=a;if(flush){float over=max(0.0,-edge);edge+=min(over,extra);}pos=edge+padding;}else{float edge=b;if(flush){float over=max(0.0,edge-1.0);edge-=min(over,extra);}pos=edge-padding;}float scale=clamp((span-padding)/paddedWidth,0.0,1.0);return RangeResult(pos,scale);}vec2 calculateRotatedDimensions(float width,mat2 rotationMatrix){vec2 a=abs(rotationMatrix*vec2(width/2.0,0.5));vec2 b=abs(rotationMatrix*vec2(width/2.0,-0.5));return vec2(max(a.x,b.x),max(a.y,b.y))*2.0;}ivec2 fixAlignForAngle(ivec2 align,float angleInDegrees){float a=mod(angleInDegrees+45.0,360.0);int x=align.x;int y=-align.y;if(a<90.0){return ivec2(x,y);}else if(a<180.0){return ivec2(y,-x);}else if(a<270.0){return ivec2(-x,y);}else{return ivec2(-y,x);}}void main(void){float opacity=getScaled_opacity()*uViewOpacity;vec2 size=vec2(getScaled_size());float x=getScaled_x();float y=getScaled_y();float scale=1.0;float angleInDegrees=getScaled_angle();float angle=-angleInDegrees*PI/180.0;float sinTheta=sin(angle);float cosTheta=cos(angle);mat2 rotationMatrix=mat2(cosTheta,sinTheta,-sinTheta,cosTheta);vec2 flushSize=calculateRotatedDimensions(width,rotationMatrix);\n#if defined(x2_DEFINED) || defined(y2_DEFINED)\nivec2 align=fixAlignForAngle(uAlign,angleInDegrees);\n#else\nivec2 align=uAlign;\n#endif\n#ifdef x2_DEFINED\nfloat x2=getScaled_x2();if(uLogoLetter){size.x=(x2-x)*uViewportSize.x;x+=(x2-x)/2.0;}else{float x2=getScaled_x2();RangeResult result=positionInsideRange(min(x,x2),max(x,x2),size.x*scale*flushSize.x/uViewportSize.x,uPaddingX/uViewportSize.x,align.x,uFlushX);x=result.pos;scale*=result.scale;}\n#endif\nvec2 pos=applySampleFacet(vec2(x,y));\n#ifdef y2_DEFINED\nfloat y2=getScaled_y2();vec2 pos2=applySampleFacet(vec2(x,y2));if(uLogoLetter){size.y=(pos2.y-pos.y)*uViewportSize.y;pos.y+=(pos2.y-pos.y)/2.0;}else{RangeResult result=positionInsideRange(min(pos.y,pos2.y),max(pos.y,pos2.y),size.y*scale*flushSize.y/uViewportSize.y,uPaddingY/uViewportSize.y,align.y,uFlushY);pos.y=result.pos;scale*=result.scale;}\n#endif\nif(scale<1.0){if(uSqueeze){vec2 scaleFadeExtent=vec2(3.0,6.0)/size;if(scale<scaleFadeExtent[0]){gl_Position=vec4(0.0);return;}size*=scale;opacity*=linearstep(scaleFadeExtent[0],scaleFadeExtent[1],scale);}else if(scale<1.0){gl_Position=vec4(0.0);return;}}vec2 charPos=rotationMatrix*(vertexCoord*size+uD);vec2 unitPos=pos+charPos/uViewportSize;gl_Position=unitToNdc(unitPos);vSlope=max(1.0,min(size.x,size.y)/uSdfNumerator);vColor=vec4(getScaled_color()*opacity,opacity);vTexCoord=textureCoord;if(maxValue(uViewportEdgeFadeDistance)>-pow(10.0,10.0)){vEdgeFadeOpacity=minValue(((vec4(1.0,1.0,0.0,0.0)+vec4(-1.0,-1.0,1.0,1.0)*unitPos.yxyx)*uViewportSize.yxyx-uViewportEdgeFadeDistance)/uViewportEdgeFadeWidth);}else{vEdgeFadeOpacity=1.0;}setupPicking();}";
1
+ const shader = "in mediump vec2 vertexCoord;in lowp vec2 textureCoord;in float width;out vec2 vTexCoord;out vec4 vColor;out float vSlope;out float vEdgeFadeOpacity;out float vGamma;struct RangeResult{float pos;float scale;};float minValue(vec4 v){return min(min(v.x,v.y),min(v.z,v.w));}float maxValue(vec4 v){return max(max(v.x,v.y),max(v.z,v.w));}/***All measures are in[0,1]*/RangeResult positionInsideRange(float a,float b,float width,float padding,int align,bool flush){float span=b-a;float paddedWidth=width+2.0*padding;if(a>1.0||b<0.0){return RangeResult(0.0,0.0);}float extra=max(0.0,span-paddedWidth);float pos;if(align==0){float centre=a+b;if(flush){float leftOver=max(0.0,paddedWidth-centre);centre+=min(leftOver,extra);float rightOver=max(0.0,paddedWidth+centre-2.0);centre-=min(rightOver,extra);}pos=centre/2.0;}else if(align<0){float edge=a;if(flush){float over=max(0.0,-edge);edge+=min(over,extra);}pos=edge+padding;}else{float edge=b;if(flush){float over=max(0.0,edge-1.0);edge-=min(over,extra);}pos=edge-padding;}float scale=clamp((span-padding)/paddedWidth,0.0,1.0);return RangeResult(pos,scale);}vec2 calculateRotatedDimensions(float width,mat2 rotationMatrix){vec2 a=abs(rotationMatrix*vec2(width/2.0,0.5));vec2 b=abs(rotationMatrix*vec2(width/2.0,-0.5));return vec2(max(a.x,b.x),max(a.y,b.y))*2.0;}ivec2 fixAlignForAngle(ivec2 align,float angleInDegrees){float a=mod(angleInDegrees+45.0,360.0);int x=align.x;int y=-align.y;if(a<90.0){return ivec2(x,y);}else if(a<180.0){return ivec2(y,-x);}else if(a<270.0){return ivec2(-x,y);}else{return ivec2(-y,x);}}void main(void){float opacity=getScaled_opacity()*uViewOpacity;vec2 size=vec2(getScaled_size());float x=getScaled_x();float y=getScaled_y();float scale=1.0;float angleInDegrees=getScaled_angle();float angle=-angleInDegrees*PI/180.0;float sinTheta=sin(angle);float cosTheta=cos(angle);mat2 rotationMatrix=mat2(cosTheta,sinTheta,-sinTheta,cosTheta);vec2 flushSize=calculateRotatedDimensions(width,rotationMatrix);\n#if defined(x2_DEFINED) || defined(y2_DEFINED)\nivec2 align=fixAlignForAngle(uAlign,angleInDegrees);\n#else\nivec2 align=uAlign;\n#endif\n#ifdef x2_DEFINED\nfloat x2=getScaled_x2();if(uLogoLetter){size.x=(x2-x)*uViewportSize.x;x+=(x2-x)/2.0;}else{float x2=getScaled_x2();RangeResult result=positionInsideRange(min(x,x2),max(x,x2),size.x*scale*flushSize.x/uViewportSize.x,uPaddingX/uViewportSize.x,align.x,uFlushX);x=result.pos;scale*=result.scale;}\n#endif\nvec2 pos=applySampleFacet(vec2(x,y));\n#ifdef y2_DEFINED\nfloat y2=getScaled_y2();vec2 pos2=applySampleFacet(vec2(x,y2));if(uLogoLetter){size.y=(pos2.y-pos.y)*uViewportSize.y;pos.y+=(pos2.y-pos.y)/2.0;}else{RangeResult result=positionInsideRange(min(pos.y,pos2.y),max(pos.y,pos2.y),size.y*scale*flushSize.y/uViewportSize.y,uPaddingY/uViewportSize.y,align.y,uFlushY);pos.y=result.pos;scale*=result.scale;}\n#endif\nif(scale<1.0){if(uSqueeze){vec2 scaleFadeExtent=vec2(3.0,6.0)/size;if(scale<scaleFadeExtent[0]){gl_Position=vec4(0.0);return;}size*=scale;opacity*=linearstep(scaleFadeExtent[0],scaleFadeExtent[1],scale);}else if(scale<1.0){gl_Position=vec4(0.0);return;}}vec2 charPos=rotationMatrix*(vertexCoord*size+uD);vec2 unitPos=pos+charPos/uViewportSize;gl_Position=unitToNdc(unitPos);vSlope=max(1.0,min(size.x,size.y)/uSdfNumerator);vec3 color=getScaled_color();vColor=vec4(color*opacity,opacity);vGamma=getGammaForColor(color);vTexCoord=textureCoord;if(maxValue(uViewportEdgeFadeDistance)>-pow(10.0,10.0)){vEdgeFadeOpacity=minValue(((vec4(1.0,1.0,0.0,0.0)+vec4(-1.0,-1.0,1.0,1.0)*unitPos.yxyx)*uViewportSize.yxyx-uViewportEdgeFadeDistance)/uViewportEdgeFadeWidth);}else{vEdgeFadeOpacity=1.0;}setupPicking();}";
2
2
  export default shader;
@@ -141,8 +141,19 @@ export interface ScaleMixins {
141
141
  * An alternative channel for scale resolution.
142
142
  *
143
143
  * This is mainly for internal use and allows using `color` channel to resolve `fill` and `stroke` channels under certain circumstances.
144
+ *
145
+ * @internal
144
146
  */
145
147
  resolutionChannel?: ChannelWithScale;
148
+
149
+ /**
150
+ * Whether the field or evaluated expr should be included in the scale's domain.
151
+ *
152
+ * **Default value:** `true`
153
+ *
154
+ * @internal
155
+ */
156
+ contributesToScaleDomain?: boolean;
146
157
  }
147
158
 
148
159
  export interface ValueDefBase<V extends Value = Scalar> {
@@ -157,6 +168,7 @@ export type ValueDef<V extends Value = Scalar> = ValueDefBase<V> & TitleMixins;
157
168
  export interface DatumDef<V extends Scalar | ExprRef = Scalar | ExprRef>
158
169
  extends Partial<TypeMixins<Type>>,
159
170
  BandMixins,
171
+ ScaleMixins,
160
172
  TitleMixins {
161
173
  /**
162
174
  * A constant value in data domain.
@@ -261,7 +273,8 @@ export type ValueDefWithCondition<V extends Value = Value> = Partial<
261
273
  condition?:
262
274
  | Conditional<FieldDef>
263
275
  | Conditional<DatumDef>
264
- | Conditional<ValueDef<V | ExprRef>>;
276
+ | Conditional<ValueDef<V | ExprRef>>
277
+ | Conditional<ValueDef<V | ExprRef>>[];
265
278
  };
266
279
 
267
280
  export type MarkPropFieldOrDatumOrExprDef<T extends Type = Type> =
@@ -5,17 +5,91 @@ import { Tooltip } from "./tooltip.js";
5
5
 
6
6
  export type MarkType = "rect" | "point" | "rule" | "text" | "link";
7
7
 
8
+ export interface MarkPropsBase {
9
+ type: MarkType;
10
+
11
+ // Channels.
12
+
13
+ x?: number | ExprRef;
14
+ y?: number | ExprRef;
15
+ color?: string | ExprRef;
16
+ opacity?: number | ExprRef;
17
+
18
+ /**
19
+ * If true, the mark is clipped to the UnitView's rectangle. By default, clipping
20
+ * is enabled for marks that have zoomable positional scales.
21
+ */
22
+ clip?: boolean | "never";
23
+
24
+ /**
25
+ * Offsets of the `x` and `x2` coordinates in pixels. The offset is applied
26
+ * after the viewport scaling and translation.
27
+ *
28
+ * **Default value:** `0`
29
+ */
30
+ xOffset?: number;
31
+
32
+ /**
33
+ * Offsets of the `y` and `y2` coordinates in pixels. The offset is applied
34
+ * after the viewport scaling and translation.
35
+ *
36
+ * **Default value:** `0`
37
+ */
38
+ yOffset?: number;
39
+
40
+ /**
41
+ * Minimum size for WebGL buffers (number of data items).
42
+ * Allows for using `bufferSubData()` to update graphics.
43
+ *
44
+ * This property is intended for internal use.
45
+ *
46
+ * @internal
47
+ */
48
+ minBufferSize?: number;
49
+
50
+ /**
51
+ * Tooltip handler. If `null`, no tooltip is shown.
52
+ */
53
+ tooltip?: Tooltip;
54
+ }
55
+
56
+ export interface SizeProps {
57
+ /**
58
+ * Stroke width of `"link"` and `"rule"` marks in pixels, the area of the
59
+ * bounding square of `"point"` mark, or the font size of `"text"` mark.
60
+ */
61
+ size?: number | ExprRef;
62
+ }
63
+
8
64
  export interface FillAndStrokeProps {
9
- /** The fill color */
65
+ /**
66
+ * The stroke width in pixels.
67
+ */
68
+ strokeWidth?: number | ExprRef;
69
+
70
+ /**
71
+ * Whether the `color` represents the `fill` color (`true`) or the `stroke` color (`false`).
72
+ */
73
+ filled?: boolean;
74
+
75
+ /**
76
+ * The fill color
77
+ */
10
78
  fill?: string | ExprRef;
11
79
 
12
- /** The fill opacity. Value between [0, 1]. */
80
+ /**
81
+ * The fill opacity. Value between [0, 1].
82
+ */
13
83
  fillOpacity?: number | ExprRef;
14
84
 
15
- /** The stroke color */
85
+ /**
86
+ * The stroke color
87
+ */
16
88
  stroke?: string | ExprRef;
17
89
 
18
- /** The stroke opacity. Value between [0, 1]. */
90
+ /**
91
+ * The stroke opacity. Value between [0, 1].
92
+ */
19
93
  strokeOpacity?: number | ExprRef;
20
94
  }
21
95
 
@@ -33,6 +107,17 @@ export interface AngleProps {
33
107
  angle?: number | ExprRef;
34
108
  }
35
109
 
110
+ export interface MinPickingSizeProps {
111
+ /**
112
+ * The minimum picking size invisibly increases the stroke width or point diameter
113
+ * of marks when pointing them with the mouse cursor, making it easier to select them.
114
+ * The valus is the minimum size in pixels.
115
+ *
116
+ * **Default value:** `3.0` for `"link"` and `2.0` for `"point"`
117
+ */
118
+ minPickingSize?: number | ExprRef;
119
+ }
120
+
36
121
  /**
37
122
  * Specifies how mark should be faded at the viewport edges.
38
123
  * This is mainly used to make axis labels pretty.
@@ -49,7 +134,12 @@ export interface ViewportEdgeFadeProps {
49
134
  viewportEdgeFadeDistanceLeft?: number;
50
135
  }
51
136
 
52
- export interface RectProps extends SecondaryPositionProps {
137
+ export interface RectProps
138
+ extends MarkPropsBase,
139
+ SecondaryPositionProps,
140
+ FillAndStrokeProps {
141
+ type: "rect";
142
+
53
143
  /**
54
144
  * Clamps the minimum size-dependent opacity. The property does not affect the
55
145
  * `opacity` channel. Valid values are between `0` and `1`.
@@ -120,7 +210,12 @@ export interface RectProps extends SecondaryPositionProps {
120
210
  cornerRadiusBottomRight?: number | ExprRef;
121
211
  }
122
212
 
123
- export interface RuleProps extends SecondaryPositionProps {
213
+ export interface RuleProps
214
+ extends MarkPropsBase,
215
+ SecondaryPositionProps,
216
+ SizeProps {
217
+ type: "rule";
218
+
124
219
  /**
125
220
  * The minimum length of the rule in pixels. Use this property to ensure that
126
221
  * very short ranged rules remain visible even when the user zooms out.
@@ -152,9 +247,13 @@ export interface RuleProps extends SecondaryPositionProps {
152
247
  }
153
248
 
154
249
  export interface TextProps
155
- extends SecondaryPositionProps,
250
+ extends MarkPropsBase,
251
+ SecondaryPositionProps,
156
252
  AngleProps,
157
- ViewportEdgeFadeProps {
253
+ ViewportEdgeFadeProps,
254
+ SizeProps {
255
+ type: "text";
256
+
158
257
  /**
159
258
  * The text to display. The format of numeric data can be customized by
160
259
  * setting a [format specifier](https://github.com/d3/d3-format#locale_format)
@@ -276,7 +375,14 @@ export interface TextProps
276
375
  logoLetters?: boolean | ExprRef;
277
376
  }
278
377
 
279
- export interface PointProps extends AngleProps {
378
+ export interface PointProps
379
+ extends MarkPropsBase,
380
+ FillAndStrokeProps,
381
+ AngleProps,
382
+ SizeProps,
383
+ MinPickingSizeProps {
384
+ type: "point";
385
+
280
386
  /**
281
387
  * One of `"circle"`, `"square"`, `"cross"`, `"diamond"`, `"triangle-up"`,
282
388
  * `"triangle-down"`, `"triangle-right"`, or `"triangle-left"`.
@@ -318,7 +424,13 @@ export interface PointProps extends AngleProps {
318
424
  geometricZoomBound?: number;
319
425
  }
320
426
 
321
- export interface LinkProps extends SecondaryPositionProps {
427
+ export interface LinkProps
428
+ extends MarkPropsBase,
429
+ SecondaryPositionProps,
430
+ SizeProps,
431
+ MinPickingSizeProps {
432
+ type: "link";
433
+
322
434
  /**
323
435
  * The shape of the link path. Either `"arc"`, `"diagonal"`, `"line"`, or `"dome"`.
324
436
  *
@@ -394,77 +506,11 @@ export interface LinkProps extends SecondaryPositionProps {
394
506
  * **Default value:** `true`
395
507
  */
396
508
  noFadingOnPointSelection?: boolean | ExprRef;
397
-
398
- /**
399
- * The minimum stroke width of the links when pointing with the mouse cursor.
400
- * Allows making very thin links easier to point at.
401
- *
402
- * **Default value:** `3.0`
403
- */
404
- minPickingSize?: number | ExprRef;
405
509
  }
406
510
 
407
- // TODO: Mark-specific configs
408
- export interface MarkProps
409
- extends PointProps,
410
- RectProps,
411
- TextProps,
412
- RuleProps,
413
- LinkProps,
414
- FillAndStrokeProps {
415
- // Channels.
416
- x?: number | ExprRef;
417
- y?: number | ExprRef;
418
- color?: string | ExprRef;
419
- opacity?: number | ExprRef;
420
- size?: number | ExprRef;
421
-
422
- /**
423
- * Whether the `color` represents the `fill` color (`true`) or the `stroke` color (`false`).
424
- */
425
- filled?: boolean;
426
-
427
- /**
428
- * If true, the mark is clipped to the UnitView's rectangle. By default, clipping
429
- * is enabled for marks that have zoomable positional scales.
430
- */
431
- clip?: boolean | "never";
432
-
433
- /**
434
- * Offsets of the `x` and `x2` coordinates in pixels. The offset is applied
435
- * after the viewport scaling and translation.
436
- *
437
- * **Default value:** `0`
438
- */
439
- xOffset?: number;
440
-
441
- /**
442
- * Offsets of the `y` and `y2` coordinates in pixels. The offset is applied
443
- * after the viewport scaling and translation.
444
- *
445
- * **Default value:** `0`
446
- */
447
- yOffset?: number;
448
-
449
- /**
450
- * TODO
451
- */
452
- tooltip?: Tooltip;
453
-
454
- /**
455
- * The stroke width in pixels.
456
- */
457
- strokeWidth?: number | ExprRef;
458
-
459
- /**
460
- * Minimum size for WebGL buffers (number of data items).
461
- * Allows for using `bufferSubData()` to update graphics.
462
- *
463
- * This property is intended for internal use.
464
- */
465
- minBufferSize?: number;
466
- }
467
-
468
- export interface MarkConfigAndType extends MarkProps {
469
- type: MarkType;
470
- }
511
+ export type MarkProps =
512
+ | RectProps
513
+ | TextProps
514
+ | RuleProps
515
+ | LinkProps
516
+ | PointProps;
@@ -6,12 +6,7 @@ import {
6
6
  FacetFieldDef,
7
7
  PrimaryPositionalChannel,
8
8
  } from "./channel.js";
9
- import {
10
- FillAndStrokeProps,
11
- MarkConfigAndType,
12
- MarkType,
13
- RectProps,
14
- } from "./mark.js";
9
+ import { FillAndStrokeProps, MarkProps, MarkType, RectProps } from "./mark.js";
15
10
  import { ExprRef } from "./parameter.js";
16
11
  import { Title } from "./title.js";
17
12
  import { SampleSpec } from "./sampleView.js";
@@ -166,7 +161,7 @@ export interface ViewSpecBase extends ResolveSpec {
166
161
 
167
162
  export interface UnitSpec extends ViewSpecBase, AggregateSamplesSpec {
168
163
  view?: ViewBackground;
169
- mark: MarkType | MarkConfigAndType;
164
+ mark: MarkType | MarkProps;
170
165
  }
171
166
 
172
167
  export interface AggregateSamplesSpec {
@@ -1,2 +1,2 @@
1
- export default function dataTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default, params?: Record<string, any>): Promise<string | HTMLElement | import("lit-html").TemplateResult>;
1
+ export default function dataTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default<import("../spec/mark.js").MarkProps>, params?: Record<string, any>): Promise<string | HTMLElement | import("lit-html").TemplateResult>;
2
2
  //# sourceMappingURL=dataTooltipHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataTooltipHandler.d.ts","sourceRoot":"","sources":["../../../src/tooltip/dataTooltipHandler.js"],"names":[],"mappings":"AAMoC,kNAMa"}
1
+ {"version":3,"file":"dataTooltipHandler.d.ts","sourceRoot":"","sources":["../../../src/tooltip/dataTooltipHandler.js"],"names":[],"mappings":"AAMoC,uPAMa"}
@@ -1,2 +1,2 @@
1
- export default function refseqGeneTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default, params?: Record<string, any>): Promise<string | HTMLElement | import("lit-html").TemplateResult>;
1
+ export default function refseqGeneTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default<import("../spec/mark.js").MarkProps>, params?: Record<string, any>): Promise<string | HTMLElement | import("lit-html").TemplateResult>;
2
2
  //# sourceMappingURL=refseqGeneTooltipHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refseqGeneTooltipHandler.d.ts","sourceRoot":"","sources":["../../../src/tooltip/refseqGeneTooltipHandler.js"],"names":[],"mappings":"AAOC,wNAQW"}
1
+ {"version":3,"file":"refseqGeneTooltipHandler.d.ts","sourceRoot":"","sources":["../../../src/tooltip/refseqGeneTooltipHandler.js"],"names":[],"mappings":"AAOC,6PAQW"}
@@ -25,7 +25,7 @@ export default class AxisResolution {
25
25
  *
26
26
  * @param {AxisResolutionMember} newMember
27
27
  */
28
- pushUnitView(newMember: AxisResolutionMember): void;
28
+ addMember(newMember: AxisResolutionMember): void;
29
29
  getAxisProps(): import("../spec/axis.js").GenomeAxis;
30
30
  getTitle(): string;
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"axisResolution.d.ts","sourceRoot":"","sources":["../../../src/view/axisResolution.js"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH;IACI;;;OAGG;IAEH;;OAEG;IACH,qBAFW,OAAO,oBAAoB,EAAE,wBAAwB,EAM/D;IAHG,+DAAsB;IACtB,wDAAwD;IACxD,SADW,oBAAoB,EAAE,CAChB;IAGrB,8DAEC;IAED;;;;;OAKG;IACH,wBAFW,oBAAoB,QAkB9B;IAED,qDAuBC;IAED,mBAyDC;CACJ;;UAlIS,OAAO,eAAe,EAAE,OAAO;aAC/B,CAAC;gBACD,OAAO,oBAAoB,EAAE,mBAAmB"}
1
+ {"version":3,"file":"axisResolution.d.ts","sourceRoot":"","sources":["../../../src/view/axisResolution.js"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH;IACI;;;OAGG;IAEH;;OAEG;IACH,qBAFW,OAAO,oBAAoB,EAAE,wBAAwB,EAM/D;IAHG,+DAAsB;IACtB,wDAAwD;IACxD,SADW,oBAAoB,EAAE,CAChB;IAGrB,8DAEC;IAED;;;;;OAKG;IACH,qBAFW,oBAAoB,QAkB9B;IAED,qDAuBC;IAED,mBAyDC;CACJ;;UAlIS,OAAO,eAAe,EAAE,OAAO;aAC/B,CAAC;gBACD,OAAO,oBAAoB,EAAE,mBAAmB"}