@redvars/peacock 3.3.0 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/{IndividualComponent-tDnXrOLV.js → IndividualComponent-Dt5xirYG.js} +2 -2
  2. package/dist/{IndividualComponent-tDnXrOLV.js.map → IndividualComponent-Dt5xirYG.js.map} +1 -1
  3. package/dist/array-D5vjT2Xm.js +14 -0
  4. package/dist/array-D5vjT2Xm.js.map +1 -0
  5. package/dist/assets/components.css +1 -1
  6. package/dist/assets/components.css.map +1 -1
  7. package/dist/assets/styles.css +1 -1
  8. package/dist/assets/styles.css.map +1 -1
  9. package/dist/{button-BGFJfbT2.js → button-ClzS8JLq.js} +3 -4
  10. package/dist/{button-BGFJfbT2.js.map → button-ClzS8JLq.js.map} +1 -1
  11. package/dist/button-group-BMS5WvaF.js +292 -0
  12. package/dist/button-group-BMS5WvaF.js.map +1 -0
  13. package/dist/button-group.js +6 -107
  14. package/dist/button-group.js.map +1 -1
  15. package/dist/button.js +3 -4
  16. package/dist/button.js.map +1 -1
  17. package/dist/card.js +104 -0
  18. package/dist/card.js.map +1 -0
  19. package/dist/chart-bar-DbnXQgvS.js +1121 -0
  20. package/dist/chart-bar-DbnXQgvS.js.map +1 -0
  21. package/dist/chart-bar.js +259 -0
  22. package/dist/chart-bar.js.map +1 -0
  23. package/dist/chart-donut.js +4 -2
  24. package/dist/chart-donut.js.map +1 -1
  25. package/dist/chart-doughnut.js +4 -2
  26. package/dist/chart-doughnut.js.map +1 -1
  27. package/dist/chart-pie.js +4 -2
  28. package/dist/chart-pie.js.map +1 -1
  29. package/dist/chart-stacked-bar.js +401 -0
  30. package/dist/chart-stacked-bar.js.map +1 -0
  31. package/dist/{class-map-DpeNtqCn.js → class-map-59YGWLnx.js} +9 -3
  32. package/dist/class-map-59YGWLnx.js.map +1 -0
  33. package/dist/clock.js +1 -1
  34. package/dist/code-editor.js +7 -7
  35. package/dist/code-editor.js.map +1 -1
  36. package/dist/code-highlighter.js +7 -25
  37. package/dist/code-highlighter.js.map +1 -1
  38. package/dist/custom-elements-jsdocs.json +8824 -5047
  39. package/dist/custom-elements.json +7468 -4147
  40. package/dist/index.js +16 -10
  41. package/dist/index.js.map +1 -1
  42. package/dist/number-counter.js +2 -2
  43. package/dist/{observe-theme-change-BISF-Gl5.js → observe-theme-change-pALI5fmV.js} +2 -2
  44. package/dist/{observe-theme-change-BISF-Gl5.js.map → observe-theme-change-pALI5fmV.js.map} +1 -1
  45. package/dist/peacock-loader.js +42 -1016
  46. package/dist/peacock-loader.js.map +1 -1
  47. package/dist/pie-Dz0IDiPt.js +537 -0
  48. package/dist/pie-Dz0IDiPt.js.map +1 -0
  49. package/dist/{slider-Dk9CFWTG.js → snackbar-74YCdMPL.js} +6205 -3206
  50. package/dist/snackbar-74YCdMPL.js.map +1 -0
  51. package/dist/src/accordion/accordion-item.d.ts +1 -0
  52. package/dist/src/breadcrumb/breadcrumb/breadcrumb.d.ts +2 -0
  53. package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +1 -0
  54. package/dist/src/button/button-group/button-group.d.ts +4 -0
  55. package/dist/src/card/card.d.ts +27 -0
  56. package/dist/src/card/index.d.ts +1 -0
  57. package/dist/src/chart-bar/chart-bar.d.ts +53 -0
  58. package/dist/src/chart-bar/chart-stacked-bar.d.ts +78 -0
  59. package/dist/src/chart-bar/index.d.ts +2 -0
  60. package/dist/src/code-editor/code-editor.d.ts +4 -3
  61. package/dist/src/code-highlighter/code-highlighter.d.ts +4 -7
  62. package/dist/src/index.d.ts +9 -0
  63. package/dist/src/menu/index.d.ts +3 -0
  64. package/dist/src/menu/menu/MenuSurfaceController.d.ts +18 -0
  65. package/dist/src/menu/menu/menu.d.ts +54 -12
  66. package/dist/src/menu/menu-item/menu-item.d.ts +12 -5
  67. package/dist/src/menu/sub-menu/sub-menu.d.ts +36 -0
  68. package/dist/src/pagination/index.d.ts +1 -0
  69. package/dist/src/pagination/pagination.d.ts +38 -0
  70. package/dist/src/popover/PopoverController.d.ts +4 -1
  71. package/dist/src/snackbar/index.d.ts +1 -0
  72. package/dist/src/snackbar/snackbar.d.ts +40 -0
  73. package/dist/src/table/index.d.ts +1 -0
  74. package/dist/src/table/table.d.ts +110 -0
  75. package/dist/src/tabs/tab-group.d.ts +5 -1
  76. package/dist/src/tabs/tab-panel.d.ts +2 -0
  77. package/dist/src/tabs/tab.d.ts +3 -1
  78. package/dist/src/tabs/tabs.d.ts +2 -0
  79. package/dist/src/tooltip/tooltip.d.ts +1 -3
  80. package/dist/src/tree-view/index.d.ts +2 -0
  81. package/dist/src/tree-view/tree-node.d.ts +69 -0
  82. package/dist/src/tree-view/tree-view.d.ts +40 -0
  83. package/dist/src/tree-view/wc-tree-view.d.ts +6 -0
  84. package/dist/{style-map-CfNHEkQp.js → style-map-DcB52w-l.js} +2 -2
  85. package/dist/{style-map-CfNHEkQp.js.map → style-map-DcB52w-l.js.map} +1 -1
  86. package/dist/test/card.test.d.ts +1 -0
  87. package/dist/test/chart-bar.test.d.ts +1 -0
  88. package/dist/test/icon.test.d.ts +1 -1
  89. package/dist/test/menu.test.d.ts +1 -0
  90. package/dist/test/snackbar.test.d.ts +1 -0
  91. package/dist/test/sub-menu.test.d.ts +1 -0
  92. package/dist/test/tree-view.test.d.ts +1 -0
  93. package/dist/{transform-DRuHEvar.js → transform-DSwFSqzD.js} +13 -558
  94. package/dist/transform-DSwFSqzD.js.map +1 -0
  95. package/dist/tsconfig.tsbuildinfo +1 -1
  96. package/dist/{unsafe-html-CV6Je6HL.js → unsafe-html-C2r3PyzF.js} +2 -2
  97. package/dist/{unsafe-html-CV6Je6HL.js.map → unsafe-html-C2r3PyzF.js.map} +1 -1
  98. package/package.json +1 -1
  99. package/readme.md +40 -40
  100. package/src/accordion/accordion-item.ts +2 -1
  101. package/src/breadcrumb/breadcrumb/breadcrumb.ts +3 -0
  102. package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +1 -0
  103. package/src/button/button-group/button-group.ts +6 -0
  104. package/src/card/card.scss +61 -0
  105. package/src/card/card.ts +38 -0
  106. package/src/card/index.ts +1 -0
  107. package/src/chart-bar/chart-bar.scss +58 -0
  108. package/src/chart-bar/chart-bar.ts +306 -0
  109. package/src/chart-bar/chart-stacked-bar.ts +402 -0
  110. package/src/chart-bar/index.ts +2 -0
  111. package/src/code-editor/code-editor.ts +4 -3
  112. package/src/code-highlighter/code-highlighter.ts +4 -22
  113. package/src/divider/divider.scss +2 -2
  114. package/src/empty-state/empty-state.scss +1 -1
  115. package/src/empty-state/empty-state.ts +1 -1
  116. package/src/index.ts +11 -2
  117. package/src/menu/index.ts +3 -0
  118. package/src/menu/menu/MenuSurfaceController.ts +61 -0
  119. package/src/menu/{menu-list/menu-list.scss → menu/menu.scss} +19 -4
  120. package/src/menu/menu/menu.ts +389 -81
  121. package/src/menu/menu-item/menu-item.ts +115 -36
  122. package/src/menu/sub-menu/sub-menu.scss +7 -0
  123. package/src/menu/sub-menu/sub-menu.ts +243 -0
  124. package/src/pagination/index.ts +1 -0
  125. package/src/pagination/pagination.scss +59 -0
  126. package/src/pagination/pagination.ts +135 -0
  127. package/src/peacock-loader.ts +39 -11
  128. package/src/popover/PopoverController.ts +13 -7
  129. package/src/snackbar/demo/index.html +29 -0
  130. package/src/snackbar/index.ts +1 -0
  131. package/src/snackbar/snackbar.scss +73 -0
  132. package/src/snackbar/snackbar.ts +151 -0
  133. package/src/table/index.ts +1 -0
  134. package/src/table/table.scss +174 -0
  135. package/src/table/table.ts +475 -0
  136. package/src/tabs/tab-group.ts +63 -28
  137. package/src/tabs/tab-panel.scss +3 -3
  138. package/src/tabs/tab-panel.ts +3 -0
  139. package/src/tabs/tab.scss +76 -2
  140. package/src/tabs/tab.ts +29 -6
  141. package/src/tabs/tabs.scss +6 -5
  142. package/src/tabs/tabs.ts +19 -5
  143. package/src/text/text.css-component.scss +6 -3
  144. package/src/tooltip/tooltip.scss +16 -13
  145. package/src/tooltip/tooltip.ts +7 -9
  146. package/src/tree-view/demo/index.html +57 -0
  147. package/src/tree-view/index.ts +2 -0
  148. package/src/tree-view/tree-node.scss +101 -0
  149. package/src/tree-view/tree-node.ts +268 -0
  150. package/src/tree-view/tree-view.scss +12 -0
  151. package/src/tree-view/tree-view.ts +182 -0
  152. package/src/tree-view/wc-tree-view.ts +9 -0
  153. package/dist/class-map-DpeNtqCn.js.map +0 -1
  154. package/dist/slider-Dk9CFWTG.js.map +0 -1
  155. package/dist/src/menu/menu-list/menu-list.d.ts +0 -22
  156. package/dist/state-8v48Exzh.js +0 -10
  157. package/dist/state-8v48Exzh.js.map +0 -1
  158. package/dist/transform-DRuHEvar.js.map +0 -1
  159. package/src/menu/menu-list/menu-list.ts +0 -48
