@uwdata/mosaic-spec 0.12.0 → 0.12.2
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/README.md +2 -0
- package/dist/mosaic-schema.json +7971 -2265
- package/dist/mosaic-spec.js +193 -80
- package/dist/mosaic-spec.min.js +20 -20
- package/dist/types/spec/Param.d.ts +1 -1
- package/dist/types/spec/PlotMark.d.ts +2 -1
- package/dist/types/spec/marks/Density.d.ts +22 -7
- package/dist/types/spec/marks/Waffle.d.ts +58 -0
- package/package.json +5 -5
- package/src/spec/Param.ts +1 -0
- package/src/spec/PlotMark.ts +3 -1
- package/src/spec/marks/Density.ts +25 -7
- package/src/spec/marks/Waffle.ts +61 -0
package/dist/mosaic-spec.js
CHANGED
|
@@ -103,7 +103,7 @@ var require_search_bounds = __commonJS({
|
|
|
103
103
|
}
|
|
104
104
|
return -1;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function norm2(a2, y3, c4, l, h, f) {
|
|
107
107
|
if (typeof c4 === "function") {
|
|
108
108
|
return f(a2, y3, c4, l === void 0 ? 0 : l | 0, h === void 0 ? a2.length - 1 : h | 0);
|
|
109
109
|
}
|
|
@@ -111,19 +111,19 @@ var require_search_bounds = __commonJS({
|
|
|
111
111
|
}
|
|
112
112
|
module.exports = {
|
|
113
113
|
ge: function(a2, y3, c4, l, h) {
|
|
114
|
-
return
|
|
114
|
+
return norm2(a2, y3, c4, l, h, ge);
|
|
115
115
|
},
|
|
116
116
|
gt: function(a2, y3, c4, l, h) {
|
|
117
|
-
return
|
|
117
|
+
return norm2(a2, y3, c4, l, h, gt2);
|
|
118
118
|
},
|
|
119
119
|
lt: function(a2, y3, c4, l, h) {
|
|
120
|
-
return
|
|
120
|
+
return norm2(a2, y3, c4, l, h, lt2);
|
|
121
121
|
},
|
|
122
122
|
le: function(a2, y3, c4, l, h) {
|
|
123
|
-
return
|
|
123
|
+
return norm2(a2, y3, c4, l, h, le);
|
|
124
124
|
},
|
|
125
125
|
eq: function(a2, y3, c4, l, h) {
|
|
126
|
-
return
|
|
126
|
+
return norm2(a2, y3, c4, l, h, eq2);
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
}
|
|
@@ -563,14 +563,15 @@ var MosaicClient = class {
|
|
|
563
563
|
}
|
|
564
564
|
/**
|
|
565
565
|
* Return an array of fields queried by this client.
|
|
566
|
-
* @returns {
|
|
566
|
+
* @returns {import('./types.js').FieldInfoRequest[] | null}
|
|
567
|
+
* The fields to retrieve info for.
|
|
567
568
|
*/
|
|
568
569
|
fields() {
|
|
569
570
|
return null;
|
|
570
571
|
}
|
|
571
572
|
/**
|
|
572
573
|
* Called by the coordinator to set the field info for this client.
|
|
573
|
-
* @param {
|
|
574
|
+
* @param {import('./types.js').FieldInfo[]} info The field info result.
|
|
574
575
|
* @returns {this}
|
|
575
576
|
*/
|
|
576
577
|
fieldInfo(info) {
|
|
@@ -3451,6 +3452,9 @@ var ColumnNameRefNode = class extends ColumnRefNode {
|
|
|
3451
3452
|
};
|
|
3452
3453
|
|
|
3453
3454
|
// ../sql/src/ast/column-param.js
|
|
3455
|
+
function isColumnParam(value) {
|
|
3456
|
+
return value instanceof ColumnParamNode;
|
|
3457
|
+
}
|
|
3454
3458
|
var ColumnParamNode = class extends ColumnRefNode {
|
|
3455
3459
|
/**
|
|
3456
3460
|
* Instantiate a column param node.
|
|
@@ -5039,7 +5043,7 @@ function collectAggregates(root2) {
|
|
|
5039
5043
|
function collectColumns(root2) {
|
|
5040
5044
|
const cols = {};
|
|
5041
5045
|
walk(root2, (node) => {
|
|
5042
|
-
if (node.type === COLUMN_REF) {
|
|
5046
|
+
if (node.type === COLUMN_REF || node.type === COLUMN_PARAM) {
|
|
5043
5047
|
cols[node] = node;
|
|
5044
5048
|
}
|
|
5045
5049
|
});
|
|
@@ -5170,21 +5174,21 @@ function bin2d(q, xp, yp, aggs, xn, groupby) {
|
|
|
5170
5174
|
}
|
|
5171
5175
|
|
|
5172
5176
|
// ../sql/src/transforms/bin-linear-1d.js
|
|
5173
|
-
function binLinear1d(query, x3, weight) {
|
|
5177
|
+
function binLinear1d(query, x3, weight = void 0, groupby = []) {
|
|
5174
5178
|
const w = weight ? (x4) => mul(x4, weight) : (x4) => x4;
|
|
5175
5179
|
const p0 = floor(x3);
|
|
5176
5180
|
const p1 = add(p0, 1);
|
|
5177
5181
|
return Query.from(Query.unionAll(
|
|
5178
5182
|
query.clone().select({ i: int322(p0), w: w(sub(p1, x3)) }),
|
|
5179
5183
|
query.clone().select({ i: int322(p1), w: w(sub(x3, p0)) })
|
|
5180
|
-
)).select({ index: "i", density: sum("w") }).groupby("index").having(neq("density", 0));
|
|
5184
|
+
)).select({ index: "i", density: sum("w") }, groupby).groupby("index", groupby).having(neq("density", 0));
|
|
5181
5185
|
}
|
|
5182
5186
|
|
|
5183
5187
|
// ../sql/src/transforms/bin-linear-2d.js
|
|
5184
5188
|
function identity(x3) {
|
|
5185
5189
|
return x3;
|
|
5186
5190
|
}
|
|
5187
|
-
function binLinear2d(q, xp, yp, weight, xn, groupby) {
|
|
5191
|
+
function binLinear2d(q, xp, yp, weight, xn, groupby = []) {
|
|
5188
5192
|
const w = weight ? (x3) => mul(x3, weight) : identity;
|
|
5189
5193
|
const subq = (i, w2) => q.clone().select({ xp, yp, i, w: w2 });
|
|
5190
5194
|
const index2 = (x3, y3) => add(x3, mul(y3, xn));
|
|
@@ -5914,7 +5918,7 @@ var statMap = {
|
|
|
5914
5918
|
[Min]: min,
|
|
5915
5919
|
[Nulls]: (column3) => count().where(isNull(column3))
|
|
5916
5920
|
};
|
|
5917
|
-
function summarize(table3, column3, stats) {
|
|
5921
|
+
function summarize({ table: table3, column: column3, stats }) {
|
|
5918
5922
|
return Query.from(table3).select(Array.from(stats, (s2) => ({ [s2]: statMap[s2](column3) })));
|
|
5919
5923
|
}
|
|
5920
5924
|
async function queryFieldInfo(mc, fields) {
|
|
@@ -5925,7 +5929,7 @@ async function queryFieldInfo(mc, fields) {
|
|
|
5925
5929
|
}
|
|
5926
5930
|
}
|
|
5927
5931
|
async function getFieldInfo(mc, { table: table3, column: column3, stats }) {
|
|
5928
|
-
const q = Query.from({ source: table3 }).select({ column: column3 }).groupby(column3
|
|
5932
|
+
const q = Query.from({ source: table3 }).select({ column: column3 }).groupby(isNode(column3) && isAggregateExpression(column3) ? sql`ALL` : []);
|
|
5929
5933
|
const [desc2] = Array.from(await mc.query(Query.describe(q)));
|
|
5930
5934
|
const info = {
|
|
5931
5935
|
table: table3,
|
|
@@ -5934,16 +5938,16 @@ async function getFieldInfo(mc, { table: table3, column: column3, stats }) {
|
|
|
5934
5938
|
type: jsType(desc2.column_type),
|
|
5935
5939
|
nullable: desc2.null === "YES"
|
|
5936
5940
|
};
|
|
5937
|
-
if (!
|
|
5941
|
+
if (!stats?.length) return info;
|
|
5938
5942
|
const [result] = await mc.query(
|
|
5939
|
-
summarize(table3, column3, stats),
|
|
5943
|
+
summarize({ table: table3, column: column3, stats }),
|
|
5940
5944
|
{ persist: true }
|
|
5941
5945
|
);
|
|
5942
5946
|
return Object.assign(info, result);
|
|
5943
5947
|
}
|
|
5944
5948
|
async function getTableInfo(mc, table3) {
|
|
5945
|
-
const result = await mc.query(`DESCRIBE ${asTableRef(table3)}`);
|
|
5946
|
-
return
|
|
5949
|
+
const result = Array.from(await mc.query(`DESCRIBE ${asTableRef(table3)}`));
|
|
5950
|
+
return result.map((desc2) => ({
|
|
5947
5951
|
table: table3,
|
|
5948
5952
|
column: desc2.column_name,
|
|
5949
5953
|
sqlType: desc2.column_type,
|
|
@@ -6559,7 +6563,10 @@ var Coordinator = class {
|
|
|
6559
6563
|
* or a SQL string.
|
|
6560
6564
|
* @param {object} [options] An options object.
|
|
6561
6565
|
* @param {'arrow' | 'json'} [options.type] The query result format type.
|
|
6562
|
-
* @param {boolean} [options.cache=true] If true, cache the query result
|
|
6566
|
+
* @param {boolean} [options.cache=true] If true, cache the query result
|
|
6567
|
+
* client-side within the QueryManager.
|
|
6568
|
+
* @param {boolean} [options.persist] If true, request the database
|
|
6569
|
+
* server to persist a cached query server-side.
|
|
6563
6570
|
* @param {number} [options.priority] The query priority, defaults to
|
|
6564
6571
|
* `Priority.Normal`.
|
|
6565
6572
|
* @returns {QueryResult} A query result promise.
|
|
@@ -7279,7 +7286,7 @@ function clausePoint(field3, value, {
|
|
|
7279
7286
|
source,
|
|
7280
7287
|
clients = source ? /* @__PURE__ */ new Set([source]) : void 0
|
|
7281
7288
|
}) {
|
|
7282
|
-
const predicate = value !== void 0 ?
|
|
7289
|
+
const predicate = value !== void 0 ? isIn(field3, [literal(value)]) : null;
|
|
7283
7290
|
return {
|
|
7284
7291
|
meta: { type: "point" },
|
|
7285
7292
|
source,
|
|
@@ -7733,6 +7740,8 @@ __export(api_exports, {
|
|
|
7733
7740
|
voronoi: () => voronoi2,
|
|
7734
7741
|
voronoiMesh: () => voronoiMesh2,
|
|
7735
7742
|
vspace: () => vspace,
|
|
7743
|
+
waffleX: () => waffleX2,
|
|
7744
|
+
waffleY: () => waffleY2,
|
|
7736
7745
|
width: () => width,
|
|
7737
7746
|
xAlign: () => xAlign,
|
|
7738
7747
|
xAriaDescription: () => xAriaDescription,
|
|
@@ -31808,7 +31817,9 @@ function isColor2(value) {
|
|
|
31808
31817
|
|
|
31809
31818
|
// ../plot/src/marks/util/is-constant-option.js
|
|
31810
31819
|
var constantOptions = /* @__PURE__ */ new Set([
|
|
31820
|
+
"offset",
|
|
31811
31821
|
"order",
|
|
31822
|
+
"reverse",
|
|
31812
31823
|
"sort",
|
|
31813
31824
|
"label",
|
|
31814
31825
|
"anchor",
|
|
@@ -31880,7 +31891,7 @@ var isFieldObject = (channel, field3) => {
|
|
|
31880
31891
|
var fieldEntry = (channel, field3) => ({
|
|
31881
31892
|
channel,
|
|
31882
31893
|
field: field3,
|
|
31883
|
-
as: isColumnRef(field3) ? field3.column : channel
|
|
31894
|
+
as: isColumnRef(field3) && !isColumnParam(field3) ? field3.column : channel
|
|
31884
31895
|
});
|
|
31885
31896
|
var valueEntry = (channel, value) => ({ channel, value });
|
|
31886
31897
|
var isDataArray = (source) => Array.isArray(source);
|
|
@@ -31976,7 +31987,11 @@ var Mark2 = class extends MosaicClient {
|
|
|
31976
31987
|
reqs[channel]?.forEach((s2) => entry.add(s2));
|
|
31977
31988
|
}
|
|
31978
31989
|
const table3 = this.sourceTable();
|
|
31979
|
-
return Array.from(fields, ([c4, s2]) => ({
|
|
31990
|
+
return Array.from(fields, ([c4, s2]) => ({
|
|
31991
|
+
table: table3,
|
|
31992
|
+
column: c4,
|
|
31993
|
+
stats: Array.from(s2)
|
|
31994
|
+
}));
|
|
31980
31995
|
}
|
|
31981
31996
|
fieldInfo(info) {
|
|
31982
31997
|
const lookup = Object.fromEntries(info.map((x3) => [x3.column, x3]));
|
|
@@ -32174,13 +32189,33 @@ var ConnectedMark = class extends Mark2 {
|
|
|
32174
32189
|
function array3(size, proto = []) {
|
|
32175
32190
|
return new proto.constructor(size);
|
|
32176
32191
|
}
|
|
32177
|
-
function grid1d(size, index2, value) {
|
|
32178
|
-
const
|
|
32179
|
-
const
|
|
32180
|
-
|
|
32181
|
-
|
|
32192
|
+
function grid1d(size, index2, value, columns, groupby) {
|
|
32193
|
+
const numRows = index2.length;
|
|
32194
|
+
const result = {};
|
|
32195
|
+
const cells = [];
|
|
32196
|
+
if (groupby?.length) {
|
|
32197
|
+
const group3 = new Int32Array(numRows);
|
|
32198
|
+
const gvalues = groupby.map((name2) => columns[name2]);
|
|
32199
|
+
const cellMap = {};
|
|
32200
|
+
for (let row = 0; row < numRows; ++row) {
|
|
32201
|
+
const key = gvalues.map((group4) => group4[row]);
|
|
32202
|
+
group3[row] = cellMap[key] ??= cells.push(key) - 1;
|
|
32203
|
+
}
|
|
32204
|
+
for (let i = 0; i < groupby.length; ++i) {
|
|
32205
|
+
result[groupby[i]] = cells.map((cell3) => cell3[i]);
|
|
32206
|
+
}
|
|
32207
|
+
const G = result._grid = cells.map(() => array3(size, value));
|
|
32208
|
+
for (let row = 0; row < numRows; ++row) {
|
|
32209
|
+
G[group3[row]][index2[row]] = value[row];
|
|
32210
|
+
}
|
|
32211
|
+
} else {
|
|
32212
|
+
cells.push([]);
|
|
32213
|
+
const [G] = result._grid = [array3(size, value)];
|
|
32214
|
+
for (let row = 0; row < numRows; ++row) {
|
|
32215
|
+
G[index2[row]] = value[row];
|
|
32216
|
+
}
|
|
32182
32217
|
}
|
|
32183
|
-
return
|
|
32218
|
+
return { numRows: cells.length, columns: result };
|
|
32184
32219
|
}
|
|
32185
32220
|
function grid2d(w, h, index2, columns, aggregates, groupby, interpolate) {
|
|
32186
32221
|
const numRows = index2.length;
|
|
@@ -33038,9 +33073,16 @@ function stripXY(mark2, filter3) {
|
|
|
33038
33073
|
}
|
|
33039
33074
|
|
|
33040
33075
|
// ../plot/src/marks/Density1DMark.js
|
|
33076
|
+
var GROUPBY = { fill: 1, stroke: 1, z: 1 };
|
|
33041
33077
|
var Density1DMark = class extends Mark2 {
|
|
33042
33078
|
constructor(type2, source, options) {
|
|
33043
|
-
const {
|
|
33079
|
+
const {
|
|
33080
|
+
bins: bins2 = 1024,
|
|
33081
|
+
bandwidth = 20,
|
|
33082
|
+
normalize: normalize4 = false,
|
|
33083
|
+
stack: stack2 = false,
|
|
33084
|
+
...channels
|
|
33085
|
+
} = options;
|
|
33044
33086
|
const dim = type2.endsWith("X") ? "y" : "x";
|
|
33045
33087
|
super(type2, source, channels, dim === "x" ? xext : yext);
|
|
33046
33088
|
this.dim = dim;
|
|
@@ -33049,7 +33091,13 @@ var Density1DMark = class extends Mark2 {
|
|
|
33049
33091
|
});
|
|
33050
33092
|
this.bandwidth = handleParam(bandwidth, (value) => {
|
|
33051
33093
|
this.bandwidth = value;
|
|
33052
|
-
return this.
|
|
33094
|
+
return this.grids ? this.convolve().update() : null;
|
|
33095
|
+
});
|
|
33096
|
+
this.normalize = handleParam(normalize4, (value) => {
|
|
33097
|
+
return this.normalize = value, this.convolve().update();
|
|
33098
|
+
});
|
|
33099
|
+
this.stack = handleParam(stack2, (value) => {
|
|
33100
|
+
return this.stack = value, this.update();
|
|
33053
33101
|
});
|
|
33054
33102
|
}
|
|
33055
33103
|
get filterStable() {
|
|
@@ -33064,42 +33112,67 @@ var Density1DMark = class extends Mark2 {
|
|
|
33064
33112
|
const [x3, bx] = binExpr(this, dim, bins2, extent4);
|
|
33065
33113
|
const q = markQuery(channels, this.sourceTable(), [dim]).where(filter3.concat(isBetween(bx, extent4)));
|
|
33066
33114
|
const v2 = this.channelField("weight") ? "weight" : null;
|
|
33067
|
-
|
|
33115
|
+
const g = this.groupby = channels.flatMap((c4) => {
|
|
33116
|
+
return GROUPBY[c4.channel] && c4.field ? c4.as : [];
|
|
33117
|
+
});
|
|
33118
|
+
return binLinear1d(q, x3, v2, g);
|
|
33068
33119
|
}
|
|
33069
33120
|
queryResult(data) {
|
|
33070
|
-
const
|
|
33071
|
-
this.
|
|
33121
|
+
const c4 = toDataColumns(data).columns;
|
|
33122
|
+
this.grids = grid1d(this.bins, c4.index, c4.density, c4, this.groupby);
|
|
33072
33123
|
return this.convolve();
|
|
33073
33124
|
}
|
|
33074
33125
|
convolve() {
|
|
33075
|
-
const {
|
|
33076
|
-
|
|
33126
|
+
const {
|
|
33127
|
+
bins: bins2,
|
|
33128
|
+
bandwidth,
|
|
33129
|
+
normalize: normalize4,
|
|
33130
|
+
dim,
|
|
33131
|
+
grids,
|
|
33132
|
+
groupby,
|
|
33133
|
+
plot: plot3,
|
|
33134
|
+
extent: [lo, hi]
|
|
33135
|
+
} = this;
|
|
33136
|
+
const cols = grids.columns;
|
|
33137
|
+
const numGrids = grids.numRows;
|
|
33138
|
+
const b = this.channelField(dim).as;
|
|
33139
|
+
const v2 = dim === "x" ? "y" : "x";
|
|
33077
33140
|
const size = dim === "x" ? plot3.innerWidth() : plot3.innerHeight();
|
|
33141
|
+
const neg = cols._grid.some((grid2) => grid2.some((v3) => v3 < 0));
|
|
33078
33142
|
const config = dericheConfig(bandwidth * (bins2 - 1) / size, neg);
|
|
33079
|
-
const result = dericheConv1d(config, grid2, bins2);
|
|
33080
|
-
const v2 = dim === "x" ? "y" : "x";
|
|
33081
|
-
const b = this.channelField(dim).as;
|
|
33082
33143
|
const b0 = +lo;
|
|
33083
33144
|
const delta = (hi - b0) / (bins2 - 1);
|
|
33084
|
-
const
|
|
33085
|
-
const _b = new Float64Array(
|
|
33086
|
-
const _v = new Float64Array(
|
|
33087
|
-
|
|
33088
|
-
|
|
33089
|
-
|
|
33090
|
-
|
|
33091
|
-
|
|
33145
|
+
const numRows = bins2 * numGrids;
|
|
33146
|
+
const _b = new Float64Array(numRows);
|
|
33147
|
+
const _v = new Float64Array(numRows);
|
|
33148
|
+
const _g = groupby.reduce((m, name2) => (m[name2] = Array(numRows), m), {});
|
|
33149
|
+
for (let k2 = 0, g = 0; g < numGrids; ++g) {
|
|
33150
|
+
groupby.forEach((name2) => _g[name2].fill(cols[name2][g], k2, k2 + bins2));
|
|
33151
|
+
const grid2 = cols._grid[g];
|
|
33152
|
+
const result = dericheConv1d(config, grid2, bins2);
|
|
33153
|
+
const scale3 = 1 / norm(grid2, result, delta, normalize4);
|
|
33154
|
+
for (let i = 0; i < bins2; ++i, ++k2) {
|
|
33155
|
+
_b[k2] = b0 + i * delta;
|
|
33156
|
+
_v[k2] = result[i] * scale3;
|
|
33157
|
+
}
|
|
33158
|
+
}
|
|
33159
|
+
this.data = { numRows, columns: { [b]: _b, [v2]: _v, ..._g } };
|
|
33092
33160
|
return this;
|
|
33093
33161
|
}
|
|
33094
33162
|
plotSpecs() {
|
|
33095
|
-
const { type: type2, data: { numRows: length4, columns }, channels, dim } = this;
|
|
33096
|
-
const
|
|
33163
|
+
const { type: type2, data: { numRows: length4, columns }, channels, dim, stack: stack2 } = this;
|
|
33164
|
+
const _ = type2.startsWith("area") && !stack2 ? "2" : "";
|
|
33165
|
+
const options = dim === "x" ? { [`y${_}`]: columns.y } : { [`x${_}`]: columns.x };
|
|
33097
33166
|
for (const c4 of channels) {
|
|
33098
33167
|
options[c4.channel] = channelOption(c4, columns);
|
|
33099
33168
|
}
|
|
33100
33169
|
return [{ type: type2, data: { length: length4 }, options }];
|
|
33101
33170
|
}
|
|
33102
33171
|
};
|
|
33172
|
+
function norm(grid2, smoothed, delta, type2) {
|
|
33173
|
+
const value = type2 === true || type2 === "sum" ? sum2(grid2) : type2 === "max" ? max2(smoothed) : delta;
|
|
33174
|
+
return value || 1;
|
|
33175
|
+
}
|
|
33103
33176
|
|
|
33104
33177
|
// ../plot/src/marks/Density2DMark.js
|
|
33105
33178
|
var Density2DMark = class extends Grid2DMark {
|
|
@@ -33471,13 +33544,16 @@ var HexbinMark = class extends Mark2 {
|
|
|
33471
33544
|
float642(x12),
|
|
33472
33545
|
div(add(mul(add(x3, mul(0.5, bitAnd(y3, 1))), dx), ox2), xr)
|
|
33473
33546
|
),
|
|
33474
|
-
[yc.as]: sub(
|
|
33547
|
+
[yc.as]: sub(
|
|
33548
|
+
float642(y22),
|
|
33549
|
+
div(add(mul(y3, dy), oy2), yr)
|
|
33550
|
+
),
|
|
33475
33551
|
...cols
|
|
33476
33552
|
}).groupby(x3, y3, ...dims).from(
|
|
33477
33553
|
// Subquery performs hex binning in screen space and also passes
|
|
33478
33554
|
// original columns through (the DB should optimize this).
|
|
33479
33555
|
Query.select({
|
|
33480
|
-
[py]: div(mul(yr, sub(
|
|
33556
|
+
[py]: div(sub(mul(yr, sub(y22, yc.field)), oy2), dy),
|
|
33481
33557
|
[pj]: int322(round(py)),
|
|
33482
33558
|
[px]: sub(
|
|
33483
33559
|
div(sub(mul(xr, sub(xc.field, x12)), ox2), dx),
|
|
@@ -35164,6 +35240,7 @@ var Menu = class extends MosaicClient {
|
|
|
35164
35240
|
constructor({
|
|
35165
35241
|
element,
|
|
35166
35242
|
filterBy,
|
|
35243
|
+
as,
|
|
35167
35244
|
from: from2,
|
|
35168
35245
|
column: column3,
|
|
35169
35246
|
label = column3,
|
|
@@ -35171,8 +35248,7 @@ var Menu = class extends MosaicClient {
|
|
|
35171
35248
|
// TODO
|
|
35172
35249
|
options,
|
|
35173
35250
|
value,
|
|
35174
|
-
field: field3 = column3
|
|
35175
|
-
as
|
|
35251
|
+
field: field3 = column3
|
|
35176
35252
|
} = {}) {
|
|
35177
35253
|
super(filterBy);
|
|
35178
35254
|
this.from = from2;
|
|
@@ -35189,8 +35265,8 @@ var Menu = class extends MosaicClient {
|
|
|
35189
35265
|
this.select = document.createElement("select");
|
|
35190
35266
|
this.element.appendChild(this.select);
|
|
35191
35267
|
if (options) {
|
|
35192
|
-
this.data = options.map((
|
|
35193
|
-
this.selectedValue(value
|
|
35268
|
+
this.data = options.map((opt) => isObject2(opt) ? opt : { value: opt });
|
|
35269
|
+
this.selectedValue(value === void 0 ? "" : value);
|
|
35194
35270
|
this.update();
|
|
35195
35271
|
}
|
|
35196
35272
|
if (selection2) {
|
|
@@ -35207,6 +35283,11 @@ var Menu = class extends MosaicClient {
|
|
|
35207
35283
|
this.selectedValue(value2);
|
|
35208
35284
|
}
|
|
35209
35285
|
});
|
|
35286
|
+
} else {
|
|
35287
|
+
this.select.addEventListener("pointerenter", (evt) => {
|
|
35288
|
+
if (!evt.buttons) this.activate();
|
|
35289
|
+
});
|
|
35290
|
+
this.select.addEventListener("focus", () => this.activate());
|
|
35210
35291
|
}
|
|
35211
35292
|
}
|
|
35212
35293
|
}
|
|
@@ -35226,6 +35307,9 @@ var Menu = class extends MosaicClient {
|
|
|
35226
35307
|
reset() {
|
|
35227
35308
|
this.select.selectedIndex = this.from ? 0 : -1;
|
|
35228
35309
|
}
|
|
35310
|
+
activate() {
|
|
35311
|
+
this.selection.activate(clausePoint(this.field, 0, { source: this }));
|
|
35312
|
+
}
|
|
35229
35313
|
publish(value) {
|
|
35230
35314
|
const { selection: selection2, field: field3 } = this;
|
|
35231
35315
|
if (isSelection(selection2)) {
|
|
@@ -35256,7 +35340,7 @@ var Menu = class extends MosaicClient {
|
|
|
35256
35340
|
}
|
|
35257
35341
|
if (selection2) {
|
|
35258
35342
|
const value = isSelection(selection2) ? selection2.valueFor(this) : selection2.value;
|
|
35259
|
-
this.selectedValue(value
|
|
35343
|
+
this.selectedValue(value === void 0 ? "" : value);
|
|
35260
35344
|
}
|
|
35261
35345
|
return this;
|
|
35262
35346
|
}
|
|
@@ -35331,17 +35415,28 @@ var Search = class extends MosaicClient {
|
|
|
35331
35415
|
this.searchbox.value = value;
|
|
35332
35416
|
}
|
|
35333
35417
|
});
|
|
35418
|
+
} else {
|
|
35419
|
+
this.searchbox.addEventListener("pointerenter", (evt) => {
|
|
35420
|
+
if (!evt.buttons) this.activate();
|
|
35421
|
+
});
|
|
35422
|
+
this.searchbox.addEventListener("focus", () => this.activate());
|
|
35334
35423
|
}
|
|
35335
35424
|
}
|
|
35336
35425
|
}
|
|
35337
35426
|
reset() {
|
|
35338
35427
|
this.searchbox.value = "";
|
|
35339
35428
|
}
|
|
35429
|
+
clause(value) {
|
|
35430
|
+
const { field: field3, type: type2 } = this;
|
|
35431
|
+
return clauseMatch(field3, value, { source: this, method: type2 });
|
|
35432
|
+
}
|
|
35433
|
+
activate() {
|
|
35434
|
+
this.selection.activate(this.clause(""));
|
|
35435
|
+
}
|
|
35340
35436
|
publish(value) {
|
|
35341
|
-
const { selection: selection2
|
|
35437
|
+
const { selection: selection2 } = this;
|
|
35342
35438
|
if (isSelection(selection2)) {
|
|
35343
|
-
|
|
35344
|
-
selection2.update(clause);
|
|
35439
|
+
selection2.update(this.clause(value));
|
|
35345
35440
|
} else if (isParam(selection2)) {
|
|
35346
35441
|
selection2.update(value);
|
|
35347
35442
|
}
|
|
@@ -35460,13 +35555,20 @@ var Slider = class extends MosaicClient {
|
|
|
35460
35555
|
this.curval.innerText = value2;
|
|
35461
35556
|
if (this.selection) this.publish(+value2);
|
|
35462
35557
|
});
|
|
35463
|
-
if (this.selection
|
|
35464
|
-
this.selection
|
|
35465
|
-
|
|
35466
|
-
this.slider.value
|
|
35467
|
-
|
|
35468
|
-
|
|
35469
|
-
|
|
35558
|
+
if (this.selection) {
|
|
35559
|
+
if (!isSelection(this.selection)) {
|
|
35560
|
+
this.selection.addEventListener("value", (value2) => {
|
|
35561
|
+
if (value2 !== +this.slider.value) {
|
|
35562
|
+
this.slider.value = value2;
|
|
35563
|
+
this.curval.innerText = value2;
|
|
35564
|
+
}
|
|
35565
|
+
});
|
|
35566
|
+
} else {
|
|
35567
|
+
this.slider.addEventListener("pointerenter", (evt) => {
|
|
35568
|
+
if (!evt.buttons) this.activate();
|
|
35569
|
+
});
|
|
35570
|
+
this.slider.addEventListener("focus", () => this.activate());
|
|
35571
|
+
}
|
|
35470
35572
|
}
|
|
35471
35573
|
}
|
|
35472
35574
|
query(filter3 = []) {
|
|
@@ -35490,20 +35592,27 @@ var Slider = class extends MosaicClient {
|
|
|
35490
35592
|
}
|
|
35491
35593
|
return this;
|
|
35492
35594
|
}
|
|
35595
|
+
clause(value) {
|
|
35596
|
+
const { field: field3, selectionType } = this;
|
|
35597
|
+
if (selectionType === "interval") {
|
|
35598
|
+
const domain = [this.min ?? 0, value];
|
|
35599
|
+
return clauseInterval(field3, domain, {
|
|
35600
|
+
source: this,
|
|
35601
|
+
bin: "ceil",
|
|
35602
|
+
scale: { type: "identity", domain },
|
|
35603
|
+
pixelSize: this.step
|
|
35604
|
+
});
|
|
35605
|
+
} else {
|
|
35606
|
+
return clausePoint(field3, value, { source: this });
|
|
35607
|
+
}
|
|
35608
|
+
}
|
|
35609
|
+
activate() {
|
|
35610
|
+
this.selection.activate(this.clause(0));
|
|
35611
|
+
}
|
|
35493
35612
|
publish(value) {
|
|
35494
|
-
const {
|
|
35613
|
+
const { selection: selection2 } = this;
|
|
35495
35614
|
if (isSelection(selection2)) {
|
|
35496
|
-
|
|
35497
|
-
const domain = [this.min ?? 0, value];
|
|
35498
|
-
selection2.update(clauseInterval(field3, domain, {
|
|
35499
|
-
source: this,
|
|
35500
|
-
bin: "ceil",
|
|
35501
|
-
scale: { type: "identity", domain },
|
|
35502
|
-
pixelSize: this.step
|
|
35503
|
-
}));
|
|
35504
|
-
} else {
|
|
35505
|
-
selection2.update(clausePoint(field3, value, { source: this }));
|
|
35506
|
-
}
|
|
35615
|
+
selection2.update(this.clause(value));
|
|
35507
35616
|
} else if (isParam(this.selection)) {
|
|
35508
35617
|
selection2.update(value);
|
|
35509
35618
|
}
|
|
@@ -35627,8 +35736,8 @@ var Table2 = class extends MosaicClient {
|
|
|
35627
35736
|
coordinator().prefetch(query.clone().offset(offset2 + this.limit));
|
|
35628
35737
|
}
|
|
35629
35738
|
fields() {
|
|
35630
|
-
const
|
|
35631
|
-
return this.columns.map((
|
|
35739
|
+
const table3 = this.sourceTable();
|
|
35740
|
+
return this.columns.map((column3) => ({ column: column3, table: table3 }));
|
|
35632
35741
|
}
|
|
35633
35742
|
fieldInfo(info) {
|
|
35634
35743
|
this.schema = info;
|
|
@@ -36406,7 +36515,9 @@ __export(marks_exports, {
|
|
|
36406
36515
|
vectorX: () => vectorX2,
|
|
36407
36516
|
vectorY: () => vectorY2,
|
|
36408
36517
|
voronoi: () => voronoi2,
|
|
36409
|
-
voronoiMesh: () => voronoiMesh2
|
|
36518
|
+
voronoiMesh: () => voronoiMesh2,
|
|
36519
|
+
waffleX: () => waffleX2,
|
|
36520
|
+
waffleY: () => waffleY2
|
|
36410
36521
|
});
|
|
36411
36522
|
var decorators = /* @__PURE__ */ new Set([
|
|
36412
36523
|
"frame",
|
|
@@ -36503,6 +36614,8 @@ var gridFy2 = (...args) => mark("gridFy", ...args);
|
|
|
36503
36614
|
var geo2 = (...args) => implicitType(GeoMark, ...args);
|
|
36504
36615
|
var sphere2 = (...args) => mark("sphere", ...args);
|
|
36505
36616
|
var graticule3 = (...args) => mark("graticule", ...args);
|
|
36617
|
+
var waffleX2 = (...args) => mark("waffleX", ...args);
|
|
36618
|
+
var waffleY2 = (...args) => mark("waffleY", ...args);
|
|
36506
36619
|
|
|
36507
36620
|
// ../vgplot/src/plot/interactors.js
|
|
36508
36621
|
var interactors_exports = {};
|