@unovis/ts 1.5.1-xplg.4 → 1.6.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/components/annotations/style.js.map +1 -1
- package/components/area/config.d.ts +7 -3
- package/components/area/config.js +1 -1
- package/components/area/config.js.map +1 -1
- package/components/area/index.js +25 -9
- package/components/area/index.js.map +1 -1
- package/components/area/style.js.map +1 -1
- package/components/axis/index.d.ts +1 -0
- package/components/axis/index.js +10 -2
- package/components/axis/index.js.map +1 -1
- package/components/axis/style.js.map +1 -1
- package/components/brush/config.d.ts +1 -1
- package/components/brush/config.js.map +1 -1
- package/components/brush/style.js.map +1 -1
- package/components/bullet-legend/style.js.map +1 -1
- package/components/chord-diagram/index.js +3 -1
- package/components/chord-diagram/index.js.map +1 -1
- package/components/chord-diagram/style.js.map +1 -1
- package/components/crosshair/style.js.map +1 -1
- package/components/donut/style.js.map +1 -1
- package/components/flow-legend/style.js.map +1 -1
- package/components/free-brush/style.js.map +1 -1
- package/components/graph/index.js +3 -4
- package/components/graph/index.js.map +1 -1
- package/components/graph/modules/link/index.js +1 -2
- package/components/graph/modules/link/index.js.map +1 -1
- package/components/graph/modules/link/style.js.map +1 -1
- package/components/graph/modules/node/style.js.map +1 -1
- package/components/graph/modules/panel/style.js.map +1 -1
- package/components/graph/style.js.map +1 -1
- package/components/grouped-bar/style.js.map +1 -1
- package/components/leaflet-flow-map/config.js +0 -1
- package/components/leaflet-flow-map/config.js.map +1 -1
- package/components/leaflet-flow-map/shaders.js.map +1 -1
- package/components/leaflet-map/config.js +0 -1
- package/components/leaflet-map/config.js.map +1 -1
- package/components/leaflet-map/modules/map.js +3 -3
- package/components/leaflet-map/modules/map.js.map +1 -1
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +1 -1
- package/components/leaflet-map/style.js.map +1 -1
- package/components/line/config.d.ts +5 -0
- package/components/line/config.js +1 -1
- package/components/line/config.js.map +1 -1
- package/components/line/index.js +41 -2
- package/components/line/index.js.map +1 -1
- package/components/line/style.d.ts +1 -0
- package/components/line/style.js +12 -1
- package/components/line/style.js.map +1 -1
- package/components/line/types.d.ts +1 -0
- package/components/nested-donut/config.d.ts +1 -1
- package/components/nested-donut/config.js.map +1 -1
- package/components/nested-donut/style.js.map +1 -1
- package/components/sankey/modules/label.js.map +1 -1
- package/components/sankey/modules/link.js.map +1 -1
- package/components/sankey/style.js.map +1 -1
- package/components/scatter/style.js.map +1 -1
- package/components/stacked-bar/style.js.map +1 -1
- package/components/timeline/config.d.ts +14 -65
- package/components/timeline/config.js +1 -15
- package/components/timeline/config.js.map +1 -1
- package/components/timeline/index.d.ts +10 -21
- package/components/timeline/index.js +93 -379
- package/components/timeline/index.js.map +1 -1
- package/components/timeline/style.d.ts +0 -7
- package/components/timeline/style.js +1 -40
- package/components/timeline/style.js.map +1 -1
- package/components/tooltip/config.d.ts +6 -4
- package/components/tooltip/config.js +3 -1
- package/components/tooltip/config.js.map +1 -1
- package/components/tooltip/index.d.ts +7 -3
- package/components/tooltip/index.js +39 -9
- package/components/tooltip/index.js.map +1 -1
- package/components/tooltip/style.js.map +1 -1
- package/components/topojson-map/index.js.map +1 -1
- package/components/topojson-map/style.js.map +1 -1
- package/components/vis-controls/style.js.map +1 -1
- package/components/xy-labels/style.js.map +1 -1
- package/components.d.ts +0 -4
- package/components.js +0 -2
- package/components.js.map +1 -1
- package/containers/single-container/config.d.ts +0 -3
- package/containers/single-container/config.js.map +1 -1
- package/containers/single-container/index.js +1 -2
- package/containers/single-container/index.js.map +1 -1
- package/containers/xy-container/config.d.ts +0 -5
- package/containers/xy-container/config.js +1 -1
- package/containers/xy-container/config.js.map +1 -1
- package/containers/xy-container/index.d.ts +0 -1
- package/containers/xy-container/index.js +11 -15
- package/containers/xy-container/index.js.map +1 -1
- package/core/container/config.js +0 -1
- package/core/container/config.js.map +1 -1
- package/index.js +3 -5
- package/index.js.map +1 -1
- package/maps/ind-regions.json.js +1 -1
- package/maps/us-counties.json.js +8 -8
- package/package.json +6 -5
- package/styles/index.js.map +1 -1
- package/styles/patterns.js.map +1 -1
- package/styles/sizes.js.map +1 -1
- package/types/position.d.ts +1 -2
- package/types/position.js +0 -1
- package/types/position.js.map +1 -1
- package/types.d.ts +0 -2
- package/types.js +1 -4
- package/types.js.map +1 -1
- package/utils/color.d.ts +0 -14
- package/utils/color.js +2 -26
- package/utils/color.js.map +1 -1
- package/utils/data.d.ts +1 -1
- package/utils/data.js +1 -1
- package/utils/data.js.map +1 -1
- package/utils/index.js +3 -3
- package/utils/path.d.ts +0 -8
- package/utils/path.js +1 -109
- package/utils/path.js.map +1 -1
- package/utils/text.d.ts +1 -2
- package/utils/text.js +2 -10
- package/utils/text.js.map +1 -1
- package/components/rolling-pin-legend/config.d.ts +0 -19
- package/components/rolling-pin-legend/config.js +0 -9
- package/components/rolling-pin-legend/config.js.map +0 -1
- package/components/rolling-pin-legend/index.d.ts +0 -16
- package/components/rolling-pin-legend/index.js +0 -63
- package/components/rolling-pin-legend/index.js.map +0 -1
- package/components/rolling-pin-legend/style.d.ts +0 -5
- package/components/rolling-pin-legend/style.js +0 -40
- package/components/rolling-pin-legend/style.js.map +0 -1
- package/components/rolling-pin-legend/types.d.ts +0 -1
- package/components/timeline/constants.d.ts +0 -3
- package/components/timeline/constants.js +0 -6
- package/components/timeline/constants.js.map +0 -1
- package/components/timeline/types.d.ts +0 -62
- package/components/timeline/types.js +0 -2
- package/components/timeline/types.js.map +0 -1
- package/components/timeline/utils.d.ts +0 -2
- package/components/timeline/utils.js +0 -16
- package/components/timeline/utils.js.map +0 -1
- package/components/treemap/config.d.ts +0 -44
- package/components/treemap/config.js +0 -6
- package/components/treemap/config.js.map +0 -1
- package/components/treemap/index.d.ts +0 -16
- package/components/treemap/index.js +0 -263
- package/components/treemap/index.js.map +0 -1
- package/components/treemap/style.d.ts +0 -22
- package/components/treemap/style.js +0 -62
- package/components/treemap/style.js.map +0 -1
- package/components/treemap/types.d.ts +0 -11
- package/components/treemap/types.js +0 -2
- package/components/treemap/types.js.map +0 -1
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import { select } from 'd3-selection';
|
|
2
|
-
import { hierarchy, treemap } from 'd3-hierarchy';
|
|
3
|
-
import { extent, group, max } from 'd3-array';
|
|
4
|
-
import { scaleLinear, scaleThreshold } from 'd3-scale';
|
|
5
|
-
import { hsl } from 'd3-color';
|
|
6
|
-
import { wrapSVGText } from '../../utils/text.js';
|
|
7
|
-
import { ComponentCore } from '../../core/component/index.js';
|
|
8
|
-
import { SeriesDataModel } from '../../data-models/series.js';
|
|
9
|
-
import { getColor, getHexValue, brighter, isDarkBackground } from '../../utils/color.js';
|
|
10
|
-
import { getString, getNumber } from '../../utils/data.js';
|
|
11
|
-
import { TreemapDefaultConfig } from './config.js';
|
|
12
|
-
import * as style from './style.js';
|
|
13
|
-
import { tiles, tileGroup, tile, clickableTile, label } from './style.js';
|
|
14
|
-
|
|
15
|
-
const LIGHTNESS_VARIATION_AMOUNT = 0.08;
|
|
16
|
-
const MIN_TILE_SIZE_FOR_LABEL = 20;
|
|
17
|
-
const defaultNumberFormat = (value) => `${value}`;
|
|
18
|
-
class Treemap extends ComponentCore {
|
|
19
|
-
constructor(config) {
|
|
20
|
-
super();
|
|
21
|
-
this._defaultConfig = TreemapDefaultConfig;
|
|
22
|
-
this.config = this._defaultConfig;
|
|
23
|
-
this.datamodel = new SeriesDataModel();
|
|
24
|
-
if (config)
|
|
25
|
-
this.setConfig(config);
|
|
26
|
-
this.tiles = this.g.append('g').attr('class', tiles);
|
|
27
|
-
}
|
|
28
|
-
isTileLargeEnough(d) {
|
|
29
|
-
const w = d.x1 - d.x0;
|
|
30
|
-
const h = d.y1 - d.y0;
|
|
31
|
-
return (w >= MIN_TILE_SIZE_FOR_LABEL) && (h >= MIN_TILE_SIZE_FOR_LABEL);
|
|
32
|
-
}
|
|
33
|
-
getTileLightness(node, siblings) {
|
|
34
|
-
// Get the value extent of the sibling group
|
|
35
|
-
const [minValue, maxValue] = extent(siblings, d => d.value);
|
|
36
|
-
// If there's no range or no value, return default lightness
|
|
37
|
-
if (minValue === maxValue || !node.value)
|
|
38
|
-
return 0;
|
|
39
|
-
// Calculate relative position in the range (0 to 1)
|
|
40
|
-
// Larger values will be closer to 0 (darker)
|
|
41
|
-
return LIGHTNESS_VARIATION_AMOUNT * ((maxValue - node.value) / (maxValue - minValue));
|
|
42
|
-
}
|
|
43
|
-
_render() {
|
|
44
|
-
var _a;
|
|
45
|
-
const { config, datamodel: { data }, _width, _height } = this;
|
|
46
|
-
const { numberFormat = defaultNumberFormat } = config;
|
|
47
|
-
if (!((_a = config.layers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
48
|
-
console.warn('Unovis | Treemap: No layers defined');
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
// Map each layer accessor function to get string values from the data array
|
|
52
|
-
const layerAccessors = config.layers.map(layerAccessor => {
|
|
53
|
-
return (i) => getString(data[i], layerAccessor, i);
|
|
54
|
-
});
|
|
55
|
-
// Group the data indices by the layer accessors to create a hierarchical structure
|
|
56
|
-
const nestedData = group(data.keys(), ...layerAccessors);
|
|
57
|
-
// Create the hierarchy from the grouped data,
|
|
58
|
-
// which by itself is not quite right because there is an extra
|
|
59
|
-
// level of nesting that we don't want, just above the leaf nodes.
|
|
60
|
-
const rootNode = hierarchy(nestedData);
|
|
61
|
-
// Compute the aggregation
|
|
62
|
-
if (config.value) {
|
|
63
|
-
rootNode.sum(index => typeof index === 'number' && getNumber(data[index], config.value, index));
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
rootNode.count();
|
|
67
|
-
}
|
|
68
|
-
// Fix the hierarchy by removing the extra level of nesting
|
|
69
|
-
rootNode.each(node => {
|
|
70
|
-
if (!node.children) {
|
|
71
|
-
node.parent.children = null;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
const treemapLayout = treemap()
|
|
75
|
-
.size([_width, _height])
|
|
76
|
-
.round(true)
|
|
77
|
-
.padding(config.tilePadding);
|
|
78
|
-
// Apply padding to the top of each tile,
|
|
79
|
-
// but not for the root node.
|
|
80
|
-
if (this.config.tilePaddingTop !== undefined) {
|
|
81
|
-
treemapLayout.paddingTop(d => d.parent ? config.tilePaddingTop : 0);
|
|
82
|
-
}
|
|
83
|
-
// Compute the treemap layout
|
|
84
|
-
const treemapData = treemapLayout(rootNode);
|
|
85
|
-
// Process the resulting hierarchy into the type we need
|
|
86
|
-
let nodeId = 0;
|
|
87
|
-
treemapData.each(node => {
|
|
88
|
-
const n = node;
|
|
89
|
-
// Generate unique IDs for each node
|
|
90
|
-
node._id = `node-${nodeId++}`;
|
|
91
|
-
const treemapDatum = {
|
|
92
|
-
key: n.data[0],
|
|
93
|
-
};
|
|
94
|
-
// Populate the index and datum for leaf nodes
|
|
95
|
-
const isLeafNode = !n.children;
|
|
96
|
-
if (isLeafNode) {
|
|
97
|
-
treemapDatum.index = n.data[1][0];
|
|
98
|
-
treemapDatum.datum = data[treemapDatum.index];
|
|
99
|
-
}
|
|
100
|
-
node.data = treemapDatum;
|
|
101
|
-
});
|
|
102
|
-
const descendants = treemapData.descendants();
|
|
103
|
-
// Set up the brightness increase scale based on depth
|
|
104
|
-
const maxDepth = max(descendants, d => d.depth);
|
|
105
|
-
const brightnessIncrease = scaleLinear()
|
|
106
|
-
.domain([1, maxDepth])
|
|
107
|
-
.range([0, 1]);
|
|
108
|
-
// Get all leaf node values and calculate their square roots
|
|
109
|
-
// (since area is proportional to value)
|
|
110
|
-
const leafValues = descendants.filter(d => !d.children).map(d => d.value);
|
|
111
|
-
const maxLeafValue = Math.sqrt(max(leafValues)) || 0;
|
|
112
|
-
// Divide the range into three equal intervals based on the square root of values
|
|
113
|
-
// This accounts for the fact that area is proportional to value
|
|
114
|
-
const fontSizeScale = scaleThreshold()
|
|
115
|
-
.domain([
|
|
116
|
-
maxLeafValue / 3,
|
|
117
|
-
(maxLeafValue * 2) / 3, // Second third of the max value
|
|
118
|
-
])
|
|
119
|
-
.range([
|
|
120
|
-
config.tileLabelSmallFontSize,
|
|
121
|
-
config.tileLabelMediumFontSize,
|
|
122
|
-
config.tileLabelLargeFontSize,
|
|
123
|
-
]);
|
|
124
|
-
// First pass: Set base colors without considering tileColor config
|
|
125
|
-
treemapData
|
|
126
|
-
.eachBefore((node) => {
|
|
127
|
-
if (!node.children)
|
|
128
|
-
return;
|
|
129
|
-
const children = node.children;
|
|
130
|
-
children.forEach((treemapChild, i) => {
|
|
131
|
-
// Use default color scheme without tileColor config
|
|
132
|
-
let color = getColor(treemapChild, undefined, i, treemapChild.depth !== 1);
|
|
133
|
-
color = color !== null && color !== void 0 ? color : node._fill;
|
|
134
|
-
const hexColor = color ? getHexValue(color, this.g.node()) : null;
|
|
135
|
-
if (hexColor) {
|
|
136
|
-
const hslColor = hsl(hexColor);
|
|
137
|
-
if (config.enableLightnessVariance) {
|
|
138
|
-
if (!treemapChild.children) {
|
|
139
|
-
const lightnessAdjustment = this.getTileLightness(treemapChild, children);
|
|
140
|
-
hslColor.l = Math.min(1, hslColor.l + lightnessAdjustment);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
treemapChild._fill = brighter(hslColor.toString(), brightnessIncrease(treemapChild.depth));
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
treemapChild._fill = null;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
// Second pass: Apply tileColor config as an overlay
|
|
151
|
-
if (config.tileColor) {
|
|
152
|
-
treemapData
|
|
153
|
-
.eachBefore((node) => {
|
|
154
|
-
const color = getColor(node, config.tileColor);
|
|
155
|
-
if (color !== null) {
|
|
156
|
-
node._fill = color;
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
// Render tiles
|
|
161
|
-
const visibleNodes = descendants.filter(d => d.depth > 0);
|
|
162
|
-
const tiles = this.tiles
|
|
163
|
-
.selectAll(`g.${tileGroup}`)
|
|
164
|
-
.data(visibleNodes, d => d._id);
|
|
165
|
-
const tilesEnter = tiles
|
|
166
|
-
.enter()
|
|
167
|
-
.append('g')
|
|
168
|
-
.attr('class', tileGroup);
|
|
169
|
-
// Computes the rect border radius for a given tile.
|
|
170
|
-
// The rx and ry values are the minimum of the tile
|
|
171
|
-
// border radius and some fraction the width of the tile,
|
|
172
|
-
// based on the tileBorderRadiusFactor config.
|
|
173
|
-
// This ensures that the tile border radius is not
|
|
174
|
-
// larger than the tile size, which makes small tiles
|
|
175
|
-
// look better.
|
|
176
|
-
const rx = (d) => Math.min(config.tileBorderRadius, (d.x1 - d.x0) * config.tileBorderRadiusFactor);
|
|
177
|
-
// Add clipPath elements
|
|
178
|
-
tilesEnter
|
|
179
|
-
.append('clipPath')
|
|
180
|
-
.attr('id', d => `clip-${d._id}`)
|
|
181
|
-
.append('rect')
|
|
182
|
-
.attr('rx', rx)
|
|
183
|
-
.attr('ry', rx);
|
|
184
|
-
// Tile rectangles
|
|
185
|
-
tilesEnter
|
|
186
|
-
.append('rect')
|
|
187
|
-
.classed(tile, true)
|
|
188
|
-
// Make the leaf tiles clickable if a click handler is provided
|
|
189
|
-
.classed(clickableTile, d => config.showTileClickAffordance && !d.children)
|
|
190
|
-
.attr('rx', rx)
|
|
191
|
-
.attr('ry', rx)
|
|
192
|
-
// Initialize tile positions so that the initial transition is smooth
|
|
193
|
-
.attr('x', d => d.x0)
|
|
194
|
-
.attr('y', d => d.y0)
|
|
195
|
-
.attr('width', d => d.x1 - d.x0)
|
|
196
|
-
.attr('height', d => d.y1 - d.y0)
|
|
197
|
-
.style('fill', d => { var _a; return (_a = d._fill) !== null && _a !== void 0 ? _a : getColor(d, config.tileColor); })
|
|
198
|
-
.style('opacity', 0)
|
|
199
|
-
.style('cursor', config.showTileClickAffordance ? d => !d.children ? 'pointer' : null : null);
|
|
200
|
-
tiles.merge(tilesEnter).select(`rect.${tile}`)
|
|
201
|
-
.style('fill', d => { var _a; return (_a = d._fill) !== null && _a !== void 0 ? _a : getColor(d, config.tileColor); })
|
|
202
|
-
.style('opacity', 1)
|
|
203
|
-
.attr('x', d => d.x0)
|
|
204
|
-
.attr('y', d => d.y0)
|
|
205
|
-
.attr('width', d => d.x1 - d.x0)
|
|
206
|
-
.attr('height', d => d.y1 - d.y0);
|
|
207
|
-
// Update clipPath rects
|
|
208
|
-
tiles.merge(tilesEnter).select('clipPath rect')
|
|
209
|
-
.attr('x', d => d.x0)
|
|
210
|
-
.attr('y', d => d.y0)
|
|
211
|
-
.attr('width', d => d.x1 - d.x0 - config.tilePadding)
|
|
212
|
-
.attr('height', d => d.y1 - d.y0);
|
|
213
|
-
// Tile labels
|
|
214
|
-
tilesEnter
|
|
215
|
-
.append('text')
|
|
216
|
-
.attr('class', label)
|
|
217
|
-
.attr('clip-path', d => `url(#clip-${d._id})`);
|
|
218
|
-
// Update all labels first
|
|
219
|
-
const mergedTiles = tiles.merge(tilesEnter);
|
|
220
|
-
// Hide labels that don't meet criteria
|
|
221
|
-
mergedTiles.select(`text.${label}`)
|
|
222
|
-
.style('display', d => {
|
|
223
|
-
const isAllowedNode = config.labelInternalNodes ? true : !d.children;
|
|
224
|
-
return isAllowedNode && this.isTileLargeEnough(d) ? null : 'none';
|
|
225
|
-
})
|
|
226
|
-
// Make the internal labels semibold
|
|
227
|
-
.style('font-weight', d => d.children ? '500' : 'normal');
|
|
228
|
-
// Update visible labels
|
|
229
|
-
mergedTiles.select(`text.${label}`)
|
|
230
|
-
.filter(d => {
|
|
231
|
-
const isAllowedNode = config.labelInternalNodes ? true : !d.children;
|
|
232
|
-
return isAllowedNode && this.isTileLargeEnough(d);
|
|
233
|
-
})
|
|
234
|
-
.attr('clip-path', d => `url(#clip-${d._id})`)
|
|
235
|
-
.attr('x', d => d.x0 + config.labelOffsetX)
|
|
236
|
-
.attr('y', d => d.y0 + config.labelOffsetY)
|
|
237
|
-
.each(function (d) {
|
|
238
|
-
var _a;
|
|
239
|
-
const text = select(this);
|
|
240
|
-
const label = `${d.data.key}: ${numberFormat(d.value)}`;
|
|
241
|
-
text.text(label);
|
|
242
|
-
// Set text color based on background darkness
|
|
243
|
-
const backgroundColor = (_a = d._fill) !== null && _a !== void 0 ? _a : getColor(d, config.tileColor);
|
|
244
|
-
const textColor = backgroundColor && isDarkBackground(backgroundColor) ? '#ffffff' : '#000000';
|
|
245
|
-
text.style('fill', textColor);
|
|
246
|
-
// Apply font size scaling only to leaf nodes if enabled
|
|
247
|
-
if (!d.children && config.enableTileLabelFontSizeVariation) {
|
|
248
|
-
text.style('font-size', `${fontSizeScale(Math.sqrt(d.value))}px`);
|
|
249
|
-
}
|
|
250
|
-
// Apply text wrapping to leaf nodes
|
|
251
|
-
if (!d.children) {
|
|
252
|
-
const availableWidth = d.x1 - d.x0 - (2 * config.labelOffsetX);
|
|
253
|
-
wrapSVGText(text, availableWidth);
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
// Exit
|
|
257
|
-
tiles.exit().remove();
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
Treemap.selectors = style;
|
|
261
|
-
|
|
262
|
-
export { Treemap };
|
|
263
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/treemap/index.ts"],"sourcesContent":["import { Selection, select } from 'd3-selection'\nimport { hierarchy, HierarchyNode, treemap } from 'd3-hierarchy'\nimport { group, max, extent } from 'd3-array'\nimport { scaleLinear, scaleThreshold } from 'd3-scale'\nimport { hsl } from 'd3-color'\nimport { wrapSVGText } from 'utils/text'\nimport { ComponentCore } from 'core/component'\nimport { SeriesDataModel } from 'data-models/series'\nimport { getColor, brighter, getHexValue, isDarkBackground } from 'utils/color'\nimport { getString, getNumber } from 'utils/data'\nimport { TreemapConfigInterface, TreemapDefaultConfig } from './config'\nimport { TreemapDatum, TreemapNode } from './types'\n\nimport * as s from './style' // Minimum pixel size for showing labels\n\nconst LIGHTNESS_VARIATION_AMOUNT = 0.08\n\nconst MIN_TILE_SIZE_FOR_LABEL = 20\n\nconst defaultNumberFormat = (value: number): string => `${value}`\n\nexport class Treemap<Datum> extends ComponentCore<Datum[], TreemapConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = TreemapDefaultConfig as TreemapConfigInterface<Datum>\n public config: TreemapConfigInterface<Datum> = this._defaultConfig\n\n datamodel: SeriesDataModel<Datum> = new SeriesDataModel()\n tiles: Selection<SVGGElement, unknown, SVGGElement, unknown>\n\n private isTileLargeEnough (d: TreemapNode<Datum>): boolean {\n const w = d.x1 - d.x0\n const h = d.y1 - d.y0\n return (w >= MIN_TILE_SIZE_FOR_LABEL) && (h >= MIN_TILE_SIZE_FOR_LABEL)\n }\n\n private getTileLightness (node: TreemapNode<Datum>, siblings: TreemapNode<Datum>[]): number {\n // Get the value extent of the sibling group\n const [minValue, maxValue] = extent(siblings, d => d.value)\n\n // If there's no range or no value, return default lightness\n if (minValue === maxValue || !node.value) return 0\n\n // Calculate relative position in the range (0 to 1)\n // Larger values will be closer to 0 (darker)\n return LIGHTNESS_VARIATION_AMOUNT * ((maxValue - node.value) / (maxValue - minValue))\n }\n\n constructor (config?: TreemapConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n this.tiles = this.g.append('g').attr('class', s.tiles)\n }\n\n _render (): void {\n const { config, datamodel: { data }, _width, _height } = this\n const { numberFormat = defaultNumberFormat } = config\n\n if (!config.layers?.length) {\n console.warn('Unovis | Treemap: No layers defined')\n return\n }\n\n // Map each layer accessor function to get string values from the data array\n const layerAccessors = config.layers.map(layerAccessor => {\n return (i: number) => getString(data[i], layerAccessor, i)\n })\n\n // Group the data indices by the layer accessors to create a hierarchical structure\n const nestedData = group(data.keys(), ...layerAccessors as [(d: number) => string])\n\n // Create the hierarchy from the grouped data,\n // which by itself is not quite right because there is an extra\n // level of nesting that we don't want, just above the leaf nodes.\n const rootNode = hierarchy(nestedData)\n\n // Compute the aggregation\n if (config.value) {\n rootNode.sum(index => typeof index === 'number' && getNumber(data[index], config.value, index))\n } else {\n rootNode.count()\n }\n\n // Fix the hierarchy by removing the extra level of nesting\n rootNode.each(node => {\n if (!node.children) {\n node.parent.children = null\n }\n })\n\n const treemapLayout = treemap()\n .size([_width, _height])\n .round(true)\n .padding(config.tilePadding)\n\n // Apply padding to the top of each tile,\n // but not for the root node.\n if (this.config.tilePaddingTop !== undefined) {\n treemapLayout.paddingTop(d => d.parent ? config.tilePaddingTop : 0)\n }\n\n // Compute the treemap layout\n const treemapData = treemapLayout(rootNode) as TreemapNode<Datum>\n\n // Process the resulting hierarchy into the type we need\n let nodeId = 0\n treemapData.each(node => {\n const n = node as unknown as HierarchyNode<[string, number[]]>\n // Generate unique IDs for each node\n node._id = `node-${nodeId++}`\n\n const treemapDatum: TreemapDatum<Datum> = {\n key: n.data[0],\n }\n\n // Populate the index and datum for leaf nodes\n const isLeafNode = !n.children\n if (isLeafNode) {\n treemapDatum.index = n.data[1][0]\n treemapDatum.datum = data[treemapDatum.index]\n }\n\n node.data = treemapDatum\n })\n\n const descendants = treemapData.descendants()\n\n // Set up the brightness increase scale based on depth\n const maxDepth = max(descendants, d => d.depth)\n\n const brightnessIncrease = scaleLinear()\n .domain([1, maxDepth])\n .range([0, 1])\n\n // Get all leaf node values and calculate their square roots\n // (since area is proportional to value)\n const leafValues = descendants.filter(d => !d.children).map(d => d.value)\n const maxLeafValue = Math.sqrt(max(leafValues)) || 0\n\n // Divide the range into three equal intervals based on the square root of values\n // This accounts for the fact that area is proportional to value\n const fontSizeScale = scaleThreshold<number, number>()\n .domain([\n maxLeafValue / 3, // First third of the max value\n (maxLeafValue * 2) / 3, // Second third of the max value\n ])\n .range([\n config.tileLabelSmallFontSize,\n config.tileLabelMediumFontSize,\n config.tileLabelLargeFontSize,\n ])\n\n // First pass: Set base colors without considering tileColor config\n treemapData\n .eachBefore((node) => {\n if (!node.children) return\n const children = node.children\n\n children.forEach((treemapChild, i) => {\n // Use default color scheme without tileColor config\n let color = getColor(treemapChild, undefined, i, treemapChild.depth !== 1)\n color = color ?? (node as TreemapNode<Datum>)._fill\n\n const hexColor = color ? getHexValue(color, this.g.node()) : null\n\n if (hexColor) {\n const hslColor = hsl(hexColor)\n\n if (config.enableLightnessVariance) {\n if (!treemapChild.children) {\n const lightnessAdjustment = this.getTileLightness(treemapChild, children)\n hslColor.l = Math.min(1, hslColor.l + lightnessAdjustment)\n }\n }\n\n treemapChild._fill = brighter(hslColor.toString(), brightnessIncrease(treemapChild.depth))\n } else {\n treemapChild._fill = null\n }\n })\n })\n\n // Second pass: Apply tileColor config as an overlay\n if (config.tileColor) {\n treemapData\n .eachBefore((node) => {\n const color = getColor(node, config.tileColor)\n if (color !== null) {\n node._fill = color\n }\n })\n }\n\n // Render tiles\n const visibleNodes = descendants.filter(d => d.depth > 0)\n const tiles = this.tiles\n .selectAll<SVGGElement, TreemapNode<Datum>>(`g.${s.tileGroup}`)\n .data(visibleNodes, d => d._id)\n const tilesEnter = tiles\n .enter()\n .append('g')\n .attr('class', s.tileGroup)\n\n // Computes the rect border radius for a given tile.\n // The rx and ry values are the minimum of the tile\n // border radius and some fraction the width of the tile,\n // based on the tileBorderRadiusFactor config.\n // This ensures that the tile border radius is not\n // larger than the tile size, which makes small tiles\n // look better.\n const rx = (d: TreemapNode<Datum>): number =>\n Math.min(config.tileBorderRadius, (d.x1 - d.x0) * config.tileBorderRadiusFactor)\n\n // Add clipPath elements\n tilesEnter\n .append('clipPath')\n .attr('id', d => `clip-${d._id}`)\n .append('rect')\n .attr('rx', rx)\n .attr('ry', rx)\n\n // Tile rectangles\n tilesEnter\n .append('rect')\n .classed(s.tile, true)\n\n // Make the leaf tiles clickable if a click handler is provided\n .classed(s.clickableTile, d => config.showTileClickAffordance && !d.children)\n\n .attr('rx', rx)\n .attr('ry', rx)\n // Initialize tile positions so that the initial transition is smooth\n .attr('x', d => d.x0)\n .attr('y', d => d.y0)\n .attr('width', d => d.x1 - d.x0)\n .attr('height', d => d.y1 - d.y0)\n .style('fill', d => d._fill ?? getColor(d, config.tileColor))\n .style('opacity', 0)\n .style('cursor', config.showTileClickAffordance ? d => !d.children ? 'pointer' : null : null)\n\n tiles.merge(tilesEnter).select(`rect.${s.tile}`)\n .style('fill', d => d._fill ?? getColor(d, config.tileColor))\n .style('opacity', 1)\n .attr('x', d => d.x0)\n .attr('y', d => d.y0)\n .attr('width', d => d.x1 - d.x0)\n .attr('height', d => d.y1 - d.y0)\n\n // Update clipPath rects\n tiles.merge(tilesEnter).select('clipPath rect')\n .attr('x', d => d.x0)\n .attr('y', d => d.y0)\n .attr('width', d => d.x1 - d.x0 - config.tilePadding)\n .attr('height', d => d.y1 - d.y0)\n\n // Tile labels\n tilesEnter\n .append('text')\n .attr('class', s.label)\n .attr('clip-path', d => `url(#clip-${d._id})`)\n // Update all labels first\n const mergedTiles = tiles.merge(tilesEnter)\n\n // Hide labels that don't meet criteria\n mergedTiles.select(`text.${s.label}`)\n .style('display', d => {\n const isAllowedNode = config.labelInternalNodes ? true : !d.children\n return isAllowedNode && this.isTileLargeEnough(d) ? null : 'none'\n })\n // Make the internal labels semibold\n .style('font-weight', d => d.children ? '500' : 'normal')\n\n // Update visible labels\n mergedTiles.select(`text.${s.label}`)\n .filter(d => {\n const isAllowedNode = config.labelInternalNodes ? true : !d.children\n return isAllowedNode && this.isTileLargeEnough(d)\n })\n .attr('clip-path', d => `url(#clip-${d._id})`)\n .attr('x', d => d.x0 + config.labelOffsetX)\n .attr('y', d => d.y0 + config.labelOffsetY)\n .each(function (d) {\n const text = select(this) as unknown as Selection<SVGTextElement, any, SVGElement, any>\n\n const label = `${d.data.key}: ${numberFormat(d.value)}`\n text.text(label)\n\n // Set text color based on background darkness\n const backgroundColor = d._fill ?? getColor(d, config.tileColor)\n const textColor = backgroundColor && isDarkBackground(backgroundColor) ? '#ffffff' : '#000000'\n text.style('fill', textColor)\n\n // Apply font size scaling only to leaf nodes if enabled\n if (!d.children && config.enableTileLabelFontSizeVariation) {\n text.style('font-size', `${fontSizeScale(Math.sqrt(d.value))}px`)\n }\n\n // Apply text wrapping to leaf nodes\n if (!d.children) {\n const availableWidth = d.x1 - d.x0 - (2 * config.labelOffsetX)\n wrapSVGText(text, availableWidth)\n }\n })\n\n // Exit\n tiles.exit().remove()\n }\n}\n"],"names":["s.tiles","s.tileGroup","s.tile","s.clickableTile","s.label","s"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,0BAA0B,GAAG,IAAI,CAAA;AAEvC,MAAM,uBAAuB,GAAG,EAAE,CAAA;AAElC,MAAM,mBAAmB,GAAG,CAAC,KAAa,KAAa,CAAA,EAAG,KAAK,CAAA,CAAE,CAAA;AAE3D,MAAO,OAAe,SAAQ,aAAqD,CAAA;AA0BvF,IAAA,WAAA,CAAa,MAAsC,EAAA;AACjD,QAAA,KAAK,EAAE,CAAA;QAzBC,IAAc,CAAA,cAAA,GAAG,oBAAqD,CAAA;AACzE,QAAA,IAAA,CAAA,MAAM,GAAkC,IAAI,CAAC,cAAc,CAAA;AAElE,QAAA,IAAA,CAAA,SAAS,GAA2B,IAAI,eAAe,EAAE,CAAA;AAuBvD,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,EAAEA,KAAO,CAAC,CAAA;KACvD;AAtBO,IAAA,iBAAiB,CAAE,CAAqB,EAAA;QAC9C,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAA;QACrB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAA;QACrB,OAAO,CAAC,CAAC,IAAI,uBAAuB,MAAM,CAAC,IAAI,uBAAuB,CAAC,CAAA;KACxE;IAEO,gBAAgB,CAAE,IAAwB,EAAE,QAA8B,EAAA;;AAEhF,QAAA,MAAM,CAA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AAI,CAAC,KAAK,CAAC,CAAA;;AAGhB,YAAA,MAAM,eAAe,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;AAChE,YAAA,MAAM,SAAS,GAAG,eAAe,IAAI,gBAAgB,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,SAAS,CAAA;AAC9F,YAAA,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;;YAG7B,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,gCAAgC,EAAE;AAC1D,gBAAA,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAA,EAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA,EAAA,CAAI,CAAC,CAAA;AAClE,aAAA;;AAGD,YAAA,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE;AACf,gBAAA,MAAM,cAAc,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AAC9D,gBAAA,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAA;AAClC,aAAA;AACH,SAAC,CAAC,CAAA;;AAGJ,QAAA,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAA;KACtB;;AA3RM,OAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const root: string;
|
|
2
|
-
export declare const variables: {
|
|
3
|
-
treemapTileStrokeColor: "--vis-treemap-tile-stroke-color";
|
|
4
|
-
treemapTileStrokeWidth: "--vis-treemap-tile-stroke-width";
|
|
5
|
-
treemapTileHoverStrokeColor: "--vis-treemap-tile-hover-stroke-color";
|
|
6
|
-
treemapTileFillColor: "--vis-treemap-tile-fill-color";
|
|
7
|
-
treemapTileBackgroundColor: "--vis-treemap-tile-background-color";
|
|
8
|
-
treemapTileCursor: "--vis-treemap-tile-cursor";
|
|
9
|
-
treemapLabelFontFamily: "--vis-treemap-label-font-family";
|
|
10
|
-
treemapLabelTextColor: "--vis-treemap-label-text-color";
|
|
11
|
-
treemapLabelFontSize: "--vis-treemap-label-font-size";
|
|
12
|
-
treemapLabelOpacity: "--vis-treemap-label-opacity";
|
|
13
|
-
darkTreemapTileStrokeColor: "--vis-dark-treemap-tile-stroke-color";
|
|
14
|
-
darkTreemapTileFillColor: "--vis-dark-treemap-tile-fill-color";
|
|
15
|
-
darkTreemapLabelTextColor: "--vis-dark-treemap-label-text-color";
|
|
16
|
-
};
|
|
17
|
-
export declare const tiles: string;
|
|
18
|
-
export declare const tileGroup: string;
|
|
19
|
-
export declare const tile: string;
|
|
20
|
-
export declare const clickableTile: string;
|
|
21
|
-
export declare const tileForeground: string;
|
|
22
|
-
export declare const label: string;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { css } from '@emotion/css';
|
|
2
|
-
import { getCssVarNames, injectGlobalCssVariables } from '../../utils/style.js';
|
|
3
|
-
|
|
4
|
-
const cssVarDefaults = {
|
|
5
|
-
'--vis-treemap-tile-stroke-color': '#fff',
|
|
6
|
-
'--vis-treemap-tile-stroke-width': '2px',
|
|
7
|
-
'--vis-treemap-tile-hover-stroke-color': '#fff',
|
|
8
|
-
'--vis-treemap-tile-fill-color': '#B9BEC3',
|
|
9
|
-
'--vis-treemap-tile-background-color': '#fff',
|
|
10
|
-
'--vis-treemap-tile-cursor': 'default',
|
|
11
|
-
/* Undefined by default to allow proper fallback to var(--vis-font-family) */
|
|
12
|
-
'--vis-treemap-label-font-family': undefined,
|
|
13
|
-
'--vis-treemap-label-text-color': '#5b5f6d',
|
|
14
|
-
'--vis-treemap-label-font-size': '12px',
|
|
15
|
-
/* Label opacity */
|
|
16
|
-
'--vis-treemap-label-opacity': 0.8,
|
|
17
|
-
/* Dark Theme */
|
|
18
|
-
'--vis-dark-treemap-tile-stroke-color': '#2c2c2c',
|
|
19
|
-
'--vis-dark-treemap-tile-fill-color': '#5b5f6d',
|
|
20
|
-
'--vis-dark-treemap-label-text-color': '#fff',
|
|
21
|
-
};
|
|
22
|
-
const root = css `
|
|
23
|
-
label: treemap-component;
|
|
24
|
-
`;
|
|
25
|
-
const variables = getCssVarNames(cssVarDefaults);
|
|
26
|
-
injectGlobalCssVariables(cssVarDefaults, root);
|
|
27
|
-
const tiles = css `
|
|
28
|
-
label: g-tiles;
|
|
29
|
-
`;
|
|
30
|
-
const tileGroup = css `
|
|
31
|
-
label: tile-group;
|
|
32
|
-
`;
|
|
33
|
-
const tile = css `
|
|
34
|
-
label: tile;
|
|
35
|
-
stroke: var(--vis-treemap-tile-hover-stroke-color);
|
|
36
|
-
stroke-opacity: 0;
|
|
37
|
-
transition: stroke-opacity 100ms ease-in-out;
|
|
38
|
-
|
|
39
|
-
&:hover {
|
|
40
|
-
stroke-opacity: 1;
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
// The leaf tiles are clickable
|
|
44
|
-
const clickableTile = css `
|
|
45
|
-
label: clickable-tile;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
`;
|
|
48
|
-
const tileForeground = css `
|
|
49
|
-
label: tile-foreground;
|
|
50
|
-
`;
|
|
51
|
-
const label = css `
|
|
52
|
-
label: label;
|
|
53
|
-
text-anchor: start;
|
|
54
|
-
dominant-baseline: hanging;
|
|
55
|
-
user-select: none;
|
|
56
|
-
pointer-events: none;
|
|
57
|
-
font-size: var(--vis-treemap-label-font-size);
|
|
58
|
-
opacity: var(--vis-treemap-label-opacity);
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
export { clickableTile, label, root, tile, tileForeground, tileGroup, tiles, variables };
|
|
62
|
-
//# sourceMappingURL=style.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../src/components/treemap/style.ts"],"sourcesContent":["import { css } from '@emotion/css'\n\n// Utils\nimport { getCssVarNames, injectGlobalCssVariables } from 'utils/style'\n\nconst cssVarDefaults = {\n '--vis-treemap-tile-stroke-color': '#fff',\n '--vis-treemap-tile-stroke-width': '2px',\n '--vis-treemap-tile-hover-stroke-color': '#fff',\n '--vis-treemap-tile-fill-color': '#B9BEC3',\n '--vis-treemap-tile-background-color': '#fff',\n '--vis-treemap-tile-cursor': 'default',\n /* Undefined by default to allow proper fallback to var(--vis-font-family) */\n '--vis-treemap-label-font-family': undefined as undefined,\n '--vis-treemap-label-text-color': '#5b5f6d',\n '--vis-treemap-label-font-size': '12px',\n\n /* Label opacity */\n '--vis-treemap-label-opacity': 0.8,\n\n /* Dark Theme */\n '--vis-dark-treemap-tile-stroke-color': '#2c2c2c',\n '--vis-dark-treemap-tile-fill-color': '#5b5f6d',\n '--vis-dark-treemap-label-text-color': '#fff',\n}\n\nexport const root = css`\n label: treemap-component;\n`\n\nexport const variables = getCssVarNames(cssVarDefaults)\ninjectGlobalCssVariables(cssVarDefaults, root)\n\nexport const tiles = css`\n label: g-tiles;\n`\n\nexport const tileGroup = css`\n label: tile-group;\n`\n\nexport const tile = css`\n label: tile;\n stroke: var(--vis-treemap-tile-hover-stroke-color);\n stroke-opacity: 0;\n transition: stroke-opacity 100ms ease-in-out;\n\n &:hover {\n stroke-opacity: 1;\n }\n`\n\n// The leaf tiles are clickable\nexport const clickableTile = css`\n label: clickable-tile;\n cursor: pointer;\n`\n\nexport const tileForeground = css`\n label: tile-foreground;\n`\n\nexport const label = css`\n label: label;\n text-anchor: start;\n dominant-baseline: hanging;\n user-select: none;\n pointer-events: none;\n font-size: var(--vis-treemap-label-font-size);\n opacity: var(--vis-treemap-label-opacity);\n`\n"],"names":[],"mappings":";;;AAKA,MAAM,cAAc,GAAG;AACrB,IAAA,iCAAiC,EAAE,MAAM;AACzC,IAAA,iCAAiC,EAAE,KAAK;AACxC,IAAA,uCAAuC,EAAE,MAAM;AAC/C,IAAA,+BAA+B,EAAE,SAAS;AAC1C,IAAA,qCAAqC,EAAE,MAAM;AAC7C,IAAA,2BAA2B,EAAE,SAAS;;AAEtC,IAAA,iCAAiC,EAAE,SAAsB;AACzD,IAAA,gCAAgC,EAAE,SAAS;AAC3C,IAAA,+BAA+B,EAAE,MAAM;;AAGvC,IAAA,6BAA6B,EAAE,GAAG;;AAGlC,IAAA,sCAAsC,EAAE,SAAS;AACjD,IAAA,oCAAoC,EAAE,SAAS;AAC/C,IAAA,qCAAqC,EAAE,MAAM;CAC9C,CAAA;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA;;EAEtB;MAEY,SAAS,GAAG,cAAc,CAAC,cAAc,EAAC;AACvD,wBAAwB,CAAC,cAAc,EAAE,IAAI,CAAC,CAAA;AAEvC,MAAM,KAAK,GAAG,GAAG,CAAA;;EAEvB;AAEM,MAAM,SAAS,GAAG,GAAG,CAAA;;EAE3B;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA;;;;;;;;;EAStB;AAED;AACO,MAAM,aAAa,GAAG,GAAG,CAAA;;;EAG/B;AAEM,MAAM,cAAc,GAAG,GAAG,CAAA;;EAEhC;AAEM,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HierarchyRectangularNode } from 'd3-hierarchy';
|
|
2
|
-
export declare type TreemapDatum<Datum> = {
|
|
3
|
-
key?: string;
|
|
4
|
-
index?: number;
|
|
5
|
-
datum?: Datum;
|
|
6
|
-
};
|
|
7
|
-
export interface TreemapNode<Datum> extends HierarchyRectangularNode<TreemapDatum<Datum>> {
|
|
8
|
-
_id: string;
|
|
9
|
-
_fill?: string;
|
|
10
|
-
_fillOpacity?: number | null;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|