@@ -194,7 +194,7 @@ function selection_select(select) {
194
194
  // selection; we don’t ever want to create a selection backed by a live
195
195
  // HTMLCollection or NodeList. However, note that selection.selectAll will use a
196
196
  // static NodeList as a group, since it safely derived from querySelectorAll.
197
- function array$1(x) {
197
+ function array(x) {
198
198
  return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
199
199
  }
200
200
 
@@ -210,7 +210,7 @@ function selectorAll(selector) {
210
210
 
211
211
  function arrayAll(select) {
212
212
  return function() {
213
- return array$1(select.apply(this, arguments));
213
+ return array(select.apply(this, arguments));
214
214
  };
215
215
  }
216
216
 
@@ -314,7 +314,7 @@ EnterNode.prototype = {
314
314
  querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }
315
315
  };
316
316
 
317
- function constant$2(x) {
317
+ function constant$1(x) {
318
318
  return function() {
319
319
  return x;
320
320
  };
@@ -401,7 +401,7 @@ function selection_data(value, key) {
401
401
  parents = this._parents,
402
402
  groups = this._groups;
403
403
 
404
- if (typeof value !== "function") value = constant$2(value);
404
+ if (typeof value !== "function") value = constant$1(value);
405
405
 
406
406
  for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
407
407
  var parent = parents[j],
@@ -1456,7 +1456,7 @@ function hsl2rgb(h, m1, m2) {
1456
1456
  : m1) * 255;
1457
1457
  }
1458
1458
 
1459
- var constant$1 = x => () => x;
1459
+ var constant = x => () => x;
1460
1460
 
1461
1461
  function linear(a, d) {
1462
1462
  return function(t) {
@@ -1472,13 +1472,13 @@ function exponential(a, b, y) {
1472
1472
 
1473
1473
  function gamma(y) {
1474
1474
  return (y = +y) === 1 ? nogamma : function(a, b) {
1475
- return b - a ? exponential(a, b, y) : constant$1(isNaN(a) ? b : a);
1475
+ return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
1476
1476
  };
1477
1477
  }
1478
1478
 
1479
1479
  function nogamma(a, b) {
1480
1480
  var d = b - a;
1481
- return d ? linear(a, d) : constant$1(isNaN(a) ? b : a);
1481
+ return d ? linear(a, d) : constant(isNaN(a) ? b : a);
1482
1482
  }
1483
1483
 
1484
1484
  var interpolateRgb = (function rgbGamma(y) {
@@ -1574,7 +1574,7 @@ function interpolateString(a, b) {
1574
1574
 
1575
1575
  var degrees = 180 / Math.PI;
1576
1576
 
1577
- var identity$1 = {
1577
+ var identity = {
1578
1578
  translateX: 0,
1579
1579
  translateY: 0,
1580
1580
  rotate: 0,
@@ -1604,14 +1604,14 @@ var svgNode;
1604
1604
  /* eslint-disable no-undef */
1605
1605
  function parseCss(value) {
1606
1606
  const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
1607
- return m.isIdentity ? identity$1 : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
1607
+ return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
1608
1608
  }
1609
1609
 
1610
1610
  function parseSvg(value) {
1611
- if (value == null) return identity$1;
1611
+ if (value == null) return identity;
1612
1612
  if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
1613
1613
  svgNode.setAttribute("transform", value);
1614
- if (!(value = svgNode.transform.baseVal.consolidate())) return identity$1;
1614
+ if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
1615
1615
  value = value.matrix;
1616
1616
  return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
1617
1617
  }
@@ -2665,152 +2665,6 @@ function selection_transition(name) {
2665
2665
  selection.prototype.interrupt = selection_interrupt;
2666
2666
  selection.prototype.transition = selection_transition;
2667
2667
 
2668
- const pi$1 = Math.PI,
2669
- tau$1 = 2 * pi$1,
2670
- epsilon$1 = 1e-6,
2671
- tauEpsilon = tau$1 - epsilon$1;
2672
-
2673
- function append(strings) {
2674
- this._ += strings[0];
2675
- for (let i = 1, n = strings.length; i < n; ++i) {
2676
- this._ += arguments[i] + strings[i];
2677
- }
2678
- }
2679
-
2680
- function appendRound(digits) {
2681
- let d = Math.floor(digits);
2682
- if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);
2683
- if (d > 15) return append;
2684
- const k = 10 ** d;
2685
- return function(strings) {
2686
- this._ += strings[0];
2687
- for (let i = 1, n = strings.length; i < n; ++i) {
2688
- this._ += Math.round(arguments[i] * k) / k + strings[i];
2689
- }
2690
- };
2691
- }
2692
-
2693
- class Path {
2694
- constructor(digits) {
2695
- this._x0 = this._y0 = // start of current subpath
2696
- this._x1 = this._y1 = null; // end of current subpath
2697
- this._ = "";
2698
- this._append = digits == null ? append : appendRound(digits);
2699
- }
2700
- moveTo(x, y) {
2701
- this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
2702
- }
2703
- closePath() {
2704
- if (this._x1 !== null) {
2705
- this._x1 = this._x0, this._y1 = this._y0;
2706
- this._append`Z`;
2707
- }
2708
- }
2709
- lineTo(x, y) {
2710
- this._append`L${this._x1 = +x},${this._y1 = +y}`;
2711
- }
2712
- quadraticCurveTo(x1, y1, x, y) {
2713
- this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
2714
- }
2715
- bezierCurveTo(x1, y1, x2, y2, x, y) {
2716
- this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
2717
- }
2718
- arcTo(x1, y1, x2, y2, r) {
2719
- x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
2720
-
2721
- // Is the radius negative? Error.
2722
- if (r < 0) throw new Error(`negative radius: ${r}`);
2723
-
2724
- let x0 = this._x1,
2725
- y0 = this._y1,
2726
- x21 = x2 - x1,
2727
- y21 = y2 - y1,
2728
- x01 = x0 - x1,
2729
- y01 = y0 - y1,
2730
- l01_2 = x01 * x01 + y01 * y01;
2731
-
2732
- // Is this path empty? Move to (x1,y1).
2733
- if (this._x1 === null) {
2734
- this._append`M${this._x1 = x1},${this._y1 = y1}`;
2735
- }
2736
-
2737
- // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
2738
- else if (!(l01_2 > epsilon$1));
2739
-
2740
- // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
2741
- // Equivalently, is (x1,y1) coincident with (x2,y2)?
2742
- // Or, is the radius zero? Line to (x1,y1).
2743
- else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r) {
2744
- this._append`L${this._x1 = x1},${this._y1 = y1}`;
2745
- }
2746
-
2747
- // Otherwise, draw an arc!
2748
- else {
2749
- let x20 = x2 - x0,
2750
- y20 = y2 - y0,
2751
- l21_2 = x21 * x21 + y21 * y21,
2752
- l20_2 = x20 * x20 + y20 * y20,
2753
- l21 = Math.sqrt(l21_2),
2754
- l01 = Math.sqrt(l01_2),
2755
- l = r * Math.tan((pi$1 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
2756
- t01 = l / l01,
2757
- t21 = l / l21;
2758
-
2759
- // If the start tangent is not coincident with (x0,y0), line to.
2760
- if (Math.abs(t01 - 1) > epsilon$1) {
2761
- this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
2762
- }
2763
-
2764
- this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
2765
- }
2766
- }
2767
- arc(x, y, r, a0, a1, ccw) {
2768
- x = +x, y = +y, r = +r, ccw = !!ccw;
2769
-
2770
- // Is the radius negative? Error.
2771
- if (r < 0) throw new Error(`negative radius: ${r}`);
2772
-
2773
- let dx = r * Math.cos(a0),
2774
- dy = r * Math.sin(a0),
2775
- x0 = x + dx,
2776
- y0 = y + dy,
2777
- cw = 1 ^ ccw,
2778
- da = ccw ? a0 - a1 : a1 - a0;
2779
-
2780
- // Is this path empty? Move to (x0,y0).
2781
- if (this._x1 === null) {
2782
- this._append`M${x0},${y0}`;
2783
- }
2784
-
2785
- // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
2786
- else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) {
2787
- this._append`L${x0},${y0}`;
2788
- }
2789
-
2790
- // Is this arc empty? We’re done.
2791
- if (!r) return;
2792
-
2793
- // Does the angle go the wrong way? Flip the direction.
2794
- if (da < 0) da = da % tau$1 + tau$1;
2795
-
2796
- // Is this a complete circle? Draw two arcs to complete the circle.
2797
- if (da > tauEpsilon) {
2798
- this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
2799
- }
2800
-
2801
- // Is this arc non-empty? Draw an arc!
2802
- else if (da > epsilon$1) {
2803
- this._append`A${r},${r},0,${+(da >= pi$1)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
2804
- }
2805
- }
2806
- rect(x, y, w, h) {
2807
- this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
2808
- }
2809
- toString() {
2810
- return this._;
2811
- }
2812
- }
2813
-
2814
2668
  function initRange(domain, range) {
2815
2669
  switch (arguments.length) {
2816
2670
  case 0: break;
@@ -2864,405 +2718,6 @@ function ordinal() {
2864
2718
  return scale;
2865
2719
  }
2866
2720
 
2867
- function constant(x) {
2868
- return function constant() {
2869
- return x;
2870
- };
2871
- }
2872
-
2873
- const abs = Math.abs;
2874
- const atan2 = Math.atan2;
2875
- const cos = Math.cos;
2876
- const max = Math.max;
2877
- const min = Math.min;
2878
- const sin = Math.sin;
2879
- const sqrt = Math.sqrt;
2880
-
2881
- const epsilon = 1e-12;
2882
- const pi = Math.PI;
2883
- const halfPi = pi / 2;
2884
- const tau = 2 * pi;
2885
-
2886
- function acos(x) {
2887
- return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
2888
- }
2889
-
2890
- function asin(x) {
2891
- return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
2892
- }
2893
-
2894
- function withPath(shape) {
2895
- let digits = 3;
2896
-
2897
- shape.digits = function(_) {
2898
- if (!arguments.length) return digits;
2899
- if (_ == null) {
2900
- digits = null;
2901
- } else {
2902
- const d = Math.floor(_);
2903
- if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
2904
- digits = d;
2905
- }
2906
- return shape;
2907
- };
2908
-
2909
- return () => new Path(digits);
2910
- }
2911
-
2912
- function arcInnerRadius(d) {
2913
- return d.innerRadius;
2914
- }
2915
-
2916
- function arcOuterRadius(d) {
2917
- return d.outerRadius;
2918
- }
2919
-
2920
- function arcStartAngle(d) {
2921
- return d.startAngle;
2922
- }
2923
-
2924
- function arcEndAngle(d) {
2925
- return d.endAngle;
2926
- }
2927
-
2928
- function arcPadAngle(d) {
2929
- return d && d.padAngle; // Note: optional!
2930
- }
2931
-
2932
- function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
2933
- var x10 = x1 - x0, y10 = y1 - y0,
2934
- x32 = x3 - x2, y32 = y3 - y2,
2935
- t = y32 * x10 - x32 * y10;
2936
- if (t * t < epsilon) return;
2937
- t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
2938
- return [x0 + t * x10, y0 + t * y10];
2939
- }
2940
-
2941
- // Compute perpendicular offset line of length rc.
2942
- // http://mathworld.wolfram.com/Circle-LineIntersection.html
2943
- function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
2944
- var x01 = x0 - x1,
2945
- y01 = y0 - y1,
2946
- lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
2947
- ox = lo * y01,
2948
- oy = -lo * x01,
2949
- x11 = x0 + ox,
2950
- y11 = y0 + oy,
2951
- x10 = x1 + ox,
2952
- y10 = y1 + oy,
2953
- x00 = (x11 + x10) / 2,
2954
- y00 = (y11 + y10) / 2,
2955
- dx = x10 - x11,
2956
- dy = y10 - y11,
2957
- d2 = dx * dx + dy * dy,
2958
- r = r1 - rc,
2959
- D = x11 * y10 - x10 * y11,
2960
- d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),
2961
- cx0 = (D * dy - dx * d) / d2,
2962
- cy0 = (-D * dx - dy * d) / d2,
2963
- cx1 = (D * dy + dx * d) / d2,
2964
- cy1 = (-D * dx + dy * d) / d2,
2965
- dx0 = cx0 - x00,
2966
- dy0 = cy0 - y00,
2967
- dx1 = cx1 - x00,
2968
- dy1 = cy1 - y00;
2969
-
2970
- // Pick the closer of the two intersection points.
2971
- // TODO Is there a faster way to determine which intersection to use?
2972
- if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
2973
-
2974
- return {
2975
- cx: cx0,
2976
- cy: cy0,
2977
- x01: -ox,
2978
- y01: -oy,
2979
- x11: cx0 * (r1 / r - 1),
2980
- y11: cy0 * (r1 / r - 1)
2981
- };
2982
- }
2983
-
2984
- function arc() {
2985
- var innerRadius = arcInnerRadius,
2986
- outerRadius = arcOuterRadius,
2987
- cornerRadius = constant(0),
2988
- padRadius = null,
2989
- startAngle = arcStartAngle,
2990
- endAngle = arcEndAngle,
2991
- padAngle = arcPadAngle,
2992
- context = null,
2993
- path = withPath(arc);
2994
-
2995
- function arc() {
2996
- var buffer,
2997
- r,
2998
- r0 = +innerRadius.apply(this, arguments),
2999
- r1 = +outerRadius.apply(this, arguments),
3000
- a0 = startAngle.apply(this, arguments) - halfPi,
3001
- a1 = endAngle.apply(this, arguments) - halfPi,
3002
- da = abs(a1 - a0),
3003
- cw = a1 > a0;
3004
-
3005
- if (!context) context = buffer = path();
3006
-
3007
- // Ensure that the outer radius is always larger than the inner radius.
3008
- if (r1 < r0) r = r1, r1 = r0, r0 = r;
3009
-
3010
- // Is it a point?
3011
- if (!(r1 > epsilon)) context.moveTo(0, 0);
3012
-
3013
- // Or is it a circle or annulus?
3014
- else if (da > tau - epsilon) {
3015
- context.moveTo(r1 * cos(a0), r1 * sin(a0));
3016
- context.arc(0, 0, r1, a0, a1, !cw);
3017
- if (r0 > epsilon) {
3018
- context.moveTo(r0 * cos(a1), r0 * sin(a1));
3019
- context.arc(0, 0, r0, a1, a0, cw);
3020
- }
3021
- }
3022
-
3023
- // Or is it a circular or annular sector?
3024
- else {
3025
- var a01 = a0,
3026
- a11 = a1,
3027
- a00 = a0,
3028
- a10 = a1,
3029
- da0 = da,
3030
- da1 = da,
3031
- ap = padAngle.apply(this, arguments) / 2,
3032
- rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
3033
- rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
3034
- rc0 = rc,
3035
- rc1 = rc,
3036
- t0,
3037
- t1;
3038
-
3039
- // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
3040
- if (rp > epsilon) {
3041
- var p0 = asin(rp / r0 * sin(ap)),
3042
- p1 = asin(rp / r1 * sin(ap));
3043
- if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;
3044
- else da0 = 0, a00 = a10 = (a0 + a1) / 2;
3045
- if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;
3046
- else da1 = 0, a01 = a11 = (a0 + a1) / 2;
3047
- }
3048
-
3049
- var x01 = r1 * cos(a01),
3050
- y01 = r1 * sin(a01),
3051
- x10 = r0 * cos(a10),
3052
- y10 = r0 * sin(a10);
3053
-
3054
- // Apply rounded corners?
3055
- if (rc > epsilon) {
3056
- var x11 = r1 * cos(a11),
3057
- y11 = r1 * sin(a11),
3058
- x00 = r0 * cos(a00),
3059
- y00 = r0 * sin(a00),
3060
- oc;
3061
-
3062
- // Restrict the corner radius according to the sector angle. If this
3063
- // intersection fails, it’s probably because the arc is too small, so
3064
- // disable the corner radius entirely.
3065
- if (da < pi) {
3066
- if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
3067
- var ax = x01 - oc[0],
3068
- ay = y01 - oc[1],
3069
- bx = x11 - oc[0],
3070
- by = y11 - oc[1],
3071
- kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
3072
- lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
3073
- rc0 = min(rc, (r0 - lc) / (kc - 1));
3074
- rc1 = min(rc, (r1 - lc) / (kc + 1));
3075
- } else {
3076
- rc0 = rc1 = 0;
3077
- }
3078
- }
3079
- }
3080
-
3081
- // Is the sector collapsed to a line?
3082
- if (!(da1 > epsilon)) context.moveTo(x01, y01);
3083
-
3084
- // Does the sector’s outer ring have rounded corners?
3085
- else if (rc1 > epsilon) {
3086
- t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
3087
- t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
3088
-
3089
- context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
3090
-
3091
- // Have the corners merged?
3092
- if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
3093
-
3094
- // Otherwise, draw the two corners and the ring.
3095
- else {
3096
- context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
3097
- context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
3098
- context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
3099
- }
3100
- }
3101
-
3102
- // Or is the outer ring just a circular arc?
3103
- else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
3104
-
3105
- // Is there no inner ring, and it’s a circular sector?
3106
- // Or perhaps it’s an annular sector collapsed due to padding?
3107
- if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);
3108
-
3109
- // Does the sector’s inner ring (or point) have rounded corners?
3110
- else if (rc0 > epsilon) {
3111
- t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
3112
- t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
3113
-
3114
- context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
3115
-
3116
- // Have the corners merged?
3117
- if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
3118
-
3119
- // Otherwise, draw the two corners and the ring.
3120
- else {
3121
- context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
3122
- context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
3123
- context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
3124
- }
3125
- }
3126
-
3127
- // Or is the inner ring just a circular arc?
3128
- else context.arc(0, 0, r0, a10, a00, cw);
3129
- }
3130
-
3131
- context.closePath();
3132
-
3133
- if (buffer) return context = null, buffer + "" || null;
3134
- }
3135
-
3136
- arc.centroid = function() {
3137
- var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
3138
- a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
3139
- return [cos(a) * r, sin(a) * r];
3140
- };
3141
-
3142
- arc.innerRadius = function(_) {
3143
- return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
3144
- };
3145
-
3146
- arc.outerRadius = function(_) {
3147
- return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
3148
- };
3149
-
3150
- arc.cornerRadius = function(_) {
3151
- return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
3152
- };
3153
-
3154
- arc.padRadius = function(_) {
3155
- return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
3156
- };
3157
-
3158
- arc.startAngle = function(_) {
3159
- return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
3160
- };
3161
-
3162
- arc.endAngle = function(_) {
3163
- return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
3164
- };
3165
-
3166
- arc.padAngle = function(_) {
3167
- return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
3168
- };
3169
-
3170
- arc.context = function(_) {
3171
- return arguments.length ? ((context = _ == null ? null : _), arc) : context;
3172
- };
3173
-
3174
- return arc;
3175
- }
3176
-
3177
- function array(x) {
3178
- return typeof x === "object" && "length" in x
3179
- ? x // Array, TypedArray, NodeList, array-like
3180
- : Array.from(x); // Map, Set, iterable, string, or anything else
3181
- }
3182
-
3183
- function descending(a, b) {
3184
- return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
3185
- }
3186
-
3187
- function identity(d) {
3188
- return d;
3189
- }
3190
-
3191
- function pie() {
3192
- var value = identity,
3193
- sortValues = descending,
3194
- sort = null,
3195
- startAngle = constant(0),
3196
- endAngle = constant(tau),
3197
- padAngle = constant(0);
3198
-
3199
- function pie(data) {
3200
- var i,
3201
- n = (data = array(data)).length,
3202
- j,
3203
- k,
3204
- sum = 0,
3205
- index = new Array(n),
3206
- arcs = new Array(n),
3207
- a0 = +startAngle.apply(this, arguments),
3208
- da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),
3209
- a1,
3210
- p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),
3211
- pa = p * (da < 0 ? -1 : 1),
3212
- v;
3213
-
3214
- for (i = 0; i < n; ++i) {
3215
- if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
3216
- sum += v;
3217
- }
3218
- }
3219
-
3220
- // Optionally sort the arcs by previously-computed values or by data.
3221
- if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });
3222
- else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });
3223
-
3224
- // Compute the arcs! They are stored in the original data's order.
3225
- for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
3226
- j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
3227
- data: data[j],
3228
- index: i,
3229
- value: v,
3230
- startAngle: a0,
3231
- endAngle: a1,
3232
- padAngle: p
3233
- };
3234
- }
3235
-
3236
- return arcs;
3237
- }
3238
-
3239
- pie.value = function(_) {
3240
- return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value;
3241
- };
3242
-
3243
- pie.sortValues = function(_) {
3244
- return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
3245
- };
3246
-
3247
- pie.sort = function(_) {
3248
- return arguments.length ? (sort = _, sortValues = null, pie) : sort;
3249
- };
3250
-
3251
- pie.startAngle = function(_) {
3252
- return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle;
3253
- };
3254
-
3255
- pie.endAngle = function(_) {
3256
- return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle;
3257
- };
3258
-
3259
- pie.padAngle = function(_) {
3260
- return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle;
3261
- };
3262
-
3263
- return pie;
3264
- }
3265
-
3266
2721
  function Transform(k, x, y) {
3267
2722
  this.k = k;
3268
2723
  this.x = x;
@@ -3308,5 +2763,5 @@ Transform.prototype = {
3308
2763
 
3309
2764
  Transform.prototype;
3310
2765
 
3311
- export { arc as a, cubicInOut as c, interpolateNumber as i, ordinal as o, pie as p, select as s };
3312
- //# sourceMappingURL=transform-DRuHEvar.js.map
2766
+ export { constant as a, color as b, cubicInOut as c, interpolateRgb as d, interpolateString as e, initRange as f, interpolateNumber as i, ordinal as o, select as s };
2767
+ //# sourceMappingURL=transform-DSwFSqzD.js.map