@mui/x-charts-vendor 7.12.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.
Files changed (312) hide show
  1. package/README.md +76 -0
  2. package/d3-color.d.ts +5 -0
  3. package/d3-color.js +7 -0
  4. package/d3-delaunay.d.ts +5 -0
  5. package/d3-delaunay.js +7 -0
  6. package/d3-interpolate.d.ts +5 -0
  7. package/d3-interpolate.js +7 -0
  8. package/d3-scale.d.ts +5 -0
  9. package/d3-scale.js +7 -0
  10. package/d3-shape.d.ts +5 -0
  11. package/d3-shape.js +7 -0
  12. package/d3-time.d.ts +5 -0
  13. package/d3-time.js +7 -0
  14. package/es/d3-array.js +6 -0
  15. package/es/d3-color.js +6 -0
  16. package/es/d3-delaunay.js +6 -0
  17. package/es/d3-format.js +6 -0
  18. package/es/d3-interpolate.js +6 -0
  19. package/es/d3-path.js +6 -0
  20. package/es/d3-scale.js +6 -0
  21. package/es/d3-shape.js +6 -0
  22. package/es/d3-time-format.js +6 -0
  23. package/es/d3-time.js +6 -0
  24. package/es/delaunator.js +6 -0
  25. package/es/internmap.js +6 -0
  26. package/es/robust-predicates.js +6 -0
  27. package/lib/d3-array.js +6 -0
  28. package/lib/d3-color.js +6 -0
  29. package/lib/d3-delaunay.js +6 -0
  30. package/lib/d3-format.js +6 -0
  31. package/lib/d3-interpolate.js +6 -0
  32. package/lib/d3-path.js +6 -0
  33. package/lib/d3-scale.js +6 -0
  34. package/lib/d3-shape.js +6 -0
  35. package/lib/d3-time-format.js +6 -0
  36. package/lib/d3-time.js +6 -0
  37. package/lib/delaunator.js +6 -0
  38. package/lib/internmap.js +6 -0
  39. package/lib/robust-predicates.js +6 -0
  40. package/lib-vendor/d3-array/LICENSE +13 -0
  41. package/lib-vendor/d3-array/dist/d3-array.js +1349 -0
  42. package/lib-vendor/d3-array/dist/d3-array.min.js +777 -0
  43. package/lib-vendor/d3-array/src/array.js +9 -0
  44. package/lib-vendor/d3-array/src/ascending.js +9 -0
  45. package/lib-vendor/d3-array/src/bin.js +126 -0
  46. package/lib-vendor/d3-array/src/bisect.js +15 -0
  47. package/lib-vendor/d3-array/src/bisector.js +59 -0
  48. package/lib-vendor/d3-array/src/blur.js +122 -0
  49. package/lib-vendor/d3-array/src/constant.js +9 -0
  50. package/lib-vendor/d3-array/src/count.js +24 -0
  51. package/lib-vendor/d3-array/src/cross.js +35 -0
  52. package/lib-vendor/d3-array/src/cumsum.js +11 -0
  53. package/lib-vendor/d3-array/src/descending.js +9 -0
  54. package/lib-vendor/d3-array/src/deviation.js +12 -0
  55. package/lib-vendor/d3-array/src/difference.js +16 -0
  56. package/lib-vendor/d3-array/src/disjoint.js +24 -0
  57. package/lib-vendor/d3-array/src/every.js +16 -0
  58. package/lib-vendor/d3-array/src/extent.js +35 -0
  59. package/lib-vendor/d3-array/src/filter.js +17 -0
  60. package/lib-vendor/d3-array/src/fsum.js +77 -0
  61. package/lib-vendor/d3-array/src/greatest.js +31 -0
  62. package/lib-vendor/d3-array/src/greatestIndex.js +23 -0
  63. package/lib-vendor/d3-array/src/group.js +67 -0
  64. package/lib-vendor/d3-array/src/groupSort.js +15 -0
  65. package/lib-vendor/d3-array/src/identity.js +9 -0
  66. package/lib-vendor/d3-array/src/index.js +539 -0
  67. package/lib-vendor/d3-array/src/intersection.js +23 -0
  68. package/lib-vendor/d3-array/src/least.js +31 -0
  69. package/lib-vendor/d3-array/src/leastIndex.js +23 -0
  70. package/lib-vendor/d3-array/src/map.js +11 -0
  71. package/lib-vendor/d3-array/src/max.js +24 -0
  72. package/lib-vendor/d3-array/src/maxIndex.js +26 -0
  73. package/lib-vendor/d3-array/src/mean.js +25 -0
  74. package/lib-vendor/d3-array/src/median.js +16 -0
  75. package/lib-vendor/d3-array/src/merge.js +14 -0
  76. package/lib-vendor/d3-array/src/min.js +24 -0
  77. package/lib-vendor/d3-array/src/minIndex.js +26 -0
  78. package/lib-vendor/d3-array/src/mode.js +33 -0
  79. package/lib-vendor/d3-array/src/nice.js +23 -0
  80. package/lib-vendor/d3-array/src/number.js +26 -0
  81. package/lib-vendor/d3-array/src/pairs.js +21 -0
  82. package/lib-vendor/d3-array/src/permute.js +9 -0
  83. package/lib-vendor/d3-array/src/quantile.js +55 -0
  84. package/lib-vendor/d3-array/src/quickselect.js +47 -0
  85. package/lib-vendor/d3-array/src/range.js +16 -0
  86. package/lib-vendor/d3-array/src/rank.js +30 -0
  87. package/lib-vendor/d3-array/src/reduce.js +28 -0
  88. package/lib-vendor/d3-array/src/reverse.js +10 -0
  89. package/lib-vendor/d3-array/src/scan.js +12 -0
  90. package/lib-vendor/d3-array/src/shuffle.js +20 -0
  91. package/lib-vendor/d3-array/src/some.js +16 -0
  92. package/lib-vendor/d3-array/src/sort.js +45 -0
  93. package/lib-vendor/d3-array/src/subset.js +11 -0
  94. package/lib-vendor/d3-array/src/sum.js +24 -0
  95. package/lib-vendor/d3-array/src/superset.js +28 -0
  96. package/lib-vendor/d3-array/src/threshold/freedmanDiaconis.js +14 -0
  97. package/lib-vendor/d3-array/src/threshold/scott.js +14 -0
  98. package/lib-vendor/d3-array/src/threshold/sturges.js +11 -0
  99. package/lib-vendor/d3-array/src/ticks.js +60 -0
  100. package/lib-vendor/d3-array/src/transpose.js +20 -0
  101. package/lib-vendor/d3-array/src/union.js +16 -0
  102. package/lib-vendor/d3-array/src/variance.js +31 -0
  103. package/lib-vendor/d3-array/src/zip.js +11 -0
  104. package/lib-vendor/d3-color/LICENSE +13 -0
  105. package/lib-vendor/d3-color/dist/d3-color.js +532 -0
  106. package/lib-vendor/d3-color/dist/d3-color.min.js +446 -0
  107. package/lib-vendor/d3-color/src/color.js +366 -0
  108. package/lib-vendor/d3-color/src/cubehelix.js +61 -0
  109. package/lib-vendor/d3-color/src/define.js +16 -0
  110. package/lib-vendor/d3-color/src/index.js +59 -0
  111. package/lib-vendor/d3-color/src/lab.js +117 -0
  112. package/lib-vendor/d3-color/src/math.js +8 -0
  113. package/lib-vendor/d3-delaunay/LICENSE +14 -0
  114. package/lib-vendor/d3-delaunay/dist/d3-delaunay.js +1398 -0
  115. package/lib-vendor/d3-delaunay/dist/d3-delaunay.min.js +853 -0
  116. package/lib-vendor/d3-delaunay/src/delaunay.js +282 -0
  117. package/lib-vendor/d3-delaunay/src/index.js +20 -0
  118. package/lib-vendor/d3-delaunay/src/path.js +43 -0
  119. package/lib-vendor/d3-delaunay/src/polygon.js +24 -0
  120. package/lib-vendor/d3-delaunay/src/voronoi.js +390 -0
  121. package/lib-vendor/d3-format/LICENSE +13 -0
  122. package/lib-vendor/d3-format/dist/d3-format.js +313 -0
  123. package/lib-vendor/d3-format/dist/d3-format.min.js +193 -0
  124. package/lib-vendor/d3-format/src/defaultLocale.js +23 -0
  125. package/lib-vendor/d3-format/src/exponent.js +10 -0
  126. package/lib-vendor/d3-format/src/formatDecimal.js +23 -0
  127. package/lib-vendor/d3-format/src/formatGroup.js +22 -0
  128. package/lib-vendor/d3-format/src/formatNumerals.js +13 -0
  129. package/lib-vendor/d3-format/src/formatPrefixAuto.js +18 -0
  130. package/lib-vendor/d3-format/src/formatRounded.js +14 -0
  131. package/lib-vendor/d3-format/src/formatSpecifier.js +42 -0
  132. package/lib-vendor/d3-format/src/formatTrim.js +25 -0
  133. package/lib-vendor/d3-format/src/formatTypes.js +25 -0
  134. package/lib-vendor/d3-format/src/identity.js +9 -0
  135. package/lib-vendor/d3-format/src/index.js +68 -0
  136. package/lib-vendor/d3-format/src/locale.js +152 -0
  137. package/lib-vendor/d3-format/src/precisionFixed.js +11 -0
  138. package/lib-vendor/d3-format/src/precisionPrefix.js +11 -0
  139. package/lib-vendor/d3-format/src/precisionRound.js +12 -0
  140. package/lib-vendor/d3-interpolate/LICENSE +13 -0
  141. package/lib-vendor/d3-interpolate/dist/d3-interpolate.js +543 -0
  142. package/lib-vendor/d3-interpolate/dist/d3-interpolate.min.js +362 -0
  143. package/lib-vendor/d3-interpolate/src/array.js +28 -0
  144. package/lib-vendor/d3-interpolate/src/basis.js +23 -0
  145. package/lib-vendor/d3-interpolate/src/basisClosed.js +18 -0
  146. package/lib-vendor/d3-interpolate/src/color.js +33 -0
  147. package/lib-vendor/d3-interpolate/src/constant.js +8 -0
  148. package/lib-vendor/d3-interpolate/src/cubehelix.js +32 -0
  149. package/lib-vendor/d3-interpolate/src/date.js +12 -0
  150. package/lib-vendor/d3-interpolate/src/discrete.js +12 -0
  151. package/lib-vendor/d3-interpolate/src/hcl.js +27 -0
  152. package/lib-vendor/d3-interpolate/src/hsl.js +27 -0
  153. package/lib-vendor/d3-interpolate/src/hue.js +14 -0
  154. package/lib-vendor/d3-interpolate/src/index.js +191 -0
  155. package/lib-vendor/d3-interpolate/src/lab.js +22 -0
  156. package/lib-vendor/d3-interpolate/src/number.js +11 -0
  157. package/lib-vendor/d3-interpolate/src/numberArray.js +20 -0
  158. package/lib-vendor/d3-interpolate/src/object.js +26 -0
  159. package/lib-vendor/d3-interpolate/src/piecewise.js +20 -0
  160. package/lib-vendor/d3-interpolate/src/quantize.js +11 -0
  161. package/lib-vendor/d3-interpolate/src/rgb.js +59 -0
  162. package/lib-vendor/d3-interpolate/src/round.js +11 -0
  163. package/lib-vendor/d3-interpolate/src/string.js +75 -0
  164. package/lib-vendor/d3-interpolate/src/transform/decompose.js +31 -0
  165. package/lib-vendor/d3-interpolate/src/transform/index.js +83 -0
  166. package/lib-vendor/d3-interpolate/src/transform/parse.js +25 -0
  167. package/lib-vendor/d3-interpolate/src/value.js +23 -0
  168. package/lib-vendor/d3-interpolate/src/zoom.js +66 -0
  169. package/lib-vendor/d3-path/LICENSE +13 -0
  170. package/lib-vendor/d3-path/dist/d3-path.js +161 -0
  171. package/lib-vendor/d3-path/dist/d3-path.min.js +92 -0
  172. package/lib-vendor/d3-path/src/index.js +24 -0
  173. package/lib-vendor/d3-path/src/path.js +158 -0
  174. package/lib-vendor/d3-scale/LICENSE +13 -0
  175. package/lib-vendor/d3-scale/dist/d3-scale.js +944 -0
  176. package/lib-vendor/d3-scale/dist/d3-scale.min.js +690 -0
  177. package/lib-vendor/d3-scale/src/band.js +87 -0
  178. package/lib-vendor/d3-scale/src/colors.js +11 -0
  179. package/lib-vendor/d3-scale/src/constant.js +11 -0
  180. package/lib-vendor/d3-scale/src/continuous.js +116 -0
  181. package/lib-vendor/d3-scale/src/diverging.js +91 -0
  182. package/lib-vendor/d3-scale/src/identity.js +27 -0
  183. package/lib-vendor/d3-scale/src/index.js +193 -0
  184. package/lib-vendor/d3-scale/src/init.js +38 -0
  185. package/lib-vendor/d3-scale/src/linear.js +67 -0
  186. package/lib-vendor/d3-scale/src/log.js +123 -0
  187. package/lib-vendor/d3-scale/src/nice.js +21 -0
  188. package/lib-vendor/d3-scale/src/number.js +9 -0
  189. package/lib-vendor/d3-scale/src/ordinal.js +44 -0
  190. package/lib-vendor/d3-scale/src/pow.js +44 -0
  191. package/lib-vendor/d3-scale/src/quantile.js +48 -0
  192. package/lib-vendor/d3-scale/src/quantize.js +46 -0
  193. package/lib-vendor/d3-scale/src/radial.js +53 -0
  194. package/lib-vendor/d3-scale/src/sequential.js +90 -0
  195. package/lib-vendor/d3-scale/src/sequentialQuantile.js +38 -0
  196. package/lib-vendor/d3-scale/src/symlog.js +35 -0
  197. package/lib-vendor/d3-scale/src/threshold.js +34 -0
  198. package/lib-vendor/d3-scale/src/tickFormat.js +37 -0
  199. package/lib-vendor/d3-scale/src/time.js +62 -0
  200. package/lib-vendor/d3-scale/src/utcTime.js +13 -0
  201. package/lib-vendor/d3-shape/LICENSE +13 -0
  202. package/lib-vendor/d3-shape/dist/d3-shape.js +2004 -0
  203. package/lib-vendor/d3-shape/dist/d3-shape.min.js +1389 -0
  204. package/lib-vendor/d3-shape/src/arc.js +250 -0
  205. package/lib-vendor/d3-shape/src/area.js +98 -0
  206. package/lib-vendor/d3-shape/src/areaRadial.js +42 -0
  207. package/lib-vendor/d3-shape/src/array.js +12 -0
  208. package/lib-vendor/d3-shape/src/constant.js +11 -0
  209. package/lib-vendor/d3-shape/src/curve/basis.js +62 -0
  210. package/lib-vendor/d3-shape/src/curve/basisClosed.js +70 -0
  211. package/lib-vendor/d3-shape/src/curve/basisOpen.js +54 -0
  212. package/lib-vendor/d3-shape/src/curve/bump.js +81 -0
  213. package/lib-vendor/d3-shape/src/curve/bundle.js +50 -0
  214. package/lib-vendor/d3-shape/src/curve/cardinal.js +69 -0
  215. package/lib-vendor/d3-shape/src/curve/cardinalClosed.js +76 -0
  216. package/lib-vendor/d3-shape/src/curve/cardinalOpen.js +60 -0
  217. package/lib-vendor/d3-shape/src/curve/catmullRom.js +92 -0
  218. package/lib-vendor/d3-shape/src/curve/catmullRomClosed.js +83 -0
  219. package/lib-vendor/d3-shape/src/curve/catmullRomOpen.js +67 -0
  220. package/lib-vendor/d3-shape/src/curve/linear.js +42 -0
  221. package/lib-vendor/d3-shape/src/curve/linearClosed.js +28 -0
  222. package/lib-vendor/d3-shape/src/curve/monotone.js +121 -0
  223. package/lib-vendor/d3-shape/src/curve/natural.js +67 -0
  224. package/lib-vendor/d3-shape/src/curve/radial.js +37 -0
  225. package/lib-vendor/d3-shape/src/curve/step.js +63 -0
  226. package/lib-vendor/d3-shape/src/descending.js +9 -0
  227. package/lib-vendor/d3-shape/src/identity.js +9 -0
  228. package/lib-vendor/d3-shape/src/index.js +436 -0
  229. package/lib-vendor/d3-shape/src/line.js +52 -0
  230. package/lib-vendor/d3-shape/src/lineRadial.js +24 -0
  231. package/lib-vendor/d3-shape/src/link.js +70 -0
  232. package/lib-vendor/d3-shape/src/math.js +26 -0
  233. package/lib-vendor/d3-shape/src/noop.js +7 -0
  234. package/lib-vendor/d3-shape/src/offset/diverging.js +20 -0
  235. package/lib-vendor/d3-shape/src/offset/expand.js +16 -0
  236. package/lib-vendor/d3-shape/src/offset/none.js +15 -0
  237. package/lib-vendor/d3-shape/src/offset/silhouette.js +16 -0
  238. package/lib-vendor/d3-shape/src/offset/wiggle.js +30 -0
  239. package/lib-vendor/d3-shape/src/order/appearance.js +23 -0
  240. package/lib-vendor/d3-shape/src/order/ascending.js +23 -0
  241. package/lib-vendor/d3-shape/src/order/descending.js +11 -0
  242. package/lib-vendor/d3-shape/src/order/insideOut.js +31 -0
  243. package/lib-vendor/d3-shape/src/order/none.js +12 -0
  244. package/lib-vendor/d3-shape/src/order/reverse.js +11 -0
  245. package/lib-vendor/d3-shape/src/path.js +22 -0
  246. package/lib-vendor/d3-shape/src/pie.js +79 -0
  247. package/lib-vendor/d3-shape/src/point.js +13 -0
  248. package/lib-vendor/d3-shape/src/pointRadial.js +9 -0
  249. package/lib-vendor/d3-shape/src/stack.js +55 -0
  250. package/lib-vendor/d3-shape/src/symbol/asterisk.js +21 -0
  251. package/lib-vendor/d3-shape/src/symbol/circle.js +14 -0
  252. package/lib-vendor/d3-shape/src/symbol/cross.js +25 -0
  253. package/lib-vendor/d3-shape/src/symbol/diamond.js +20 -0
  254. package/lib-vendor/d3-shape/src/symbol/diamond2.js +17 -0
  255. package/lib-vendor/d3-shape/src/symbol/plus.js +16 -0
  256. package/lib-vendor/d3-shape/src/symbol/square.js +14 -0
  257. package/lib-vendor/d3-shape/src/symbol/square2.js +17 -0
  258. package/lib-vendor/d3-shape/src/symbol/star.js +28 -0
  259. package/lib-vendor/d3-shape/src/symbol/times.js +16 -0
  260. package/lib-vendor/d3-shape/src/symbol/triangle.js +17 -0
  261. package/lib-vendor/d3-shape/src/symbol/triangle2.js +19 -0
  262. package/lib-vendor/d3-shape/src/symbol/wye.js +32 -0
  263. package/lib-vendor/d3-shape/src/symbol.js +50 -0
  264. package/lib-vendor/d3-time/LICENSE +13 -0
  265. package/lib-vendor/d3-time/dist/d3-time.js +367 -0
  266. package/lib-vendor/d3-time/dist/d3-time.min.js +190 -0
  267. package/lib-vendor/d3-time/src/day.js +30 -0
  268. package/lib-vendor/d3-time/src/duration.js +13 -0
  269. package/lib-vendor/d3-time/src/hour.js +28 -0
  270. package/lib-vendor/d3-time/src/index.js +417 -0
  271. package/lib-vendor/d3-time/src/interval.js +61 -0
  272. package/lib-vendor/d3-time/src/millisecond.js +29 -0
  273. package/lib-vendor/d3-time/src/minute.js +28 -0
  274. package/lib-vendor/d3-time/src/month.js +29 -0
  275. package/lib-vendor/d3-time/src/second.js +18 -0
  276. package/lib-vendor/d3-time/src/ticks.js +41 -0
  277. package/lib-vendor/d3-time/src/week.js +56 -0
  278. package/lib-vendor/d3-time/src/year.js +51 -0
  279. package/lib-vendor/d3-time-format/LICENSE +13 -0
  280. package/lib-vendor/d3-time-format/dist/d3-time-format.js +648 -0
  281. package/lib-vendor/d3-time-format/dist/d3-time-format.min.js +528 -0
  282. package/lib-vendor/d3-time-format/src/defaultLocale.js +32 -0
  283. package/lib-vendor/d3-time-format/src/index.js +60 -0
  284. package/lib-vendor/d3-time-format/src/isoFormat.js +13 -0
  285. package/lib-vendor/d3-time-format/src/isoParse.js +14 -0
  286. package/lib-vendor/d3-time-format/src/locale.js +606 -0
  287. package/lib-vendor/delaunator/LICENSE +15 -0
  288. package/lib-vendor/delaunator/delaunator.js +688 -0
  289. package/lib-vendor/delaunator/delaunator.min.js +316 -0
  290. package/lib-vendor/delaunator/index.js +440 -0
  291. package/lib-vendor/internmap/LICENSE +13 -0
  292. package/lib-vendor/internmap/dist/internmap.js +93 -0
  293. package/lib-vendor/internmap/dist/internmap.min.js +81 -0
  294. package/lib-vendor/internmap/src/index.js +87 -0
  295. package/lib-vendor/robust-predicates/LICENSE +24 -0
  296. package/lib-vendor/robust-predicates/esm/incircle.js +667 -0
  297. package/lib-vendor/robust-predicates/esm/insphere.js +693 -0
  298. package/lib-vendor/robust-predicates/esm/orient2d.js +174 -0
  299. package/lib-vendor/robust-predicates/esm/orient3d.js +422 -0
  300. package/lib-vendor/robust-predicates/esm/util.js +147 -0
  301. package/lib-vendor/robust-predicates/index.js +57 -0
  302. package/lib-vendor/robust-predicates/umd/incircle.js +798 -0
  303. package/lib-vendor/robust-predicates/umd/incircle.min.js +170 -0
  304. package/lib-vendor/robust-predicates/umd/insphere.js +828 -0
  305. package/lib-vendor/robust-predicates/umd/insphere.min.js +223 -0
  306. package/lib-vendor/robust-predicates/umd/orient2d.js +260 -0
  307. package/lib-vendor/robust-predicates/umd/orient2d.min.js +69 -0
  308. package/lib-vendor/robust-predicates/umd/orient3d.js +550 -0
  309. package/lib-vendor/robust-predicates/umd/orient3d.min.js +133 -0
  310. package/lib-vendor/robust-predicates/umd/predicates.js +2073 -0
  311. package/lib-vendor/robust-predicates/umd/predicates.min.js +468 -0
  312. package/package.json +63 -0
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = _default;
8
+ var _constant = _interopRequireDefault(require("./constant.js"));
9
+ var _math = require("./math.js");
10
+ var _path = require("./path.js");
11
+ function arcInnerRadius(d) {
12
+ return d.innerRadius;
13
+ }
14
+ function arcOuterRadius(d) {
15
+ return d.outerRadius;
16
+ }
17
+ function arcStartAngle(d) {
18
+ return d.startAngle;
19
+ }
20
+ function arcEndAngle(d) {
21
+ return d.endAngle;
22
+ }
23
+ function arcPadAngle(d) {
24
+ return d && d.padAngle; // Note: optional!
25
+ }
26
+ function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
27
+ var x10 = x1 - x0,
28
+ y10 = y1 - y0,
29
+ x32 = x3 - x2,
30
+ y32 = y3 - y2,
31
+ t = y32 * x10 - x32 * y10;
32
+ if (t * t < _math.epsilon) return;
33
+ t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
34
+ return [x0 + t * x10, y0 + t * y10];
35
+ }
36
+
37
+ // Compute perpendicular offset line of length rc.
38
+ // http://mathworld.wolfram.com/Circle-LineIntersection.html
39
+ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
40
+ var x01 = x0 - x1,
41
+ y01 = y0 - y1,
42
+ lo = (cw ? rc : -rc) / (0, _math.sqrt)(x01 * x01 + y01 * y01),
43
+ ox = lo * y01,
44
+ oy = -lo * x01,
45
+ x11 = x0 + ox,
46
+ y11 = y0 + oy,
47
+ x10 = x1 + ox,
48
+ y10 = y1 + oy,
49
+ x00 = (x11 + x10) / 2,
50
+ y00 = (y11 + y10) / 2,
51
+ dx = x10 - x11,
52
+ dy = y10 - y11,
53
+ d2 = dx * dx + dy * dy,
54
+ r = r1 - rc,
55
+ D = x11 * y10 - x10 * y11,
56
+ d = (dy < 0 ? -1 : 1) * (0, _math.sqrt)((0, _math.max)(0, r * r * d2 - D * D)),
57
+ cx0 = (D * dy - dx * d) / d2,
58
+ cy0 = (-D * dx - dy * d) / d2,
59
+ cx1 = (D * dy + dx * d) / d2,
60
+ cy1 = (-D * dx + dy * d) / d2,
61
+ dx0 = cx0 - x00,
62
+ dy0 = cy0 - y00,
63
+ dx1 = cx1 - x00,
64
+ dy1 = cy1 - y00;
65
+
66
+ // Pick the closer of the two intersection points.
67
+ // TODO Is there a faster way to determine which intersection to use?
68
+ if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
69
+ return {
70
+ cx: cx0,
71
+ cy: cy0,
72
+ x01: -ox,
73
+ y01: -oy,
74
+ x11: cx0 * (r1 / r - 1),
75
+ y11: cy0 * (r1 / r - 1)
76
+ };
77
+ }
78
+ function _default() {
79
+ var innerRadius = arcInnerRadius,
80
+ outerRadius = arcOuterRadius,
81
+ cornerRadius = (0, _constant.default)(0),
82
+ padRadius = null,
83
+ startAngle = arcStartAngle,
84
+ endAngle = arcEndAngle,
85
+ padAngle = arcPadAngle,
86
+ context = null,
87
+ path = (0, _path.withPath)(arc);
88
+ function arc() {
89
+ var buffer,
90
+ r,
91
+ r0 = +innerRadius.apply(this, arguments),
92
+ r1 = +outerRadius.apply(this, arguments),
93
+ a0 = startAngle.apply(this, arguments) - _math.halfPi,
94
+ a1 = endAngle.apply(this, arguments) - _math.halfPi,
95
+ da = (0, _math.abs)(a1 - a0),
96
+ cw = a1 > a0;
97
+ if (!context) context = buffer = path();
98
+
99
+ // Ensure that the outer radius is always larger than the inner radius.
100
+ if (r1 < r0) r = r1, r1 = r0, r0 = r;
101
+
102
+ // Is it a point?
103
+ if (!(r1 > _math.epsilon)) context.moveTo(0, 0);
104
+
105
+ // Or is it a circle or annulus?
106
+ else if (da > _math.tau - _math.epsilon) {
107
+ context.moveTo(r1 * (0, _math.cos)(a0), r1 * (0, _math.sin)(a0));
108
+ context.arc(0, 0, r1, a0, a1, !cw);
109
+ if (r0 > _math.epsilon) {
110
+ context.moveTo(r0 * (0, _math.cos)(a1), r0 * (0, _math.sin)(a1));
111
+ context.arc(0, 0, r0, a1, a0, cw);
112
+ }
113
+ }
114
+
115
+ // Or is it a circular or annular sector?
116
+ else {
117
+ var a01 = a0,
118
+ a11 = a1,
119
+ a00 = a0,
120
+ a10 = a1,
121
+ da0 = da,
122
+ da1 = da,
123
+ ap = padAngle.apply(this, arguments) / 2,
124
+ rp = ap > _math.epsilon && (padRadius ? +padRadius.apply(this, arguments) : (0, _math.sqrt)(r0 * r0 + r1 * r1)),
125
+ rc = (0, _math.min)((0, _math.abs)(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
126
+ rc0 = rc,
127
+ rc1 = rc,
128
+ t0,
129
+ t1;
130
+
131
+ // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
132
+ if (rp > _math.epsilon) {
133
+ var p0 = (0, _math.asin)(rp / r0 * (0, _math.sin)(ap)),
134
+ p1 = (0, _math.asin)(rp / r1 * (0, _math.sin)(ap));
135
+ if ((da0 -= p0 * 2) > _math.epsilon) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;else da0 = 0, a00 = a10 = (a0 + a1) / 2;
136
+ if ((da1 -= p1 * 2) > _math.epsilon) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;else da1 = 0, a01 = a11 = (a0 + a1) / 2;
137
+ }
138
+ var x01 = r1 * (0, _math.cos)(a01),
139
+ y01 = r1 * (0, _math.sin)(a01),
140
+ x10 = r0 * (0, _math.cos)(a10),
141
+ y10 = r0 * (0, _math.sin)(a10);
142
+
143
+ // Apply rounded corners?
144
+ if (rc > _math.epsilon) {
145
+ var x11 = r1 * (0, _math.cos)(a11),
146
+ y11 = r1 * (0, _math.sin)(a11),
147
+ x00 = r0 * (0, _math.cos)(a00),
148
+ y00 = r0 * (0, _math.sin)(a00),
149
+ oc;
150
+
151
+ // Restrict the corner radius according to the sector angle. If this
152
+ // intersection fails, it’s probably because the arc is too small, so
153
+ // disable the corner radius entirely.
154
+ if (da < _math.pi) {
155
+ if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
156
+ var ax = x01 - oc[0],
157
+ ay = y01 - oc[1],
158
+ bx = x11 - oc[0],
159
+ by = y11 - oc[1],
160
+ kc = 1 / (0, _math.sin)((0, _math.acos)((ax * bx + ay * by) / ((0, _math.sqrt)(ax * ax + ay * ay) * (0, _math.sqrt)(bx * bx + by * by))) / 2),
161
+ lc = (0, _math.sqrt)(oc[0] * oc[0] + oc[1] * oc[1]);
162
+ rc0 = (0, _math.min)(rc, (r0 - lc) / (kc - 1));
163
+ rc1 = (0, _math.min)(rc, (r1 - lc) / (kc + 1));
164
+ } else {
165
+ rc0 = rc1 = 0;
166
+ }
167
+ }
168
+ }
169
+
170
+ // Is the sector collapsed to a line?
171
+ if (!(da1 > _math.epsilon)) context.moveTo(x01, y01);
172
+
173
+ // Does the sector’s outer ring have rounded corners?
174
+ else if (rc1 > _math.epsilon) {
175
+ t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
176
+ t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
177
+ context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
178
+
179
+ // Have the corners merged?
180
+ if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, (0, _math.atan2)(t0.y01, t0.x01), (0, _math.atan2)(t1.y01, t1.x01), !cw);
181
+
182
+ // Otherwise, draw the two corners and the ring.
183
+ else {
184
+ context.arc(t0.cx, t0.cy, rc1, (0, _math.atan2)(t0.y01, t0.x01), (0, _math.atan2)(t0.y11, t0.x11), !cw);
185
+ context.arc(0, 0, r1, (0, _math.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _math.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
186
+ context.arc(t1.cx, t1.cy, rc1, (0, _math.atan2)(t1.y11, t1.x11), (0, _math.atan2)(t1.y01, t1.x01), !cw);
187
+ }
188
+ }
189
+
190
+ // Or is the outer ring just a circular arc?
191
+ else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
192
+
193
+ // Is there no inner ring, and it’s a circular sector?
194
+ // Or perhaps it’s an annular sector collapsed due to padding?
195
+ if (!(r0 > _math.epsilon) || !(da0 > _math.epsilon)) context.lineTo(x10, y10);
196
+
197
+ // Does the sector’s inner ring (or point) have rounded corners?
198
+ else if (rc0 > _math.epsilon) {
199
+ t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
200
+ t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
201
+ context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
202
+
203
+ // Have the corners merged?
204
+ if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, (0, _math.atan2)(t0.y01, t0.x01), (0, _math.atan2)(t1.y01, t1.x01), !cw);
205
+
206
+ // Otherwise, draw the two corners and the ring.
207
+ else {
208
+ context.arc(t0.cx, t0.cy, rc0, (0, _math.atan2)(t0.y01, t0.x01), (0, _math.atan2)(t0.y11, t0.x11), !cw);
209
+ context.arc(0, 0, r0, (0, _math.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _math.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), cw);
210
+ context.arc(t1.cx, t1.cy, rc0, (0, _math.atan2)(t1.y11, t1.x11), (0, _math.atan2)(t1.y01, t1.x01), !cw);
211
+ }
212
+ }
213
+
214
+ // Or is the inner ring just a circular arc?
215
+ else context.arc(0, 0, r0, a10, a00, cw);
216
+ }
217
+ context.closePath();
218
+ if (buffer) return context = null, buffer + "" || null;
219
+ }
220
+ arc.centroid = function () {
221
+ var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
222
+ a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - _math.pi / 2;
223
+ return [(0, _math.cos)(a) * r, (0, _math.sin)(a) * r];
224
+ };
225
+ arc.innerRadius = function (_) {
226
+ return arguments.length ? (innerRadius = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : innerRadius;
227
+ };
228
+ arc.outerRadius = function (_) {
229
+ return arguments.length ? (outerRadius = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : outerRadius;
230
+ };
231
+ arc.cornerRadius = function (_) {
232
+ return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : cornerRadius;
233
+ };
234
+ arc.padRadius = function (_) {
235
+ return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : padRadius;
236
+ };
237
+ arc.startAngle = function (_) {
238
+ return arguments.length ? (startAngle = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : startAngle;
239
+ };
240
+ arc.endAngle = function (_) {
241
+ return arguments.length ? (endAngle = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : endAngle;
242
+ };
243
+ arc.padAngle = function (_) {
244
+ return arguments.length ? (padAngle = typeof _ === "function" ? _ : (0, _constant.default)(+_), arc) : padAngle;
245
+ };
246
+ arc.context = function (_) {
247
+ return arguments.length ? (context = _ == null ? null : _, arc) : context;
248
+ };
249
+ return arc;
250
+ }
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = _default;
8
+ var _array = _interopRequireDefault(require("./array.js"));
9
+ var _constant = _interopRequireDefault(require("./constant.js"));
10
+ var _linear = _interopRequireDefault(require("./curve/linear.js"));
11
+ var _line = _interopRequireDefault(require("./line.js"));
12
+ var _path = require("./path.js");
13
+ var _point = require("./point.js");
14
+ function _default(x0, y0, y1) {
15
+ var x1 = null,
16
+ defined = (0, _constant.default)(true),
17
+ context = null,
18
+ curve = _linear.default,
19
+ output = null,
20
+ path = (0, _path.withPath)(area);
21
+ x0 = typeof x0 === "function" ? x0 : x0 === undefined ? _point.x : (0, _constant.default)(+x0);
22
+ y0 = typeof y0 === "function" ? y0 : y0 === undefined ? (0, _constant.default)(0) : (0, _constant.default)(+y0);
23
+ y1 = typeof y1 === "function" ? y1 : y1 === undefined ? _point.y : (0, _constant.default)(+y1);
24
+ function area(data) {
25
+ var i,
26
+ j,
27
+ k,
28
+ n = (data = (0, _array.default)(data)).length,
29
+ d,
30
+ defined0 = false,
31
+ buffer,
32
+ x0z = new Array(n),
33
+ y0z = new Array(n);
34
+ if (context == null) output = curve(buffer = path());
35
+ for (i = 0; i <= n; ++i) {
36
+ if (!(i < n && defined(d = data[i], i, data)) === defined0) {
37
+ if (defined0 = !defined0) {
38
+ j = i;
39
+ output.areaStart();
40
+ output.lineStart();
41
+ } else {
42
+ output.lineEnd();
43
+ output.lineStart();
44
+ for (k = i - 1; k >= j; --k) {
45
+ output.point(x0z[k], y0z[k]);
46
+ }
47
+ output.lineEnd();
48
+ output.areaEnd();
49
+ }
50
+ }
51
+ if (defined0) {
52
+ x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);
53
+ output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);
54
+ }
55
+ }
56
+ if (buffer) return output = null, buffer + "" || null;
57
+ }
58
+ function arealine() {
59
+ return (0, _line.default)().defined(defined).curve(curve).context(context);
60
+ }
61
+ area.x = function (_) {
62
+ return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constant.default)(+_), x1 = null, area) : x0;
63
+ };
64
+ area.x0 = function (_) {
65
+ return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constant.default)(+_), area) : x0;
66
+ };
67
+ area.x1 = function (_) {
68
+ return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constant.default)(+_), area) : x1;
69
+ };
70
+ area.y = function (_) {
71
+ return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constant.default)(+_), y1 = null, area) : y0;
72
+ };
73
+ area.y0 = function (_) {
74
+ return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constant.default)(+_), area) : y0;
75
+ };
76
+ area.y1 = function (_) {
77
+ return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constant.default)(+_), area) : y1;
78
+ };
79
+ area.lineX0 = area.lineY0 = function () {
80
+ return arealine().x(x0).y(y0);
81
+ };
82
+ area.lineY1 = function () {
83
+ return arealine().x(x0).y(y1);
84
+ };
85
+ area.lineX1 = function () {
86
+ return arealine().x(x1).y(y0);
87
+ };
88
+ area.defined = function (_) {
89
+ return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constant.default)(!!_), area) : defined;
90
+ };
91
+ area.curve = function (_) {
92
+ return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;
93
+ };
94
+ area.context = function (_) {
95
+ return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;
96
+ };
97
+ return area;
98
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = _default;
8
+ var _radial = _interopRequireWildcard(require("./curve/radial.js"));
9
+ var _area = _interopRequireDefault(require("./area.js"));
10
+ var _lineRadial = require("./lineRadial.js");
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+ function _default() {
14
+ var a = (0, _area.default)().curve(_radial.curveRadialLinear),
15
+ c = a.curve,
16
+ x0 = a.lineX0,
17
+ x1 = a.lineX1,
18
+ y0 = a.lineY0,
19
+ y1 = a.lineY1;
20
+ a.angle = a.x, delete a.x;
21
+ a.startAngle = a.x0, delete a.x0;
22
+ a.endAngle = a.x1, delete a.x1;
23
+ a.radius = a.y, delete a.y;
24
+ a.innerRadius = a.y0, delete a.y0;
25
+ a.outerRadius = a.y1, delete a.y1;
26
+ a.lineStartAngle = function () {
27
+ return (0, _lineRadial.lineRadial)(x0());
28
+ }, delete a.lineX0;
29
+ a.lineEndAngle = function () {
30
+ return (0, _lineRadial.lineRadial)(x1());
31
+ }, delete a.lineX1;
32
+ a.lineInnerRadius = function () {
33
+ return (0, _lineRadial.lineRadial)(y0());
34
+ }, delete a.lineY0;
35
+ a.lineOuterRadius = function () {
36
+ return (0, _lineRadial.lineRadial)(y1());
37
+ }, delete a.lineY1;
38
+ a.curve = function (_) {
39
+ return arguments.length ? c((0, _radial.default)(_)) : c()._curve;
40
+ };
41
+ return a;
42
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = _default;
7
+ exports.slice = void 0;
8
+ var slice = exports.slice = Array.prototype.slice;
9
+ function _default(x) {
10
+ return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like
11
+ : Array.from(x); // Map, Set, iterable, string, or anything else
12
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = _default;
7
+ function _default(x) {
8
+ return function constant() {
9
+ return x;
10
+ };
11
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Basis = Basis;
7
+ exports.default = _default;
8
+ exports.point = point;
9
+ function point(that, x, y) {
10
+ that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6);
11
+ }
12
+ function Basis(context) {
13
+ this._context = context;
14
+ }
15
+ Basis.prototype = {
16
+ areaStart: function () {
17
+ this._line = 0;
18
+ },
19
+ areaEnd: function () {
20
+ this._line = NaN;
21
+ },
22
+ lineStart: function () {
23
+ this._x0 = this._x1 = this._y0 = this._y1 = NaN;
24
+ this._point = 0;
25
+ },
26
+ lineEnd: function () {
27
+ switch (this._point) {
28
+ case 3:
29
+ point(this, this._x1, this._y1);
30
+ // falls through
31
+ case 2:
32
+ this._context.lineTo(this._x1, this._y1);
33
+ break;
34
+ }
35
+ if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
36
+ this._line = 1 - this._line;
37
+ },
38
+ point: function (x, y) {
39
+ x = +x, y = +y;
40
+ switch (this._point) {
41
+ case 0:
42
+ this._point = 1;
43
+ this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
44
+ break;
45
+ case 1:
46
+ this._point = 2;
47
+ break;
48
+ case 2:
49
+ this._point = 3;
50
+ this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
51
+ // falls through
52
+ default:
53
+ point(this, x, y);
54
+ break;
55
+ }
56
+ this._x0 = this._x1, this._x1 = x;
57
+ this._y0 = this._y1, this._y1 = y;
58
+ }
59
+ };
60
+ function _default(context) {
61
+ return new Basis(context);
62
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = _default;
8
+ var _noop = _interopRequireDefault(require("../noop.js"));
9
+ var _basis = require("./basis.js");
10
+ function BasisClosed(context) {
11
+ this._context = context;
12
+ }
13
+ BasisClosed.prototype = {
14
+ areaStart: _noop.default,
15
+ areaEnd: _noop.default,
16
+ lineStart: function () {
17
+ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
18
+ this._point = 0;
19
+ },
20
+ lineEnd: function () {
21
+ switch (this._point) {
22
+ case 1:
23
+ {
24
+ this._context.moveTo(this._x2, this._y2);
25
+ this._context.closePath();
26
+ break;
27
+ }
28
+ case 2:
29
+ {
30
+ this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);
31
+ this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);
32
+ this._context.closePath();
33
+ break;
34
+ }
35
+ case 3:
36
+ {
37
+ this.point(this._x2, this._y2);
38
+ this.point(this._x3, this._y3);
39
+ this.point(this._x4, this._y4);
40
+ break;
41
+ }
42
+ }
43
+ },
44
+ point: function (x, y) {
45
+ x = +x, y = +y;
46
+ switch (this._point) {
47
+ case 0:
48
+ this._point = 1;
49
+ this._x2 = x, this._y2 = y;
50
+ break;
51
+ case 1:
52
+ this._point = 2;
53
+ this._x3 = x, this._y3 = y;
54
+ break;
55
+ case 2:
56
+ this._point = 3;
57
+ this._x4 = x, this._y4 = y;
58
+ this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6);
59
+ break;
60
+ default:
61
+ (0, _basis.point)(this, x, y);
62
+ break;
63
+ }
64
+ this._x0 = this._x1, this._x1 = x;
65
+ this._y0 = this._y1, this._y1 = y;
66
+ }
67
+ };
68
+ function _default(context) {
69
+ return new BasisClosed(context);
70
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = _default;
7
+ var _basis = require("./basis.js");
8
+ function BasisOpen(context) {
9
+ this._context = context;
10
+ }
11
+ BasisOpen.prototype = {
12
+ areaStart: function () {
13
+ this._line = 0;
14
+ },
15
+ areaEnd: function () {
16
+ this._line = NaN;
17
+ },
18
+ lineStart: function () {
19
+ this._x0 = this._x1 = this._y0 = this._y1 = NaN;
20
+ this._point = 0;
21
+ },
22
+ lineEnd: function () {
23
+ if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
24
+ this._line = 1 - this._line;
25
+ },
26
+ point: function (x, y) {
27
+ x = +x, y = +y;
28
+ switch (this._point) {
29
+ case 0:
30
+ this._point = 1;
31
+ break;
32
+ case 1:
33
+ this._point = 2;
34
+ break;
35
+ case 2:
36
+ this._point = 3;
37
+ var x0 = (this._x0 + 4 * this._x1 + x) / 6,
38
+ y0 = (this._y0 + 4 * this._y1 + y) / 6;
39
+ this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0);
40
+ break;
41
+ case 3:
42
+ this._point = 4;
43
+ // falls through
44
+ default:
45
+ (0, _basis.point)(this, x, y);
46
+ break;
47
+ }
48
+ this._x0 = this._x1, this._x1 = x;
49
+ this._y0 = this._y1, this._y1 = y;
50
+ }
51
+ };
52
+ function _default(context) {
53
+ return new BasisOpen(context);
54
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.bumpRadial = bumpRadial;
8
+ exports.bumpX = bumpX;
9
+ exports.bumpY = bumpY;
10
+ var _pointRadial = _interopRequireDefault(require("../pointRadial.js"));
11
+ class Bump {
12
+ constructor(context, x) {
13
+ this._context = context;
14
+ this._x = x;
15
+ }
16
+ areaStart() {
17
+ this._line = 0;
18
+ }
19
+ areaEnd() {
20
+ this._line = NaN;
21
+ }
22
+ lineStart() {
23
+ this._point = 0;
24
+ }
25
+ lineEnd() {
26
+ if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
27
+ this._line = 1 - this._line;
28
+ }
29
+ point(x, y) {
30
+ x = +x, y = +y;
31
+ switch (this._point) {
32
+ case 0:
33
+ {
34
+ this._point = 1;
35
+ if (this._line) this._context.lineTo(x, y);else this._context.moveTo(x, y);
36
+ break;
37
+ }
38
+ case 1:
39
+ this._point = 2;
40
+ // falls through
41
+ default:
42
+ {
43
+ if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);
44
+ break;
45
+ }
46
+ }
47
+ this._x0 = x, this._y0 = y;
48
+ }
49
+ }
50
+ class BumpRadial {
51
+ constructor(context) {
52
+ this._context = context;
53
+ }
54
+ lineStart() {
55
+ this._point = 0;
56
+ }
57
+ lineEnd() {}
58
+ point(x, y) {
59
+ x = +x, y = +y;
60
+ if (this._point === 0) {
61
+ this._point = 1;
62
+ } else {
63
+ const p0 = (0, _pointRadial.default)(this._x0, this._y0);
64
+ const p1 = (0, _pointRadial.default)(this._x0, this._y0 = (this._y0 + y) / 2);
65
+ const p2 = (0, _pointRadial.default)(x, this._y0);
66
+ const p3 = (0, _pointRadial.default)(x, y);
67
+ this._context.moveTo(...p0);
68
+ this._context.bezierCurveTo(...p1, ...p2, ...p3);
69
+ }
70
+ this._x0 = x, this._y0 = y;
71
+ }
72
+ }
73
+ function bumpX(context) {
74
+ return new Bump(context, true);
75
+ }
76
+ function bumpY(context) {
77
+ return new Bump(context, false);
78
+ }
79
+ function bumpRadial(context) {
80
+ return new BumpRadial(context);
81
+ }