@uwdata/mosaic-plot 0.6.1 → 0.7.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.
- package/LICENSE +19 -0
- package/dist/mosaic-plot.js +395 -352
- package/dist/mosaic-plot.min.js +11 -11
- package/package.json +4 -4
- package/src/interactors/Interval1D.js +1 -1
- package/src/interactors/Interval2D.js +2 -2
- package/src/interactors/PanZoom.js +2 -2
- package/src/interactors/util/get-field.js +2 -2
- package/src/legend.js +4 -2
- package/src/marks/ConnectedMark.js +5 -8
- package/src/marks/DenseLineMark.js +11 -4
- package/src/marks/Grid2DMark.js +1 -1
- package/src/marks/Mark.js +45 -24
- package/src/marks/RasterMark.js +1 -1
- package/src/marks/RasterTileMark.js +1 -1
- package/src/marks/util/channel-scale.js +1 -2
- package/src/marks/util/extent.js +3 -5
- package/src/marks/util/grid.js +10 -12
- package/src/marks/util/interpolate.js +9 -0
- package/src/marks/util/is-color.js +3 -0
- package/src/marks/util/to-data-array.js +2 -2
- package/src/plot-renderer.js +9 -13
- package/src/transforms/bin.js +2 -2
- package/src/marks/util/arrow.js +0 -55
package/dist/mosaic-plot.js
CHANGED
|
@@ -12864,6 +12864,15 @@ var Query = class _Query {
|
|
|
12864
12864
|
static except(...queries) {
|
|
12865
12865
|
return new SetOperation("EXCEPT", queries.flat());
|
|
12866
12866
|
}
|
|
12867
|
+
static describe(query) {
|
|
12868
|
+
const q = query.clone();
|
|
12869
|
+
const { clone, toString } = q;
|
|
12870
|
+
return Object.assign(q, {
|
|
12871
|
+
describe: true,
|
|
12872
|
+
clone: () => _Query.describe(clone.call(q)),
|
|
12873
|
+
toString: () => `DESCRIBE ${toString.call(q)}`
|
|
12874
|
+
});
|
|
12875
|
+
}
|
|
12867
12876
|
constructor() {
|
|
12868
12877
|
this.query = {
|
|
12869
12878
|
with: [],
|
|
@@ -13098,6 +13107,7 @@ var Query = class _Query {
|
|
|
13098
13107
|
}
|
|
13099
13108
|
toString() {
|
|
13100
13109
|
const {
|
|
13110
|
+
with: cte,
|
|
13101
13111
|
select: select2,
|
|
13102
13112
|
distinct: distinct2,
|
|
13103
13113
|
from,
|
|
@@ -13109,8 +13119,7 @@ var Query = class _Query {
|
|
|
13109
13119
|
qualify,
|
|
13110
13120
|
orderby,
|
|
13111
13121
|
limit,
|
|
13112
|
-
offset: offset2
|
|
13113
|
-
with: cte
|
|
13122
|
+
offset: offset2
|
|
13114
13123
|
} = this.query;
|
|
13115
13124
|
const sql2 = [];
|
|
13116
13125
|
if (cte.length) {
|
|
@@ -13232,6 +13241,9 @@ var SetOperation = class _SetOperation {
|
|
|
13232
13241
|
function isQuery(value) {
|
|
13233
13242
|
return value instanceof Query || value instanceof SetOperation;
|
|
13234
13243
|
}
|
|
13244
|
+
function isDescribeQuery(value) {
|
|
13245
|
+
return isQuery(value) && value.describe;
|
|
13246
|
+
}
|
|
13235
13247
|
function unquote(s2) {
|
|
13236
13248
|
return isDoubleQuoted(s2) ? s2.slice(1, -1) : s2;
|
|
13237
13249
|
}
|
|
@@ -13331,131 +13343,6 @@ function create(name, query, {
|
|
|
13331
13343
|
return "CREATE" + (replace ? " OR REPLACE " : " ") + (temp ? "TEMP " : "") + (view ? "VIEW" : "TABLE") + (replace ? " " : " IF NOT EXISTS ") + name + " AS " + query;
|
|
13332
13344
|
}
|
|
13333
13345
|
|
|
13334
|
-
// ../core/src/util/js-type.js
|
|
13335
|
-
function jsType(type2) {
|
|
13336
|
-
switch (type2) {
|
|
13337
|
-
case "BIGINT":
|
|
13338
|
-
case "HUGEINT":
|
|
13339
|
-
case "INTEGER":
|
|
13340
|
-
case "SMALLINT":
|
|
13341
|
-
case "TINYINT":
|
|
13342
|
-
case "UBIGINT":
|
|
13343
|
-
case "UINTEGER":
|
|
13344
|
-
case "USMALLINT":
|
|
13345
|
-
case "UTINYINT":
|
|
13346
|
-
case "DOUBLE":
|
|
13347
|
-
case "FLOAT":
|
|
13348
|
-
case "REAL":
|
|
13349
|
-
case "DECIMAL":
|
|
13350
|
-
return "number";
|
|
13351
|
-
case "DATE":
|
|
13352
|
-
case "TIMESTAMP":
|
|
13353
|
-
case "TIMESTAMPTZ":
|
|
13354
|
-
case "TIMESTAMP WITH TIME ZONE":
|
|
13355
|
-
case "TIME":
|
|
13356
|
-
case "TIMESTAMP_NS":
|
|
13357
|
-
return "date";
|
|
13358
|
-
case "BOOLEAN":
|
|
13359
|
-
return "boolean";
|
|
13360
|
-
case "VARCHAR":
|
|
13361
|
-
case "UUID":
|
|
13362
|
-
return "string";
|
|
13363
|
-
case "LIST":
|
|
13364
|
-
return "array";
|
|
13365
|
-
case "BLOB":
|
|
13366
|
-
case "STRUCT":
|
|
13367
|
-
case "MAP":
|
|
13368
|
-
return "object";
|
|
13369
|
-
default:
|
|
13370
|
-
throw new Error(`Unsupported type: ${type2}`);
|
|
13371
|
-
}
|
|
13372
|
-
}
|
|
13373
|
-
|
|
13374
|
-
// ../core/src/util/summarize.js
|
|
13375
|
-
var Count = "count";
|
|
13376
|
-
var Nulls = "nulls";
|
|
13377
|
-
var Max = "max";
|
|
13378
|
-
var Min = "min";
|
|
13379
|
-
var Distinct = "distinct";
|
|
13380
|
-
var statMap = {
|
|
13381
|
-
[Count]: count,
|
|
13382
|
-
[Distinct]: (column3) => count(column3).distinct(),
|
|
13383
|
-
[Max]: max,
|
|
13384
|
-
[Min]: min,
|
|
13385
|
-
[Nulls]: (column3) => count().where(isNull(column3))
|
|
13386
|
-
};
|
|
13387
|
-
function summarize({ table, column: column3 }, stats) {
|
|
13388
|
-
return Query.from(table).select(stats.map((s2) => [s2, statMap[s2](column3)]));
|
|
13389
|
-
}
|
|
13390
|
-
|
|
13391
|
-
// ../core/src/Catalog.js
|
|
13392
|
-
var object = () => /* @__PURE__ */ Object.create(null);
|
|
13393
|
-
var Catalog = class {
|
|
13394
|
-
constructor(coordinator2) {
|
|
13395
|
-
this.mc = coordinator2;
|
|
13396
|
-
this.clear();
|
|
13397
|
-
}
|
|
13398
|
-
clear() {
|
|
13399
|
-
this.tables = object();
|
|
13400
|
-
}
|
|
13401
|
-
tableInfo(table) {
|
|
13402
|
-
const cache = this.tables;
|
|
13403
|
-
if (cache[table]) {
|
|
13404
|
-
return cache[table];
|
|
13405
|
-
}
|
|
13406
|
-
const infoPromise = getTableInfo(this.mc, table).catch((err) => {
|
|
13407
|
-
cache[table] = null;
|
|
13408
|
-
throw err;
|
|
13409
|
-
});
|
|
13410
|
-
return cache[table] = infoPromise;
|
|
13411
|
-
}
|
|
13412
|
-
async fieldInfo({ table, column: column3, stats }) {
|
|
13413
|
-
const tableInfo = await this.tableInfo(table);
|
|
13414
|
-
const colInfo = tableInfo[column3];
|
|
13415
|
-
if (colInfo == null)
|
|
13416
|
-
return;
|
|
13417
|
-
if (!stats?.length)
|
|
13418
|
-
return colInfo;
|
|
13419
|
-
const result = await this.mc.query(
|
|
13420
|
-
summarize(colInfo, stats),
|
|
13421
|
-
{ persist: true }
|
|
13422
|
-
);
|
|
13423
|
-
const info = { ...colInfo, ...Array.from(result)[0] };
|
|
13424
|
-
for (const key in info) {
|
|
13425
|
-
const value = info[key];
|
|
13426
|
-
if (typeof value === "bigint") {
|
|
13427
|
-
info[key] = Number(value);
|
|
13428
|
-
}
|
|
13429
|
-
}
|
|
13430
|
-
return info;
|
|
13431
|
-
}
|
|
13432
|
-
async queryFields(fields) {
|
|
13433
|
-
const list = await resolveFields(this, fields);
|
|
13434
|
-
const data = await Promise.all(list.map((f) => this.fieldInfo(f)));
|
|
13435
|
-
return data.filter((x3) => x3);
|
|
13436
|
-
}
|
|
13437
|
-
};
|
|
13438
|
-
async function getTableInfo(mc, table) {
|
|
13439
|
-
const result = await mc.query(
|
|
13440
|
-
`DESCRIBE ${asRelation(table)}`,
|
|
13441
|
-
{ type: "json", cache: false }
|
|
13442
|
-
);
|
|
13443
|
-
const columns = object();
|
|
13444
|
-
for (const entry of result) {
|
|
13445
|
-
columns[entry.column_name] = {
|
|
13446
|
-
table,
|
|
13447
|
-
column: entry.column_name,
|
|
13448
|
-
sqlType: entry.column_type,
|
|
13449
|
-
type: jsType(entry.column_type),
|
|
13450
|
-
nullable: entry.null === "YES"
|
|
13451
|
-
};
|
|
13452
|
-
}
|
|
13453
|
-
return columns;
|
|
13454
|
-
}
|
|
13455
|
-
async function resolveFields(catalog, list) {
|
|
13456
|
-
return list.length === 1 && list[0].column === "*" ? Object.values(await catalog.tableInfo(list[0].table)) : list;
|
|
13457
|
-
}
|
|
13458
|
-
|
|
13459
13346
|
// ../core/src/util/hash.js
|
|
13460
13347
|
function fnv_hash(v2) {
|
|
13461
13348
|
let a2 = 2166136261;
|
|
@@ -13815,7 +13702,7 @@ function consolidate(group3, enqueue, record) {
|
|
|
13815
13702
|
type: "arrow",
|
|
13816
13703
|
cache: false,
|
|
13817
13704
|
record: false,
|
|
13818
|
-
query: consolidatedQuery(group3, record)
|
|
13705
|
+
query: group3.query = consolidatedQuery(group3, record)
|
|
13819
13706
|
},
|
|
13820
13707
|
result: group3.result = queryResult()
|
|
13821
13708
|
});
|
|
@@ -13863,7 +13750,7 @@ function consolidatedQuery(group3, record) {
|
|
|
13863
13750
|
return query.$select(Array.from(fields.values()));
|
|
13864
13751
|
}
|
|
13865
13752
|
async function processResults(group3, cache) {
|
|
13866
|
-
const { maps, result } = group3;
|
|
13753
|
+
const { maps, query, result } = group3;
|
|
13867
13754
|
if (!maps)
|
|
13868
13755
|
return;
|
|
13869
13756
|
let data;
|
|
@@ -13875,25 +13762,33 @@ async function processResults(group3, cache) {
|
|
|
13875
13762
|
}
|
|
13876
13763
|
return;
|
|
13877
13764
|
}
|
|
13765
|
+
const describe = isDescribeQuery(query);
|
|
13878
13766
|
group3.forEach(({ entry }, index2) => {
|
|
13879
13767
|
const { request, result: result2 } = entry;
|
|
13880
|
-
const
|
|
13768
|
+
const map4 = maps[index2];
|
|
13769
|
+
const extract = describe && map4 ? filterResult(data, map4) : map4 ? projectResult(data, map4) : data;
|
|
13881
13770
|
if (request.cache) {
|
|
13882
|
-
cache.set(String(request.query),
|
|
13771
|
+
cache.set(String(request.query), extract);
|
|
13883
13772
|
}
|
|
13884
|
-
result2.fulfill(
|
|
13773
|
+
result2.fulfill(extract);
|
|
13885
13774
|
});
|
|
13886
13775
|
}
|
|
13887
13776
|
function projectResult(data, map4) {
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
13777
|
+
const cols = {};
|
|
13778
|
+
for (const [name, as] of map4) {
|
|
13779
|
+
cols[as] = data.getChild(name);
|
|
13780
|
+
}
|
|
13781
|
+
return new data.constructor(cols);
|
|
13782
|
+
}
|
|
13783
|
+
function filterResult(data, map4) {
|
|
13784
|
+
const lookup = new Map(map4);
|
|
13785
|
+
const result = [];
|
|
13786
|
+
for (const d of data) {
|
|
13787
|
+
if (lookup.has(d.column_name)) {
|
|
13788
|
+
result.push({ ...d, column_name: lookup.get(d.column_name) });
|
|
13892
13789
|
}
|
|
13893
|
-
return new data.constructor(cols);
|
|
13894
|
-
} else {
|
|
13895
|
-
return data;
|
|
13896
13790
|
}
|
|
13791
|
+
return result;
|
|
13897
13792
|
}
|
|
13898
13793
|
|
|
13899
13794
|
// ../core/src/util/cache.js
|
|
@@ -14140,6 +14035,197 @@ function QueryManager() {
|
|
|
14140
14035
|
};
|
|
14141
14036
|
}
|
|
14142
14037
|
|
|
14038
|
+
// ../core/src/util/js-type.js
|
|
14039
|
+
function jsType(type2) {
|
|
14040
|
+
switch (type2) {
|
|
14041
|
+
case "BIGINT":
|
|
14042
|
+
case "HUGEINT":
|
|
14043
|
+
case "INTEGER":
|
|
14044
|
+
case "SMALLINT":
|
|
14045
|
+
case "TINYINT":
|
|
14046
|
+
case "UBIGINT":
|
|
14047
|
+
case "UINTEGER":
|
|
14048
|
+
case "USMALLINT":
|
|
14049
|
+
case "UTINYINT":
|
|
14050
|
+
case "DOUBLE":
|
|
14051
|
+
case "FLOAT":
|
|
14052
|
+
case "REAL":
|
|
14053
|
+
return "number";
|
|
14054
|
+
case "DATE":
|
|
14055
|
+
case "TIMESTAMP":
|
|
14056
|
+
case "TIMESTAMPTZ":
|
|
14057
|
+
case "TIMESTAMP WITH TIME ZONE":
|
|
14058
|
+
case "TIME":
|
|
14059
|
+
case "TIMESTAMP_NS":
|
|
14060
|
+
return "date";
|
|
14061
|
+
case "BOOLEAN":
|
|
14062
|
+
return "boolean";
|
|
14063
|
+
case "VARCHAR":
|
|
14064
|
+
case "UUID":
|
|
14065
|
+
return "string";
|
|
14066
|
+
case "ARRAY":
|
|
14067
|
+
case "LIST":
|
|
14068
|
+
return "array";
|
|
14069
|
+
case "BLOB":
|
|
14070
|
+
case "STRUCT":
|
|
14071
|
+
case "MAP":
|
|
14072
|
+
case "GEOMETRY":
|
|
14073
|
+
return "object";
|
|
14074
|
+
default:
|
|
14075
|
+
if (type2.startsWith("DECIMAL")) {
|
|
14076
|
+
return "number";
|
|
14077
|
+
} else if (type2.startsWith("STRUCT") || type2.startsWith("MAP")) {
|
|
14078
|
+
return "object";
|
|
14079
|
+
} else if (type2.endsWith("]")) {
|
|
14080
|
+
return "array";
|
|
14081
|
+
}
|
|
14082
|
+
throw new Error(`Unsupported type: ${type2}`);
|
|
14083
|
+
}
|
|
14084
|
+
}
|
|
14085
|
+
|
|
14086
|
+
// ../core/src/util/convert-arrow.js
|
|
14087
|
+
var INTEGER = 2;
|
|
14088
|
+
var FLOAT = 3;
|
|
14089
|
+
var DECIMAL = 7;
|
|
14090
|
+
var TIMESTAMP = 10;
|
|
14091
|
+
function isArrowTable(values2) {
|
|
14092
|
+
return typeof values2?.getChild === "function";
|
|
14093
|
+
}
|
|
14094
|
+
function convertArrowArrayType(type2) {
|
|
14095
|
+
switch (type2.typeId) {
|
|
14096
|
+
case INTEGER:
|
|
14097
|
+
case FLOAT:
|
|
14098
|
+
case DECIMAL:
|
|
14099
|
+
return Float64Array;
|
|
14100
|
+
default:
|
|
14101
|
+
return Array;
|
|
14102
|
+
}
|
|
14103
|
+
}
|
|
14104
|
+
function convertArrowValue(type2) {
|
|
14105
|
+
const { typeId } = type2;
|
|
14106
|
+
if (typeId === TIMESTAMP) {
|
|
14107
|
+
return (v2) => v2 == null ? v2 : new Date(v2);
|
|
14108
|
+
}
|
|
14109
|
+
if (typeId === INTEGER && type2.bitWidth >= 64) {
|
|
14110
|
+
return (v2) => v2 == null ? v2 : Number(v2);
|
|
14111
|
+
}
|
|
14112
|
+
if (typeId === DECIMAL) {
|
|
14113
|
+
const scale3 = 1 / Math.pow(10, type2.scale);
|
|
14114
|
+
return (v2) => v2 == null ? v2 : decimalToNumber(v2, scale3);
|
|
14115
|
+
}
|
|
14116
|
+
return (v2) => v2;
|
|
14117
|
+
}
|
|
14118
|
+
function convertArrowColumn(column3) {
|
|
14119
|
+
const { type: type2 } = column3;
|
|
14120
|
+
const { typeId } = type2;
|
|
14121
|
+
if (typeId === TIMESTAMP) {
|
|
14122
|
+
const size = column3.length;
|
|
14123
|
+
const array3 = new Array(size);
|
|
14124
|
+
for (let row = 0; row < size; ++row) {
|
|
14125
|
+
const v2 = column3.get(row);
|
|
14126
|
+
array3[row] = v2 == null ? null : new Date(v2);
|
|
14127
|
+
}
|
|
14128
|
+
return array3;
|
|
14129
|
+
}
|
|
14130
|
+
if (typeId === INTEGER && type2.bitWidth >= 64) {
|
|
14131
|
+
const size = column3.length;
|
|
14132
|
+
const array3 = new Float64Array(size);
|
|
14133
|
+
for (let row = 0; row < size; ++row) {
|
|
14134
|
+
const v2 = column3.get(row);
|
|
14135
|
+
array3[row] = v2 == null ? NaN : Number(v2);
|
|
14136
|
+
}
|
|
14137
|
+
return array3;
|
|
14138
|
+
}
|
|
14139
|
+
if (typeId === DECIMAL) {
|
|
14140
|
+
const scale3 = 1 / Math.pow(10, type2.scale);
|
|
14141
|
+
const size = column3.length;
|
|
14142
|
+
const array3 = new Float64Array(size);
|
|
14143
|
+
for (let row = 0; row < size; ++row) {
|
|
14144
|
+
const v2 = column3.get(row);
|
|
14145
|
+
array3[row] = v2 == null ? NaN : decimalToNumber(v2, scale3);
|
|
14146
|
+
}
|
|
14147
|
+
return array3;
|
|
14148
|
+
}
|
|
14149
|
+
return column3.toArray();
|
|
14150
|
+
}
|
|
14151
|
+
var BASE32 = Array.from(
|
|
14152
|
+
{ length: 8 },
|
|
14153
|
+
(_, i) => Math.pow(2, i * 32)
|
|
14154
|
+
);
|
|
14155
|
+
function decimalToNumber(v2, scale3) {
|
|
14156
|
+
const n = v2.length;
|
|
14157
|
+
let x3 = 0;
|
|
14158
|
+
if (v2.signed && (v2[n - 1] | 0) < 0) {
|
|
14159
|
+
for (let i = 0; i < n; ++i) {
|
|
14160
|
+
x3 += ~(v2[i] | 0) * BASE32[i];
|
|
14161
|
+
}
|
|
14162
|
+
x3 = -(x3 + 1);
|
|
14163
|
+
} else {
|
|
14164
|
+
for (let i = 0; i < n; ++i) {
|
|
14165
|
+
x3 += v2[i] * BASE32[i];
|
|
14166
|
+
}
|
|
14167
|
+
}
|
|
14168
|
+
return x3 * scale3;
|
|
14169
|
+
}
|
|
14170
|
+
|
|
14171
|
+
// ../core/src/util/field-info.js
|
|
14172
|
+
var Count = "count";
|
|
14173
|
+
var Nulls = "nulls";
|
|
14174
|
+
var Max = "max";
|
|
14175
|
+
var Min = "min";
|
|
14176
|
+
var Distinct = "distinct";
|
|
14177
|
+
var statMap = {
|
|
14178
|
+
[Count]: count,
|
|
14179
|
+
[Distinct]: (column3) => count(column3).distinct(),
|
|
14180
|
+
[Max]: max,
|
|
14181
|
+
[Min]: min,
|
|
14182
|
+
[Nulls]: (column3) => count().where(isNull(column3))
|
|
14183
|
+
};
|
|
14184
|
+
function summarize(table, column3, stats) {
|
|
14185
|
+
return Query.from(table).select(Array.from(stats, (s2) => [s2, statMap[s2](column3)]));
|
|
14186
|
+
}
|
|
14187
|
+
async function queryFieldInfo(mc, fields) {
|
|
14188
|
+
if (fields.length === 1 && `${fields[0].column}` === "*") {
|
|
14189
|
+
return getTableInfo(mc, fields[0].table);
|
|
14190
|
+
} else {
|
|
14191
|
+
return (await Promise.all(fields.map((f) => getFieldInfo(mc, f)))).filter((x3) => x3);
|
|
14192
|
+
}
|
|
14193
|
+
}
|
|
14194
|
+
async function getFieldInfo(mc, { table, column: column3, stats }) {
|
|
14195
|
+
const q = Query.from({ source: table }).select({ column: column3 }).groupby(column3.aggregate ? sql`ALL` : []);
|
|
14196
|
+
const [desc2] = Array.from(await mc.query(Query.describe(q)));
|
|
14197
|
+
const info = {
|
|
14198
|
+
table,
|
|
14199
|
+
column: `${column3}`,
|
|
14200
|
+
sqlType: desc2.column_type,
|
|
14201
|
+
type: jsType(desc2.column_type),
|
|
14202
|
+
nullable: desc2.null === "YES"
|
|
14203
|
+
};
|
|
14204
|
+
if (!(stats?.length || stats?.size))
|
|
14205
|
+
return info;
|
|
14206
|
+
const result = await mc.query(
|
|
14207
|
+
summarize(table, column3, stats),
|
|
14208
|
+
{ persist: true }
|
|
14209
|
+
);
|
|
14210
|
+
for (let i = 0; i < result.numCols; ++i) {
|
|
14211
|
+
const { name } = result.schema.fields[i];
|
|
14212
|
+
const child = result.getChildAt(i);
|
|
14213
|
+
const convert = convertArrowValue(child.type);
|
|
14214
|
+
info[name] = convert(child.get(0));
|
|
14215
|
+
}
|
|
14216
|
+
return info;
|
|
14217
|
+
}
|
|
14218
|
+
async function getTableInfo(mc, table) {
|
|
14219
|
+
const result = await mc.query(`DESCRIBE ${asRelation(table)}`);
|
|
14220
|
+
return Array.from(result).map((desc2) => ({
|
|
14221
|
+
table,
|
|
14222
|
+
column: desc2.column_name,
|
|
14223
|
+
sqlType: desc2.column_type,
|
|
14224
|
+
type: jsType(desc2.column_type),
|
|
14225
|
+
nullable: desc2.null === "YES"
|
|
14226
|
+
}));
|
|
14227
|
+
}
|
|
14228
|
+
|
|
14143
14229
|
// ../core/src/util/void-logger.js
|
|
14144
14230
|
function voidLogger() {
|
|
14145
14231
|
return {
|
|
@@ -14172,7 +14258,6 @@ var Coordinator = class {
|
|
|
14172
14258
|
logger = console,
|
|
14173
14259
|
manager = QueryManager()
|
|
14174
14260
|
} = options;
|
|
14175
|
-
this.catalog = new Catalog(this);
|
|
14176
14261
|
this.manager = manager;
|
|
14177
14262
|
this.logger(logger);
|
|
14178
14263
|
this.configure(options);
|
|
@@ -14191,7 +14276,7 @@ var Coordinator = class {
|
|
|
14191
14276
|
this.manager.consolidate(consolidate2);
|
|
14192
14277
|
this.indexes = indexes2;
|
|
14193
14278
|
}
|
|
14194
|
-
clear({ clients = true, cache = true
|
|
14279
|
+
clear({ clients = true, cache = true } = {}) {
|
|
14195
14280
|
this.manager.clear();
|
|
14196
14281
|
if (clients) {
|
|
14197
14282
|
this.clients?.forEach((client) => this.disconnect(client));
|
|
@@ -14201,8 +14286,6 @@ var Coordinator = class {
|
|
|
14201
14286
|
}
|
|
14202
14287
|
if (cache)
|
|
14203
14288
|
this.manager.cache().clear();
|
|
14204
|
-
if (catalog)
|
|
14205
|
-
this.catalog.clear();
|
|
14206
14289
|
}
|
|
14207
14290
|
databaseConnector(db) {
|
|
14208
14291
|
return this.manager.connector(db);
|
|
@@ -14255,7 +14338,7 @@ var Coordinator = class {
|
|
|
14255
14338
|
* @param {import('./MosaicClient.js').MosaicClient} client the client to disconnect
|
|
14256
14339
|
*/
|
|
14257
14340
|
async connect(client) {
|
|
14258
|
-
const {
|
|
14341
|
+
const { clients, filterGroups, indexes: indexes2 } = this;
|
|
14259
14342
|
if (clients.has(client)) {
|
|
14260
14343
|
throw new Error("Client already connected.");
|
|
14261
14344
|
}
|
|
@@ -14263,7 +14346,7 @@ var Coordinator = class {
|
|
|
14263
14346
|
client.coordinator = this;
|
|
14264
14347
|
const fields = client.fields();
|
|
14265
14348
|
if (fields?.length) {
|
|
14266
|
-
client.fieldInfo(await
|
|
14349
|
+
client.fieldInfo(await queryFieldInfo(this, fields));
|
|
14267
14350
|
}
|
|
14268
14351
|
const filter3 = client.filterBy;
|
|
14269
14352
|
if (filter3) {
|
|
@@ -21556,46 +21639,46 @@ function streamGeometry(geometry, stream) {
|
|
|
21556
21639
|
}
|
|
21557
21640
|
}
|
|
21558
21641
|
var streamObjectType = {
|
|
21559
|
-
Feature: function(
|
|
21560
|
-
streamGeometry(
|
|
21642
|
+
Feature: function(object, stream) {
|
|
21643
|
+
streamGeometry(object.geometry, stream);
|
|
21561
21644
|
},
|
|
21562
|
-
FeatureCollection: function(
|
|
21563
|
-
var features =
|
|
21645
|
+
FeatureCollection: function(object, stream) {
|
|
21646
|
+
var features = object.features, i = -1, n = features.length;
|
|
21564
21647
|
while (++i < n)
|
|
21565
21648
|
streamGeometry(features[i].geometry, stream);
|
|
21566
21649
|
}
|
|
21567
21650
|
};
|
|
21568
21651
|
var streamGeometryType = {
|
|
21569
|
-
Sphere: function(
|
|
21652
|
+
Sphere: function(object, stream) {
|
|
21570
21653
|
stream.sphere();
|
|
21571
21654
|
},
|
|
21572
|
-
Point: function(
|
|
21573
|
-
|
|
21574
|
-
stream.point(
|
|
21655
|
+
Point: function(object, stream) {
|
|
21656
|
+
object = object.coordinates;
|
|
21657
|
+
stream.point(object[0], object[1], object[2]);
|
|
21575
21658
|
},
|
|
21576
|
-
MultiPoint: function(
|
|
21577
|
-
var coordinates =
|
|
21659
|
+
MultiPoint: function(object, stream) {
|
|
21660
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
21578
21661
|
while (++i < n)
|
|
21579
|
-
|
|
21662
|
+
object = coordinates[i], stream.point(object[0], object[1], object[2]);
|
|
21580
21663
|
},
|
|
21581
|
-
LineString: function(
|
|
21582
|
-
streamLine(
|
|
21664
|
+
LineString: function(object, stream) {
|
|
21665
|
+
streamLine(object.coordinates, stream, 0);
|
|
21583
21666
|
},
|
|
21584
|
-
MultiLineString: function(
|
|
21585
|
-
var coordinates =
|
|
21667
|
+
MultiLineString: function(object, stream) {
|
|
21668
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
21586
21669
|
while (++i < n)
|
|
21587
21670
|
streamLine(coordinates[i], stream, 0);
|
|
21588
21671
|
},
|
|
21589
|
-
Polygon: function(
|
|
21590
|
-
streamPolygon(
|
|
21672
|
+
Polygon: function(object, stream) {
|
|
21673
|
+
streamPolygon(object.coordinates, stream);
|
|
21591
21674
|
},
|
|
21592
|
-
MultiPolygon: function(
|
|
21593
|
-
var coordinates =
|
|
21675
|
+
MultiPolygon: function(object, stream) {
|
|
21676
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
21594
21677
|
while (++i < n)
|
|
21595
21678
|
streamPolygon(coordinates[i], stream);
|
|
21596
21679
|
},
|
|
21597
|
-
GeometryCollection: function(
|
|
21598
|
-
var geometries =
|
|
21680
|
+
GeometryCollection: function(object, stream) {
|
|
21681
|
+
var geometries = object.geometries, i = -1, n = geometries.length;
|
|
21599
21682
|
while (++i < n)
|
|
21600
21683
|
streamGeometry(geometries[i], stream);
|
|
21601
21684
|
}
|
|
@@ -21614,11 +21697,11 @@ function streamPolygon(coordinates, stream) {
|
|
|
21614
21697
|
streamLine(coordinates[i], stream, 1);
|
|
21615
21698
|
stream.polygonEnd();
|
|
21616
21699
|
}
|
|
21617
|
-
function stream_default(
|
|
21618
|
-
if (
|
|
21619
|
-
streamObjectType[
|
|
21700
|
+
function stream_default(object, stream) {
|
|
21701
|
+
if (object && streamObjectType.hasOwnProperty(object.type)) {
|
|
21702
|
+
streamObjectType[object.type](object, stream);
|
|
21620
21703
|
} else {
|
|
21621
|
-
streamGeometry(
|
|
21704
|
+
streamGeometry(object, stream);
|
|
21622
21705
|
}
|
|
21623
21706
|
}
|
|
21624
21707
|
|
|
@@ -21742,12 +21825,12 @@ function centroidRingPoint(lambda, phi) {
|
|
|
21742
21825
|
Z1 += w * (z0 + (z0 = z));
|
|
21743
21826
|
centroidPointCartesian(x0, y0, z0);
|
|
21744
21827
|
}
|
|
21745
|
-
function centroid_default(
|
|
21828
|
+
function centroid_default(object) {
|
|
21746
21829
|
W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = 0;
|
|
21747
21830
|
X2 = new Adder();
|
|
21748
21831
|
Y2 = new Adder();
|
|
21749
21832
|
Z2 = new Adder();
|
|
21750
|
-
stream_default(
|
|
21833
|
+
stream_default(object, centroidStream);
|
|
21751
21834
|
var x3 = +X2, y3 = +Y2, z = +Z2, m = hypot(x3, y3, z);
|
|
21752
21835
|
if (m < epsilon22) {
|
|
21753
21836
|
x3 = X1, y3 = Y1, z = Z1;
|
|
@@ -22931,28 +23014,28 @@ function appendRound2(digits) {
|
|
|
22931
23014
|
// ../../node_modules/d3-geo/src/path/index.js
|
|
22932
23015
|
function path_default(projection3, context) {
|
|
22933
23016
|
let digits = 3, pointRadius = 4.5, projectionStream, contextStream;
|
|
22934
|
-
function path2(
|
|
22935
|
-
if (
|
|
23017
|
+
function path2(object) {
|
|
23018
|
+
if (object) {
|
|
22936
23019
|
if (typeof pointRadius === "function")
|
|
22937
23020
|
contextStream.pointRadius(+pointRadius.apply(this, arguments));
|
|
22938
|
-
stream_default(
|
|
23021
|
+
stream_default(object, projectionStream(contextStream));
|
|
22939
23022
|
}
|
|
22940
23023
|
return contextStream.result();
|
|
22941
23024
|
}
|
|
22942
|
-
path2.area = function(
|
|
22943
|
-
stream_default(
|
|
23025
|
+
path2.area = function(object) {
|
|
23026
|
+
stream_default(object, projectionStream(area_default2));
|
|
22944
23027
|
return area_default2.result();
|
|
22945
23028
|
};
|
|
22946
|
-
path2.measure = function(
|
|
22947
|
-
stream_default(
|
|
23029
|
+
path2.measure = function(object) {
|
|
23030
|
+
stream_default(object, projectionStream(measure_default));
|
|
22948
23031
|
return measure_default.result();
|
|
22949
23032
|
};
|
|
22950
|
-
path2.bounds = function(
|
|
22951
|
-
stream_default(
|
|
23033
|
+
path2.bounds = function(object) {
|
|
23034
|
+
stream_default(object, projectionStream(bounds_default));
|
|
22952
23035
|
return bounds_default.result();
|
|
22953
23036
|
};
|
|
22954
|
-
path2.centroid = function(
|
|
22955
|
-
stream_default(
|
|
23037
|
+
path2.centroid = function(object) {
|
|
23038
|
+
stream_default(object, projectionStream(centroid_default2));
|
|
22956
23039
|
return centroid_default2.result();
|
|
22957
23040
|
};
|
|
22958
23041
|
path2.projection = function(_) {
|
|
@@ -23033,37 +23116,37 @@ TransformStream.prototype = {
|
|
|
23033
23116
|
};
|
|
23034
23117
|
|
|
23035
23118
|
// ../../node_modules/d3-geo/src/projection/fit.js
|
|
23036
|
-
function fit(projection3, fitBounds,
|
|
23119
|
+
function fit(projection3, fitBounds, object) {
|
|
23037
23120
|
var clip = projection3.clipExtent && projection3.clipExtent();
|
|
23038
23121
|
projection3.scale(150).translate([0, 0]);
|
|
23039
23122
|
if (clip != null)
|
|
23040
23123
|
projection3.clipExtent(null);
|
|
23041
|
-
stream_default(
|
|
23124
|
+
stream_default(object, projection3.stream(bounds_default));
|
|
23042
23125
|
fitBounds(bounds_default.result());
|
|
23043
23126
|
if (clip != null)
|
|
23044
23127
|
projection3.clipExtent(clip);
|
|
23045
23128
|
return projection3;
|
|
23046
23129
|
}
|
|
23047
|
-
function fitExtent(projection3, extent4,
|
|
23130
|
+
function fitExtent(projection3, extent4, object) {
|
|
23048
23131
|
return fit(projection3, function(b) {
|
|
23049
23132
|
var w = extent4[1][0] - extent4[0][0], h = extent4[1][1] - extent4[0][1], k2 = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x3 = +extent4[0][0] + (w - k2 * (b[1][0] + b[0][0])) / 2, y3 = +extent4[0][1] + (h - k2 * (b[1][1] + b[0][1])) / 2;
|
|
23050
23133
|
projection3.scale(150 * k2).translate([x3, y3]);
|
|
23051
|
-
},
|
|
23134
|
+
}, object);
|
|
23052
23135
|
}
|
|
23053
|
-
function fitSize(projection3, size,
|
|
23054
|
-
return fitExtent(projection3, [[0, 0], size],
|
|
23136
|
+
function fitSize(projection3, size, object) {
|
|
23137
|
+
return fitExtent(projection3, [[0, 0], size], object);
|
|
23055
23138
|
}
|
|
23056
|
-
function fitWidth(projection3, width,
|
|
23139
|
+
function fitWidth(projection3, width, object) {
|
|
23057
23140
|
return fit(projection3, function(b) {
|
|
23058
23141
|
var w = +width, k2 = w / (b[1][0] - b[0][0]), x3 = (w - k2 * (b[1][0] + b[0][0])) / 2, y3 = -k2 * b[0][1];
|
|
23059
23142
|
projection3.scale(150 * k2).translate([x3, y3]);
|
|
23060
|
-
},
|
|
23143
|
+
}, object);
|
|
23061
23144
|
}
|
|
23062
|
-
function fitHeight(projection3, height,
|
|
23145
|
+
function fitHeight(projection3, height, object) {
|
|
23063
23146
|
return fit(projection3, function(b) {
|
|
23064
23147
|
var h = +height, k2 = h / (b[1][1] - b[0][1]), x3 = -k2 * b[0][0], y3 = (h - k2 * (b[1][1] + b[0][1])) / 2;
|
|
23065
23148
|
projection3.scale(150 * k2).translate([x3, y3]);
|
|
23066
|
-
},
|
|
23149
|
+
}, object);
|
|
23067
23150
|
}
|
|
23068
23151
|
|
|
23069
23152
|
// ../../node_modules/d3-geo/src/projection/resample.js
|
|
@@ -23235,17 +23318,17 @@ function projectionMutator(projectAt) {
|
|
|
23235
23318
|
projection3.precision = function(_) {
|
|
23236
23319
|
return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
|
|
23237
23320
|
};
|
|
23238
|
-
projection3.fitExtent = function(extent4,
|
|
23239
|
-
return fitExtent(projection3, extent4,
|
|
23321
|
+
projection3.fitExtent = function(extent4, object) {
|
|
23322
|
+
return fitExtent(projection3, extent4, object);
|
|
23240
23323
|
};
|
|
23241
|
-
projection3.fitSize = function(size,
|
|
23242
|
-
return fitSize(projection3, size,
|
|
23324
|
+
projection3.fitSize = function(size, object) {
|
|
23325
|
+
return fitSize(projection3, size, object);
|
|
23243
23326
|
};
|
|
23244
|
-
projection3.fitWidth = function(width,
|
|
23245
|
-
return fitWidth(projection3, width,
|
|
23327
|
+
projection3.fitWidth = function(width, object) {
|
|
23328
|
+
return fitWidth(projection3, width, object);
|
|
23246
23329
|
};
|
|
23247
|
-
projection3.fitHeight = function(height,
|
|
23248
|
-
return fitHeight(projection3, height,
|
|
23330
|
+
projection3.fitHeight = function(height, object) {
|
|
23331
|
+
return fitHeight(projection3, height, object);
|
|
23249
23332
|
};
|
|
23250
23333
|
function recenter() {
|
|
23251
23334
|
var center2 = scaleTranslateRotate(k2, 0, 0, sx, sy, alpha).apply(null, project2(lambda, phi)), transform3 = scaleTranslateRotate(k2, x3 - center2[0], y3 - center2[1], sx, sy, alpha);
|
|
@@ -23386,17 +23469,17 @@ function albersUsa_default() {
|
|
|
23386
23469
|
hawaiiPoint = hawaii.translate([x3 - 0.205 * k2, y3 + 0.212 * k2]).clipExtent([[x3 - 0.214 * k2 + epsilon6, y3 + 0.166 * k2 + epsilon6], [x3 - 0.115 * k2 - epsilon6, y3 + 0.234 * k2 - epsilon6]]).stream(pointStream);
|
|
23387
23470
|
return reset();
|
|
23388
23471
|
};
|
|
23389
|
-
albersUsa.fitExtent = function(extent4,
|
|
23390
|
-
return fitExtent(albersUsa, extent4,
|
|
23472
|
+
albersUsa.fitExtent = function(extent4, object) {
|
|
23473
|
+
return fitExtent(albersUsa, extent4, object);
|
|
23391
23474
|
};
|
|
23392
|
-
albersUsa.fitSize = function(size,
|
|
23393
|
-
return fitSize(albersUsa, size,
|
|
23475
|
+
albersUsa.fitSize = function(size, object) {
|
|
23476
|
+
return fitSize(albersUsa, size, object);
|
|
23394
23477
|
};
|
|
23395
|
-
albersUsa.fitWidth = function(width,
|
|
23396
|
-
return fitWidth(albersUsa, width,
|
|
23478
|
+
albersUsa.fitWidth = function(width, object) {
|
|
23479
|
+
return fitWidth(albersUsa, width, object);
|
|
23397
23480
|
};
|
|
23398
|
-
albersUsa.fitHeight = function(height,
|
|
23399
|
-
return fitHeight(albersUsa, height,
|
|
23481
|
+
albersUsa.fitHeight = function(height, object) {
|
|
23482
|
+
return fitHeight(albersUsa, height, object);
|
|
23400
23483
|
};
|
|
23401
23484
|
function reset() {
|
|
23402
23485
|
cache = cacheStream = null;
|
|
@@ -29989,21 +30072,30 @@ function createProjection({
|
|
|
29989
30072
|
if (k2 > 0) {
|
|
29990
30073
|
tx -= (k2 * (x06 + x12) - dx) / 2;
|
|
29991
30074
|
ty -= (k2 * (y06 + y12) - dy) / 2;
|
|
29992
|
-
transform3 =
|
|
29993
|
-
|
|
29994
|
-
|
|
29995
|
-
|
|
29996
|
-
|
|
30075
|
+
transform3 = Object.assign(
|
|
30076
|
+
transform_default({
|
|
30077
|
+
point(x3, y3) {
|
|
30078
|
+
this.stream.point(x3 * k2 + tx, y3 * k2 + ty);
|
|
30079
|
+
}
|
|
30080
|
+
}),
|
|
30081
|
+
{ invert: ([x3, y3]) => [(x3 - tx) / k2, (y3 - ty) / k2] }
|
|
30082
|
+
);
|
|
29997
30083
|
} else {
|
|
29998
30084
|
warn(`Warning: the projection could not be fit to the specified domain; using the default scale.`);
|
|
29999
30085
|
}
|
|
30000
30086
|
}
|
|
30001
|
-
transform3 ??= tx === 0 && ty === 0 ? identity8() :
|
|
30002
|
-
|
|
30003
|
-
|
|
30004
|
-
|
|
30005
|
-
|
|
30006
|
-
|
|
30087
|
+
transform3 ??= tx === 0 && ty === 0 ? identity8() : Object.assign(
|
|
30088
|
+
transform_default({
|
|
30089
|
+
point(x3, y3) {
|
|
30090
|
+
this.stream.point(x3 + tx, y3 + ty);
|
|
30091
|
+
}
|
|
30092
|
+
}),
|
|
30093
|
+
{ invert: ([x3, y3]) => [x3 - tx, y3 - ty] }
|
|
30094
|
+
);
|
|
30095
|
+
return {
|
|
30096
|
+
stream: (s2) => projection3.stream(transform3.stream(clip(s2))),
|
|
30097
|
+
invert: (p) => projection3.invert(transform3.invert(p))
|
|
30098
|
+
};
|
|
30007
30099
|
}
|
|
30008
30100
|
function namedProjection(projection3) {
|
|
30009
30101
|
switch (`${projection3}`.toLowerCase()) {
|
|
@@ -30089,13 +30181,19 @@ function conicProjection2(createProjection2, kx2, ky2) {
|
|
|
30089
30181
|
aspectRatio
|
|
30090
30182
|
};
|
|
30091
30183
|
}
|
|
30092
|
-
var identity8 = constant({
|
|
30184
|
+
var identity8 = constant({
|
|
30185
|
+
stream: (stream) => stream,
|
|
30186
|
+
invert: (p) => p
|
|
30187
|
+
});
|
|
30093
30188
|
var reflectY = constant(
|
|
30094
|
-
|
|
30095
|
-
|
|
30096
|
-
|
|
30097
|
-
|
|
30098
|
-
|
|
30189
|
+
Object.assign(
|
|
30190
|
+
transform_default({
|
|
30191
|
+
point(x3, y3) {
|
|
30192
|
+
this.stream.point(x3, -y3);
|
|
30193
|
+
}
|
|
30194
|
+
}),
|
|
30195
|
+
{ invert: ([x3, y3]) => [x3, -y3] }
|
|
30196
|
+
)
|
|
30099
30197
|
);
|
|
30100
30198
|
function project(cx, cy, values2, projection3) {
|
|
30101
30199
|
const x3 = values2[cx];
|
|
@@ -30174,8 +30272,8 @@ function getGeometryChannels(channel) {
|
|
|
30174
30272
|
sphere() {
|
|
30175
30273
|
}
|
|
30176
30274
|
};
|
|
30177
|
-
for (const
|
|
30178
|
-
stream_default(
|
|
30275
|
+
for (const object of channel.value)
|
|
30276
|
+
stream_default(object, sink);
|
|
30179
30277
|
return [x3, y3];
|
|
30180
30278
|
}
|
|
30181
30279
|
|
|
@@ -34258,6 +34356,7 @@ function plot(options = {}) {
|
|
|
34258
34356
|
}
|
|
34259
34357
|
figure.scale = exposeScales(scales2.scales);
|
|
34260
34358
|
figure.legend = exposeLegends(scaleDescriptors, context, options);
|
|
34359
|
+
figure.projection = context.projection;
|
|
34261
34360
|
const w = consumeWarnings();
|
|
34262
34361
|
if (w > 0) {
|
|
34263
34362
|
select_default2(svg).append("text").attr("x", width).attr("y", 20).attr("dy", "-1em").attr("text-anchor", "end").attr("font-family", "initial").text("\u26A0\uFE0F").append("title").text(`${w.toLocaleString("en-US")} warning${w === 1 ? "" : "s"}. Please check the console.`);
|
|
@@ -39643,13 +39742,13 @@ var attributeMap = /* @__PURE__ */ new Map([
|
|
|
39643
39742
|
["projectionInsetBottom", "projection.insetBottom"],
|
|
39644
39743
|
["projectionClip", "projection.clip"]
|
|
39645
39744
|
]);
|
|
39646
|
-
function setProperty(
|
|
39745
|
+
function setProperty(object, path2, value) {
|
|
39647
39746
|
for (let i = 0; i < path2.length; ++i) {
|
|
39648
39747
|
const key = path2[i];
|
|
39649
39748
|
if (i === path2.length - 1) {
|
|
39650
|
-
|
|
39749
|
+
object[key] = value;
|
|
39651
39750
|
} else {
|
|
39652
|
-
|
|
39751
|
+
object = object[key] || (object[key] = {});
|
|
39653
39752
|
}
|
|
39654
39753
|
}
|
|
39655
39754
|
}
|
|
@@ -39719,16 +39818,16 @@ function setSymbolAttributes(plot2, svg, attributes, symbols3) {
|
|
|
39719
39818
|
}
|
|
39720
39819
|
function inferLabels(spec, plot2) {
|
|
39721
39820
|
const { marks: marks2 } = plot2;
|
|
39722
|
-
inferLabel("x", spec, marks2
|
|
39723
|
-
inferLabel("y", spec, marks2
|
|
39821
|
+
inferLabel("x", spec, marks2);
|
|
39822
|
+
inferLabel("y", spec, marks2);
|
|
39724
39823
|
inferLabel("fx", spec, marks2);
|
|
39725
39824
|
inferLabel("fy", spec, marks2);
|
|
39726
39825
|
}
|
|
39727
|
-
function inferLabel(key, spec, marks2
|
|
39826
|
+
function inferLabel(key, spec, marks2) {
|
|
39728
39827
|
const scale3 = spec[key] || {};
|
|
39729
39828
|
if (scale3.axis === null || scale3.label !== void 0)
|
|
39730
39829
|
return;
|
|
39731
|
-
const fields = marks2.map((mark) => mark.channelField(
|
|
39830
|
+
const fields = marks2.map((mark) => mark.channelField(key)?.field);
|
|
39732
39831
|
if (fields.every((x3) => x3 == null))
|
|
39733
39832
|
return;
|
|
39734
39833
|
let candCol;
|
|
@@ -39741,7 +39840,7 @@ function inferLabel(key, spec, marks2, channels = [key]) {
|
|
|
39741
39840
|
} else if (candCol === void 0 && candLabel === void 0) {
|
|
39742
39841
|
candCol = column3;
|
|
39743
39842
|
candLabel = label;
|
|
39744
|
-
type2 = getType(marks2[i].data,
|
|
39843
|
+
type2 = getType(marks2[i].data, key) || "number";
|
|
39745
39844
|
} else if (candLabel !== label) {
|
|
39746
39845
|
candLabel = void 0;
|
|
39747
39846
|
} else if (candCol !== column3) {
|
|
@@ -39783,13 +39882,11 @@ function annotateMarks(svg, indices) {
|
|
|
39783
39882
|
}
|
|
39784
39883
|
}
|
|
39785
39884
|
}
|
|
39786
|
-
function getType(data,
|
|
39885
|
+
function getType(data, channel) {
|
|
39787
39886
|
for (const row of data) {
|
|
39788
|
-
|
|
39789
|
-
|
|
39790
|
-
|
|
39791
|
-
return v2 instanceof Date ? "date" : typeof v2;
|
|
39792
|
-
}
|
|
39887
|
+
const v2 = row[channel] ?? row[channel + "1"] ?? row[channel + "2"];
|
|
39888
|
+
if (v2 != null) {
|
|
39889
|
+
return v2 instanceof Date ? "date" : typeof v2;
|
|
39793
39890
|
}
|
|
39794
39891
|
}
|
|
39795
39892
|
}
|
|
@@ -39992,49 +40089,6 @@ function isSymbol2(value) {
|
|
|
39992
40089
|
return symbols2.has(`${value}`.toLowerCase());
|
|
39993
40090
|
}
|
|
39994
40091
|
|
|
39995
|
-
// src/marks/util/arrow.js
|
|
39996
|
-
var INTEGER = 2;
|
|
39997
|
-
var FLOAT = 3;
|
|
39998
|
-
var DECIMAL = 7;
|
|
39999
|
-
var TIMESTAMP = 10;
|
|
40000
|
-
function isArrowTable(values2) {
|
|
40001
|
-
return typeof values2?.getChild === "function";
|
|
40002
|
-
}
|
|
40003
|
-
function convertArrowType(type2) {
|
|
40004
|
-
switch (type2.typeId) {
|
|
40005
|
-
case INTEGER:
|
|
40006
|
-
case FLOAT:
|
|
40007
|
-
case DECIMAL:
|
|
40008
|
-
return Float64Array;
|
|
40009
|
-
default:
|
|
40010
|
-
return Array;
|
|
40011
|
-
}
|
|
40012
|
-
}
|
|
40013
|
-
function convertArrow(type2) {
|
|
40014
|
-
const { typeId } = type2;
|
|
40015
|
-
if (typeId === TIMESTAMP) {
|
|
40016
|
-
return (v2) => v2 == null ? v2 : new Date(v2);
|
|
40017
|
-
}
|
|
40018
|
-
if (typeId === INTEGER && type2.bitWidth >= 64) {
|
|
40019
|
-
return (v2) => v2 == null ? v2 : Number(v2);
|
|
40020
|
-
}
|
|
40021
|
-
return (v2) => v2;
|
|
40022
|
-
}
|
|
40023
|
-
function convertArrowColumn(column3) {
|
|
40024
|
-
const { type: type2 } = column3;
|
|
40025
|
-
const { typeId } = type2;
|
|
40026
|
-
if (typeId === INTEGER && type2.bitWidth >= 64) {
|
|
40027
|
-
const size = column3.length;
|
|
40028
|
-
const array3 = new Float64Array(size);
|
|
40029
|
-
for (let row = 0; row < size; ++row) {
|
|
40030
|
-
const v2 = column3.get(row);
|
|
40031
|
-
array3[row] = v2 == null ? NaN : Number(v2);
|
|
40032
|
-
}
|
|
40033
|
-
return array3;
|
|
40034
|
-
}
|
|
40035
|
-
return column3.toArray();
|
|
40036
|
-
}
|
|
40037
|
-
|
|
40038
40092
|
// src/marks/util/to-data-array.js
|
|
40039
40093
|
function toDataArray(data) {
|
|
40040
40094
|
return isArrowTable(data) ? arrowToObjects(data) : data;
|
|
@@ -40050,7 +40104,7 @@ function arrowToObjects(data) {
|
|
|
40050
40104
|
for (let j = 0; j < numCols; ++j) {
|
|
40051
40105
|
const child = batch.getChildAt(j);
|
|
40052
40106
|
const { name, type: type2 } = schema.fields[j];
|
|
40053
|
-
const valueOf =
|
|
40107
|
+
const valueOf = convertArrowValue(type2);
|
|
40054
40108
|
for (let o = k2, i = 0; i < numRows; ++i, ++o) {
|
|
40055
40109
|
objects[o][name] = valueOf(child.get(i));
|
|
40056
40110
|
}
|
|
@@ -40135,17 +40189,15 @@ var Mark2 = class extends MosaicClient {
|
|
|
40135
40189
|
hasOwnData() {
|
|
40136
40190
|
return this.source == null || isDataArray(this.source);
|
|
40137
40191
|
}
|
|
40192
|
+
hasFieldInfo() {
|
|
40193
|
+
return !!this._fieldInfo;
|
|
40194
|
+
}
|
|
40138
40195
|
channel(channel) {
|
|
40139
40196
|
return this.channels.find((c4) => c4.channel === channel);
|
|
40140
40197
|
}
|
|
40141
|
-
channelField(
|
|
40142
|
-
const
|
|
40143
|
-
|
|
40144
|
-
const c4 = this.channel(channel);
|
|
40145
|
-
if (c4?.field)
|
|
40146
|
-
return c4;
|
|
40147
|
-
}
|
|
40148
|
-
return null;
|
|
40198
|
+
channelField(channel, { exact } = {}) {
|
|
40199
|
+
const c4 = exact ? this.channel(channel) : this.channels.find((c5) => c5.channel.startsWith(channel));
|
|
40200
|
+
return c4?.field ? c4 : null;
|
|
40149
40201
|
}
|
|
40150
40202
|
fields() {
|
|
40151
40203
|
if (this.hasOwnData())
|
|
@@ -40153,26 +40205,25 @@ var Mark2 = class extends MosaicClient {
|
|
|
40153
40205
|
const { source: { table }, channels, reqs } = this;
|
|
40154
40206
|
const fields = /* @__PURE__ */ new Map();
|
|
40155
40207
|
for (const { channel, field: field2 } of channels) {
|
|
40156
|
-
|
|
40157
|
-
if (!column3) {
|
|
40208
|
+
if (!field2)
|
|
40158
40209
|
continue;
|
|
40159
|
-
|
|
40160
|
-
|
|
40161
|
-
|
|
40162
|
-
|
|
40163
|
-
|
|
40164
|
-
field2.stats?.forEach((s2) => entry.add(s2));
|
|
40165
|
-
}
|
|
40210
|
+
const stats = field2.stats?.stats || [];
|
|
40211
|
+
const key = field2.stats?.column ?? field2;
|
|
40212
|
+
const entry = fields.get(key) ?? fields.set(key, /* @__PURE__ */ new Set()).get(key);
|
|
40213
|
+
stats.forEach((s2) => entry.add(s2));
|
|
40214
|
+
reqs[channel]?.forEach((s2) => entry.add(s2));
|
|
40166
40215
|
}
|
|
40167
|
-
return Array.from(fields, ([
|
|
40168
|
-
return { table, column: column3, stats: Array.from(stats) };
|
|
40169
|
-
});
|
|
40216
|
+
return Array.from(fields, ([c4, s2]) => ({ table, column: c4, stats: s2 }));
|
|
40170
40217
|
}
|
|
40171
40218
|
fieldInfo(info) {
|
|
40172
|
-
|
|
40173
|
-
|
|
40174
|
-
|
|
40175
|
-
|
|
40219
|
+
const lookup = Object.fromEntries(info.map((x3) => [x3.column, x3]));
|
|
40220
|
+
for (const entry of this.channels) {
|
|
40221
|
+
const { field: field2 } = entry;
|
|
40222
|
+
if (field2) {
|
|
40223
|
+
Object.assign(entry, lookup[field2.stats?.column ?? field2]);
|
|
40224
|
+
}
|
|
40225
|
+
}
|
|
40226
|
+
this._fieldInfo = true;
|
|
40176
40227
|
return this;
|
|
40177
40228
|
}
|
|
40178
40229
|
query(filter3 = []) {
|
|
@@ -40240,8 +40291,7 @@ function channelScale(mark, channel) {
|
|
|
40240
40291
|
const { plot: plot2 } = mark;
|
|
40241
40292
|
let scaleType = plot2.getAttribute(`${channel}Scale`);
|
|
40242
40293
|
if (!scaleType) {
|
|
40243
|
-
const {
|
|
40244
|
-
const { type: type2 } = mark.stats[field2.column];
|
|
40294
|
+
const { type: type2 } = mark.channelField(channel);
|
|
40245
40295
|
scaleType = type2 === "date" ? "time" : "linear";
|
|
40246
40296
|
}
|
|
40247
40297
|
const options = { type: scaleType };
|
|
@@ -40279,15 +40329,13 @@ var xext = { x: ["min", "max"] };
|
|
|
40279
40329
|
var yext = { y: ["min", "max"] };
|
|
40280
40330
|
var xyext = { ...xext, ...yext };
|
|
40281
40331
|
function plotExtent(mark, filter3, channel, domainAttr, niceAttr) {
|
|
40282
|
-
const { plot: plot2
|
|
40332
|
+
const { plot: plot2 } = mark;
|
|
40283
40333
|
const domain = plot2.getAttribute(domainAttr);
|
|
40284
40334
|
const nice3 = plot2.getAttribute(niceAttr);
|
|
40285
40335
|
if (Array.isArray(domain) && !domain[Transient]) {
|
|
40286
40336
|
return domain;
|
|
40287
40337
|
} else {
|
|
40288
|
-
const {
|
|
40289
|
-
const { column: column3 } = field2;
|
|
40290
|
-
const { min: min5, max: max4 } = stats[column3];
|
|
40338
|
+
const { column: column3, min: min5, max: max4 } = mark.channelField(channel);
|
|
40291
40339
|
const dom = filteredExtent(filter3, column3) || (nice3 ? linear2().domain([min5, max4]).nice().domain() : [min5, max4]);
|
|
40292
40340
|
if (domain !== Fixed)
|
|
40293
40341
|
dom[Transient] = true;
|
|
@@ -40307,7 +40355,7 @@ function filteredExtent(filter3, column3) {
|
|
|
40307
40355
|
let lo;
|
|
40308
40356
|
let hi;
|
|
40309
40357
|
const visitor = (type2, clause) => {
|
|
40310
|
-
if (type2 === "BETWEEN" && clause.field
|
|
40358
|
+
if (type2 === "BETWEEN" && `${clause.field}` === column3) {
|
|
40311
40359
|
const { range: range3 } = clause;
|
|
40312
40360
|
if (range3 && (lo == null || range3[0] < lo))
|
|
40313
40361
|
lo = range3[0];
|
|
@@ -40327,26 +40375,23 @@ function filteredExtent(filter3, column3) {
|
|
|
40327
40375
|
var ConnectedMark = class extends Mark2 {
|
|
40328
40376
|
constructor(type2, source, encodings) {
|
|
40329
40377
|
const dim = type2.endsWith("X") ? "y" : type2.endsWith("Y") ? "x" : null;
|
|
40330
|
-
const req = { [dim]: ["min", "max"] };
|
|
40378
|
+
const req = dim ? { [dim]: ["min", "max"] } : void 0;
|
|
40331
40379
|
super(type2, source, encodings, req);
|
|
40332
40380
|
this.dim = dim;
|
|
40333
40381
|
}
|
|
40334
40382
|
query(filter3 = []) {
|
|
40335
|
-
const { plot: plot2, dim, source
|
|
40383
|
+
const { plot: plot2, dim, source } = this;
|
|
40336
40384
|
const { optimize = true } = source.options || {};
|
|
40337
40385
|
const q = super.query(filter3);
|
|
40338
40386
|
if (!dim)
|
|
40339
40387
|
return q;
|
|
40340
40388
|
const ortho = dim === "x" ? "y" : "x";
|
|
40341
|
-
const value = this.channelField(ortho)?.as;
|
|
40342
|
-
const { field: field2, as } = this.channelField(dim);
|
|
40343
|
-
const { type: type2 } = stats[field2.column];
|
|
40389
|
+
const value = this.channelField(ortho, { exact: true })?.as;
|
|
40390
|
+
const { field: field2, as, type: type2, min: min5, max: max4 } = this.channelField(dim);
|
|
40344
40391
|
const isContinuous = type2 === "date" || type2 === "number";
|
|
40345
40392
|
if (optimize && isContinuous && value) {
|
|
40346
|
-
const { column: column3 } = field2;
|
|
40347
|
-
const { max: max4, min: min5 } = stats[column3];
|
|
40348
40393
|
const size = dim === "x" ? plot2.innerWidth() : plot2.innerHeight();
|
|
40349
|
-
const [lo, hi] = filteredExtent(filter3,
|
|
40394
|
+
const [lo, hi] = filteredExtent(filter3, field2) || [min5, max4];
|
|
40350
40395
|
const [expr] = binExpr(this, dim, size, [lo, hi], 1, as);
|
|
40351
40396
|
const cols = q.select().map((c4) => c4.as).filter((c4) => c4 !== as && c4 !== value);
|
|
40352
40397
|
return m4(q, expr, as, value, cols);
|
|
@@ -40368,17 +40413,10 @@ function m4(input, bin3, x3, y3, cols = []) {
|
|
|
40368
40413
|
|
|
40369
40414
|
// src/marks/util/grid.js
|
|
40370
40415
|
function arrayType(values2, name = "density") {
|
|
40371
|
-
|
|
40372
|
-
return convertArrowType(values2.getChild(name).type);
|
|
40373
|
-
} else {
|
|
40374
|
-
return typeof values2[0][name] === "number" ? Float64Array : Array;
|
|
40375
|
-
}
|
|
40376
|
-
}
|
|
40377
|
-
function grid1d(n, values2) {
|
|
40378
|
-
const Type3 = arrayType(values2);
|
|
40379
|
-
return valuesToGrid(new Type3(n), values2);
|
|
40416
|
+
return isArrowTable(values2) ? convertArrowArrayType(values2.getChild(name).type) : typeof values2[0]?.[name] === "number" ? Float64Array : Array;
|
|
40380
40417
|
}
|
|
40381
|
-
function
|
|
40418
|
+
function grid1d(n, values2, name = "density") {
|
|
40419
|
+
const grid = new (arrayType(values2))(n);
|
|
40382
40420
|
if (isArrowTable(values2)) {
|
|
40383
40421
|
const numRows = values2.numRows;
|
|
40384
40422
|
if (numRows === 0)
|
|
@@ -40877,7 +40915,7 @@ var Grid2DMark = class extends Mark2 {
|
|
|
40877
40915
|
}
|
|
40878
40916
|
setPlot(plot2, index2) {
|
|
40879
40917
|
const update2 = () => {
|
|
40880
|
-
if (this.
|
|
40918
|
+
if (this.hasFieldInfo())
|
|
40881
40919
|
this.requestUpdate();
|
|
40882
40920
|
};
|
|
40883
40921
|
plot2.addAttributeListener("domainX", update2);
|
|
@@ -41222,7 +41260,7 @@ var RasterMark = class extends Grid2DMark {
|
|
|
41222
41260
|
}
|
|
41223
41261
|
setPlot(plot2, index2) {
|
|
41224
41262
|
const update2 = () => {
|
|
41225
|
-
if (this.
|
|
41263
|
+
if (this.hasFieldInfo())
|
|
41226
41264
|
this.rasterize();
|
|
41227
41265
|
};
|
|
41228
41266
|
plot2.addAttributeListener("schemeColor", update2);
|
|
@@ -41423,9 +41461,12 @@ var DenseLineMark = class extends RasterMark {
|
|
|
41423
41461
|
function stripXY(mark, filter3) {
|
|
41424
41462
|
if (Array.isArray(filter3) && !filter3.length)
|
|
41425
41463
|
return filter3;
|
|
41426
|
-
const xc = mark.channelField("x")
|
|
41427
|
-
const yc = mark.channelField("y")
|
|
41428
|
-
const test = (p) =>
|
|
41464
|
+
const { column: xc } = mark.channelField("x");
|
|
41465
|
+
const { column: yc } = mark.channelField("y");
|
|
41466
|
+
const test = (p) => {
|
|
41467
|
+
const col = `${p.field}`;
|
|
41468
|
+
return p.op !== "BETWEEN" || col !== xc && col !== yc;
|
|
41469
|
+
};
|
|
41429
41470
|
const filterAnd = (p) => p.op === "AND" ? and(p.children.filter((c4) => test(c4))) : p;
|
|
41430
41471
|
return Array.isArray(filter3) ? filter3.filter((p) => test(p)).map((p) => filterAnd(p)) : filterAnd(filter3);
|
|
41431
41472
|
}
|
|
@@ -41714,7 +41755,7 @@ var RasterTileMark = class extends Grid2DMark {
|
|
|
41714
41755
|
}
|
|
41715
41756
|
setPlot(plot2, index2) {
|
|
41716
41757
|
const update2 = () => {
|
|
41717
|
-
if (this.
|
|
41758
|
+
if (this.hasFieldInfo())
|
|
41718
41759
|
this.rasterize();
|
|
41719
41760
|
};
|
|
41720
41761
|
plot2.addAttributeListener("schemeColor", update2);
|
|
@@ -42263,8 +42304,8 @@ function closeTo(a2, b) {
|
|
|
42263
42304
|
}
|
|
42264
42305
|
|
|
42265
42306
|
// src/interactors/util/get-field.js
|
|
42266
|
-
function getField(mark,
|
|
42267
|
-
const field2 = mark.channelField(
|
|
42307
|
+
function getField(mark, channel) {
|
|
42308
|
+
const field2 = mark.channelField(channel)?.field;
|
|
42268
42309
|
return field2?.basis || field2;
|
|
42269
42310
|
}
|
|
42270
42311
|
|
|
@@ -42298,7 +42339,7 @@ var Interval1D = class {
|
|
|
42298
42339
|
this.pixelSize = pixelSize || 1;
|
|
42299
42340
|
this.selection = selection2;
|
|
42300
42341
|
this.peers = peers;
|
|
42301
|
-
this.field = field2 || getField(mark,
|
|
42342
|
+
this.field = field2 || getField(mark, channel);
|
|
42302
42343
|
this.style = style && sanitizeStyles(style);
|
|
42303
42344
|
this.brush = channel === "y" ? brushY2() : brushX2();
|
|
42304
42345
|
this.brush.on("brush end", ({ selection: selection3 }) => this.publish(selection3));
|
|
@@ -42366,8 +42407,8 @@ var Interval2D = class {
|
|
|
42366
42407
|
this.pixelSize = pixelSize || 1;
|
|
42367
42408
|
this.selection = selection2;
|
|
42368
42409
|
this.peers = peers;
|
|
42369
|
-
this.xfield = xfield || getField(mark,
|
|
42370
|
-
this.yfield = yfield || getField(mark,
|
|
42410
|
+
this.xfield = xfield || getField(mark, "x");
|
|
42411
|
+
this.yfield = yfield || getField(mark, "y");
|
|
42371
42412
|
this.style = style && sanitizeStyles(style);
|
|
42372
42413
|
this.brush = brush2();
|
|
42373
42414
|
this.brush.on("brush end", ({ selection: selection3 }) => this.publish(selection3));
|
|
@@ -42503,8 +42544,8 @@ var PanZoom = class {
|
|
|
42503
42544
|
this.mark = mark;
|
|
42504
42545
|
this.xsel = x3;
|
|
42505
42546
|
this.ysel = y3;
|
|
42506
|
-
this.xfield = xfield || getField(mark,
|
|
42507
|
-
this.yfield = yfield || getField(mark,
|
|
42547
|
+
this.xfield = xfield || getField(mark, "x");
|
|
42548
|
+
this.yfield = yfield || getField(mark, "y");
|
|
42508
42549
|
this.zoom = extent3(zoom, [0, Infinity], [1, 1]);
|
|
42509
42550
|
this.panx = this.xsel && panx;
|
|
42510
42551
|
this.pany = this.ysel && pany;
|
|
@@ -42733,8 +42774,10 @@ function findMark({ marks: marks2 }, channel) {
|
|
|
42733
42774
|
if (channels == null)
|
|
42734
42775
|
return null;
|
|
42735
42776
|
for (let i = marks2.length - 1; i > -1; --i) {
|
|
42736
|
-
|
|
42737
|
-
|
|
42777
|
+
for (const channel2 of channels) {
|
|
42778
|
+
if (marks2[i].channelField(channel2, { exact: true })) {
|
|
42779
|
+
return marks2[i];
|
|
42780
|
+
}
|
|
42738
42781
|
}
|
|
42739
42782
|
}
|
|
42740
42783
|
return null;
|
|
@@ -42763,7 +42806,7 @@ function binField(mark, channel, column3, options) {
|
|
|
42763
42806
|
column: column3,
|
|
42764
42807
|
label: column3,
|
|
42765
42808
|
get stats() {
|
|
42766
|
-
return ["min", "max"];
|
|
42809
|
+
return { column: column3, stats: ["min", "max"] };
|
|
42767
42810
|
},
|
|
42768
42811
|
get columns() {
|
|
42769
42812
|
return [column3];
|
|
@@ -42773,7 +42816,7 @@ function binField(mark, channel, column3, options) {
|
|
|
42773
42816
|
},
|
|
42774
42817
|
toString() {
|
|
42775
42818
|
const { apply: apply2, sqlApply, sqlInvert } = channelScale(mark, channel);
|
|
42776
|
-
const { min: min5, max: max4 } = mark.
|
|
42819
|
+
const { min: min5, max: max4 } = mark.channelField(channel);
|
|
42777
42820
|
const b = bins(apply2(min5), apply2(max4), options);
|
|
42778
42821
|
const col = sqlApply(column3);
|
|
42779
42822
|
const base = b.min === 0 ? col : `(${col} - ${b.min})`;
|