@uwdata/mosaic-spec 0.7.1 → 0.9.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 (158) hide show
  1. package/dist/mosaic-schema.json +192673 -0
  2. package/dist/mosaic-spec.js +5077 -5774
  3. package/dist/mosaic-spec.min.js +23 -23
  4. package/dist/types/ast/ASTNode.d.ts +26 -0
  5. package/dist/types/ast/DataNode.d.ts +60 -0
  6. package/dist/types/ast/ExpressionNode.d.ts +15 -0
  7. package/dist/types/ast/HConcatNode.d.ts +10 -0
  8. package/dist/types/ast/HSpaceNode.d.ts +11 -0
  9. package/dist/types/ast/InputNode.d.ts +8 -0
  10. package/dist/types/ast/LiteralNode.d.ts +7 -0
  11. package/dist/types/ast/OptionsNode.d.ts +10 -0
  12. package/dist/types/ast/ParamNode.d.ts +9 -0
  13. package/dist/types/ast/ParamRefNode.d.ts +8 -0
  14. package/dist/types/ast/PlotAttributeNode.d.ts +18 -0
  15. package/dist/types/ast/PlotFromNode.d.ts +9 -0
  16. package/dist/types/ast/PlotInteractorNode.d.ts +8 -0
  17. package/dist/types/ast/PlotLegendNode.d.ts +10 -0
  18. package/dist/types/ast/PlotMarkNode.d.ts +10 -0
  19. package/dist/types/ast/PlotNode.d.ts +11 -0
  20. package/dist/types/ast/SelectionNode.d.ts +12 -0
  21. package/dist/types/ast/SpecNode.d.ts +10 -0
  22. package/dist/types/ast/TransformNode.d.ts +13 -0
  23. package/dist/types/ast/VConcatNode.d.ts +10 -0
  24. package/dist/types/ast/VSpaceNode.d.ts +11 -0
  25. package/dist/types/ast-to-dom.d.ts +38 -0
  26. package/dist/types/ast-to-esm.d.ts +64 -0
  27. package/dist/types/config/components.d.ts +4 -0
  28. package/dist/types/config/extensions.d.ts +9 -0
  29. package/dist/types/config/inputs.d.ts +5 -0
  30. package/dist/types/config/plots.d.ts +34 -0
  31. package/dist/types/config/transforms.d.ts +4 -0
  32. package/dist/types/constants.d.ts +30 -0
  33. package/dist/types/index.d.ts +29 -0
  34. package/dist/types/parse-spec.d.ts +86 -0
  35. package/dist/types/spec/CSSStyles.d.ts +3 -0
  36. package/dist/types/spec/Data.d.ts +165 -0
  37. package/dist/types/spec/Expression.d.ts +27 -0
  38. package/dist/types/spec/HConcat.d.ts +8 -0
  39. package/dist/types/spec/HSpace.d.ts +9 -0
  40. package/dist/types/spec/Input.d.ts +207 -0
  41. package/dist/types/spec/Param.d.ts +51 -0
  42. package/dist/types/spec/Plot.d.ts +14 -0
  43. package/dist/types/spec/PlotAttribute.d.ts +1522 -0
  44. package/dist/types/spec/PlotFrom.d.ts +20 -0
  45. package/dist/types/spec/PlotInteractor.d.ts +8 -0
  46. package/dist/types/spec/PlotLegend.d.ts +68 -0
  47. package/dist/types/spec/PlotMark.d.ts +27 -0
  48. package/dist/types/spec/PlotTypes.d.ts +293 -0
  49. package/dist/types/spec/Spec.d.ts +52 -0
  50. package/dist/types/spec/Transform.d.ts +314 -0
  51. package/dist/types/spec/VConcat.d.ts +8 -0
  52. package/dist/types/spec/VSpace.d.ts +9 -0
  53. package/dist/types/spec/interactors/Highlight.d.ts +37 -0
  54. package/dist/types/spec/interactors/Interval1D.d.ts +63 -0
  55. package/dist/types/spec/interactors/Interval2D.d.ts +46 -0
  56. package/dist/types/spec/interactors/Nearest.d.ts +44 -0
  57. package/dist/types/spec/interactors/PanZoom.d.ts +58 -0
  58. package/dist/types/spec/interactors/Toggle.d.ts +59 -0
  59. package/dist/types/spec/marks/Area.d.ts +139 -0
  60. package/dist/types/spec/marks/Arrow.d.ts +94 -0
  61. package/dist/types/spec/marks/Axis.d.ts +281 -0
  62. package/dist/types/spec/marks/Bar.d.ts +150 -0
  63. package/dist/types/spec/marks/Cell.d.ts +57 -0
  64. package/dist/types/spec/marks/Contour.d.ts +23 -0
  65. package/dist/types/spec/marks/Delaunay.d.ts +86 -0
  66. package/dist/types/spec/marks/DenseLine.d.ts +27 -0
  67. package/dist/types/spec/marks/Density.d.ts +121 -0
  68. package/dist/types/spec/marks/Dot.d.ts +133 -0
  69. package/dist/types/spec/marks/ErrorBar.d.ts +82 -0
  70. package/dist/types/spec/marks/Frame.d.ts +21 -0
  71. package/dist/types/spec/marks/Geo.d.ts +53 -0
  72. package/dist/types/spec/marks/Hexbin.d.ts +30 -0
  73. package/dist/types/spec/marks/Hexgrid.d.ts +25 -0
  74. package/dist/types/spec/marks/Image.d.ts +89 -0
  75. package/dist/types/spec/marks/Line.d.ts +82 -0
  76. package/dist/types/spec/marks/Link.d.ts +60 -0
  77. package/dist/types/spec/marks/Marks.d.ts +905 -0
  78. package/dist/types/spec/marks/Raster.d.ts +124 -0
  79. package/dist/types/spec/marks/Rect.d.ts +166 -0
  80. package/dist/types/spec/marks/Regression.d.ts +58 -0
  81. package/dist/types/spec/marks/Rule.d.ts +100 -0
  82. package/dist/types/spec/marks/Text.d.ts +110 -0
  83. package/dist/types/spec/marks/Tick.d.ts +61 -0
  84. package/dist/types/spec/marks/Vector.d.ts +99 -0
  85. package/dist/types/util.d.ts +12 -0
  86. package/jsconfig.json +10 -0
  87. package/package.json +14 -9
  88. package/src/ast/ASTNode.js +23 -2
  89. package/src/ast/DataNode.js +79 -21
  90. package/src/ast/HSpaceNode.js +1 -1
  91. package/src/ast/InputNode.js +1 -2
  92. package/src/ast/ParamNode.js +1 -2
  93. package/src/ast/PlotAttributeNode.js +1 -2
  94. package/src/ast/PlotInteractorNode.js +1 -2
  95. package/src/ast/PlotLegendNode.js +1 -2
  96. package/src/ast/PlotMarkNode.js +3 -2
  97. package/src/ast/TransformNode.js +1 -2
  98. package/src/ast/VSpaceNode.js +1 -1
  99. package/src/ast-to-dom.js +9 -3
  100. package/src/ast-to-esm.js +41 -12
  101. package/src/config/inputs.js +1 -0
  102. package/src/config/plots.js +4 -0
  103. package/src/config/transforms.js +6 -0
  104. package/src/index.js +4 -0
  105. package/src/parse-spec.js +38 -5
  106. package/src/spec/CSSStyles.ts +9 -0
  107. package/src/spec/Data.ts +184 -0
  108. package/src/spec/Expression.ts +31 -0
  109. package/src/spec/HConcat.ts +9 -0
  110. package/src/spec/HSpace.ts +9 -0
  111. package/src/spec/Input.ts +204 -0
  112. package/src/spec/Param.ts +68 -0
  113. package/src/spec/Plot.ts +15 -0
  114. package/src/spec/PlotAttribute.ts +1783 -0
  115. package/src/spec/PlotFrom.ts +23 -0
  116. package/src/spec/PlotInteractor.ts +25 -0
  117. package/src/spec/PlotLegend.ts +70 -0
  118. package/src/spec/PlotMark.ts +53 -0
  119. package/src/spec/PlotTypes.ts +519 -0
  120. package/src/spec/Spec.ts +70 -0
  121. package/src/spec/Transform.ts +446 -0
  122. package/src/spec/VConcat.ts +9 -0
  123. package/src/spec/VSpace.ts +9 -0
  124. package/src/spec/interactors/Highlight.ts +38 -0
  125. package/src/spec/interactors/Interval1D.ts +67 -0
  126. package/src/spec/interactors/Interval2D.ts +48 -0
  127. package/src/spec/interactors/Nearest.ts +48 -0
  128. package/src/spec/interactors/PanZoom.ts +65 -0
  129. package/src/spec/interactors/Toggle.ts +65 -0
  130. package/src/spec/marks/Area.ts +154 -0
  131. package/src/spec/marks/Arrow.ts +108 -0
  132. package/src/spec/marks/Axis.ts +305 -0
  133. package/src/spec/marks/Bar.ts +160 -0
  134. package/src/spec/marks/Cell.ts +62 -0
  135. package/src/spec/marks/Contour.ts +25 -0
  136. package/src/spec/marks/Delaunay.ts +95 -0
  137. package/src/spec/marks/DenseLine.ts +30 -0
  138. package/src/spec/marks/Density.ts +145 -0
  139. package/src/spec/marks/Dot.ts +152 -0
  140. package/src/spec/marks/ErrorBar.ts +91 -0
  141. package/src/spec/marks/Frame.ts +23 -0
  142. package/src/spec/marks/Geo.ts +58 -0
  143. package/src/spec/marks/Hexbin.ts +34 -0
  144. package/src/spec/marks/Hexgrid.ts +27 -0
  145. package/src/spec/marks/Image.ts +101 -0
  146. package/src/spec/marks/Line.ts +93 -0
  147. package/src/spec/marks/Link.ts +70 -0
  148. package/src/spec/marks/Marks.ts +1088 -0
  149. package/src/spec/marks/Raster.ts +145 -0
  150. package/src/spec/marks/Rect.ts +183 -0
  151. package/src/spec/marks/Regression.ts +63 -0
  152. package/src/spec/marks/Rule.ts +113 -0
  153. package/src/spec/marks/Text.ts +127 -0
  154. package/src/spec/marks/Tick.ts +69 -0
  155. package/src/spec/marks/Vector.ts +113 -0
  156. package/src/util.js +8 -0
  157. package/tsconfig.json +11 -0
  158. package/LICENSE +0 -47
