@uwdata/mosaic-plot 0.14.1 → 0.16.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uwdata/mosaic-plot",
3
- "version": "0.14.1",
3
+ "version": "0.16.1",
4
4
  "description": "A Mosaic-powered plotting framework based on Observable Plot.",
5
5
  "keywords": [
6
6
  "data",
@@ -26,10 +26,9 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@observablehq/plot": "^0.6.17",
29
- "@uwdata/mosaic-core": "^0.14.1",
30
- "@uwdata/mosaic-sql": "^0.14.1",
31
- "d3": "^7.9.0",
32
- "isoformat": "^0.2.1"
29
+ "@uwdata/mosaic-core": "^0.16.1",
30
+ "@uwdata/mosaic-sql": "^0.16.1",
31
+ "d3": "^7.9.0"
33
32
  },
34
- "gitHead": "5959cb169e95bd8467e1e5d7a9b98954f09474f3"
33
+ "gitHead": "e12af9927b0a35a0e3194850ef569d0d24a022ce"
35
34
  }
@@ -1,6 +1,7 @@
1
+ /** @import { ExprNode } from '@uwdata/mosaic-sql' */
1
2
  import { interpolatorBarycentric, interpolateNearest, interpolatorRandomWalk } from '@observablehq/plot';
2
3
  import { toDataColumns } from '@uwdata/mosaic-core';
3
- import { ExprNode, Query, bin2d, binLinear2d, collectColumns, count, isAggregateExpression, isBetween, lt, lte, sum } from '@uwdata/mosaic-sql';
4
+ import { Query, bin2d, binLinear2d, collectColumns, count, isAggregateExpression, isBetween, lt, lte, sum } from '@uwdata/mosaic-sql';
4
5
  import { Transient } from '../symbols.js';
5
6
  import { binExpr } from './util/bin-expr.js';
6
7
  import { dericheConfig, dericheConv2d } from './util/density.js';
package/src/marks/Mark.js CHANGED
@@ -1,5 +1,6 @@
1
- import { isParam, MosaicClient, toDataColumns } from '@uwdata/mosaic-core';
2
- import { Query, SelectQuery, collectParams, column, isAggregateExpression, isColumnParam, isColumnRef, isNode, isParamLike } from '@uwdata/mosaic-sql';
1
+ /** @import { SelectQuery } from '@uwdata/mosaic-sql' */
2
+ import { isParam, MosaicClient, queryFieldInfo, toDataColumns } from '@uwdata/mosaic-core';
3
+ import { Query, collectParams, column, isAggregateExpression, isColumnParam, isColumnRef, isNode, isParamLike } from '@uwdata/mosaic-sql';
3
4
  import { isColor } from './util/is-color.js';
4
5
  import { isConstantOption } from './util/is-constant-option.js';
5
6
  import { isSymbol } from './util/is-symbol.js';
@@ -121,7 +122,7 @@ export class Mark extends MosaicClient {
121
122
  return c?.field ? c : null;
122
123
  }
123
124
 
124
- fields() {
125
+ async prepare() {
125
126
  if (this.hasOwnData()) return null;
126
127
 
127
128
  const { channels, reqs } = this;
@@ -136,14 +137,11 @@ export class Mark extends MosaicClient {
136
137
  }
137
138
 
138
139
  const table = this.sourceTable();
139
- return Array.from(fields, ([c, s]) => ({
140
- table,
141
- column: c,
142
- stats: Array.from(s)
143
- }));
144
- }
140
+ const info = await queryFieldInfo(
141
+ this.coordinator,
142
+ Array.from(fields, ([c, s]) => ({ table, column: c, stats: Array.from(s) }))
143
+ );
145
144
 
146
- fieldInfo(info) {
147
145
  const lookup = Object.fromEntries(info.map(x => [x.column, x]));
148
146
  for (const entry of this.channels) {
149
147
  const { field } = entry;
@@ -152,7 +150,6 @@ export class Mark extends MosaicClient {
152
150
  }
153
151
  }
154
152
  this._fieldInfo = true;
155
- return this;
156
153
  }
157
154
 
158
155
  /**