@ggterm/core 0.2.7 → 0.2.9

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/dist/cli-plot.js CHANGED
@@ -652,7 +652,7 @@ function isCategoricalField(data, field) {
652
652
  for (const row of data) {
653
653
  const value = row[field];
654
654
  if (value !== null && value !== undefined) {
655
- if (typeof value === "string" && isNaN(Number(value))) {
655
+ if (typeof value === "string") {
656
656
  return true;
657
657
  }
658
658
  }
@@ -1049,6 +1049,44 @@ function getPointColor(row, aes, colorScale) {
1049
1049
  }
1050
1050
  return DEFAULT_POINT_COLOR;
1051
1051
  }
1052
+ function parseColorToRgba(color, fallback = { r: 128, g: 128, b: 128, a: 1 }) {
1053
+ if (!color)
1054
+ return fallback;
1055
+ if (typeof color === "object" && color !== null && "r" in color) {
1056
+ return color;
1057
+ }
1058
+ if (typeof color === "string") {
1059
+ if (color.startsWith("#")) {
1060
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
1061
+ if (result) {
1062
+ return {
1063
+ r: parseInt(result[1], 16),
1064
+ g: parseInt(result[2], 16),
1065
+ b: parseInt(result[3], 16),
1066
+ a: 1
1067
+ };
1068
+ }
1069
+ }
1070
+ const namedColors = {
1071
+ red: { r: 255, g: 0, b: 0, a: 1 },
1072
+ blue: { r: 0, g: 0, b: 255, a: 1 },
1073
+ green: { r: 0, g: 128, b: 0, a: 1 },
1074
+ black: { r: 0, g: 0, b: 0, a: 1 },
1075
+ white: { r: 255, g: 255, b: 255, a: 1 },
1076
+ gray: { r: 128, g: 128, b: 128, a: 1 },
1077
+ grey: { r: 128, g: 128, b: 128, a: 1 },
1078
+ yellow: { r: 255, g: 255, b: 0, a: 1 },
1079
+ orange: { r: 255, g: 165, b: 0, a: 1 },
1080
+ purple: { r: 128, g: 0, b: 128, a: 1 },
1081
+ cyan: { r: 0, g: 255, b: 255, a: 1 },
1082
+ magenta: { r: 255, g: 0, b: 255, a: 1 }
1083
+ };
1084
+ const named = namedColors[color.toLowerCase()];
1085
+ if (named)
1086
+ return named;
1087
+ }
1088
+ return fallback;
1089
+ }
1052
1090
  function renderGeomPoint(data, geom, aes, scales, canvas) {
1053
1091
  const defaultShape = getPointShape(geom.params.shape);
1054
1092
  const positionType = getPositionType(geom.position);
@@ -1447,7 +1485,7 @@ function renderGeomHLine(_data, geom, _aes, scales, canvas) {
1447
1485
  if (yintercept === undefined)
1448
1486
  return;
1449
1487
  const cy = Math.round(scales.y.map(yintercept));
1450
- const color = geom.params.color ?? { r: 128, g: 128, b: 128, a: 1 };
1488
+ const color = parseColorToRgba(geom.params.color);
1451
1489
  const startX = Math.round(scales.x.range[0]);
1452
1490
  const endX = Math.round(scales.x.range[1]);
1453
1491
  canvas.drawHLine(startX, cy, endX - startX + 1, "─", color);
@@ -1457,7 +1495,7 @@ function renderGeomVLine(_data, geom, _aes, scales, canvas) {
1457
1495
  if (xintercept === undefined)
1458
1496
  return;
1459
1497
  const cx = Math.round(scales.x.map(xintercept));
1460
- const color = geom.params.color ?? { r: 128, g: 128, b: 128, a: 1 };
1498
+ const color = parseColorToRgba(geom.params.color);
1461
1499
  const startY = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
1462
1500
  const endY = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
1463
1501
  canvas.drawVLine(cx, startY, endY - startY + 1, "│", color);
@@ -2016,7 +2054,7 @@ function renderGeomAbline(_data, geom, _aes, scales, canvas) {
2016
2054
  const intercept = geom.params.intercept ?? 0;
2017
2055
  const linetype = geom.params.linetype ?? "solid";
2018
2056
  const lineChar = linetype === "dotted" ? "·" : linetype === "dashed" ? "╌" : "─";
2019
- const color = geom.params.color ?? { r: 128, g: 128, b: 128, a: 1 };
2057
+ const color = parseColorToRgba(geom.params.color);
2020
2058
  const plotLeft = Math.round(scales.x.range[0]);
2021
2059
  const plotRight = Math.round(scales.x.range[1]);
2022
2060
  const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
@@ -3791,6 +3829,124 @@ function stat_qq_line(params = {}) {
3791
3829
  };
3792
3830
  }
3793
3831
 
3832
+ // src/stats/density2d.ts
3833
+ function gaussian2d(dx, dy, hx, hy) {
3834
+ const ux = dx / hx;
3835
+ const uy = dy / hy;
3836
+ return Math.exp(-0.5 * (ux * ux + uy * uy)) / (2 * Math.PI * hx * hy);
3837
+ }
3838
+ function scottBandwidth2d(values) {
3839
+ const n = values.length;
3840
+ if (n < 2)
3841
+ return 1;
3842
+ const mean = values.reduce((a, b) => a + b, 0) / n;
3843
+ const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1);
3844
+ const std = Math.sqrt(variance);
3845
+ return std * Math.pow(n, -1 / 6);
3846
+ }
3847
+ function computeDensity2d(data, xField, yField, params = {}) {
3848
+ const points = [];
3849
+ const xValues = [];
3850
+ const yValues = [];
3851
+ for (const row of data) {
3852
+ const xVal = row[xField];
3853
+ const yVal = row[yField];
3854
+ if (xVal === null || xVal === undefined || yVal === null || yVal === undefined)
3855
+ continue;
3856
+ const x = Number(xVal);
3857
+ const y = Number(yVal);
3858
+ if (isNaN(x) || isNaN(y))
3859
+ continue;
3860
+ points.push({ x, y });
3861
+ xValues.push(x);
3862
+ yValues.push(y);
3863
+ }
3864
+ if (points.length < 3) {
3865
+ return [];
3866
+ }
3867
+ const n = params.n ?? 50;
3868
+ const nx = params.nx ?? n;
3869
+ const ny = params.ny ?? n;
3870
+ const adjust = params.adjust ?? 1;
3871
+ let hx, hy;
3872
+ if (Array.isArray(params.h)) {
3873
+ hx = params.h[0] * adjust;
3874
+ hy = params.h[1] * adjust;
3875
+ } else if (params.h !== undefined) {
3876
+ hx = params.h * adjust;
3877
+ hy = params.h * adjust;
3878
+ } else {
3879
+ hx = scottBandwidth2d(xValues) * adjust;
3880
+ hy = scottBandwidth2d(yValues) * adjust;
3881
+ }
3882
+ if (hx <= 0)
3883
+ hx = 1;
3884
+ if (hy <= 0)
3885
+ hy = 1;
3886
+ const xMin = Math.min(...xValues);
3887
+ const xMax = Math.max(...xValues);
3888
+ const yMin = Math.min(...yValues);
3889
+ const yMax = Math.max(...yValues);
3890
+ const xPad = 3 * hx;
3891
+ const yPad = 3 * hy;
3892
+ const gridXMin = xMin - xPad;
3893
+ const gridXMax = xMax + xPad;
3894
+ const gridYMin = yMin - yPad;
3895
+ const gridYMax = yMax + yPad;
3896
+ const xStep = (gridXMax - gridXMin) / (nx - 1);
3897
+ const yStep = (gridYMax - gridYMin) / (ny - 1);
3898
+ const results = [];
3899
+ const nPoints = points.length;
3900
+ for (let i = 0;i < nx; i++) {
3901
+ const gx = gridXMin + i * xStep;
3902
+ for (let j = 0;j < ny; j++) {
3903
+ const gy = gridYMin + j * yStep;
3904
+ let density = 0;
3905
+ for (const pt of points) {
3906
+ density += gaussian2d(gx - pt.x, gy - pt.y, hx, hy);
3907
+ }
3908
+ density /= nPoints;
3909
+ results.push({
3910
+ x: gx,
3911
+ y: gy,
3912
+ z: density,
3913
+ density,
3914
+ level: density
3915
+ });
3916
+ }
3917
+ }
3918
+ return results;
3919
+ }
3920
+ function stat_density_2d(params = {}) {
3921
+ return {
3922
+ type: "density_2d",
3923
+ compute(data, aes) {
3924
+ if (aes.color) {
3925
+ const groups = new Map;
3926
+ for (const row of data) {
3927
+ const group = String(row[aes.color] ?? "default");
3928
+ if (!groups.has(group)) {
3929
+ groups.set(group, []);
3930
+ }
3931
+ groups.get(group).push(row);
3932
+ }
3933
+ const result = [];
3934
+ for (const [group, groupData] of groups) {
3935
+ const density = computeDensity2d(groupData, aes.x, aes.y, params);
3936
+ for (const d of density) {
3937
+ result.push({
3938
+ ...d,
3939
+ [aes.color]: group
3940
+ });
3941
+ }
3942
+ }
3943
+ return result;
3944
+ }
3945
+ return computeDensity2d(data, aes.x, aes.y, params);
3946
+ }
3947
+ };
3948
+ }
3949
+
3794
3950
  // src/facets/index.ts
3795
3951
  function as_labeller(labels) {
3796
3952
  return (value) => labels[value] ?? value;
@@ -4109,6 +4265,15 @@ function applyStatTransform(data, geom, aes) {
4109
4265
  drop: geom.params.drop
4110
4266
  });
4111
4267
  return bin2dStat.compute(data, aes);
4268
+ } else if (geom.stat === "density_2d") {
4269
+ const density2dStat = stat_density_2d({
4270
+ h: geom.params.bandwidth,
4271
+ n: geom.params.n,
4272
+ nx: geom.params.nx,
4273
+ ny: geom.params.ny,
4274
+ adjust: geom.params.adjust
4275
+ });
4276
+ return density2dStat.compute(data, aes);
4112
4277
  }
4113
4278
  return data;
4114
4279
  }
@@ -4177,6 +4342,10 @@ function renderToCanvas(spec, options) {
4177
4342
  scaleData = applyStatTransform(spec.data, geom, spec.aes);
4178
4343
  scaleAes = { ...spec.aes, x: "x", y: "y", fill: "fill" };
4179
4344
  break;
4345
+ } else if (geom.stat === "density_2d") {
4346
+ scaleData = applyStatTransform(spec.data, geom, spec.aes);
4347
+ scaleAes = { ...spec.aes, x: "x", y: "y" };
4348
+ break;
4180
4349
  }
4181
4350
  }
4182
4351
  scaleData = applyCoordTransform(scaleData, scaleAes, spec.coord);
@@ -4213,6 +4382,8 @@ function renderToCanvas(spec, options) {
4213
4382
  geomAes = { ...spec.aes, x: "x", y: "y", xend: "xend", yend: "yend" };
4214
4383
  } else if (geom.stat === "bin2d") {
4215
4384
  geomAes = { ...spec.aes, x: "x", y: "y", fill: "fill" };
4385
+ } else if (geom.stat === "density_2d") {
4386
+ geomAes = { ...spec.aes, x: "x", y: "y" };
4216
4387
  }
4217
4388
  geomData = applyCoordTransform(geomData, geomAes, spec.coord);
4218
4389
  }