@@ -0,0 +1,89 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { FrameAnchor } from '../PlotTypes.js';
3
+ import { ChannelValue, ChannelValueSpec, MarkData, MarkOptions } from './Marks.js';
4
+ /** Options for the image mark. */
5
+ export interface ImageOptions extends MarkOptions {
6
+ /**
7
+ * The horizontal position channel specifying the image’s center; typically
8
+ * bound to the *x* scale.
9
+ */
10
+ x?: ChannelValueSpec;
11
+ /**
12
+ * The vertical position channel specifying the image’s center; typically
13
+ * bound to the *y* scale.
14
+ */
15
+ y?: ChannelValueSpec;
16
+ /**
17
+ * The image width in pixels. When a number, it is interpreted as a constant
18
+ * radius in pixels; otherwise it is interpreted as a channel. Also sets the
19
+ * default **height**; if neither are set, defaults to 16. Images with a
20
+ * nonpositive width are not drawn.
21
+ */
22
+ width?: ChannelValue | ParamRef;
23
+ /**
24
+ * The image height in pixels. When a number, it is interpreted as a constant
25
+ * radius in pixels; otherwise it is interpreted as a channel. Also sets the
26
+ * default **height**; if neither are set, defaults to 16. Images with a
27
+ * nonpositive height are not drawn.
28
+ */
29
+ height?: ChannelValue | ParamRef;
30
+ /**
31
+ * The image clip radius, for circular images. If null (default), images are
32
+ * not clipped; when a number, it is interpreted as a constant in pixels;
33
+ * otherwise it is interpreted as a channel, typically bound to the *r* scale.
34
+ * Also defaults **height** and **width** to twice its value.
35
+ */
36
+ r?: ChannelValue | ParamRef;
37
+ /**
38
+ * The rotation angle, in degrees clockwise. When a number, it is interpreted
39
+ * as a constant; otherwise it is interpreted as a channel.
40
+ */
41
+ rotate?: ChannelValue | ParamRef;
42
+ /**
43
+ * The required image URL (or relative path). If a string that starts with a
44
+ * dot, slash, or URL protocol (*e.g.*, “https:”) it is assumed to be a
45
+ * constant; otherwise it is interpreted as a channel.
46
+ */
47
+ src?: ChannelValue | ParamRef;
48
+ /**
49
+ * The image [aspect ratio][1]; defaults to *xMidYMid meet*. To crop the image
50
+ * instead of scaling it to fit, use *xMidYMid slice*.
51
+ *
52
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio
53
+ */
54
+ preserveAspectRatio?: string | ParamRef;
55
+ /**
56
+ * The [cross-origin][1] behavior. See the [Plot.image notebook][2] for details.
57
+ *
58
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/crossorigin
59
+ * [2]: https://observablehq.com/@observablehq/plot-image
60
+ */
61
+ crossOrigin?: string | ParamRef;
62
+ /**
63
+ * The frame anchor specifies defaults for **x** and **y** based on the plot’s
64
+ * frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*),
65
+ * one of the four corners (*top-left*, *top-right*, *bottom-right*,
66
+ * *bottom-left*), or the *middle* of the frame.
67
+ */
68
+ frameAnchor?: FrameAnchor | ParamRef;
69
+ /**
70
+ * The [image-rendering attribute][1]; defaults to *auto* (bilinear). The
71
+ * option may be set to *pixelated* to disable bilinear interpolation for a
72
+ * sharper image; however, note that this is not supported in WebKit.
73
+ *
74
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering
75
+ */
76
+ imageRendering?: string | ParamRef;
77
+ }
78
+ export interface Image extends MarkData, ImageOptions {
79
+ /**
80
+ * An image mark that draws images as in a scatterplot.
81
+ *
82
+ * If either **x** or **y** is not specified, the default is determined by
83
+ * the **frameAnchor** option. If none of **x**, **y**, and **frameAnchor**
84
+ * are specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*],
85
+ * [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …]
86
+ * and **y** = [*y₀*, *y₁*, *y₂*, …].
87
+ */
88
+ mark: 'image';
89
+ }
@@ -0,0 +1,82 @@
1
+ import { ChannelValue, ChannelValueSpec, CurveAutoOptions, MarkData, MarkOptions, MarkerOptions } from './Marks.js';
2
+ /** Options for the line mark. */
3
+ export interface LineOptions extends MarkOptions, MarkerOptions, CurveAutoOptions {
4
+ /**
5
+ * The required horizontal position channel, typically bound to the *x*
6
+ * scale.
7
+ */
8
+ x?: ChannelValueSpec;
9
+ /**
10
+ * The required vertical position channel, typically bound to the *y* scale.
11
+ */
12
+ y?: ChannelValueSpec;
13
+ /**
14
+ * An optional ordinal channel for grouping data into (possibly stacked)
15
+ * series to be drawn as separate lines. If not specified, it defaults to
16
+ * **fill** if a channel, or **stroke** if a channel.
17
+ */
18
+ z?: ChannelValue;
19
+ }
20
+ /** Options for the lineX mark. */
21
+ export interface LineXOptions extends LineOptions {
22
+ /**
23
+ * The vertical position channel, typically bound to the *y* scale;
24
+ * defaults to the zero-based index of the data [0, 1, 2, …].
25
+ */
26
+ y?: ChannelValueSpec;
27
+ }
28
+ /** Options for the lineY mark. */
29
+ export interface LineYOptions extends LineOptions {
30
+ /**
31
+ * The horizontal position channel, typically bound to the *x* scale;
32
+ * defaults to the zero-based index of the data [0, 1, 2, …].
33
+ */
34
+ x?: ChannelValueSpec;
35
+ }
36
+ /** The line mark. */
37
+ export interface Line extends MarkData, LineOptions {
38
+ /**
39
+ * A line mark that connects control points.
40
+ *
41
+ * Points along the line are connected in input order. If there are multiple
42
+ * series via the **z**, **fill**, or **stroke** channel, series are drawn in
43
+ * input order such that the last series is drawn on top. Typically *data* is
44
+ * already in sorted order, such as chronological for time series; if needed,
45
+ * consider a **sort** transform.
46
+ *
47
+ * If any **x** or **y** values are invalid (undefined, null, or NaN), the
48
+ * line will be interrupted, resulting in a break that divides the line shape
49
+ * into multiple segments. If a line segment consists of only a single point,
50
+ * it may appear invisible unless rendered with rounded or square line caps.
51
+ * In addition, some curves such as *cardinal-open* only render a visible
52
+ * segment if it contains multiple points.
53
+ *
54
+ * Variable aesthetic channels are supported: if the **stroke** is defined as
55
+ * a channel, the line will be broken into contiguous overlapping segments
56
+ * when the stroke color changes; the stroke color will apply to the interval
57
+ * spanning the current data point and the following data point. This
58
+ * behavior also applies to the **fill**, **fillOpacity**, **strokeOpacity**,
59
+ * **strokeWidth**, **opacity**, **href**, **title**, and **ariaLabel**
60
+ * channels. When any of these channels are used, setting an explicit **z**
61
+ * channel (possibly to null) is strongly recommended.
62
+ */
63
+ mark: 'line';
64
+ }
65
+ /** The lineX mark. */
66
+ export interface LineX extends MarkData, LineXOptions {
67
+ /**
68
+ * Like line, except that **x** defaults to the identity function assuming
69
+ * that *data* = [*x₀*, *x₁*, *x₂*, …] and **y** defaults to the zero-based
70
+ * index [0, 1, 2, …].
71
+ */
72
+ mark: 'lineX';
73
+ }
74
+ /** The lineY mark. */
75
+ export interface LineY extends MarkData, LineYOptions {
76
+ /**
77
+ * Like line, except **y** defaults to the identity function and assumes
78
+ * that *data* = [*y₀*, *y₁*, *y₂*, …] and **x** defaults to the zero-based
79
+ * index [0, 1, 2, …].
80
+ */
81
+ mark: 'lineY';
82
+ }
@@ -0,0 +1,60 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { ChannelValueSpec, CurveAutoOptions, MarkData, MarkOptions, MarkerOptions } from './Marks.js';
3
+ /** Options for the link mark. */
4
+ export interface LinkOptions extends MarkOptions, MarkerOptions, CurveAutoOptions {
5
+ /**
6
+ * The horizontal position, for vertical links; typically bound to the *x*
7
+ * scale; shorthand for setting defaults for both **x1** and **x2**.
8
+ */
9
+ x?: ChannelValueSpec;
10
+ /**
11
+ * The vertical position, for horizontal links; typically bound to the *y*
12
+ * scale; shorthand for setting defaults for both **y1** and **y2**.
13
+ */
14
+ y?: ChannelValueSpec;
15
+ /**
16
+ * The starting horizontal position; typically bound to the *x* scale; also
17
+ * sets a default for **x2**.
18
+ */
19
+ x1?: ChannelValueSpec;
20
+ /**
21
+ * The starting vertical position; typically bound to the *y* scale; also sets
22
+ * a default for **y2**.
23
+ */
24
+ y1?: ChannelValueSpec;
25
+ /**
26
+ * The ending horizontal position; typically bound to the *x* scale; also sets
27
+ * a default for **x1**.
28
+ */
29
+ x2?: ChannelValueSpec;
30
+ /**
31
+ * The ending vertical position; typically bound to the *y* scale; also sets a
32
+ * default for **y1**.
33
+ */
34
+ y2?: ChannelValueSpec;
35
+ /**
36
+ * The curve (interpolation) method for connecting adjacent points.
37
+ *
38
+ * Since a link has exactly two points, only the following curves (or a custom
39
+ * curve) are recommended: *linear*, *step*, *step-after*, *step-before*,
40
+ * *bump-x*, or *bump-y*. Note that the *linear* curve is incapable of showing
41
+ * a fill since a straight line has zero area. For a curved link, use an arrow
42
+ * mark with the **bend** option.
43
+ *
44
+ * If the plot uses a spherical **projection**, the default *auto* **curve**
45
+ * will render links as geodesics; to draw a straight line instead, use the
46
+ * *linear* **curve**.
47
+ */
48
+ curve?: CurveAutoOptions['curve'] | ParamRef;
49
+ }
50
+ /** The link mark. */
51
+ export interface Link extends MarkData, LinkOptions {
52
+ /**
53
+ * A link mark, drawing line segments (curves) connecting pairs of points.
54
+ *
55
+ * If the plot uses a spherical **projection**, the default *auto* **curve**
56
+ * will render links as geodesics; to draw a straight line instead, use the
57
+ * *linear* **curve**.
58
+ */
59
+ mark: 'link';
60
+ }