@barefootjs/chart 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +79 -81
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -169,51 +169,34 @@ var bisectRight = ascendingBisect.right;
169
169
  var bisectLeft = ascendingBisect.left;
170
170
  var bisectCenter = bisector(number).center;
171
171
  var bisect_default = bisectRight;
172
- // ../../node_modules/.bun/internmap@2.0.3/node_modules/internmap/src/index.js
173
- class InternMap extends Map {
174
- constructor(entries, key = keyof) {
175
- super();
176
- Object.defineProperties(this, { _intern: { value: new Map }, _key: { value: key } });
177
- if (entries != null)
178
- for (const [key2, value] of entries)
179
- this.set(key2, value);
180
- }
181
- get(key) {
182
- return super.get(intern_get(this, key));
183
- }
184
- has(key) {
185
- return super.has(intern_get(this, key));
186
- }
187
- set(key, value) {
188
- return super.set(intern_set(this, key), value);
189
- }
190
- delete(key) {
191
- return super.delete(intern_delete(this, key));
172
+ // ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/max.js
173
+ function max(values, valueof) {
174
+ let max2;
175
+ if (valueof === undefined) {
176
+ for (const value of values) {
177
+ if (value != null && (max2 < value || max2 === undefined && value >= value)) {
178
+ max2 = value;
179
+ }
180
+ }
181
+ } else {
182
+ let index = -1;
183
+ for (let value of values) {
184
+ if ((value = valueof(value, ++index, values)) != null && (max2 < value || max2 === undefined && value >= value)) {
185
+ max2 = value;
186
+ }
187
+ }
192
188
  }
189
+ return max2;
193
190
  }
194
- function intern_get({ _intern, _key }, value) {
195
- const key = _key(value);
196
- return _intern.has(key) ? _intern.get(key) : value;
197
- }
198
- function intern_set({ _intern, _key }, value) {
199
- const key = _key(value);
200
- if (_intern.has(key))
201
- return _intern.get(key);
202
- _intern.set(key, value);
203
- return value;
204
- }
205
- function intern_delete({ _intern, _key }, value) {
206
- const key = _key(value);
207
- if (_intern.has(key)) {
208
- value = _intern.get(key);
209
- _intern.delete(key);
191
+ // ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/range.js
192
+ function range(start, stop, step) {
193
+ start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
194
+ var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n);
195
+ while (++i < n) {
196
+ range2[i] = start + i * step;
210
197
  }
211
- return value;
212
- }
213
- function keyof(value) {
214
- return value !== null && typeof value === "object" ? value.valueOf() : value;
198
+ return range2;
215
199
  }
216
-
217
200
  // ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/ticks.js
218
201
  var e10 = Math.sqrt(50);
219
202
  var e5 = Math.sqrt(10);
@@ -279,34 +262,49 @@ function tickStep(start, stop, count) {
279
262
  const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
280
263
  return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
281
264
  }
282
-
283
- // ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/max.js
284
- function max(values, valueof) {
285
- let max2;
286
- if (valueof === undefined) {
287
- for (const value of values) {
288
- if (value != null && (max2 < value || max2 === undefined && value >= value)) {
289
- max2 = value;
290
- }
291
- }
292
- } else {
293
- let index = -1;
294
- for (let value of values) {
295
- if ((value = valueof(value, ++index, values)) != null && (max2 < value || max2 === undefined && value >= value)) {
296
- max2 = value;
297
- }
298
- }
265
+ // ../../node_modules/.bun/internmap@2.0.3/node_modules/internmap/src/index.js
266
+ class InternMap extends Map {
267
+ constructor(entries, key = keyof) {
268
+ super();
269
+ Object.defineProperties(this, { _intern: { value: new Map }, _key: { value: key } });
270
+ if (entries != null)
271
+ for (const [key2, value] of entries)
272
+ this.set(key2, value);
273
+ }
274
+ get(key) {
275
+ return super.get(intern_get(this, key));
276
+ }
277
+ has(key) {
278
+ return super.has(intern_get(this, key));
279
+ }
280
+ set(key, value) {
281
+ return super.set(intern_set(this, key), value);
282
+ }
283
+ delete(key) {
284
+ return super.delete(intern_delete(this, key));
299
285
  }
300
- return max2;
301
286
  }
302
- // ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/range.js
303
- function range(start, stop, step) {
304
- start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
305
- var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n);
306
- while (++i < n) {
307
- range2[i] = start + i * step;
287
+ function intern_get({ _intern, _key }, value) {
288
+ const key = _key(value);
289
+ return _intern.has(key) ? _intern.get(key) : value;
290
+ }
291
+ function intern_set({ _intern, _key }, value) {
292
+ const key = _key(value);
293
+ if (_intern.has(key))
294
+ return _intern.get(key);
295
+ _intern.set(key, value);
296
+ return value;
297
+ }
298
+ function intern_delete({ _intern, _key }, value) {
299
+ const key = _key(value);
300
+ if (_intern.has(key)) {
301
+ value = _intern.get(key);
302
+ _intern.delete(key);
308
303
  }
309
- return range2;
304
+ return value;
305
+ }
306
+ function keyof(value) {
307
+ return value !== null && typeof value === "object" ? value.valueOf() : value;
310
308
  }
311
309
  // ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/init.js
312
310
  function initRange(domain, range2) {
@@ -326,24 +324,24 @@ function initRange(domain, range2) {
326
324
  // ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js
327
325
  var implicit = Symbol("implicit");
328
326
  function ordinal() {
329
- var index = new InternMap, domain = [], range2 = [], unknown = implicit;
327
+ var index2 = new InternMap, domain = [], range2 = [], unknown = implicit;
330
328
  function scale(d) {
331
- let i = index.get(d);
329
+ let i = index2.get(d);
332
330
  if (i === undefined) {
333
331
  if (unknown !== implicit)
334
332
  return unknown;
335
- index.set(d, i = domain.push(d) - 1);
333
+ index2.set(d, i = domain.push(d) - 1);
336
334
  }
337
335
  return range2[i % range2.length];
338
336
  }
339
337
  scale.domain = function(_) {
340
338
  if (!arguments.length)
341
339
  return domain.slice();
342
- domain = [], index = new InternMap;
340
+ domain = [], index2 = new InternMap;
343
341
  for (const value of _) {
344
- if (index.has(value))
342
+ if (index2.has(value))
345
343
  continue;
346
- index.set(value, domain.push(value) - 1);
344
+ index2.set(value, domain.push(value) - 1);
347
345
  }
348
346
  return scale;
349
347
  };
@@ -1467,7 +1465,7 @@ var cos = Math.cos;
1467
1465
  var max2 = Math.max;
1468
1466
  var min = Math.min;
1469
1467
  var sin = Math.sin;
1470
- var sqrt = Math.sqrt;
1468
+ var sqrt2 = Math.sqrt;
1471
1469
  var epsilon = 0.000000000001;
1472
1470
  var pi = Math.PI;
1473
1471
  var halfPi = pi / 2;
@@ -1622,7 +1620,7 @@ function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
1622
1620
  return [x0 + t * x10, y0 + t * y10];
1623
1621
  }
1624
1622
  function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
1625
- var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max2(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
1623
+ var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt2(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt2(max2(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
1626
1624
  if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1)
1627
1625
  cx0 = cx1, cy0 = cy1;
1628
1626
  return {
@@ -1652,7 +1650,7 @@ function arc_default() {
1652
1650
  context.arc(0, 0, r0, a1, a0, cw);
1653
1651
  }
1654
1652
  } else {
1655
- var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
1653
+ var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt2(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
1656
1654
  if (rp > epsilon) {
1657
1655
  var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
1658
1656
  if ((da0 -= p0 * 2) > epsilon)
@@ -1669,7 +1667,7 @@ function arc_default() {
1669
1667
  var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
1670
1668
  if (da < pi) {
1671
1669
  if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
1672
- var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
1670
+ var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt2(ax * ax + ay * ay) * sqrt2(bx * bx + by * by))) / 2), lc = sqrt2(oc[0] * oc[0] + oc[1] * oc[1]);
1673
1671
  rc0 = min(rc, (r0 - lc) / (kc - 1));
1674
1672
  rc1 = min(rc, (r1 - lc) / (kc + 1));
1675
1673
  } else {
@@ -1923,22 +1921,22 @@ function identity_default2(d) {
1923
1921
  function pie_default() {
1924
1922
  var value = identity_default2, sortValues = descending_default, sort = null, startAngle = constant_default2(0), endAngle = constant_default2(tau), padAngle = constant_default2(0);
1925
1923
  function pie(data) {
1926
- var i, n = (data = array_default(data)).length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;
1924
+ var i, n = (data = array_default(data)).length, j, k, sum = 0, index2 = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;
1927
1925
  for (i = 0;i < n; ++i) {
1928
- if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
1926
+ if ((v = arcs[index2[i] = i] = +value(data[i], i, data)) > 0) {
1929
1927
  sum += v;
1930
1928
  }
1931
1929
  }
1932
1930
  if (sortValues != null)
1933
- index.sort(function(i2, j2) {
1931
+ index2.sort(function(i2, j2) {
1934
1932
  return sortValues(arcs[i2], arcs[j2]);
1935
1933
  });
1936
1934
  else if (sort != null)
1937
- index.sort(function(i2, j2) {
1935
+ index2.sort(function(i2, j2) {
1938
1936
  return sort(data[i2], data[j2]);
1939
1937
  });
1940
1938
  for (i = 0, k = sum ? (da - n * pa) / sum : 0;i < n; ++i, a0 = a1) {
1941
- j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
1939
+ j = index2[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
1942
1940
  data: data[j],
1943
1941
  index: i,
1944
1942
  value: v,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/chart",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "SVG chart components for BarefootJS with signal-based reactivity",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "directory": "packages/chart"
40
40
  },
41
41
  "peerDependencies": {
42
- "@barefootjs/client": ">=0.0.1"
42
+ "@barefootjs/client": ">=0.1.1"
43
43
  },
44
44
  "dependencies": {
45
45
  "d3-array": "^3.2.4",