package/dist/cli.js CHANGED
@@ -652,7 +652,7 @@ function isCategoricalField(data, field) {
652
652
  for (const row of data) {
653
653
  const value = row[field];
654
654
  if (value !== null && value !== undefined) {
655
- if (typeof value === "string" && isNaN(Number(value))) {
655
+ if (typeof value === "string") {
656
656
  return true;
657
657
  }
658
658
  }
@@ -1049,6 +1049,44 @@ function getPointColor(row, aes, colorScale) {
1049
1049
  }
1050
1050
  return DEFAULT_POINT_COLOR;
1051
1051
  }
1052
+ function parseColorToRgba(color, fallback = { r: 128, g: 128, b: 128, a: 1 }) {
1053
+ if (!color)
1054
+ return fallback;
1055
+ if (typeof color === "object" && color !== null && "r" in color) {
1056
+ return color;
1057
+ }
1058
+ if (typeof color === "string") {
1059
+ if (color.startsWith("#")) {
1060
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
1061
+ if (result) {
1062
+ return {
1063
+ r: parseInt(result[1], 16),
1064
+ g: parseInt(result[2], 16),
1065
+ b: parseInt(result[3], 16),
1066
+ a: 1
1067
+ };
1068
+ }
1069
+ }
1070
+ const namedColors = {
1071
+ red: { r: 255, g: 0, b: 0, a: 1 },
1072
+ blue: { r: 0, g: 0, b: 255, a: 1 },
1073
+ green: { r: 0, g: 128, b: 0, a: 1 },
1074
+ black: { r: 0, g: 0, b: 0, a: 1 },
1075
+ white: { r: 255, g: 255, b: 255, a: 1 },
1076
+ gray: { r: 128, g: 128, b: 128, a: 1 },
1077
+ grey: { r: 128, g: 128, b: 128, a: 1 },
1078
+ yellow: { r: 255, g: 255, b: 0, a: 1 },
1079
+ orange: { r: 255, g: 165, b: 0, a: 1 },
1080
+ purple: { r: 128, g: 0, b: 128, a: 1 },
1081
+ cyan: { r: 0, g: 255, b: 255, a: 1 },
1082
+ magenta: { r: 255, g: 0, b: 255, a: 1 }
1083
+ };
1084
+ const named = namedColors[color.toLowerCase()];
1085
+ if (named)
1086
+ return named;
1087
+ }
1088
+ return fallback;
1089
+ }
1052
1090
  function renderGeomPoint(data, geom, aes, scales, canvas) {
1053
1091
  const defaultShape = getPointShape(geom.params.shape);
1054
1092
  const positionType = getPositionType(geom.position);
@@ -1447,7 +1485,7 @@ function renderGeomHLine(_data, geom, _aes, scales, canvas) {
1447
1485
  if (yintercept === undefined)
1448
1486
  return;
1449
1487
  const cy = Math.round(scales.y.map(yintercept));
1450
- const color = geom.params.color ?? { r: 128, g: 128, b: 128, a: 1 };
1488
+ const color = parseColorToRgba(geom.params.color);
1451
1489
  const startX = Math.round(scales.x.range[0]);
1452
1490
  const endX = Math.round(scales.x.range[1]);
1453
1491
  canvas.drawHLine(startX, cy, endX - startX + 1, "─", color);
@@ -1457,7 +1495,7 @@ function renderGeomVLine(_data, geom, _aes, scales, canvas) {
1457
1495
  if (xintercept === undefined)
1458
1496
  return;
1459
1497
  const cx = Math.round(scales.x.map(xintercept));
1460
- const color = geom.params.color ?? { r: 128, g: 128, b: 128, a: 1 };
1498
+ const color = parseColorToRgba(geom.params.color);
1461
1499
  const startY = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
1462
1500
  const endY = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
1463
1501
  canvas.drawVLine(cx, startY, endY - startY + 1, "│", color);
@@ -2016,7 +2054,7 @@ function renderGeomAbline(_data, geom, _aes, scales, canvas) {
2016
2054
  const intercept = geom.params.intercept ?? 0;
2017
2055
  const linetype = geom.params.linetype ?? "solid";
2018
2056
  const lineChar = linetype === "dotted" ? "·" : linetype === "dashed" ? "╌" : "─";
2019
- const color = geom.params.color ?? { r: 128, g: 128, b: 128, a: 1 };
2057
+ const color = parseColorToRgba(geom.params.color);
2020
2058
  const plotLeft = Math.round(scales.x.range[0]);
2021
2059
  const plotRight = Math.round(scales.x.range[1]);
2022
2060
  const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
@@ -3791,6 +3829,124 @@ function stat_qq_line(params = {}) {
3791
3829
  };
3792
3830
  }
3793
3831
 
3832
+ // src/stats/density2d.ts
3833
+ function gaussian2d(dx, dy, hx, hy) {
3834
+ const ux = dx / hx;
3835
+ const uy = dy / hy;
3836
+ return Math.exp(-0.5 * (ux * ux + uy * uy)) / (2 * Math.PI * hx * hy);
3837
+ }
3838
+ function scottBandwidth2d(values) {
3839
+ const n = values.length;
3840
+ if (n < 2)
3841
+ return 1;
3842
+ const mean = values.reduce((a, b) => a + b, 0) / n;
3843
+ const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1);
3844
+ const std = Math.sqrt(variance);
3845
+ return std * Math.pow(n, -1 / 6);
3846
+ }
3847
+ function computeDensity2d(data, xField, yField, params = {}) {
3848
+ const points = [];
3849
+ const xValues = [];
3850
+ const yValues = [];
3851
+ for (const row of data) {
3852
+ const xVal = row[xField];
3853
+ const yVal = row[yField];
3854
+ if (xVal === null || xVal === undefined || yVal === null || yVal === undefined)
3855
+ continue;
3856
+ const x = Number(xVal);
3857
+ const y = Number(yVal);
3858
+ if (isNaN(x) || isNaN(y))
3859
+ continue;
3860
+ points.push({ x, y });
3861
+ xValues.push(x);
3862
+ yValues.push(y);
3863
+ }
3864
+ if (points.length < 3) {
3865
+ return [];
3866
+ }
3867
+ const n = params.n ?? 50;
3868
+ const nx = params.nx ?? n;
3869
+ const ny = params.ny ?? n;
3870
+ const adjust = params.adjust ?? 1;
3871
+ let hx, hy;
3872
+ if (Array.isArray(params.h)) {
3873
+ hx = params.h[0] * adjust;
3874
+ hy = params.h[1] * adjust;
3875
+ } else if (params.h !== undefined) {
3876
+ hx = params.h * adjust;
3877
+ hy = params.h * adjust;
3878
+ } else {
3879
+ hx = scottBandwidth2d(xValues) * adjust;
3880
+ hy = scottBandwidth2d(yValues) * adjust;
3881
+ }
3882
+ if (hx <= 0)
3883
+ hx = 1;
3884
+ if (hy <= 0)
3885
+ hy = 1;
3886
+ const xMin = Math.min(...xValues);
3887
+ const xMax = Math.max(...xValues);
3888
+ const yMin = Math.min(...yValues);
3889
+ const yMax = Math.max(...yValues);
3890
+ const xPad = 3 * hx;
3891
+ const yPad = 3 * hy;
3892
+ const gridXMin = xMin - xPad;
3893
+ const gridXMax = xMax + xPad;
3894
+ const gridYMin = yMin - yPad;
3895
+ const gridYMax = yMax + yPad;
3896
+ const xStep = (gridXMax - gridXMin) / (nx - 1);
3897
+ const yStep = (gridYMax - gridYMin) / (ny - 1);
3898
+ const results = [];
3899
+ const nPoints = points.length;
3900
+ for (let i = 0;i < nx; i++) {
3901
+ const gx = gridXMin + i * xStep;
3902
+ for (let j = 0;j < ny; j++) {
3903
+ const gy = gridYMin + j * yStep;
3904
+ let density = 0;
3905
+ for (const pt of points) {
3906
+ density += gaussian2d(gx - pt.x, gy - pt.y, hx, hy);
3907
+ }
3908
+ density /= nPoints;
3909
+ results.push({
3910
+ x: gx,
3911
+ y: gy,
3912
+ z: density,
3913
+ density,
3914
+ level: density
3915
+ });
3916
+ }
3917
+ }
3918
+ return results;
3919
+ }
3920
+ function stat_density_2d(params = {}) {
3921
+ return {
3922
+ type: "density_2d",
3923
+ compute(data, aes) {
3924
+ if (aes.color) {
3925
+ const groups = new Map;
3926
+ for (const row of data) {
3927
+ const group = String(row[aes.color] ?? "default");
3928
+ if (!groups.has(group)) {
3929
+ groups.set(group, []);
3930
+ }
3931
+ groups.get(group).push(row);
3932
+ }
3933
+ const result = [];
3934
+ for (const [group, groupData] of groups) {
3935
+ const density = computeDensity2d(groupData, aes.x, aes.y, params);
3936
+ for (const d of density) {
3937
+ result.push({
3938
+ ...d,
3939
+ [aes.color]: group
3940
+ });
3941
+ }
3942
+ }
3943
+ return result;
3944
+ }
3945
+ return computeDensity2d(data, aes.x, aes.y, params);
3946
+ }
3947
+ };
3948
+ }
3949
+
3794
3950
  // src/facets/index.ts
3795
3951
  function as_labeller(labels) {
3796
3952
  return (value) => labels[value] ?? value;
@@ -4109,6 +4265,15 @@ function applyStatTransform(data, geom, aes) {
4109
4265
  drop: geom.params.drop
4110
4266
  });
4111
4267
  return bin2dStat.compute(data, aes);
4268
+ } else if (geom.stat === "density_2d") {
4269
+ const density2dStat = stat_density_2d({
4270
+ h: geom.params.bandwidth,
4271
+ n: geom.params.n,
4272
+ nx: geom.params.nx,
4273
+ ny: geom.params.ny,
4274
+ adjust: geom.params.adjust
4275
+ });
4276
+ return density2dStat.compute(data, aes);
4112
4277
  }
4113
4278
  return data;
4114
4279
  }
@@ -4177,6 +4342,10 @@ function renderToCanvas(spec, options) {
4177
4342
  scaleData = applyStatTransform(spec.data, geom, spec.aes);
4178
4343
  scaleAes = { ...spec.aes, x: "x", y: "y", fill: "fill" };
4179
4344
  break;
4345
+ } else if (geom.stat === "density_2d") {
4346
+ scaleData = applyStatTransform(spec.data, geom, spec.aes);
4347
+ scaleAes = { ...spec.aes, x: "x", y: "y" };
4348
+ break;
4180
4349
  }
4181
4350
  }
4182
4351
  scaleData = applyCoordTransform(scaleData, scaleAes, spec.coord);
@@ -4213,6 +4382,8 @@ function renderToCanvas(spec, options) {
4213
4382
  geomAes = { ...spec.aes, x: "x", y: "y", xend: "xend", yend: "yend" };
4214
4383
  } else if (geom.stat === "bin2d") {
4215
4384
  geomAes = { ...spec.aes, x: "x", y: "y", fill: "fill" };
4385
+ } else if (geom.stat === "density_2d") {
4386
+ geomAes = { ...spec.aes, x: "x", y: "y" };
4216
4387
  }
4217
4388
  geomData = applyCoordTransform(geomData, geomAes, spec.coord);
4218
4389
  }
