@cloudflare/chart-hierarchical
Advanced tools
Comparing version 3.7.6 to 4.0.0
@@ -1,3 +0,5 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var _excluded = ["onHover"]; | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -14,18 +16,21 @@ | ||
import { createComponent } from '@cloudflare/style-container'; | ||
const ChartTooltip = createComponent(({ | ||
theme | ||
}) => ({ | ||
maxWidth: 360, | ||
color: theme.colors.gray[8], | ||
backgroundColor: `${transparentize(0.2, theme.colors.black)} !important`, | ||
border: '1px solid', | ||
borderColor: transparentize(0.4, theme.colors.gray[8]) | ||
}), ReactTooltip); | ||
var ChartTooltip = createComponent(_ref => { | ||
var { | ||
theme | ||
} = _ref; | ||
return { | ||
maxWidth: 360, | ||
color: theme.colors.gray[8], | ||
backgroundColor: "".concat(transparentize(0.2, theme.colors.black), " !important"), | ||
border: '1px solid', | ||
borderColor: transparentize(0.4, theme.colors.gray[8]) | ||
}; | ||
}, ReactTooltip); | ||
const withChartTooltip = Comp => { | ||
var _class, _temp; | ||
var withChartTooltip = Comp => { | ||
var _class; | ||
return _temp = _class = class HierarchicalChart extends React.PureComponent { | ||
constructor(...args) { | ||
super(...args); | ||
return _class = class HierarchicalChart extends React.PureComponent { | ||
constructor() { | ||
super(...arguments); | ||
@@ -46,7 +51,10 @@ _defineProperty(this, "state", { | ||
_defineProperty(this, "_getTooltipContent", () => { | ||
const _this$props = this.props, | ||
showTooltip = _this$props.showTooltip, | ||
tooltipTitle = _this$props.tooltipTitle, | ||
tooltipContent = _this$props.tooltipContent; | ||
const hoverNode = this.state.hoverNode; | ||
var { | ||
showTooltip, | ||
tooltipTitle, | ||
tooltipContent | ||
} = this.props; | ||
var { | ||
hoverNode | ||
} = this.state; | ||
return !!hoverNode && !!showTooltip(hoverNode.data, hoverNode) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("b", null, tooltipTitle(hoverNode.data, hoverNode)), /*#__PURE__*/React.createElement("div", null, tooltipContent(hoverNode.data, hoverNode))); | ||
@@ -61,7 +69,9 @@ }); | ||
render() { | ||
const _this$props2 = this.props, | ||
_ = _this$props2.onHover, | ||
outerProps = _objectWithoutProperties(_this$props2, ["onHover"]); | ||
var _this$props = this.props, | ||
{ | ||
onHover: _ | ||
} = _this$props, | ||
outerProps = _objectWithoutProperties(_this$props, _excluded); | ||
const tooltipId = `tooltip-${this.chartId}`; | ||
var tooltipId = "tooltip-".concat(this.chartId); | ||
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Comp, _extends({ | ||
@@ -88,5 +98,5 @@ chartId: this.chartId, | ||
onHover: () => {} | ||
}), _temp; | ||
}), _class; | ||
}; | ||
export default withChartTooltip; |
@@ -0,1 +1,4 @@ | ||
var _excluded = ["zoomK", "borderWidth"], | ||
_excluded2 = ["zoomK"]; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -5,3 +8,3 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -15,6 +18,6 @@ import React from 'react'; | ||
import { isDark } from '@cloudflare/util-color'; | ||
const LABELS_OPACITY_SCALE = scaleLinear().domain([20, 50]).range([0, 1]); | ||
var LABELS_OPACITY_SCALE = scaleLinear().domain([20, 50]).range([0, 1]); | ||
const withZoomK = Comp => { | ||
const CompWithZoomK = props => /*#__PURE__*/React.createElement(Subscriber, { | ||
var withZoomK = Comp => { | ||
var CompWithZoomK = props => /*#__PURE__*/React.createElement(Subscriber, { | ||
channel: "zoomK" | ||
@@ -28,25 +31,33 @@ }, zoomK => /*#__PURE__*/React.createElement(Comp, _extends({ | ||
const CircleWrapper = createComponent(({ | ||
dim | ||
}) => ({ | ||
opacity: dim ? 0.2 : 1, | ||
transition: 'opacity .4s ease-in-out' | ||
}), 'g'); | ||
const StyledCircle = createComponent(({ | ||
theme | ||
}) => ({ | ||
cursor: 'pointer', | ||
stroke: theme.colors.gray[7], | ||
shapeRendering: 'crispEdges', | ||
strokeOpacity: 0.4, | ||
transition: 'stroke-opacity .4s', | ||
'&:hover': { | ||
strokeOpacity: 1, | ||
transition: 'stroke-opacity .05s' | ||
} | ||
}), 'circle'); | ||
const CircleElement = withZoomK((_ref) => { | ||
let zoomK = _ref.zoomK, | ||
borderWidth = _ref.borderWidth, | ||
props = _objectWithoutProperties(_ref, ["zoomK", "borderWidth"]); | ||
var CircleWrapper = createComponent(_ref => { | ||
var { | ||
dim | ||
} = _ref; | ||
return { | ||
opacity: dim ? 0.2 : 1, | ||
transition: 'opacity .4s ease-in-out' | ||
}; | ||
}, 'g'); | ||
var StyledCircle = createComponent(_ref2 => { | ||
var { | ||
theme | ||
} = _ref2; | ||
return { | ||
cursor: 'pointer', | ||
stroke: theme.colors.gray[7], | ||
shapeRendering: 'crispEdges', | ||
strokeOpacity: 0.4, | ||
transition: 'stroke-opacity .4s', | ||
'&:hover': { | ||
strokeOpacity: 1, | ||
transition: 'stroke-opacity .05s' | ||
} | ||
}; | ||
}, 'circle'); | ||
var CircleElement = withZoomK(_ref3 => { | ||
var { | ||
zoomK, | ||
borderWidth | ||
} = _ref3, | ||
props = _objectWithoutProperties(_ref3, _excluded); | ||
@@ -57,50 +68,59 @@ return /*#__PURE__*/React.createElement(StyledCircle, _extends({ | ||
}); | ||
const StyledCircleText = createComponent(({ | ||
theme, | ||
light, | ||
subtitle = false | ||
}) => ({ | ||
fontSize: theme.fontSizes[subtitle ? 0 : 1], | ||
opacity: subtitle ? 0.6 : 1, | ||
pointerEvents: 'none', | ||
userSelect: 'none', | ||
textAnchor: 'middle', | ||
fill: light ? theme.colors.gray[9] : theme.colors.gray[2] | ||
}), 'text'); | ||
const CircleText = withZoomK((_ref2) => { | ||
let zoomK = _ref2.zoomK, | ||
props = _objectWithoutProperties(_ref2, ["zoomK"]); | ||
var StyledCircleText = createComponent(_ref4 => { | ||
var { | ||
theme, | ||
light, | ||
subtitle = false | ||
} = _ref4; | ||
return { | ||
fontSize: theme.fontSizes[subtitle ? 0 : 1], | ||
opacity: subtitle ? 0.6 : 1, | ||
pointerEvents: 'none', | ||
userSelect: 'none', | ||
textAnchor: 'middle', | ||
fill: light ? theme.colors.gray[9] : theme.colors.gray[2] | ||
}; | ||
}, 'text'); | ||
var CircleText = withZoomK(_ref5 => { | ||
var { | ||
zoomK | ||
} = _ref5, | ||
props = _objectWithoutProperties(_ref5, _excluded2); | ||
return /*#__PURE__*/React.createElement(StyledCircleText, _extends({ | ||
transform: `scale(${1 / zoomK})` | ||
transform: "scale(".concat(1 / zoomK, ")") | ||
}, props)); | ||
}); | ||
const CircleLabels = withZoomK(({ | ||
diameter, | ||
zoomK, | ||
children | ||
}) => /*#__PURE__*/React.createElement("g", { | ||
style: { | ||
opacity: LABELS_OPACITY_SCALE(diameter * zoomK) | ||
} | ||
}, children)); | ||
var CircleLabels = withZoomK(_ref6 => { | ||
var { | ||
diameter, | ||
zoomK, | ||
children | ||
} = _ref6; | ||
return /*#__PURE__*/React.createElement("g", { | ||
style: { | ||
opacity: LABELS_OPACITY_SCALE(diameter * zoomK) | ||
} | ||
}, children); | ||
}); | ||
class Circle extends React.PureComponent { | ||
render() { | ||
const _this$props = this.props, | ||
circleId = _this$props.circleId, | ||
x = _this$props.x, | ||
y = _this$props.y, | ||
r = _this$props.r, | ||
color = _this$props.color, | ||
borderWidth = _this$props.borderWidth, | ||
dim = _this$props.dim, | ||
title = _this$props.title, | ||
subtitle = _this$props.subtitle; | ||
const isDarkColor = isDark(color); | ||
var { | ||
circleId, | ||
x, | ||
y, | ||
r, | ||
color, | ||
borderWidth, | ||
dim, | ||
title, | ||
subtitle | ||
} = this.props; | ||
var isDarkColor = isDark(color); | ||
return /*#__PURE__*/React.createElement(CircleWrapper, { | ||
dim: dim, | ||
transform: `translate(${x},${y})` | ||
transform: "translate(".concat(x, ",").concat(y, ")") | ||
}, /*#__PURE__*/React.createElement(CircleElement, { | ||
id: `circle-${circleId}`, | ||
id: "circle-".concat(circleId), | ||
r: r, | ||
@@ -110,7 +130,7 @@ fill: color, | ||
}), /*#__PURE__*/React.createElement("clipPath", { | ||
id: `clip-${circleId}` | ||
id: "clip-".concat(circleId) | ||
}, /*#__PURE__*/React.createElement("use", { | ||
xlinkHref: `#circle-${circleId}` | ||
xlinkHref: "#circle-".concat(circleId) | ||
})), /*#__PURE__*/React.createElement("g", { | ||
clipPath: `url(#clip-${circleId})` | ||
clipPath: "url(#clip-".concat(circleId, ")") | ||
}, /*#__PURE__*/React.createElement(CircleLabels, { | ||
@@ -117,0 +137,0 @@ diameter: r * 2 |
@@ -13,5 +13,5 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import Circle from './circle'; | ||
const TRANSITION_DURATION = 750; | ||
var TRANSITION_DURATION = 750; | ||
const accessorFn = p => p instanceof Function ? p // fn | ||
var accessorFn = p => p instanceof Function ? p // fn | ||
: typeof p === 'string' ? obj => obj[p] // property name | ||
@@ -21,3 +21,3 @@ : () => p; // constant | ||
const CanvasWrapper = createComponent(() => ({ | ||
var CanvasWrapper = createComponent(() => ({ | ||
cursor: 'move' | ||
@@ -27,4 +27,4 @@ })); | ||
class CirclePackViz extends React.PureComponent { | ||
constructor(...args) { | ||
super(...args); | ||
constructor() { | ||
super(...arguments); | ||
@@ -44,15 +44,16 @@ _defineProperty(this, "state", { | ||
_defineProperty(this, "_parseData", () => { | ||
const _this$props = this.props, | ||
data = _this$props.data, | ||
circlePadding = _this$props.circlePadding, | ||
sizeDimension = _this$props.sizeDimension, | ||
width = _this$props.width, | ||
height = _this$props.height, | ||
excludeRoot = _this$props.excludeRoot; | ||
var { | ||
data, | ||
circlePadding, | ||
sizeDimension, | ||
width, | ||
height, | ||
excludeRoot | ||
} = this.props; | ||
if (data) { | ||
// Stratify it | ||
const hierData = d3Stratify()(data).sum(accessorFn(sizeDimension)); | ||
var hierData = d3Stratify()(data).sum(accessorFn(sizeDimension)); | ||
d3Pack().padding(circlePadding).size([width, height])(hierData); | ||
const layoutData = hierData.descendants().filter(excludeRoot ? d => d.depth > 0 : () => true); | ||
var layoutData = hierData.descendants().filter(excludeRoot ? d => d.depth > 0 : () => true); | ||
this.setState({ | ||
@@ -74,7 +75,8 @@ layoutData | ||
zoomToNode(d) { | ||
const _this$props2 = this.props, | ||
width = _this$props2.width, | ||
height = _this$props2.height; | ||
const ZOOM_REL_PADDING = 0.12; | ||
const k = Math.max(1, Math.min(width, height) / (d.r * 2) * (1 - ZOOM_REL_PADDING)); | ||
var { | ||
width, | ||
height | ||
} = this.props; | ||
var ZOOM_REL_PADDING = 0.12; | ||
var k = Math.max(1, Math.min(width, height) / (d.r * 2) * (1 - ZOOM_REL_PADDING)); | ||
this.zoomElem.zoomTo(Math.max(0, Math.min(width * (1 - 1 / k), // Don't pan out of chart boundaries | ||
@@ -92,3 +94,3 @@ d.x - width / k / 2 // Center circle in view | ||
componentDidUpdate(prevProps) { | ||
const nextProps = this.props; | ||
var nextProps = this.props; | ||
@@ -106,3 +108,3 @@ if (didPropsChange(['width', 'height', 'sizeDimension'])) { | ||
function didPropsChange(propNames) { | ||
for (let p of propNames) { | ||
for (var p of propNames) { | ||
if (prevProps[p] !== nextProps[p]) { | ||
@@ -118,22 +120,24 @@ return true; | ||
render() { | ||
const _this$props3 = this.props, | ||
width = _this$props3.width, | ||
height = _this$props3.height, | ||
chartId = _this$props3.chartId, | ||
tooltipId = _this$props3.tooltipId, | ||
colorDimension = _this$props3.colorDimension, | ||
borderWidth = _this$props3.borderWidth, | ||
label = _this$props3.label, | ||
subLabel = _this$props3.subLabel, | ||
minCircleRadius = _this$props3.minCircleRadius, | ||
highlightTerms = _this$props3.highlightTerms, | ||
_onClick = _this$props3.onClick, | ||
_onDoubleClick = _this$props3.onDoubleClick, | ||
onHover = _this$props3.onHover; | ||
const _this$state = this.state, | ||
layoutData = _this$state.layoutData, | ||
zoomTransform = _this$state.zoomTransform; | ||
const renderData = (layoutData || []).filter((d // Show only circles in scene that are larger than the threshold | ||
var { | ||
width, | ||
height, | ||
chartId, | ||
tooltipId, | ||
colorDimension, | ||
borderWidth, | ||
label, | ||
subLabel, | ||
minCircleRadius, | ||
highlightTerms, | ||
onClick: _onClick, | ||
onDoubleClick: _onDoubleClick, | ||
onHover | ||
} = this.props; | ||
var { | ||
layoutData, | ||
zoomTransform | ||
} = this.state; | ||
var renderData = (layoutData || []).filter((d // Show only circles in scene that are larger than the threshold | ||
) => d.x + d.r > -zoomTransform.x / zoomTransform.k && d.x - d.r < -zoomTransform.x / zoomTransform.k + width / zoomTransform.k && d.y + d.r > -zoomTransform.y / zoomTransform.k && d.y - d.r < -zoomTransform.y / zoomTransform.k + height / zoomTransform.k && d.r >= minCircleRadius / zoomTransform.k); | ||
const timing = { | ||
var timing = { | ||
duration: this.skipTransitions ? 0 : TRANSITION_DURATION, | ||
@@ -192,35 +196,38 @@ ease: easeCubic | ||
}, /*#__PURE__*/React.createElement("g", { | ||
transform: nodes.length ? `translate(${nodes[0].state.zoomX},${nodes[0].state.zoomY}) scale(${nodes[0].state.zoomK})` : null | ||
}, nodes.map(({ | ||
key, | ||
data: d, | ||
state | ||
}) => /*#__PURE__*/React.createElement("g", { | ||
key: key, | ||
onClick: e => { | ||
e.stopPropagation(); | ||
this.zoomToNode(d); | ||
transform: nodes.length ? "translate(".concat(nodes[0].state.zoomX, ",").concat(nodes[0].state.zoomY, ") scale(").concat(nodes[0].state.zoomK, ")") : null | ||
}, nodes.map(_ref => { | ||
var { | ||
key, | ||
data: d, | ||
state | ||
} = _ref; | ||
return /*#__PURE__*/React.createElement("g", { | ||
key: key, | ||
onClick: e => { | ||
e.stopPropagation(); | ||
this.zoomToNode(d); | ||
_onClick(d.data, d); | ||
}, | ||
onDoubleClick: e => { | ||
e.stopPropagation(); | ||
_onClick(d.data, d); | ||
}, | ||
onDoubleClick: e => { | ||
e.stopPropagation(); | ||
_onDoubleClick(d.data, d); | ||
}, | ||
onMouseEnter: () => onHover(d.data, d), | ||
onMouseLeave: () => onHover(null, null), | ||
"data-for": tooltipId, | ||
"data-tip": true | ||
}, /*#__PURE__*/React.createElement(Circle, { | ||
circleId: `${chartId}-${d.id}.`, | ||
x: state.x, | ||
y: state.y, | ||
r: state.r, | ||
color: state.color, | ||
borderWidth: state.borderWidth, | ||
dim: !!highlightTerms && !d.id.toLowerCase().includes(highlightTerms), | ||
title: d.children ? '' : label(d.data, d), | ||
subtitle: d.children ? '' : subLabel(d.data, d) | ||
}))))))))); | ||
_onDoubleClick(d.data, d); | ||
}, | ||
onMouseEnter: () => onHover(d.data, d), | ||
onMouseLeave: () => onHover(null, null), | ||
"data-for": tooltipId, | ||
"data-tip": true | ||
}, /*#__PURE__*/React.createElement(Circle, { | ||
circleId: "".concat(chartId, "-").concat(d.id, "."), | ||
x: state.x, | ||
y: state.y, | ||
r: state.r, | ||
color: state.color, | ||
borderWidth: state.borderWidth, | ||
dim: !!highlightTerms && !d.id.toLowerCase().includes(highlightTerms), | ||
title: d.children ? '' : label(d.data, d), | ||
subtitle: d.children ? '' : subLabel(d.data, d) | ||
})); | ||
}))))))); | ||
} | ||
@@ -227,0 +234,0 @@ |
@@ -6,5 +6,5 @@ import { withAutoWidth } from '@cloudflare/util-responsive'; | ||
import CirclePack from './CirclePack'; | ||
export const PartitionChart = withAutoWidth(Partition); | ||
export const SunburstChart = withAutoWidth(Sunburst); | ||
export const TreemapChart = withAutoWidth(Treemap); | ||
export const CirclePackChart = withAutoWidth(CirclePack); | ||
export var PartitionChart = withAutoWidth(Partition); | ||
export var SunburstChart = withAutoWidth(Sunburst); | ||
export var TreemapChart = withAutoWidth(Treemap); | ||
export var CirclePackChart = withAutoWidth(CirclePack); |
@@ -14,7 +14,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import PartitionBlock from './partitionBlock'; | ||
const TRANSITION_DURATION = 750; | ||
var TRANSITION_DURATION = 750; | ||
const accessorFn = p => p instanceof Function ? p : obj => obj[p]; | ||
var accessorFn = p => p instanceof Function ? p : obj => obj[p]; | ||
const CanvasWrapper = createComponent(() => ({ | ||
var CanvasWrapper = createComponent(() => ({ | ||
cursor: 'move' | ||
@@ -24,4 +24,4 @@ })); | ||
class PartitionViz extends React.PureComponent { | ||
constructor(...args) { | ||
super(...args); | ||
constructor() { | ||
super(...arguments); | ||
@@ -41,3 +41,3 @@ _defineProperty(this, "state", { | ||
_defineProperty(this, "zoomToNode", d => { | ||
const horiz = this.props.orientation === 'horizontal'; | ||
var horiz = this.props.orientation === 'horizontal'; | ||
this.zoomElem.zoomTo(...this._rev([d.x0, 0], horiz), this.props[horiz ? 'height' : 'width'] / (d.x1 - d.x0)); | ||
@@ -51,15 +51,16 @@ }); | ||
_defineProperty(this, "_parseData", () => { | ||
const _this$props = this.props, | ||
data = _this$props.data, | ||
sizeDimension = _this$props.sizeDimension, | ||
width = _this$props.width, | ||
height = _this$props.height, | ||
orientation = _this$props.orientation, | ||
excludeRoot = _this$props.excludeRoot; | ||
var { | ||
data, | ||
sizeDimension, | ||
width, | ||
height, | ||
orientation, | ||
excludeRoot | ||
} = this.props; | ||
if (data) { | ||
// Stratify it | ||
const hierData = d3Stratify()(data).sum(accessorFn(sizeDimension)); | ||
var hierData = d3Stratify()(data).sum(accessorFn(sizeDimension)); | ||
const size = this._rev([width, height], orientation === 'horizontal'); | ||
var size = this._rev([width, height], orientation === 'horizontal'); | ||
@@ -72,3 +73,3 @@ d3Partition() //.padding(1) | ||
// re-scale y values if excluding root | ||
const yScale = scaleLinear().domain([hierData.y1 - hierData.y0, size[1]]).range([0, size[1]]); | ||
var yScale = scaleLinear().domain([hierData.y1 - hierData.y0, size[1]]).range([0, size[1]]); | ||
hierData.descendants().forEach(d => { | ||
@@ -80,3 +81,3 @@ d.y0 = yScale(d.y0); | ||
const layoutData = hierData.descendants().filter(d => d.y0 >= 0); | ||
var layoutData = hierData.descendants().filter(d => d.y0 >= 0); | ||
this.setState({ | ||
@@ -104,3 +105,3 @@ layoutData | ||
componentDidUpdate(prevProps) { | ||
const nextProps = this.props; | ||
var nextProps = this.props; | ||
@@ -118,3 +119,3 @@ if (didPropsChange(['width', 'height', 'sizeDimension', 'excludeRoot'])) { | ||
function didPropsChange(propNames) { | ||
for (let p of propNames) { | ||
for (var p of propNames) { | ||
if (prevProps[p] !== nextProps[p]) { | ||
@@ -130,23 +131,25 @@ return true; | ||
render() { | ||
const _this$props2 = this.props, | ||
width = _this$props2.width, | ||
height = _this$props2.height, | ||
chartId = _this$props2.chartId, | ||
tooltipId = _this$props2.tooltipId, | ||
orientation = _this$props2.orientation, | ||
colorDimension = _this$props2.colorDimension, | ||
label = _this$props2.label, | ||
subLabel = _this$props2.subLabel, | ||
minSegmentWidth = _this$props2.minSegmentWidth, | ||
highlightTerms = _this$props2.highlightTerms, | ||
_onClick = _this$props2.onClick, | ||
_onDoubleClick = _this$props2.onDoubleClick, | ||
onHover = _this$props2.onHover; | ||
const _this$state = this.state, | ||
layoutData = _this$state.layoutData, | ||
zoomTransform = _this$state.zoomTransform; | ||
const horiz = orientation === 'horizontal'; | ||
const renderData = (layoutData || []).filter((d // Show only segments in scene that are wider than the threshold | ||
var { | ||
width, | ||
height, | ||
chartId, | ||
tooltipId, | ||
orientation, | ||
colorDimension, | ||
label, | ||
subLabel, | ||
minSegmentWidth, | ||
highlightTerms, | ||
onClick: _onClick, | ||
onDoubleClick: _onDoubleClick, | ||
onHover | ||
} = this.props; | ||
var { | ||
layoutData, | ||
zoomTransform | ||
} = this.state; | ||
var horiz = orientation === 'horizontal'; | ||
var renderData = (layoutData || []).filter((d // Show only segments in scene that are wider than the threshold | ||
) => d.x1 > (horiz ? -zoomTransform.y : -zoomTransform.x) / zoomTransform.k && d.x0 < (horiz ? height - zoomTransform.y : width - zoomTransform.x) / zoomTransform.k && d.x1 - d.x0 >= minSegmentWidth / zoomTransform.k); | ||
const timing = { | ||
var timing = { | ||
duration: this.skipTransitions ? 0 : TRANSITION_DURATION, | ||
@@ -199,36 +202,39 @@ ease: easeCubic | ||
}, /*#__PURE__*/React.createElement("g", { | ||
transform: nodes.length ? `translate(${this._rev([nodes[0].state.zoomPos, 0], horiz).join(',')}) scale(${this._rev([nodes[0].state.zoomK, 1], horiz).join(',')})` : null | ||
}, nodes.map(({ | ||
key, | ||
data: d, | ||
state | ||
}) => /*#__PURE__*/React.createElement("g", { | ||
key: key, | ||
onClick: e => { | ||
e.stopPropagation(); | ||
this.zoomToNode(d); | ||
transform: nodes.length ? "translate(".concat(this._rev([nodes[0].state.zoomPos, 0], horiz).join(','), ") scale(").concat(this._rev([nodes[0].state.zoomK, 1], horiz).join(','), ")") : null | ||
}, nodes.map(_ref => { | ||
var { | ||
key, | ||
data: d, | ||
state | ||
} = _ref; | ||
return /*#__PURE__*/React.createElement("g", { | ||
key: key, | ||
onClick: e => { | ||
e.stopPropagation(); | ||
this.zoomToNode(d); | ||
_onClick(d.data, d); | ||
}, | ||
onDoubleClick: e => { | ||
e.stopPropagation(); | ||
_onClick(d.data, d); | ||
}, | ||
onDoubleClick: e => { | ||
e.stopPropagation(); | ||
_onDoubleClick(d.data, d); | ||
}, | ||
onMouseEnter: () => onHover(d.data, d), | ||
onMouseLeave: () => onHover(null, null), | ||
"data-for": tooltipId, | ||
"data-tip": true | ||
}, /*#__PURE__*/React.createElement(PartitionBlock, { | ||
blockId: `${chartId}-${d.id}.`, | ||
x: !horiz ? state.x : d.y0, | ||
y: horiz ? state.x : orientation === 'flame' ? height - d.y1 : d.y0, | ||
width: !horiz ? Math.max(0, state.width - 1 / state.zoomK) : d.y1 - d.y0 - 1, | ||
height: horiz ? Math.max(0, state.width - 1 / state.zoomK) : d.y1 - d.y0 - 1, | ||
stretchVertically: horiz, | ||
color: state.color, | ||
dim: !!highlightTerms && !d.id.toLowerCase().includes(highlightTerms), | ||
title: label(d.data, d), | ||
subtitle: subLabel(d.data, d) | ||
}))))))))); | ||
_onDoubleClick(d.data, d); | ||
}, | ||
onMouseEnter: () => onHover(d.data, d), | ||
onMouseLeave: () => onHover(null, null), | ||
"data-for": tooltipId, | ||
"data-tip": true | ||
}, /*#__PURE__*/React.createElement(PartitionBlock, { | ||
blockId: "".concat(chartId, "-").concat(d.id, "."), | ||
x: !horiz ? state.x : d.y0, | ||
y: horiz ? state.x : orientation === 'flame' ? height - d.y1 : d.y0, | ||
width: !horiz ? Math.max(0, state.width - 1 / state.zoomK) : d.y1 - d.y0 - 1, | ||
height: horiz ? Math.max(0, state.width - 1 / state.zoomK) : d.y1 - d.y0 - 1, | ||
stretchVertically: horiz, | ||
color: state.color, | ||
dim: !!highlightTerms && !d.id.toLowerCase().includes(highlightTerms), | ||
title: label(d.data, d), | ||
subtitle: subLabel(d.data, d) | ||
})); | ||
}))))))); | ||
} | ||
@@ -235,0 +241,0 @@ |
@@ -0,1 +1,3 @@ | ||
var _excluded = ["zoomK", "stretchVertically"]; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -5,3 +7,3 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -15,6 +17,6 @@ import React from 'react'; | ||
import { isDark } from '@cloudflare/util-color'; | ||
const LABELS_OPACITY_SCALE = scaleLinear().domain([15, 40]).range([0, 1]); | ||
var LABELS_OPACITY_SCALE = scaleLinear().domain([15, 40]).range([0, 1]); | ||
const withZoomK = Comp => { | ||
const CompWithZoomK = props => /*#__PURE__*/React.createElement(Subscriber, { | ||
var withZoomK = Comp => { | ||
var CompWithZoomK = props => /*#__PURE__*/React.createElement(Subscriber, { | ||
channel: "zoomK" | ||
@@ -28,9 +30,12 @@ }, zoomK => /*#__PURE__*/React.createElement(Comp, _extends({ | ||
const BlockWrapper = createComponent(({ | ||
dim | ||
}) => ({ | ||
opacity: dim ? 0.2 : 1, | ||
transition: 'opacity .4s ease-in-out' | ||
}), 'g'); | ||
const BlockRect = createComponent(() => ({ | ||
var BlockWrapper = createComponent(_ref => { | ||
var { | ||
dim | ||
} = _ref; | ||
return { | ||
opacity: dim ? 0.2 : 1, | ||
transition: 'opacity .4s ease-in-out' | ||
}; | ||
}, 'g'); | ||
var BlockRect = createComponent(() => ({ | ||
cursor: 'pointer', | ||
@@ -44,21 +49,26 @@ opacity: 1, | ||
}), 'rect'); | ||
const StyledBlockText = createComponent(({ | ||
theme, | ||
centered, | ||
light, | ||
subtitle = false | ||
}) => ({ | ||
fontSize: theme.fontSizes[subtitle ? 0 : 1], | ||
opacity: subtitle ? 0.6 : 1, | ||
pointerEvents: 'none', | ||
userSelect: 'none', | ||
textAnchor: centered ? 'middle' : 'start', | ||
fill: light ? theme.colors.gray[9] : theme.colors.gray[2] | ||
}), 'text'); | ||
const BlockText = withZoomK((_ref) => { | ||
let zoomK = _ref.zoomK, | ||
stretchVertically = _ref.stretchVertically, | ||
props = _objectWithoutProperties(_ref, ["zoomK", "stretchVertically"]); | ||
var StyledBlockText = createComponent(_ref2 => { | ||
var { | ||
theme, | ||
centered, | ||
light, | ||
subtitle = false | ||
} = _ref2; | ||
return { | ||
fontSize: theme.fontSizes[subtitle ? 0 : 1], | ||
opacity: subtitle ? 0.6 : 1, | ||
pointerEvents: 'none', | ||
userSelect: 'none', | ||
textAnchor: centered ? 'middle' : 'start', | ||
fill: light ? theme.colors.gray[9] : theme.colors.gray[2] | ||
}; | ||
}, 'text'); | ||
var BlockText = withZoomK(_ref3 => { | ||
var { | ||
zoomK, | ||
stretchVertically | ||
} = _ref3, | ||
props = _objectWithoutProperties(_ref3, _excluded); | ||
let textScale = [1 / zoomK, 1]; | ||
var textScale = [1 / zoomK, 1]; | ||
@@ -70,38 +80,42 @@ if (stretchVertically) { | ||
return /*#__PURE__*/React.createElement(StyledBlockText, _extends({ | ||
transform: `scale(${textScale.join(',')})`, | ||
transform: "scale(".concat(textScale.join(','), ")"), | ||
centered: !stretchVertically | ||
}, props)); | ||
}); | ||
const BlockLabels = withZoomK(({ | ||
blockWidth, | ||
blockHeight, | ||
stretchVertically, | ||
zoomK, | ||
children | ||
}) => /*#__PURE__*/React.createElement("g", { | ||
transform: `translate(${stretchVertically ? '4' : blockWidth / 2}, ${blockHeight / 2})`, | ||
style: { | ||
opacity: LABELS_OPACITY_SCALE((stretchVertically ? blockHeight : blockWidth) * zoomK) | ||
} | ||
}, children)); | ||
var BlockLabels = withZoomK(_ref4 => { | ||
var { | ||
blockWidth, | ||
blockHeight, | ||
stretchVertically, | ||
zoomK, | ||
children | ||
} = _ref4; | ||
return /*#__PURE__*/React.createElement("g", { | ||
transform: "translate(".concat(stretchVertically ? '4' : blockWidth / 2, ", ").concat(blockHeight / 2, ")"), | ||
style: { | ||
opacity: LABELS_OPACITY_SCALE((stretchVertically ? blockHeight : blockWidth) * zoomK) | ||
} | ||
}, children); | ||
}); | ||
class PartitionBlock extends React.PureComponent { | ||
render() { | ||
const _this$props = this.props, | ||
blockId = _this$props.blockId, | ||
x = _this$props.x, | ||
y = _this$props.y, | ||
width = _this$props.width, | ||
height = _this$props.height, | ||
stretchVertically = _this$props.stretchVertically, | ||
color = _this$props.color, | ||
dim = _this$props.dim, | ||
title = _this$props.title, | ||
subtitle = _this$props.subtitle; | ||
const isDarkColor = isDark(color); | ||
var { | ||
blockId, | ||
x, | ||
y, | ||
width, | ||
height, | ||
stretchVertically, | ||
color, | ||
dim, | ||
title, | ||
subtitle | ||
} = this.props; | ||
var isDarkColor = isDark(color); | ||
return /*#__PURE__*/React.createElement(BlockWrapper, { | ||
dim: dim, | ||
transform: `translate(${x},${y})` | ||
transform: "translate(".concat(x, ",").concat(y, ")") | ||
}, /*#__PURE__*/React.createElement(BlockRect, { | ||
id: `rect-${blockId}`, | ||
id: "rect-".concat(blockId), | ||
width: width, | ||
@@ -111,7 +125,7 @@ height: height, | ||
}), /*#__PURE__*/React.createElement("clipPath", { | ||
id: `clip-${blockId}` | ||
id: "clip-".concat(blockId) | ||
}, /*#__PURE__*/React.createElement("use", { | ||
xlinkHref: `#rect-${blockId}` | ||
xlinkHref: "#rect-".concat(blockId) | ||
})), /*#__PURE__*/React.createElement("g", { | ||
clipPath: `url(#clip-${blockId})` | ||
clipPath: "url(#clip-".concat(blockId, ")") | ||
}, /*#__PURE__*/React.createElement(BlockLabels, { | ||
@@ -118,0 +132,0 @@ blockWidth: width, |
@@ -11,9 +11,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import SunburstSlice from './sunburstSlice'; | ||
const TRANSITION_DURATION = 750; | ||
var TRANSITION_DURATION = 750; | ||
const accessorFn = p => p instanceof Function ? p : obj => obj[p]; | ||
var accessorFn = p => p instanceof Function ? p : obj => obj[p]; | ||
class SunburstViz extends React.PureComponent { | ||
constructor(...args) { | ||
super(...args); | ||
constructor() { | ||
super(...arguments); | ||
@@ -23,10 +23,11 @@ _defineProperty(this, "state", {}); | ||
_defineProperty(this, "_parseData", () => { | ||
const _this$props = this.props, | ||
data = _this$props.data, | ||
sizeDimension = _this$props.sizeDimension, | ||
excludeRoot = _this$props.excludeRoot; | ||
var { | ||
data, | ||
sizeDimension, | ||
excludeRoot | ||
} = this.props; | ||
if (data) { | ||
// Stratify it | ||
const hierData = d3Stratify()(data).sum(accessorFn(sizeDimension)); | ||
var hierData = d3Stratify()(data).sum(accessorFn(sizeDimension)); | ||
d3Partition().padding(0)(hierData); | ||
@@ -36,3 +37,3 @@ | ||
// re-scale y values if excluding root | ||
const yScale = scaleLinear().domain([hierData.y1 - hierData.y0, 1]); | ||
var yScale = scaleLinear().domain([hierData.y1 - hierData.y0, 1]); | ||
hierData.descendants().forEach(d => { | ||
@@ -44,3 +45,3 @@ d.y0 = yScale(d.y0); | ||
const layoutData = hierData.descendants(); | ||
var layoutData = hierData.descendants(); | ||
this.setState({ | ||
@@ -58,3 +59,3 @@ layoutData | ||
componentDidUpdate(prevProps) { | ||
const nextProps = this.props; | ||
var nextProps = this.props; | ||
@@ -71,3 +72,3 @@ if (didPropsChange(['sizeDimension', 'data', 'excludeRoot'])) { | ||
function didPropsChange(propNames) { | ||
for (let p of propNames) { | ||
for (var p of propNames) { | ||
if (prevProps[p] !== nextProps[p]) { | ||
@@ -83,19 +84,21 @@ return true; | ||
render() { | ||
const _this$props2 = this.props, | ||
width = _this$props2.width, | ||
height = _this$props2.height, | ||
chartId = _this$props2.chartId, | ||
tooltipId = _this$props2.tooltipId, | ||
colorDimension = _this$props2.colorDimension, | ||
label = _this$props2.label, | ||
subLabel = _this$props2.subLabel, | ||
minArcAngle = _this$props2.minArcAngle, | ||
highlightTerms = _this$props2.highlightTerms, | ||
_onClick = _this$props2.onClick, | ||
_onDoubleClick = _this$props2.onDoubleClick, | ||
onHover = _this$props2.onHover; | ||
const _this$state = this.state, | ||
layoutData = _this$state.layoutData, | ||
focusOnNode = _this$state.focusOnNode; | ||
const focusD = focusOnNode && focusOnNode.y0 >= 0 ? focusOnNode : { | ||
var { | ||
width, | ||
height, | ||
chartId, | ||
tooltipId, | ||
colorDimension, | ||
label, | ||
subLabel, | ||
minArcAngle, | ||
highlightTerms, | ||
onClick: _onClick, | ||
onDoubleClick: _onDoubleClick, | ||
onHover | ||
} = this.props; | ||
var { | ||
layoutData, | ||
focusOnNode | ||
} = this.state; | ||
var focusD = focusOnNode && focusOnNode.y0 >= 0 ? focusOnNode : { | ||
x0: 0, | ||
@@ -107,11 +110,11 @@ x1: 1, | ||
const getSelectedIds = node => node ? [node.id, ...getSelectedIds(node.parent)] : []; | ||
var getSelectedIds = node => node ? [node.id, ...getSelectedIds(node.parent)] : []; | ||
const selectedIds = getSelectedIds(focusOnNode); | ||
const renderData = (layoutData || []).filter((d // Show only slices with a large enough angle | ||
var selectedIds = getSelectedIds(focusOnNode); | ||
var renderData = (layoutData || []).filter((d // Show only slices with a large enough angle | ||
) => d.x1 >= focusD.x0 && d.x0 <= focusD.x1 && (d.x1 - d.x0) / (focusD.x1 - focusD.x0) > minArcAngle / 360); | ||
const maxRadius = Math.min(width, height) / 2; | ||
const radiusScale = scaleSqrt().range([maxRadius * 0.1, maxRadius]); | ||
const angleScale = scaleLinear().range([0, 2 * Math.PI]).clamp(true); | ||
const timing = { | ||
var maxRadius = Math.min(width, height) / 2; | ||
var radiusScale = scaleSqrt().range([maxRadius * 0.1, maxRadius]); | ||
var angleScale = scaleLinear().range([0, 2 * Math.PI]).clamp(true); | ||
var timing = { | ||
duration: TRANSITION_DURATION, | ||
@@ -123,3 +126,3 @@ ease: easeCubic | ||
height: height, | ||
viewBox: `${-width / 2} ${-height / 2} ${width} ${height}`, | ||
viewBox: "".concat(-width / 2, " ").concat(-height / 2, " ").concat(width, " ").concat(height), | ||
onClick: _ => this.setState({ | ||
@@ -159,3 +162,3 @@ focusOnNode: null | ||
if (nodes.length) { | ||
const state = nodes[0].state; | ||
var state = nodes[0].state; | ||
radiusScale.domain([state.rDomain0, state.rDomain1]); | ||
@@ -171,36 +174,39 @@ angleScale.domain([state.angleDomain0, state.angleDomain1]); | ||
return /*#__PURE__*/React.createElement("g", null, nodes // Make sure selected stack is visible on top | ||
.sort((a, b) => selectedIds.indexOf(a.key) - selectedIds.indexOf(b.key)).map(({ | ||
key, | ||
data: d, | ||
state | ||
}) => /*#__PURE__*/React.createElement("g", { | ||
key: key, | ||
onClick: e => { | ||
e.stopPropagation(); | ||
this.setState({ | ||
focusOnNode: d | ||
}); | ||
.sort((a, b) => selectedIds.indexOf(a.key) - selectedIds.indexOf(b.key)).map(_ref => { | ||
var { | ||
key, | ||
data: d, | ||
state | ||
} = _ref; | ||
return /*#__PURE__*/React.createElement("g", { | ||
key: key, | ||
onClick: e => { | ||
e.stopPropagation(); | ||
this.setState({ | ||
focusOnNode: d | ||
}); | ||
_onClick(d.data, d); | ||
}, | ||
onDoubleClick: e => { | ||
e.stopPropagation(); | ||
_onClick(d.data, d); | ||
}, | ||
onDoubleClick: e => { | ||
e.stopPropagation(); | ||
_onDoubleClick(d.data, d); | ||
}, | ||
onMouseEnter: () => onHover(d.data, d), | ||
onMouseLeave: () => onHover(null, null), | ||
"data-for": tooltipId, | ||
"data-tip": true | ||
}, /*#__PURE__*/React.createElement(SunburstSlice, { | ||
sliceId: `${chartId}-${d.id}.`, | ||
angle0: angleScale(d.x0), | ||
angle1: angleScale(d.x1), | ||
r0: radiusScale(d.y0), | ||
r1: radiusScale(d.y1), | ||
color: state.color, | ||
dim: !!highlightTerms && !d.id.toLowerCase().includes(highlightTerms), | ||
title: label(d.data, d), | ||
subtitle: subLabel(d.data, d) | ||
})))); | ||
_onDoubleClick(d.data, d); | ||
}, | ||
onMouseEnter: () => onHover(d.data, d), | ||
onMouseLeave: () => onHover(null, null), | ||
"data-for": tooltipId, | ||
"data-tip": true | ||
}, /*#__PURE__*/React.createElement(SunburstSlice, { | ||
sliceId: "".concat(chartId, "-").concat(d.id, "."), | ||
angle0: angleScale(d.x0), | ||
angle1: angleScale(d.x1), | ||
r0: radiusScale(d.y0), | ||
r1: radiusScale(d.y1), | ||
color: state.color, | ||
dim: !!highlightTerms && !d.id.toLowerCase().includes(highlightTerms), | ||
title: label(d.data, d), | ||
subtitle: subLabel(d.data, d) | ||
})); | ||
})); | ||
})); | ||
@@ -207,0 +213,0 @@ } |
@@ -0,1 +1,3 @@ | ||
var _excluded = ["arcId", "children"]; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -12,44 +14,55 @@ | ||
import { isDark } from '@cloudflare/util-color'; | ||
const CHAR_PX = 6; | ||
const SliceWrapper = createComponent(({ | ||
dim | ||
}) => ({ | ||
opacity: dim ? 0.2 : 1, | ||
transition: 'opacity .4s ease-in-out' | ||
}), 'g'); | ||
const ArcPath = createComponent(({ | ||
theme, | ||
hidden = false | ||
}) => ({ | ||
cursor: 'pointer', | ||
stroke: hidden ? undefined : theme.colors.white, | ||
strokeWidth: hidden ? 0 : 1, | ||
fill: hidden ? 'none' : undefined, | ||
opacity: 1, | ||
transition: hidden ? undefined : 'opacity .4s', | ||
'&:hover': hidden ? {} : { | ||
opacity: 0.85, | ||
transition: 'opacity .05s' | ||
} | ||
}), 'path'); | ||
const StyledSliceText = createComponent(({ | ||
theme, | ||
light, | ||
show, | ||
subtitle = false | ||
}) => ({ | ||
fontSize: theme.fontSizes[subtitle ? 0 : 1], | ||
opacity: subtitle ? 0.6 : 1, | ||
pointerEvents: 'none', | ||
userSelect: 'none', | ||
textAnchor: 'middle', | ||
dominantBaseline: 'middle', | ||
fill: light ? theme.colors.gray[9] : theme.colors.gray[2], | ||
display: show ? undefined : 'none' | ||
}), 'text'); | ||
var CHAR_PX = 6; | ||
var SliceWrapper = createComponent(_ref => { | ||
var { | ||
dim | ||
} = _ref; | ||
return { | ||
opacity: dim ? 0.2 : 1, | ||
transition: 'opacity .4s ease-in-out' | ||
}; | ||
}, 'g'); | ||
var ArcPath = createComponent(_ref2 => { | ||
var { | ||
theme, | ||
hidden = false | ||
} = _ref2; | ||
return { | ||
cursor: 'pointer', | ||
stroke: hidden ? undefined : theme.colors.white, | ||
strokeWidth: hidden ? 0 : 1, | ||
fill: hidden ? 'none' : undefined, | ||
opacity: 1, | ||
transition: hidden ? undefined : 'opacity .4s', | ||
'&:hover': hidden ? {} : { | ||
opacity: 0.85, | ||
transition: 'opacity .05s' | ||
} | ||
}; | ||
}, 'path'); | ||
var StyledSliceText = createComponent(_ref3 => { | ||
var { | ||
theme, | ||
light, | ||
show, | ||
subtitle = false | ||
} = _ref3; | ||
return { | ||
fontSize: theme.fontSizes[subtitle ? 0 : 1], | ||
opacity: subtitle ? 0.6 : 1, | ||
pointerEvents: 'none', | ||
userSelect: 'none', | ||
textAnchor: 'middle', | ||
dominantBaseline: 'middle', | ||
fill: light ? theme.colors.gray[9] : theme.colors.gray[2], | ||
display: show ? undefined : 'none' | ||
}; | ||
}, 'text'); | ||
const SliceText = (_ref) => { | ||
let arcId = _ref.arcId, | ||
children = _ref.children, | ||
props = _objectWithoutProperties(_ref, ["arcId", "children"]); | ||
var SliceText = _ref4 => { | ||
var { | ||
arcId, | ||
children | ||
} = _ref4, | ||
props = _objectWithoutProperties(_ref4, _excluded); | ||
@@ -69,13 +82,14 @@ return /*#__PURE__*/React.createElement(StyledSliceText, props, /*#__PURE__*/React.createElement("textPath", { | ||
render() { | ||
const _this$props = this.props, | ||
sliceId = _this$props.sliceId, | ||
angle0 = _this$props.angle0, | ||
angle1 = _this$props.angle1, | ||
r0 = _this$props.r0, | ||
r1 = _this$props.r1, | ||
color = _this$props.color, | ||
dim = _this$props.dim, | ||
title = _this$props.title, | ||
subtitle = _this$props.subtitle; | ||
const arc = { | ||
var { | ||
sliceId, | ||
angle0, | ||
angle1, | ||
r0, | ||
r1, | ||
color, | ||
dim, | ||
title, | ||
subtitle | ||
} = this.props; | ||
var arc = { | ||
innerRadius: Math.max(0, r0), | ||
@@ -86,25 +100,25 @@ outerRadius: Math.max(0, r1), | ||
}; | ||
const isDarkColor = isDark(color); | ||
var isDarkColor = isDark(color); | ||
return /*#__PURE__*/React.createElement(SliceWrapper, { | ||
dim: dim | ||
}, /*#__PURE__*/React.createElement(ArcPath, { | ||
id: `main-arc-${sliceId}`, | ||
id: "main-arc-".concat(sliceId), | ||
d: d3Arc()(arc), | ||
fill: color | ||
}), /*#__PURE__*/React.createElement(ArcPath, { | ||
id: `hidden-arc-${sliceId}`, | ||
id: "hidden-arc-".concat(sliceId), | ||
d: middleArcLine(arc), | ||
hidden: true | ||
}), /*#__PURE__*/React.createElement("clipPath", { | ||
id: `clip-${sliceId}` | ||
id: "clip-".concat(sliceId) | ||
}, /*#__PURE__*/React.createElement("use", { | ||
xlinkHref: `#main-arc-${sliceId}` | ||
xlinkHref: "#main-arc-".concat(sliceId) | ||
})), /*#__PURE__*/React.createElement("g", { | ||
clipPath: `url(#clip-${sliceId})` | ||
clipPath: "url(#clip-".concat(sliceId, ")") | ||
}, /*#__PURE__*/React.createElement(SliceText, { | ||
arcId: `#hidden-arc-${sliceId}`, | ||
arcId: "#hidden-arc-".concat(sliceId), | ||
light: isDarkColor, | ||
show: textFits(title, arc) | ||
}, title), /*#__PURE__*/React.createElement(SliceText, { | ||
arcId: `#hidden-arc-${sliceId}`, | ||
arcId: "#hidden-arc-".concat(sliceId), | ||
light: isDarkColor, | ||
@@ -116,14 +130,15 @@ subtitle: true, | ||
function middleArcLine({ | ||
innerRadius, | ||
outerRadius, | ||
startAngle, | ||
endAngle | ||
}) { | ||
const halfPi = Math.PI / 2; | ||
const angles = [startAngle - halfPi, endAngle - halfPi]; | ||
const r = (innerRadius + outerRadius) / 2; | ||
function middleArcLine(_ref5) { | ||
var { | ||
innerRadius, | ||
outerRadius, | ||
startAngle, | ||
endAngle | ||
} = _ref5; | ||
var halfPi = Math.PI / 2; | ||
var angles = [startAngle - halfPi, endAngle - halfPi]; | ||
var r = (innerRadius + outerRadius) / 2; | ||
if (!r || !(angles[1] - angles[0])) return ''; | ||
const middleAngle = (angles[1] + angles[0]) / 2; | ||
const invertDirection = middleAngle > 0 && middleAngle < Math.PI; // On lower quadrants write text ccw | ||
var middleAngle = (angles[1] + angles[0]) / 2; | ||
var invertDirection = middleAngle > 0 && middleAngle < Math.PI; // On lower quadrants write text ccw | ||
@@ -134,3 +149,3 @@ if (invertDirection) { | ||
const path = d3Path(); | ||
var path = d3Path(); | ||
path.arc(0, 0, r, angles[0], angles[1], invertDirection); | ||
@@ -140,11 +155,13 @@ return path.toString(); | ||
function textFits(text, { | ||
innerRadius, | ||
outerRadius, | ||
startAngle, | ||
endAngle | ||
}, rOffset = 0) { | ||
const deltaAngle = endAngle - startAngle; | ||
const r = Math.max(0, (innerRadius + outerRadius) / 2 + rOffset); | ||
const perimeter = r * deltaAngle; | ||
function textFits(text, _ref6) { | ||
var { | ||
innerRadius, | ||
outerRadius, | ||
startAngle, | ||
endAngle | ||
} = _ref6; | ||
var rOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var deltaAngle = endAngle - startAngle; | ||
var r = Math.max(0, (innerRadius + outerRadius) / 2 + rOffset); | ||
var perimeter = r * deltaAngle; | ||
return text.length * CHAR_PX < perimeter && r - CHAR_PX > innerRadius; | ||
@@ -151,0 +168,0 @@ } |
@@ -13,5 +13,5 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import TreemapBlock from './treemapBlock'; | ||
const TRANSITION_DURATION = 750; | ||
var TRANSITION_DURATION = 750; | ||
const accessorFn = p => p instanceof Function ? p // fn | ||
var accessorFn = p => p instanceof Function ? p // fn | ||
: typeof p === 'string' ? obj => obj[p] // property name | ||
@@ -21,3 +21,3 @@ : () => p; // constant | ||
const CanvasWrapper = createComponent(() => ({ | ||
var CanvasWrapper = createComponent(() => ({ | ||
cursor: 'move' | ||
@@ -27,4 +27,4 @@ })); | ||
class TreemapViz extends React.PureComponent { | ||
constructor(...args) { | ||
super(...args); | ||
constructor() { | ||
super(...arguments); | ||
@@ -44,15 +44,16 @@ _defineProperty(this, "state", { | ||
_defineProperty(this, "_parseData", () => { | ||
const _this$props = this.props, | ||
data = _this$props.data, | ||
blockPadding = _this$props.blockPadding, | ||
sizeDimension = _this$props.sizeDimension, | ||
width = _this$props.width, | ||
height = _this$props.height, | ||
excludeRoot = _this$props.excludeRoot; | ||
var { | ||
data, | ||
blockPadding, | ||
sizeDimension, | ||
width, | ||
height, | ||
excludeRoot | ||
} = this.props; | ||
if (data) { | ||
// Stratify it | ||
const hierData = d3Stratify()(data).sum(accessorFn(sizeDimension)); | ||
var hierData = d3Stratify()(data).sum(accessorFn(sizeDimension)); | ||
d3Treemap().paddingInner(blockPadding).size([width, height])(hierData); | ||
const layoutData = hierData.descendants().filter(excludeRoot ? d => d.depth > 0 : () => true); | ||
var layoutData = hierData.descendants().filter(excludeRoot ? d => d.depth > 0 : () => true); | ||
this.setState({ | ||
@@ -74,6 +75,7 @@ layoutData | ||
zoomToNode(d) { | ||
const _this$props2 = this.props, | ||
width = _this$props2.width, | ||
height = _this$props2.height; | ||
const k = Math.min(width / (d.x1 - d.x0), height / (d.y1 - d.y0)); | ||
var { | ||
width, | ||
height | ||
} = this.props; | ||
var k = Math.min(width / (d.x1 - d.x0), height / (d.y1 - d.y0)); | ||
this.zoomElem.zoomTo(Math.max(0, Math.min(width * (1 - 1 / k), // Don't pan out of chart boundaries | ||
@@ -91,3 +93,3 @@ d.x0 - (width / k - (d.x1 - d.x0)) / 2 // Center block in view | ||
componentDidUpdate(prevProps) { | ||
const nextProps = this.props; | ||
var nextProps = this.props; | ||
@@ -105,3 +107,3 @@ if (didPropsChange(['width', 'height', 'sizeDimension'])) { | ||
function didPropsChange(propNames) { | ||
for (let p of propNames) { | ||
for (var p of propNames) { | ||
if (prevProps[p] !== nextProps[p]) { | ||
@@ -117,22 +119,24 @@ return true; | ||
render() { | ||
const _this$props3 = this.props, | ||
width = _this$props3.width, | ||
height = _this$props3.height, | ||
chartId = _this$props3.chartId, | ||
tooltipId = _this$props3.tooltipId, | ||
colorDimension = _this$props3.colorDimension, | ||
borderWidth = _this$props3.borderWidth, | ||
label = _this$props3.label, | ||
subLabel = _this$props3.subLabel, | ||
minBlockArea = _this$props3.minBlockArea, | ||
highlightTerms = _this$props3.highlightTerms, | ||
_onClick = _this$props3.onClick, | ||
_onDoubleClick = _this$props3.onDoubleClick, | ||
onHover = _this$props3.onHover; | ||
const _this$state = this.state, | ||
layoutData = _this$state.layoutData, | ||
zoomTransform = _this$state.zoomTransform; | ||
const renderData = (layoutData || []).filter((d // Show only blocks in scene that are larger than the threshold | ||
var { | ||
width, | ||
height, | ||
chartId, | ||
tooltipId, | ||
colorDimension, | ||
borderWidth, | ||
label, | ||
subLabel, | ||
minBlockArea, | ||
highlightTerms, | ||
onClick: _onClick, | ||
onDoubleClick: _onDoubleClick, | ||
onHover | ||
} = this.props; | ||
var { | ||
layoutData, | ||
zoomTransform | ||
} = this.state; | ||
var renderData = (layoutData || []).filter((d // Show only blocks in scene that are larger than the threshold | ||
) => d.x1 > -zoomTransform.x / zoomTransform.k && d.x0 < -zoomTransform.x / zoomTransform.k + width / zoomTransform.k && d.y1 > -zoomTransform.y / zoomTransform.k && d.y0 < -zoomTransform.y / zoomTransform.k + height / zoomTransform.k && (d.x1 - d.x0) * (d.y1 - d.y0) >= minBlockArea / zoomTransform.k); | ||
const timing = { | ||
var timing = { | ||
duration: this.skipTransitions ? 0 : TRANSITION_DURATION, | ||
@@ -196,36 +200,39 @@ ease: easeCubic | ||
}, /*#__PURE__*/React.createElement("g", { | ||
transform: nodes.length ? `translate(${nodes[0].state.zoomX},${nodes[0].state.zoomY}) scale(${nodes[0].state.zoomK})` : null | ||
}, nodes.map(({ | ||
key, | ||
data: d, | ||
state | ||
}) => /*#__PURE__*/React.createElement("g", { | ||
key: key, | ||
onClick: e => { | ||
e.stopPropagation(); | ||
this.zoomToNode(d); | ||
transform: nodes.length ? "translate(".concat(nodes[0].state.zoomX, ",").concat(nodes[0].state.zoomY, ") scale(").concat(nodes[0].state.zoomK, ")") : null | ||
}, nodes.map(_ref => { | ||
var { | ||
key, | ||
data: d, | ||
state | ||
} = _ref; | ||
return /*#__PURE__*/React.createElement("g", { | ||
key: key, | ||
onClick: e => { | ||
e.stopPropagation(); | ||
this.zoomToNode(d); | ||
_onClick(d.data, d); | ||
}, | ||
onDoubleClick: e => { | ||
e.stopPropagation(); | ||
_onClick(d.data, d); | ||
}, | ||
onDoubleClick: e => { | ||
e.stopPropagation(); | ||
_onDoubleClick(d.data, d); | ||
}, | ||
onMouseEnter: () => onHover(d.data, d), | ||
onMouseLeave: () => onHover(null, null), | ||
"data-for": tooltipId, | ||
"data-tip": true | ||
}, /*#__PURE__*/React.createElement(TreemapBlock, { | ||
blockId: `${chartId}-${d.id}.`, | ||
x: state.x, | ||
y: state.y, | ||
width: state.width, | ||
height: state.height, | ||
color: state.color, | ||
borderWidth: state.borderWidth, | ||
dim: !!highlightTerms && !d.id.toLowerCase().includes(highlightTerms), | ||
title: label(d.data, d), | ||
subtitle: subLabel(d.data, d) | ||
}))))))))); | ||
_onDoubleClick(d.data, d); | ||
}, | ||
onMouseEnter: () => onHover(d.data, d), | ||
onMouseLeave: () => onHover(null, null), | ||
"data-for": tooltipId, | ||
"data-tip": true | ||
}, /*#__PURE__*/React.createElement(TreemapBlock, { | ||
blockId: "".concat(chartId, "-").concat(d.id, "."), | ||
x: state.x, | ||
y: state.y, | ||
width: state.width, | ||
height: state.height, | ||
color: state.color, | ||
borderWidth: state.borderWidth, | ||
dim: !!highlightTerms && !d.id.toLowerCase().includes(highlightTerms), | ||
title: label(d.data, d), | ||
subtitle: subLabel(d.data, d) | ||
})); | ||
}))))))); | ||
} | ||
@@ -232,0 +239,0 @@ |
@@ -0,1 +1,4 @@ | ||
var _excluded = ["zoomK", "borderWidth"], | ||
_excluded2 = ["zoomK"]; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -5,3 +8,3 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -15,6 +18,6 @@ import React from 'react'; | ||
import { isDark } from '@cloudflare/util-color'; | ||
const LABELS_OPACITY_SCALE = scaleLinear().domain([600, 3000]).range([0, 1]); | ||
var LABELS_OPACITY_SCALE = scaleLinear().domain([600, 3000]).range([0, 1]); | ||
const withZoomK = Comp => { | ||
const CompWithZoomK = props => /*#__PURE__*/React.createElement(Subscriber, { | ||
var withZoomK = Comp => { | ||
var CompWithZoomK = props => /*#__PURE__*/React.createElement(Subscriber, { | ||
channel: "zoomK" | ||
@@ -28,25 +31,33 @@ }, zoomK => /*#__PURE__*/React.createElement(Comp, _extends({ | ||
const BlockWrapper = createComponent(({ | ||
dim | ||
}) => ({ | ||
opacity: dim ? 0.2 : 1, | ||
transition: 'opacity .4s ease-in-out' | ||
}), 'g'); | ||
const StyledBlockRect = createComponent(({ | ||
theme | ||
}) => ({ | ||
cursor: 'pointer', | ||
stroke: theme.colors.gray[7], | ||
shapeRendering: 'crispEdges', | ||
strokeOpacity: 0.4, | ||
transition: 'stroke-opacity .4s', | ||
'&:hover': { | ||
strokeOpacity: 1, | ||
transition: 'stroke-opacity .05s' | ||
} | ||
}), 'rect'); | ||
const BlockRect = withZoomK((_ref) => { | ||
let zoomK = _ref.zoomK, | ||
borderWidth = _ref.borderWidth, | ||
props = _objectWithoutProperties(_ref, ["zoomK", "borderWidth"]); | ||
var BlockWrapper = createComponent(_ref => { | ||
var { | ||
dim | ||
} = _ref; | ||
return { | ||
opacity: dim ? 0.2 : 1, | ||
transition: 'opacity .4s ease-in-out' | ||
}; | ||
}, 'g'); | ||
var StyledBlockRect = createComponent(_ref2 => { | ||
var { | ||
theme | ||
} = _ref2; | ||
return { | ||
cursor: 'pointer', | ||
stroke: theme.colors.gray[7], | ||
shapeRendering: 'crispEdges', | ||
strokeOpacity: 0.4, | ||
transition: 'stroke-opacity .4s', | ||
'&:hover': { | ||
strokeOpacity: 1, | ||
transition: 'stroke-opacity .05s' | ||
} | ||
}; | ||
}, 'rect'); | ||
var BlockRect = withZoomK(_ref3 => { | ||
var { | ||
zoomK, | ||
borderWidth | ||
} = _ref3, | ||
props = _objectWithoutProperties(_ref3, _excluded); | ||
@@ -57,53 +68,62 @@ return /*#__PURE__*/React.createElement(StyledBlockRect, _extends({ | ||
}); | ||
const StyledBlockText = createComponent(({ | ||
theme, | ||
light, | ||
subtitle = false | ||
}) => ({ | ||
fontSize: theme.fontSizes[subtitle ? 0 : 1], | ||
opacity: subtitle ? 0.6 : 1, | ||
pointerEvents: 'none', | ||
userSelect: 'none', | ||
textAnchor: 'middle', | ||
fill: light ? theme.colors.gray[9] : theme.colors.gray[2] | ||
}), 'text'); | ||
const BlockText = withZoomK((_ref2) => { | ||
let zoomK = _ref2.zoomK, | ||
props = _objectWithoutProperties(_ref2, ["zoomK"]); | ||
var StyledBlockText = createComponent(_ref4 => { | ||
var { | ||
theme, | ||
light, | ||
subtitle = false | ||
} = _ref4; | ||
return { | ||
fontSize: theme.fontSizes[subtitle ? 0 : 1], | ||
opacity: subtitle ? 0.6 : 1, | ||
pointerEvents: 'none', | ||
userSelect: 'none', | ||
textAnchor: 'middle', | ||
fill: light ? theme.colors.gray[9] : theme.colors.gray[2] | ||
}; | ||
}, 'text'); | ||
var BlockText = withZoomK(_ref5 => { | ||
var { | ||
zoomK | ||
} = _ref5, | ||
props = _objectWithoutProperties(_ref5, _excluded2); | ||
return /*#__PURE__*/React.createElement(StyledBlockText, _extends({ | ||
transform: `scale(${1 / zoomK})` | ||
transform: "scale(".concat(1 / zoomK, ")") | ||
}, props)); | ||
}); | ||
const BlockLabels = withZoomK(({ | ||
blockWidth, | ||
blockHeight, | ||
zoomK, | ||
children | ||
}) => /*#__PURE__*/React.createElement("g", { | ||
transform: `translate(${blockWidth / 2}, ${blockHeight / 2})`, | ||
style: { | ||
opacity: LABELS_OPACITY_SCALE(blockWidth * blockHeight * Math.pow(zoomK, 2)) | ||
} | ||
}, children)); | ||
var BlockLabels = withZoomK(_ref6 => { | ||
var { | ||
blockWidth, | ||
blockHeight, | ||
zoomK, | ||
children | ||
} = _ref6; | ||
return /*#__PURE__*/React.createElement("g", { | ||
transform: "translate(".concat(blockWidth / 2, ", ").concat(blockHeight / 2, ")"), | ||
style: { | ||
opacity: LABELS_OPACITY_SCALE(blockWidth * blockHeight * Math.pow(zoomK, 2)) | ||
} | ||
}, children); | ||
}); | ||
class TreemapBlock extends React.PureComponent { | ||
render() { | ||
const _this$props = this.props, | ||
blockId = _this$props.blockId, | ||
x = _this$props.x, | ||
y = _this$props.y, | ||
width = _this$props.width, | ||
height = _this$props.height, | ||
color = _this$props.color, | ||
borderWidth = _this$props.borderWidth, | ||
dim = _this$props.dim, | ||
title = _this$props.title, | ||
subtitle = _this$props.subtitle; | ||
const isDarkColor = isDark(color); | ||
var { | ||
blockId, | ||
x, | ||
y, | ||
width, | ||
height, | ||
color, | ||
borderWidth, | ||
dim, | ||
title, | ||
subtitle | ||
} = this.props; | ||
var isDarkColor = isDark(color); | ||
return /*#__PURE__*/React.createElement(BlockWrapper, { | ||
dim: dim, | ||
transform: `translate(${x},${y})` | ||
transform: "translate(".concat(x, ",").concat(y, ")") | ||
}, /*#__PURE__*/React.createElement(BlockRect, { | ||
id: `rect-${blockId}`, | ||
id: "rect-".concat(blockId), | ||
width: width, | ||
@@ -114,7 +134,7 @@ height: height, | ||
}), /*#__PURE__*/React.createElement("clipPath", { | ||
id: `clip-${blockId}` | ||
id: "clip-".concat(blockId) | ||
}, /*#__PURE__*/React.createElement("use", { | ||
xlinkHref: `#rect-${blockId}` | ||
xlinkHref: "#rect-".concat(blockId) | ||
})), /*#__PURE__*/React.createElement("g", { | ||
clipPath: `url(#clip-${blockId})` | ||
clipPath: "url(#clip-".concat(blockId, ")") | ||
}, /*#__PURE__*/React.createElement(BlockLabels, { | ||
@@ -121,0 +141,0 @@ blockWidth: width, |
@@ -41,16 +41,17 @@ import React from 'react'; | ||
_onZoom() { | ||
const _this$props = this.props, | ||
onZoomChange = _this$props.onZoomChange, | ||
xRange = _this$props.xRange, | ||
yRange = _this$props.yRange; | ||
const transform = d3Event.transform; | ||
var { | ||
onZoomChange, | ||
xRange, | ||
yRange | ||
} = this.props; | ||
var transform = d3Event.transform; | ||
const size = this._getElemDimensions(); | ||
var size = this._getElemDimensions(); | ||
this.state.zoom.translateExtent([[0, 0], size]); | ||
const xScale = scaleLinear().domain([0, size[0]]); | ||
const yScale = scaleLinear().domain([0, size[1]]); | ||
var xScale = scaleLinear().domain([0, size[0]]); | ||
var yScale = scaleLinear().domain([0, size[1]]); | ||
xScale.range(xRange || xScale.domain()); | ||
yScale.range(yRange || yScale.domain()); | ||
const dataRange = { | ||
var dataRange = { | ||
x: [xScale(Math.abs(transform.x)), xScale(Math.abs(transform.x) + (xScale.domain()[1] - xScale.domain()[0]) / transform.k)], | ||
@@ -66,3 +67,3 @@ y: [yScale(Math.abs(transform.y)), yScale(Math.abs(transform.y) + (yScale.domain()[1] - yScale.domain()[0]) / transform.k)] | ||
_getD3Elem() { | ||
const rootEl = d3Select(this.rootElem); | ||
var rootEl = d3Select(this.rootElem); | ||
return this.props.domSelector ? rootEl.select(this.props.domSelector) : rootEl; | ||
@@ -72,3 +73,3 @@ } | ||
_getElemDimensions() { | ||
const bbox = this._getD3Elem().node().getBoundingClientRect(); | ||
var bbox = this._getD3Elem().node().getBoundingClientRect(); | ||
@@ -75,0 +76,0 @@ return [bbox.width, bbox.height]; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -20,5 +20,7 @@ Object.defineProperty(exports, "__esModule", { | ||
var _excluded = ["onHover"]; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -33,14 +35,18 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -60,10 +66,10 @@ | ||
var withChartTooltip = function withChartTooltip(Comp) { | ||
var _class, _temp; | ||
var _class; | ||
return _temp = _class = /*#__PURE__*/function (_React$PureComponent) { | ||
return _class = /*#__PURE__*/function (_React$PureComponent) { | ||
_inherits(HierarchicalChart, _React$PureComponent); | ||
var _super = _createSuper(HierarchicalChart); | ||
function HierarchicalChart() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -77,11 +83,11 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(HierarchicalChart)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", { | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
hoverNode: null | ||
}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "chartId", Math.round(Math.random() * 1e12)); | ||
_defineProperty(_assertThisInitialized(_this), "chartId", Math.round(Math.random() * 1e12)); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_handleHover", function (d, node) { | ||
_defineProperty(_assertThisInitialized(_this), "_handleHover", function (d, node) { | ||
_this.setState({ | ||
@@ -94,3 +100,3 @@ hoverNode: node | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_getTooltipContent", function () { | ||
_defineProperty(_assertThisInitialized(_this), "_getTooltipContent", function () { | ||
var _this$props = _this.props, | ||
@@ -117,3 +123,3 @@ showTooltip = _this$props.showTooltip, | ||
_ = _this$props2.onHover, | ||
outerProps = _objectWithoutProperties(_this$props2, ["onHover"]); | ||
outerProps = _objectWithoutProperties(_this$props2, _excluded); | ||
@@ -150,3 +156,3 @@ var tooltipId = "tooltip-".concat(this.chartId); | ||
onHover: function onHover() {} | ||
}), _temp; | ||
}), _class; | ||
}; | ||
@@ -153,0 +159,0 @@ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -24,2 +24,5 @@ Object.defineProperty(exports, "__esModule", { | ||
var _excluded = ["zoomK", "borderWidth"], | ||
_excluded2 = ["zoomK"]; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -31,14 +34,18 @@ | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -48,3 +55,3 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -91,3 +98,3 @@ var LABELS_OPACITY_SCALE = (0, _d3Scale.scaleLinear)().domain([20, 50]).range([0, 1]); | ||
borderWidth = _ref3.borderWidth, | ||
props = _objectWithoutProperties(_ref3, ["zoomK", "borderWidth"]); | ||
props = _objectWithoutProperties(_ref3, _excluded); | ||
@@ -114,3 +121,3 @@ return /*#__PURE__*/_react.default.createElement(StyledCircle, _extends({ | ||
var zoomK = _ref5.zoomK, | ||
props = _objectWithoutProperties(_ref5, ["zoomK"]); | ||
props = _objectWithoutProperties(_ref5, _excluded2); | ||
@@ -135,6 +142,8 @@ return /*#__PURE__*/_react.default.createElement(StyledCircleText, _extends({ | ||
var _super = _createSuper(Circle); | ||
function Circle() { | ||
_classCallCheck(this, Circle); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(Circle).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -141,0 +150,0 @@ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -32,2 +32,8 @@ Object.defineProperty(exports, "__esModule", { | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -37,14 +43,18 @@ | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -74,5 +84,5 @@ | ||
var _super = _createSuper(CirclePackViz); | ||
function CirclePackViz() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -86,5 +96,5 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(CirclePackViz)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", { | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
zoomTransform: { | ||
@@ -97,11 +107,11 @@ x: 0, | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "zoomReset", function () { | ||
_defineProperty(_assertThisInitialized(_this), "zoomReset", function () { | ||
return _this.zoomElem.zoomReset(); | ||
}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "zoomBy", function (k) { | ||
_defineProperty(_assertThisInitialized(_this), "zoomBy", function (k) { | ||
return _this.zoomElem.zoomBy(k); | ||
}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_parseData", function () { | ||
_defineProperty(_assertThisInitialized(_this), "_parseData", function () { | ||
var _this$props = _this.props, | ||
@@ -131,3 +141,3 @@ data = _this$props.data, | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_handleZoomChange", function (_, zoomTransform, srcMouseEvent) { | ||
_defineProperty(_assertThisInitialized(_this), "_handleZoomChange", function (_, zoomTransform, srcMouseEvent) { | ||
// Prevent using transitions when using mouse wheel to zoom | ||
@@ -179,8 +189,7 @@ _this.skipTransitions = !!srcMouseEvent; | ||
function didPropsChange(propNames) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var _iterator = _createForOfIteratorHelper(propNames), | ||
_step; | ||
try { | ||
for (var _iterator = propNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var p = _step.value; | ||
@@ -193,14 +202,5 @@ | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
_iterator.e(err); | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
_iterator.f(); | ||
} | ||
@@ -207,0 +207,0 @@ |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.CirclePackChart = exports.TreemapChart = exports.SunburstChart = exports.PartitionChart = void 0; | ||
exports.TreemapChart = exports.SunburstChart = exports.PartitionChart = exports.CirclePackChart = void 0; | ||
@@ -9,0 +9,0 @@ var _utilResponsive = require("@cloudflare/util-responsive"); |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -34,2 +34,4 @@ Object.defineProperty(exports, "__esModule", { | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
@@ -51,14 +53,18 @@ | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -83,5 +89,5 @@ | ||
var _super = _createSuper(PartitionViz); | ||
function PartitionViz() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -95,5 +101,5 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(PartitionViz)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", { | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
zoomTransform: { | ||
@@ -106,11 +112,11 @@ x: 0, | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "zoomReset", function () { | ||
_defineProperty(_assertThisInitialized(_this), "zoomReset", function () { | ||
return _this.zoomElem.zoomReset(); | ||
}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "zoomBy", function (k) { | ||
_defineProperty(_assertThisInitialized(_this), "zoomBy", function (k) { | ||
return _this.zoomElem.zoomBy(k); | ||
}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "zoomToNode", function (d) { | ||
_defineProperty(_assertThisInitialized(_this), "zoomToNode", function (d) { | ||
var _this$zoomElem; | ||
@@ -123,7 +129,7 @@ | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_rev", function (arr, reverse) { | ||
_defineProperty(_assertThisInitialized(_this), "_rev", function (arr, reverse) { | ||
return reverse ? arr.reverse() : arr; | ||
}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_parseData", function () { | ||
_defineProperty(_assertThisInitialized(_this), "_parseData", function () { | ||
var _this$props = _this.props, | ||
@@ -166,3 +172,3 @@ data = _this$props.data, | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_handleZoomChange", function (_, zoomTransform, srcMouseEvent) { | ||
_defineProperty(_assertThisInitialized(_this), "_handleZoomChange", function (_, zoomTransform, srcMouseEvent) { | ||
// Prevent using transitions when using mouse wheel to zoom | ||
@@ -202,8 +208,7 @@ _this.skipTransitions = !!srcMouseEvent; | ||
function didPropsChange(propNames) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var _iterator = _createForOfIteratorHelper(propNames), | ||
_step; | ||
try { | ||
for (var _iterator = propNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var p = _step.value; | ||
@@ -216,14 +221,5 @@ | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
_iterator.e(err); | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
_iterator.f(); | ||
} | ||
@@ -230,0 +226,0 @@ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -24,2 +24,4 @@ Object.defineProperty(exports, "__esModule", { | ||
var _excluded = ["zoomK", "stretchVertically"]; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -31,14 +33,18 @@ | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -48,3 +54,3 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -103,3 +109,3 @@ var LABELS_OPACITY_SCALE = (0, _d3Scale.scaleLinear)().domain([15, 40]).range([0, 1]); | ||
stretchVertically = _ref3.stretchVertically, | ||
props = _objectWithoutProperties(_ref3, ["zoomK", "stretchVertically"]); | ||
props = _objectWithoutProperties(_ref3, _excluded); | ||
@@ -134,6 +140,8 @@ var textScale = [1 / zoomK, 1]; | ||
var _super = _createSuper(PartitionBlock); | ||
function PartitionBlock() { | ||
_classCallCheck(this, PartitionBlock); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(PartitionBlock).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -140,0 +148,0 @@ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -32,4 +32,2 @@ Object.defineProperty(exports, "__esModule", { | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
@@ -39,2 +37,6 @@ | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
@@ -46,14 +48,18 @@ | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -72,5 +78,5 @@ | ||
var _super = _createSuper(SunburstViz); | ||
function SunburstViz() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -84,7 +90,7 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SunburstViz)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {}); | ||
_defineProperty(_assertThisInitialized(_this), "state", {}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_parseData", function () { | ||
_defineProperty(_assertThisInitialized(_this), "_parseData", function () { | ||
var _this$props = _this.props, | ||
@@ -140,8 +146,7 @@ data = _this$props.data, | ||
function didPropsChange(propNames) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var _iterator = _createForOfIteratorHelper(propNames), | ||
_step; | ||
try { | ||
for (var _iterator = propNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var p = _step.value; | ||
@@ -154,14 +159,5 @@ | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
_iterator.e(err); | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
_iterator.f(); | ||
} | ||
@@ -168,0 +164,0 @@ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -24,2 +24,4 @@ Object.defineProperty(exports, "__esModule", { | ||
var _excluded = ["arcId", "children"]; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -31,14 +33,18 @@ | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -94,3 +100,3 @@ | ||
children = _ref4.children, | ||
props = _objectWithoutProperties(_ref4, ["arcId", "children"]); | ||
props = _objectWithoutProperties(_ref4, _excluded); | ||
@@ -111,6 +117,8 @@ return /*#__PURE__*/_react.default.createElement(StyledSliceText, props, /*#__PURE__*/_react.default.createElement("textPath", { | ||
var _super = _createSuper(SunburstSlice); | ||
function SunburstSlice() { | ||
_classCallCheck(this, SunburstSlice); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(SunburstSlice).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -117,0 +125,0 @@ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -32,2 +32,8 @@ Object.defineProperty(exports, "__esModule", { | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -37,14 +43,18 @@ | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -74,5 +84,5 @@ | ||
var _super = _createSuper(TreemapViz); | ||
function TreemapViz() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -86,5 +96,5 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(TreemapViz)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", { | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
zoomTransform: { | ||
@@ -97,11 +107,11 @@ x: 0, | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "zoomReset", function () { | ||
_defineProperty(_assertThisInitialized(_this), "zoomReset", function () { | ||
return _this.zoomElem.zoomReset(); | ||
}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "zoomBy", function (k) { | ||
_defineProperty(_assertThisInitialized(_this), "zoomBy", function (k) { | ||
return _this.zoomElem.zoomBy(k); | ||
}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_parseData", function () { | ||
_defineProperty(_assertThisInitialized(_this), "_parseData", function () { | ||
var _this$props = _this.props, | ||
@@ -131,3 +141,3 @@ data = _this$props.data, | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_handleZoomChange", function (_, zoomTransform, srcMouseEvent) { | ||
_defineProperty(_assertThisInitialized(_this), "_handleZoomChange", function (_, zoomTransform, srcMouseEvent) { | ||
// Prevent using transitions when using mouse wheel to zoom | ||
@@ -178,8 +188,7 @@ _this.skipTransitions = !!srcMouseEvent; | ||
function didPropsChange(propNames) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var _iterator = _createForOfIteratorHelper(propNames), | ||
_step; | ||
try { | ||
for (var _iterator = propNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var p = _step.value; | ||
@@ -192,14 +201,5 @@ | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
_iterator.e(err); | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
_iterator.f(); | ||
} | ||
@@ -206,0 +206,0 @@ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -24,2 +24,5 @@ Object.defineProperty(exports, "__esModule", { | ||
var _excluded = ["zoomK", "borderWidth"], | ||
_excluded2 = ["zoomK"]; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -31,14 +34,18 @@ | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -48,3 +55,3 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -91,3 +98,3 @@ var LABELS_OPACITY_SCALE = (0, _d3Scale.scaleLinear)().domain([600, 3000]).range([0, 1]); | ||
borderWidth = _ref3.borderWidth, | ||
props = _objectWithoutProperties(_ref3, ["zoomK", "borderWidth"]); | ||
props = _objectWithoutProperties(_ref3, _excluded); | ||
@@ -114,3 +121,3 @@ return /*#__PURE__*/_react.default.createElement(StyledBlockRect, _extends({ | ||
var zoomK = _ref5.zoomK, | ||
props = _objectWithoutProperties(_ref5, ["zoomK"]); | ||
props = _objectWithoutProperties(_ref5, _excluded2); | ||
@@ -137,6 +144,8 @@ return /*#__PURE__*/_react.default.createElement(StyledBlockText, _extends({ | ||
var _super = _createSuper(TreemapBlock); | ||
function TreemapBlock() { | ||
_classCallCheck(this, TreemapBlock); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(TreemapBlock).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -143,0 +152,0 @@ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
@@ -28,17 +28,23 @@ Object.defineProperty(exports, "__esModule", { | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var Zoomable = /*#__PURE__*/function (_React$PureComponent) { | ||
_inherits(Zoomable, _React$PureComponent); | ||
var _super = _createSuper(Zoomable); | ||
function Zoomable(props) { | ||
@@ -49,11 +55,11 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Zoomable).call(this, props)); | ||
_this = _super.call(this, props); | ||
_this.state = { | ||
zoom: (0, _d3Zoom.zoom)().scaleExtent([1, Infinity]) | ||
}; | ||
_this.zoomReset = _this.zoomReset.bind(_assertThisInitialized(_assertThisInitialized(_this))); | ||
_this.zoomBy = _this.zoomBy.bind(_assertThisInitialized(_assertThisInitialized(_this))); | ||
_this.zoomTo = _this.zoomTo.bind(_assertThisInitialized(_assertThisInitialized(_this))); | ||
_this._getD3Elem = _this._getD3Elem.bind(_assertThisInitialized(_assertThisInitialized(_this))); | ||
_this._onZoom = _this._onZoom.bind(_assertThisInitialized(_assertThisInitialized(_this))); | ||
_this.zoomReset = _this.zoomReset.bind(_assertThisInitialized(_this)); | ||
_this.zoomBy = _this.zoomBy.bind(_assertThisInitialized(_this)); | ||
_this.zoomTo = _this.zoomTo.bind(_assertThisInitialized(_this)); | ||
_this._getD3Elem = _this._getD3Elem.bind(_assertThisInitialized(_this)); | ||
_this._onZoom = _this._onZoom.bind(_assertThisInitialized(_this)); | ||
return _this; | ||
@@ -60,0 +66,0 @@ } |
{ | ||
"name": "@cloudflare/chart-hierarchical", | ||
"description": "Cloudflare hierarchical interactive charts", | ||
"version": "3.7.6", | ||
"version": "4.0.0", | ||
"main": "lib/index.js", | ||
@@ -10,8 +10,9 @@ "module": "es/index.js", | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/", | ||
"access": "public" | ||
"access": "public", | ||
"main": "lib/index.js", | ||
"module": "es/index.js" | ||
}, | ||
"dependencies": { | ||
"@cloudflare/util-color": "^1.1.18", | ||
"@cloudflare/util-responsive": "^1.2.64", | ||
"@cloudflare/util-responsive": "^1.2.66", | ||
"d3-ease": "^1.0.3", | ||
@@ -33,3 +34,3 @@ "d3-hierarchy": "^1.1.5", | ||
"@cloudflare/style-const": "^5.3.9", | ||
"@cloudflare/style-container": "^7.8.41", | ||
"@cloudflare/style-container": "^7.9.0", | ||
"react": "^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0" | ||
@@ -47,4 +48,3 @@ }, | ||
"test-watch": "stratus test --watch" | ||
}, | ||
"gitHead": "db9637310d476ef91a50177d026526ca40cb9330" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
319949
4076