package/dist/index.js CHANGED
@@ -651,7 +651,7 @@ function isCategoricalField(data, field) {
651
651
  for (const row of data) {
652
652
  const value = row[field];
653
653
  if (value !== null && value !== undefined) {
654
- if (typeof value === "string" && isNaN(Number(value))) {
654
+ if (typeof value === "string") {
655
655
  return true;
656
656
  }
657
657
  }
@@ -1048,6 +1048,44 @@ function getPointColor(row, aes, colorScale) {
1048
1048
  }
1049
1049
  return DEFAULT_POINT_COLOR;
1050
1050
  }
1051
+ function parseColorToRgba(color, fallback = { r: 128, g: 128, b: 128, a: 1 }) {
1052
+ if (!color)
1053
+ return fallback;
1054
+ if (typeof color === "object" && color !== null && "r" in color) {
1055
+ return color;
1056
+ }
1057
+ if (typeof color === "string") {
1058
+ if (color.startsWith("#")) {
1059
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
1060
+ if (result) {
1061
+ return {
1062
+ r: parseInt(result[1], 16),
1063
+ g: parseInt(result[2], 16),
1064
+ b: parseInt(result[3], 16),
1065
+ a: 1
1066
+ };
1067
+ }
1068
+ }
1069
+ const namedColors = {
1070
+ red: { r: 255, g: 0, b: 0, a: 1 },
1071
+ blue: { r: 0, g: 0, b: 255, a: 1 },
1072
+ green: { r: 0, g: 128, b: 0, a: 1 },
1073
+ black: { r: 0, g: 0, b: 0, a: 1 },
1074
+ white: { r: 255, g: 255, b: 255, a: 1 },
1075
+ gray: { r: 128, g: 128, b: 128, a: 1 },
1076
+ grey: { r: 128, g: 128, b: 128, a: 1 },
1077
+ yellow: { r: 255, g: 255, b: 0, a: 1 },
1078
+ orange: { r: 255, g: 165, b: 0, a: 1 },
1079
+ purple: { r: 128, g: 0, b: 128, a: 1 },
1080
+ cyan: { r: 0, g: 255, b: 255, a: 1 },
1081
+ magenta: { r: 255, g: 0, b: 255, a: 1 }
1082
+ };
1083
+ const named = namedColors[color.toLowerCase()];
1084
+ if (named)
1085
+ return named;
1086
+ }
1087
+ return fallback;
1088
+ }
1051
1089
  function renderGeomPoint(data, geom, aes, scales, canvas) {
1052
1090
  const defaultShape = getPointShape(geom.params.shape);
1053
1091
  const positionType = getPositionType(geom.position);
@@ -1446,7 +1484,7 @@ function renderGeomHLine(_data, geom, _aes, scales, canvas) {
1446
1484
  if (yintercept === undefined)
1447
1485
  return;
1448
1486
  const cy = Math.round(scales.y.map(yintercept));
1449
- const color = geom.params.color ?? { r: 128, g: 128, b: 128, a: 1 };
1487
+ const color = parseColorToRgba(geom.params.color);
1450
1488
  const startX = Math.round(scales.x.range[0]);
1451
1489
  const endX = Math.round(scales.x.range[1]);
1452
1490
  canvas.drawHLine(startX, cy, endX - startX + 1, "─", color);
@@ -1456,7 +1494,7 @@ function renderGeomVLine(_data, geom, _aes, scales, canvas) {
1456
1494
  if (xintercept === undefined)
1457
1495
  return;
1458
1496
  const cx = Math.round(scales.x.map(xintercept));
1459
- const color = geom.params.color ?? { r: 128, g: 128, b: 128, a: 1 };
1497
+ const color = parseColorToRgba(geom.params.color);
1460
1498
  const startY = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
1461
1499
  const endY = Math.round(Math.max(scales.y.range[0], scales.y.range[1]));
1462
1500
  canvas.drawVLine(cx, startY, endY - startY + 1, "│", color);
@@ -2015,7 +2053,7 @@ function renderGeomAbline(_data, geom, _aes, scales, canvas) {
2015
2053
  const intercept = geom.params.intercept ?? 0;
2016
2054
  const linetype = geom.params.linetype ?? "solid";
2017
2055
  const lineChar = linetype === "dotted" ? "·" : linetype === "dashed" ? "╌" : "─";
2018
- const color = geom.params.color ?? { r: 128, g: 128, b: 128, a: 1 };
2056
+ const color = parseColorToRgba(geom.params.color);
2019
2057
  const plotLeft = Math.round(scales.x.range[0]);
2020
2058
  const plotRight = Math.round(scales.x.range[1]);
2021
2059
  const plotTop = Math.round(Math.min(scales.y.range[0], scales.y.range[1]));
@@ -3790,6 +3828,124 @@ function stat_qq_line(params = {}) {
3790
3828
  };
3791
3829
  }
3792
3830
 
3831
+ // src/stats/density2d.ts
3832
+ function gaussian2d(dx, dy, hx, hy) {
3833
+ const ux = dx / hx;
3834
+ const uy = dy / hy;
3835
+ return Math.exp(-0.5 * (ux * ux + uy * uy)) / (2 * Math.PI * hx * hy);
3836
+ }
3837
+ function scottBandwidth2d(values) {
3838
+ const n = values.length;
3839
+ if (n < 2)
3840
+ return 1;
3841
+ const mean = values.reduce((a, b) => a + b, 0) / n;
3842
+ const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1);
3843
+ const std = Math.sqrt(variance);
3844
+ return std * Math.pow(n, -1 / 6);
3845
+ }
3846
+ function computeDensity2d(data, xField, yField, params = {}) {
3847
+ const points = [];
3848
+ const xValues = [];
3849
+ const yValues = [];
3850
+ for (const row of data) {
3851
+ const xVal = row[xField];
3852
+ const yVal = row[yField];
3853
+ if (xVal === null || xVal === undefined || yVal === null || yVal === undefined)
3854
+ continue;
3855
+ const x = Number(xVal);
3856
+ const y = Number(yVal);
3857
+ if (isNaN(x) || isNaN(y))
3858
+ continue;
3859
+ points.push({ x, y });
3860
+ xValues.push(x);
3861
+ yValues.push(y);
3862
+ }
3863
+ if (points.length < 3) {
3864
+ return [];
3865
+ }
3866
+ const n = params.n ?? 50;
3867
+ const nx = params.nx ?? n;
3868
+ const ny = params.ny ?? n;
3869
+ const adjust = params.adjust ?? 1;
3870
+ let hx, hy;
3871
+ if (Array.isArray(params.h)) {
3872
+ hx = params.h[0] * adjust;
3873
+ hy = params.h[1] * adjust;
3874
+ } else if (params.h !== undefined) {
3875
+ hx = params.h * adjust;
3876
+ hy = params.h * adjust;
3877
+ } else {
3878
+ hx = scottBandwidth2d(xValues) * adjust;
3879
+ hy = scottBandwidth2d(yValues) * adjust;
3880
+ }
3881
+ if (hx <= 0)
3882
+ hx = 1;
3883
+ if (hy <= 0)
3884
+ hy = 1;
3885
+ const xMin = Math.min(...xValues);
3886
+ const xMax = Math.max(...xValues);
3887
+ const yMin = Math.min(...yValues);
3888
+ const yMax = Math.max(...yValues);
3889
+ const xPad = 3 * hx;
3890
+ const yPad = 3 * hy;
3891
+ const gridXMin = xMin - xPad;
3892
+ const gridXMax = xMax + xPad;
3893
+ const gridYMin = yMin - yPad;
3894
+ const gridYMax = yMax + yPad;
3895
+ const xStep = (gridXMax - gridXMin) / (nx - 1);
3896
+ const yStep = (gridYMax - gridYMin) / (ny - 1);
3897
+ const results = [];
3898
+ const nPoints = points.length;
3899
+ for (let i = 0;i < nx; i++) {
3900
+ const gx = gridXMin + i * xStep;
3901
+ for (let j = 0;j < ny; j++) {
3902
+ const gy = gridYMin + j * yStep;
3903
+ let density = 0;
3904
+ for (const pt of points) {
3905
+ density += gaussian2d(gx - pt.x, gy - pt.y, hx, hy);
3906
+ }
3907
+ density /= nPoints;
3908
+ results.push({
3909
+ x: gx,
3910
+ y: gy,
3911
+ z: density,
3912
+ density,
3913
+ level: density
3914
+ });
3915
+ }
3916
+ }
3917
+ return results;
3918
+ }
3919
+ function stat_density_2d(params = {}) {
3920
+ return {
3921
+ type: "density_2d",
3922
+ compute(data, aes) {
3923
+ if (aes.color) {
3924
+ const groups = new Map;
3925
+ for (const row of data) {
3926
+ const group = String(row[aes.color] ?? "default");
3927
+ if (!groups.has(group)) {
3928
+ groups.set(group, []);
3929
+ }
3930
+ groups.get(group).push(row);
3931
+ }
3932
+ const result = [];
3933
+ for (const [group, groupData] of groups) {
3934
+ const density = computeDensity2d(groupData, aes.x, aes.y, params);
3935
+ for (const d of density) {
3936
+ result.push({
3937
+ ...d,
3938
+ [aes.color]: group
3939
+ });
3940
+ }
3941
+ }
3942
+ return result;
3943
+ }
3944
+ return computeDensity2d(data, aes.x, aes.y, params);
3945
+ }
3946
+ };
3947
+ }
3948
+
3793
3949
  // src/facets/index.ts
3794
3950
  function as_labeller(labels) {
3795
3951
  return (value) => labels[value] ?? value;
@@ -4108,6 +4264,15 @@ function applyStatTransform(data, geom, aes) {
4108
4264
  drop: geom.params.drop
4109
4265
  });
4110
4266
  return bin2dStat.compute(data, aes);
4267
+ } else if (geom.stat === "density_2d") {
4268
+ const density2dStat = stat_density_2d({
4269
+ h: geom.params.bandwidth,
4270
+ n: geom.params.n,
4271
+ nx: geom.params.nx,
4272
+ ny: geom.params.ny,
4273
+ adjust: geom.params.adjust
4274
+ });
4275
+ return density2dStat.compute(data, aes);
4111
4276
  }
4112
4277
  return data;
4113
4278
  }
@@ -4176,6 +4341,10 @@ function renderToCanvas(spec, options) {
4176
4341
  scaleData = applyStatTransform(spec.data, geom, spec.aes);
4177
4342
  scaleAes = { ...spec.aes, x: "x", y: "y", fill: "fill" };
4178
4343
  break;
4344
+ } else if (geom.stat === "density_2d") {
4345
+ scaleData = applyStatTransform(spec.data, geom, spec.aes);
4346
+ scaleAes = { ...spec.aes, x: "x", y: "y" };
4347
+ break;
4179
4348
  }
4180
4349
  }
4181
4350
  scaleData = applyCoordTransform(scaleData, scaleAes, spec.coord);
@@ -4212,6 +4381,8 @@ function renderToCanvas(spec, options) {
4212
4381
  geomAes = { ...spec.aes, x: "x", y: "y", xend: "xend", yend: "yend" };
4213
4382
  } else if (geom.stat === "bin2d") {
4214
4383
  geomAes = { ...spec.aes, x: "x", y: "y", fill: "fill" };
4384
+ } else if (geom.stat === "density_2d") {
4385
+ geomAes = { ...spec.aes, x: "x", y: "y" };
4215
4386
  }
4216
4387
  geomData = applyCoordTransform(geomData, geomAes, spec.coord);
4217
4388
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/pipeline/pipeline.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAA6C,QAAQ,EAAE,aAAa,EAAQ,MAAM,UAAU,CAAA;AACxG,OAAO,EAAE,cAAc,EAAgB,MAAM,kBAAkB,CAAA;AAiB/D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,QAAQ,EAAE;QACR,CAAC,EAAE,MAAM,CAAA;QACT,CAAC,EAAE,MAAM,CAAA;QACT,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,UAAU,CAAC,EAAE;QACX,CAAC,EAAE,MAAM,CAAA;QACT,CAAC,EAAE,MAAM,CAAA;QACT,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,aAAa,GACrB,UAAU,CAgEZ;AA4HD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,aAAa,GACrB,cAAc,CAsLhB;AAwcD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,aAAa,GACrB,MAAM,CASR"}
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/pipeline/pipeline.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAA6C,QAAQ,EAAE,aAAa,EAAQ,MAAM,UAAU,CAAA;AACxG,OAAO,EAAE,cAAc,EAAgB,MAAM,kBAAkB,CAAA;AAkB/D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,QAAQ,EAAE;QACR,CAAC,EAAE,MAAM,CAAA;QACT,CAAC,EAAE,MAAM,CAAA;QACT,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,UAAU,CAAC,EAAE;QACX,CAAC,EAAE,MAAM,CAAA;QACT,CAAC,EAAE,MAAM,CAAA;QACT,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,aAAa,GACrB,UAAU,CAgEZ;AAqID;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,aAAa,GACrB,cAAc,CA8LhB;AAwcD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,aAAa,GACrB,MAAM,CASR"}
@@ -1 +1 @@
1
- {"version":3,"file":"render-geoms.d.ts","sourceRoot":"","sources":["../../src/pipeline/render-geoms.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MA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;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,GACrB,IAAI,CAkCN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,GACrB,IAAI,CA4BN;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,GACrB,IAAI,CAwFN;AA6BD;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAkFN"}
1
+ {"version":3,"file":"render-geoms.d.ts","sourceRoot":"","sources":["../../src/pipeline/render-geoms.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAQ,MAAM,UAAU,CAAA;AACxE,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,UAAU,CAAA;AAoGhE;;GAEG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,GACrB,IAAI,CA8CN;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B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gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,GACrB,IAAI,CAwFN;AA6BD;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAkFN"}
@@ -1 +1 @@
1
- {"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../src/pipeline/scales.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACV,IAAI,EACJ,KAAK,EACL,cAAc,EACf,MAAM,UAAU,CAAA;AAEjB;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,GACZ,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBlB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,MAAM,GACN,WAAW,GACX,SAAS,CAAA;AAEb;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,iDAAiD;IACjD,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,oBAAyB,GACjC,MAAM,EAAE,CAoEV;AAED;;GAEG;A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,EAAE,MAAM,CAAA;CAAE,EACjE,UAAU,GAAE,KAAK,EAAO,EACxB,WAAW,CAAC,EAAE,WAAW,GACxB,YAAY,CA+Ld"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * stat_density_2d - 2D Kernel Density Estimation
3
+ *
4
+ * Computes a 2D density surface from scatter data using kernel density
5
+ * estimation. Output is suitable for contour visualization.
6
+ */
7
+ import type { DataSource, Stat } from '../types';
8
+ export interface StatDensity2dParams {
9
+ /** Bandwidth for kernel density estimation (default: auto via Scott's rule) */
10
+ h?: number | [number, number];
11
+ /** Number of grid points in x direction (default: 50) */
12
+ n?: number;
13
+ /** Number of grid points in x direction */
14
+ nx?: number;
15
+ /** Number of grid points in y direction */
16
+ ny?: number;
17
+ /** Adjustment factor for bandwidth (default: 1) */
18
+ adjust?: number;
19
+ }
20
+ export interface Density2dResult {
21
+ x: number;
22
+ y: number;
23
+ z: number;
24
+ density: number;
25
+ level: number;
26
+ [key: string]: unknown;
27
+ }
28
+ /**
29
+ * Compute 2D kernel density estimation
30
+ */
31
+ export declare function computeDensity2d(data: DataSource, xField: string, yField: string, params?: StatDensity2dParams): Density2dResult[];
32
+ /**
33
+ * Create stat_density_2d transformation
34
+ */
35
+ export declare function stat_density_2d(params?: StatDensity2dParams): Stat;
36
+ //# sourceMappingURL=density2d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"density2d.d.ts","sourceRoot":"","sources":["../../src/stats/density2d.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAoB,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAElE,MAAM,WAAW,mBAAmB;IAClC,+EAA+E;IAC/E,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,yDAAyD;IACzD,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,2CAA2C;IAC3C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,2CAA2C;IAC3C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AA4BD,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,mBAAwB,GAC/B,eAAe,EAAE,CA6FnB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,mBAAwB,GAAG,IAAI,CAgCtE"}
@@ -11,6 +11,8 @@ export { stat_boxplot, computeBoxplotStats } from './boxplot';
11
11
  export type { StatBoxplotParams, BoxplotResult } from './boxplot';
12
12
  export { stat_density, stat_ydensity, computeDensity } from './density';
13
13
  export type { StatDensityParams, DensityResult } from './density';
14
+ export { stat_density_2d, computeDensity2d } from './density2d';
15
+ export type { StatDensity2dParams, Density2dResult } from './density2d';
14
16
  export { stat_smooth, computeSmooth } from './smooth';
15
17
  export type { StatSmoothParams, SmoothResult } from './smooth';
16
18
  export { stat_summary, computeSummary } from './summary';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stats/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC7C,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACnD,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA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AAS,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC7D,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEjE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AACvE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEjE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC/D,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEvE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE9D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AACxD,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE7E,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AACtE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@ggterm/core",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Grammar of Graphics engine for terminals",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "bin": {
9
- "ggterm": "./dist/cli.js",
10
- "ggterm-plot": "./dist/cli-plot.js"
9
+ "ggterm": "dist/cli.js",
10
+ "ggterm-plot": "dist/cli-plot.js"
11
11
  },
12
12
  "exports": {
13
13
  ".": {
@@ -36,7 +36,7 @@
36
36
  "license": "MIT",
37
37
  "repository": {
38
38
  "type": "git",
39
- "url": "https://github.com/shandley/ggterm.git",
39
+ "url": "git+https://github.com/shandley/ggterm.git",
40
40
  "directory": "packages/core"
41
41
  },
42
42
  "homepage": "https://github.com/shandley/ggterm#readme",