@unovis/ts 1.7.0-Phoenix.0 → 1.7.0-pre.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/components/area/config.d.ts +2 -0
- package/components/area/config.js +1 -1
- package/components/area/config.js.map +1 -1
- package/components/area/index.js +6 -3
- package/components/area/index.js.map +1 -1
- package/components/crosshair/config.d.ts +1 -1
- package/components/crosshair/config.js.map +1 -1
- package/components/crosshair/index.d.ts +1 -1
- package/components/crosshair/index.js.map +1 -1
- package/components/free-brush/types.js +1 -0
- package/components/free-brush/types.js.map +1 -1
- package/components/graph/index.d.ts +1 -0
- package/components/graph/index.js +35 -14
- package/components/graph/index.js.map +1 -1
- package/components/graph/modules/link/index.js +1 -1
- package/components/graph/modules/link/index.js.map +1 -1
- package/components/leaflet-map/leaflet.css.js +2 -2
- package/components/leaflet-map/modules/map.js +2 -2
- package/components/leaflet-map/modules/map.js.map +1 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +0 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.js +1 -2
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +1 -1
- package/components/sankey/config.d.ts +25 -10
- package/components/sankey/config.js +2 -2
- package/components/sankey/config.js.map +1 -1
- package/components/sankey/index.d.ts +26 -31
- package/components/sankey/index.js +340 -115
- package/components/sankey/index.js.map +1 -1
- package/components/sankey/modules/label.d.ts +8 -5
- package/components/sankey/modules/label.js +70 -32
- package/components/sankey/modules/label.js.map +1 -1
- package/components/sankey/modules/link.d.ts +1 -0
- package/components/sankey/modules/link.js +23 -41
- package/components/sankey/modules/link.js.map +1 -1
- package/components/sankey/modules/node.d.ts +5 -4
- package/components/sankey/modules/node.js +65 -16
- package/components/sankey/modules/node.js.map +1 -1
- package/components/sankey/style.d.ts +67 -1
- package/components/sankey/style.js +77 -77
- package/components/sankey/style.js.map +1 -1
- package/components/sankey/types.d.ts +5 -2
- package/components/sankey/types.js +9 -2
- package/components/sankey/types.js.map +1 -1
- package/components/tooltip/index.js +2 -2
- package/components/tooltip/index.js.map +1 -1
- package/components/treemap/index.js +2 -4
- package/components/treemap/index.js.map +1 -1
- package/containers/single-container/config.d.ts +3 -0
- package/containers/single-container/config.js.map +1 -1
- package/containers/single-container/index.js +2 -1
- package/containers/single-container/index.js.map +1 -1
- package/containers/xy-container/config.d.ts +3 -0
- package/containers/xy-container/config.js.map +1 -1
- package/containers/xy-container/index.d.ts +1 -0
- package/containers/xy-container/index.js +13 -9
- package/containers/xy-container/index.js.map +1 -1
- package/index.js +1 -1
- package/package.json +42 -10
- package/types.js +1 -1
|
@@ -1,63 +1,54 @@
|
|
|
1
|
-
import { css
|
|
1
|
+
import { css } from '@emotion/css';
|
|
2
|
+
import { getCssVarNames, injectGlobalCssVariables } from '../../utils/style.js';
|
|
2
3
|
import { UNOVIS_ICON_FONT_FAMILY_DEFAULT } from '../../styles/index.js';
|
|
3
4
|
|
|
4
5
|
const SANKEY_ICON_SIZE = 22;
|
|
5
6
|
const root = css `
|
|
6
7
|
label: sankey-component;
|
|
7
8
|
`;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
--vis-sankey-link-
|
|
12
|
-
--vis-sankey-link-
|
|
13
|
-
--vis-sankey-link-opacity: 0
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
--vis-sankey-node-
|
|
17
|
-
--vis-sankey-node-color:
|
|
18
|
-
--vis-sankey-node-
|
|
19
|
-
--vis-sankey-node-opacity: 0
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
--vis-sankey-node-
|
|
23
|
-
--vis-sankey-node-
|
|
24
|
-
|
|
25
|
-
--vis-sankey-node-label-color: #
|
|
26
|
-
--vis-sankey-node-label-
|
|
27
|
-
--vis-sankey-node-label-
|
|
28
|
-
--vis-sankey-node-label-
|
|
29
|
-
--vis-sankey-node-label-
|
|
30
|
-
|
|
31
|
-
--vis-sankey-node-
|
|
32
|
-
--vis-sankey-node-sublabel-font-
|
|
33
|
-
|
|
34
|
-
/* Icons */
|
|
35
|
-
--vis-sankey-icon-size:
|
|
36
|
-
--vis-sankey-icon-color: #ffffff
|
|
37
|
-
--vis-sankey-icon-stroke-opacity: 0.6
|
|
38
|
-
--vis-sankey-icon-font-family:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
--vis-dark-sankey-
|
|
45
|
-
--vis-dark-sankey-node-color:
|
|
46
|
-
--vis-dark-sankey-node-label-color: #
|
|
47
|
-
--vis-dark-sankey-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
body.theme-dark ${`.${root}`} {
|
|
53
|
-
--vis-sankey-node-color: var(--vis-dark-sankey-node-color);
|
|
54
|
-
--vis-sankey-link-color: var(--vis-dark-sankey-link-color);
|
|
55
|
-
--vis-sankey-node-label-color: var(--vis-dark-sankey-node-label-color);
|
|
56
|
-
--vis-sankey-node-label-background-fill-color: var(--vis-dark-sankey-label-background-fill-color);
|
|
57
|
-
--vis-sankey-node-label-background-stroke-color: var(--vis-dark-sankey-label-background-stroke-color);
|
|
58
|
-
--vis-sankey-icon-color: var(--vis-dark-sankey-icon-color);
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
9
|
+
const cssVarDefaults = {
|
|
10
|
+
/* Links */
|
|
11
|
+
'--vis-sankey-link-cursor': 'default',
|
|
12
|
+
'--vis-sankey-link-color': 'var(--vis-color-main-light)',
|
|
13
|
+
'--vis-sankey-link-opacity': '0.5',
|
|
14
|
+
'--vis-sankey-link-hover-opacity': '1.0',
|
|
15
|
+
/* Nodes */
|
|
16
|
+
'--vis-sankey-node-cursor': 'default',
|
|
17
|
+
'--vis-sankey-node-color': 'var(--vis-color-main)',
|
|
18
|
+
'--vis-sankey-node-label-color': '#575c65',
|
|
19
|
+
'--vis-sankey-node-opacity': '0.9',
|
|
20
|
+
'--vis-sankey-node-hover-opacity': '1.0',
|
|
21
|
+
/* Node Selection */
|
|
22
|
+
'--vis-sankey-node-selection-stroke-width': '1.5px',
|
|
23
|
+
'--vis-sankey-node-selection-stroke-opacity': '0.6',
|
|
24
|
+
'--vis-sankey-node-selection-border-radius': '2px',
|
|
25
|
+
/* Node Labels */
|
|
26
|
+
'--vis-sankey-node-label-background-fill-color': '#ffffff',
|
|
27
|
+
'--vis-sankey-node-label-background-stroke-color': '#eaeaea',
|
|
28
|
+
'--vis-sankey-node-label-background-opacity': '0.9',
|
|
29
|
+
'--vis-sankey-node-label-cursor': 'default',
|
|
30
|
+
'--vis-sankey-node-label-font-weight': '600',
|
|
31
|
+
'--vis-sankey-node-label-font-size': '12px',
|
|
32
|
+
'--vis-sankey-node-label-text-decoration': 'none',
|
|
33
|
+
'--vis-sankey-node-sublabel-font-size': '10px',
|
|
34
|
+
'--vis-sankey-node-sublabel-font-weight': '500',
|
|
35
|
+
/* Icons */
|
|
36
|
+
'--vis-sankey-icon-size': `${SANKEY_ICON_SIZE}px`,
|
|
37
|
+
'--vis-sankey-icon-color': '#ffffff',
|
|
38
|
+
'--vis-sankey-icon-stroke-opacity': '0.6',
|
|
39
|
+
'--vis-sankey-icon-font-family': UNOVIS_ICON_FONT_FAMILY_DEFAULT,
|
|
40
|
+
// Undefined by default to allow proper fallback to var(--vis-font-family)
|
|
41
|
+
/* --vis-sankey-label-font-family: */
|
|
42
|
+
/* Dark Theme */
|
|
43
|
+
'--vis-dark-sankey-link-color': 'var(--vis-color-main-dark)',
|
|
44
|
+
'--vis-dark-sankey-node-color': 'var(--vis-color-main)',
|
|
45
|
+
'--vis-dark-sankey-node-label-color': '#eaeaea',
|
|
46
|
+
'--vis-dark-sankey-node-label-background-fill-color': '#292b34',
|
|
47
|
+
'--vis-dark-sankey-node-label-background-stroke-color': '#575c65',
|
|
48
|
+
'--vis-dark-sankey-icon-color': '#292b34',
|
|
49
|
+
};
|
|
50
|
+
const variables = getCssVarNames(cssVarDefaults);
|
|
51
|
+
injectGlobalCssVariables(cssVarDefaults, root);
|
|
61
52
|
const links = css `
|
|
62
53
|
label: links;
|
|
63
54
|
`;
|
|
@@ -68,14 +59,14 @@ const link = css `
|
|
|
68
59
|
label: link;
|
|
69
60
|
|
|
70
61
|
path {
|
|
71
|
-
cursor: var(
|
|
72
|
-
fill: var(
|
|
73
|
-
fill-opacity: var(
|
|
62
|
+
cursor: var(${variables.sankeyLinkCursor});
|
|
63
|
+
fill: var(${variables.sankeyLinkColor});
|
|
64
|
+
fill-opacity: var(${variables.sankeyLinkOpacity});
|
|
74
65
|
}
|
|
75
66
|
|
|
76
67
|
&:hover {
|
|
77
68
|
path {
|
|
78
|
-
fill-opacity: var(
|
|
69
|
+
fill-opacity: var(${variables.sankeyLinkHoverOpacity});
|
|
79
70
|
}
|
|
80
71
|
}
|
|
81
72
|
`;
|
|
@@ -88,7 +79,7 @@ const linkSelectionHelper = css `
|
|
|
88
79
|
`;
|
|
89
80
|
const labelGroup = css `
|
|
90
81
|
label: label-group;
|
|
91
|
-
cursor: var(
|
|
82
|
+
cursor: var(${variables.sankeyNodeLabelCursor});
|
|
92
83
|
`;
|
|
93
84
|
const labelTrimmed = css `
|
|
94
85
|
label: label-trimmed;
|
|
@@ -97,9 +88,9 @@ const label = css `
|
|
|
97
88
|
label: label;
|
|
98
89
|
dominant-baseline: hanging;
|
|
99
90
|
|
|
100
|
-
fill: var(
|
|
101
|
-
text-decoration: var(
|
|
102
|
-
font-weight: var(
|
|
91
|
+
fill: var(${variables.sankeyNodeLabelColor});
|
|
92
|
+
text-decoration: var(${variables.sankeyNodeLabelTextDecoration});
|
|
93
|
+
font-weight: var(${variables.sankeyNodeLabelFontWeight});
|
|
103
94
|
user-select: none;
|
|
104
95
|
|
|
105
96
|
&, tspan {
|
|
@@ -111,20 +102,20 @@ const sublabel = css `
|
|
|
111
102
|
label: sub-label;
|
|
112
103
|
dominant-baseline: hanging;
|
|
113
104
|
|
|
114
|
-
fill: var(
|
|
105
|
+
fill: var(${variables.sankeyNodeLabelColor});
|
|
115
106
|
user-select: none;
|
|
116
107
|
|
|
117
108
|
&, tspan {
|
|
118
109
|
font-family: var(--vis-sankey-label-font-family, var(--vis-font-family));
|
|
119
|
-
font-weight: var(
|
|
110
|
+
font-weight: var(${variables.sankeyNodeSublabelFontWeight});
|
|
120
111
|
dominant-baseline: hanging;
|
|
121
112
|
}
|
|
122
113
|
`;
|
|
123
114
|
const labelBackground = css `
|
|
124
115
|
label: label-background;
|
|
125
|
-
stroke: var(
|
|
126
|
-
fill: var(
|
|
127
|
-
opacity: var(
|
|
116
|
+
stroke: var(${variables.sankeyNodeLabelBackgroundStrokeColor});
|
|
117
|
+
fill: var(${variables.sankeyNodeLabelBackgroundFillColor});
|
|
118
|
+
opacity: var(${variables.sankeyNodeLabelBackgroundOpacity});
|
|
128
119
|
`;
|
|
129
120
|
const hidden = css `
|
|
130
121
|
label: hidden;
|
|
@@ -140,32 +131,41 @@ const nodeGroup = css `
|
|
|
140
131
|
const node = css `
|
|
141
132
|
label: node;
|
|
142
133
|
|
|
143
|
-
cursor: var(
|
|
144
|
-
fill: var(
|
|
145
|
-
opacity: var(
|
|
134
|
+
cursor: var(${variables.sankeyNodeCursor});
|
|
135
|
+
fill: var(${variables.sankeyNodeColor});
|
|
136
|
+
opacity: var(${variables.sankeyNodeOpacity});
|
|
146
137
|
|
|
147
138
|
&:hover {
|
|
148
|
-
opacity: var(
|
|
139
|
+
opacity: var(${variables.sankeyNodeHoverOpacity});
|
|
149
140
|
}
|
|
150
141
|
`;
|
|
151
142
|
const nodeIcon = css `
|
|
152
143
|
label: icon;
|
|
153
144
|
|
|
154
|
-
font-family: var(
|
|
145
|
+
font-family: var(${variables.sankeyIconFontFamily});
|
|
155
146
|
text-anchor: middle;
|
|
156
|
-
font-size: var(
|
|
157
|
-
fill: var(
|
|
158
|
-
stroke: var(
|
|
159
|
-
stroke-opacity: var(
|
|
147
|
+
font-size: var(${variables.sankeyIconSize});
|
|
148
|
+
fill: var(${variables.sankeyIconColor});
|
|
149
|
+
stroke: var(${variables.sankeyNodeColor});
|
|
150
|
+
stroke-opacity: var(${variables.sankeyIconStrokeOpacity});
|
|
160
151
|
user-select: none;
|
|
161
152
|
pointer-events: none;
|
|
162
153
|
`;
|
|
163
154
|
const nodeExit = css `
|
|
164
155
|
label: node-exit;
|
|
165
156
|
`;
|
|
157
|
+
const nodeSelectionRect = css `
|
|
158
|
+
label: node-selection-rect;
|
|
159
|
+
fill: none;
|
|
160
|
+
stroke: var(${variables.sankeyNodeColor});
|
|
161
|
+
stroke-width: var(${variables.sankeyNodeSelectionStrokeWidth});
|
|
162
|
+
stroke-opacity: var(${variables.sankeyNodeSelectionStrokeOpacity});
|
|
163
|
+
rx: var(${variables.sankeyNodeSelectionBorderRadius});
|
|
164
|
+
ry: var(${variables.sankeyNodeSelectionBorderRadius});
|
|
165
|
+
`;
|
|
166
166
|
const background = css `
|
|
167
167
|
label: background;
|
|
168
168
|
`;
|
|
169
169
|
|
|
170
|
-
export { SANKEY_ICON_SIZE, background, forceShow, hidden, label, labelBackground, labelGroup, labelTrimmed, link, linkPath, linkSelectionHelper, links, node, nodeExit, nodeGroup, nodeIcon, nodes, root, sublabel, variables };
|
|
170
|
+
export { SANKEY_ICON_SIZE, background, cssVarDefaults, forceShow, hidden, label, labelBackground, labelGroup, labelTrimmed, link, linkPath, linkSelectionHelper, links, node, nodeExit, nodeGroup, nodeIcon, nodeSelectionRect, nodes, root, sublabel, variables };
|
|
171
171
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../src/components/sankey/style.ts"],"sourcesContent":["import { css
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../src/components/sankey/style.ts"],"sourcesContent":["import { css } from '@emotion/css'\nimport { getCssVarNames, injectGlobalCssVariables } from 'utils/style'\nimport { UNOVIS_ICON_FONT_FAMILY_DEFAULT } from 'styles/index'\n\nexport const SANKEY_ICON_SIZE = 22\n\nexport const root = css`\n label: sankey-component;\n`\n\nexport const cssVarDefaults = {\n /* Links */\n '--vis-sankey-link-cursor': 'default',\n '--vis-sankey-link-color': 'var(--vis-color-main-light)',\n '--vis-sankey-link-opacity': '0.5',\n '--vis-sankey-link-hover-opacity': '1.0',\n\n /* Nodes */\n '--vis-sankey-node-cursor': 'default',\n '--vis-sankey-node-color': 'var(--vis-color-main)',\n '--vis-sankey-node-label-color': '#575c65',\n '--vis-sankey-node-opacity': '0.9',\n '--vis-sankey-node-hover-opacity': '1.0',\n\n /* Node Selection */\n '--vis-sankey-node-selection-stroke-width': '1.5px',\n '--vis-sankey-node-selection-stroke-opacity': '0.6',\n '--vis-sankey-node-selection-border-radius': '2px',\n\n /* Node Labels */\n '--vis-sankey-node-label-background-fill-color': '#ffffff',\n '--vis-sankey-node-label-background-stroke-color': '#eaeaea',\n '--vis-sankey-node-label-background-opacity': '0.9',\n '--vis-sankey-node-label-cursor': 'default',\n '--vis-sankey-node-label-font-weight': '600',\n '--vis-sankey-node-label-font-size': '12px',\n '--vis-sankey-node-label-text-decoration': 'none',\n\n '--vis-sankey-node-sublabel-font-size': '10px',\n '--vis-sankey-node-sublabel-font-weight': '500',\n\n /* Icons */\n '--vis-sankey-icon-size': `${SANKEY_ICON_SIZE}px`,\n '--vis-sankey-icon-color': '#ffffff',\n '--vis-sankey-icon-stroke-opacity': '0.6',\n '--vis-sankey-icon-font-family': UNOVIS_ICON_FONT_FAMILY_DEFAULT,\n\n // Undefined by default to allow proper fallback to var(--vis-font-family)\n /* --vis-sankey-label-font-family: */\n\n /* Dark Theme */\n '--vis-dark-sankey-link-color': 'var(--vis-color-main-dark)',\n '--vis-dark-sankey-node-color': 'var(--vis-color-main)',\n '--vis-dark-sankey-node-label-color': '#eaeaea',\n '--vis-dark-sankey-node-label-background-fill-color': '#292b34',\n '--vis-dark-sankey-node-label-background-stroke-color': '#575c65',\n '--vis-dark-sankey-icon-color': '#292b34',\n}\n\nexport const variables = getCssVarNames(cssVarDefaults)\ninjectGlobalCssVariables(cssVarDefaults, root)\n\nexport const links = css`\n label: links;\n`\n\nexport const nodes = css`\n label: nodes;\n`\n\nexport const link = css`\n label: link;\n\n path {\n cursor: var(${variables.sankeyLinkCursor});\n fill: var(${variables.sankeyLinkColor});\n fill-opacity: var(${variables.sankeyLinkOpacity});\n }\n\n &:hover {\n path {\n fill-opacity: var(${variables.sankeyLinkHoverOpacity});\n }\n }\n`\n\nexport const linkPath = css`\n label: visible;\n`\n\nexport const linkSelectionHelper = css`\n label: transparent;\n opacity: 0;\n`\n\nexport const labelGroup = css`\n label: label-group;\n cursor: var(${variables.sankeyNodeLabelCursor});\n`\n\nexport const labelTrimmed = css`\n label: label-trimmed;\n`\n\nexport const label = css`\n label: label;\n dominant-baseline: hanging;\n\n fill: var(${variables.sankeyNodeLabelColor});\n text-decoration: var(${variables.sankeyNodeLabelTextDecoration});\n font-weight: var(${variables.sankeyNodeLabelFontWeight});\n user-select: none;\n\n &, tspan {\n font-family: var(--vis-sankey-label-font-family, var(--vis-font-family));\n dominant-baseline: hanging;\n }\n`\n\nexport const sublabel = css`\n label: sub-label;\n dominant-baseline: hanging;\n\n fill: var(${variables.sankeyNodeLabelColor});\n user-select: none;\n\n &, tspan {\n font-family: var(--vis-sankey-label-font-family, var(--vis-font-family));\n font-weight: var(${variables.sankeyNodeSublabelFontWeight});\n dominant-baseline: hanging;\n }\n`\n\nexport const labelBackground = css`\n label: label-background;\n stroke: var(${variables.sankeyNodeLabelBackgroundStrokeColor});\n fill: var(${variables.sankeyNodeLabelBackgroundFillColor});\n opacity: var(${variables.sankeyNodeLabelBackgroundOpacity});\n`\n\nexport const hidden = css`\n label: hidden;\n visibility: hidden;\n`\n\nexport const forceShow = css`\n label: forceShow;\n visibility: visible;\n`\n\nexport const nodeGroup = css`\n label: node-group;\n`\n\nexport const node = css`\n label: node;\n\n cursor: var(${variables.sankeyNodeCursor});\n fill: var(${variables.sankeyNodeColor});\n opacity: var(${variables.sankeyNodeOpacity});\n\n &:hover {\n opacity: var(${variables.sankeyNodeHoverOpacity});\n }\n`\n\nexport const nodeIcon = css`\n label: icon;\n\n font-family: var(${variables.sankeyIconFontFamily});\n text-anchor: middle;\n font-size: var(${variables.sankeyIconSize});\n fill: var(${variables.sankeyIconColor});\n stroke: var(${variables.sankeyNodeColor});\n stroke-opacity: var(${variables.sankeyIconStrokeOpacity});\n user-select: none;\n pointer-events: none;\n`\n\nexport const nodeExit = css`\n label: node-exit;\n`\n\nexport const nodeSelectionRect = css`\n label: node-selection-rect;\n fill: none;\n stroke: var(${variables.sankeyNodeColor});\n stroke-width: var(${variables.sankeyNodeSelectionStrokeWidth});\n stroke-opacity: var(${variables.sankeyNodeSelectionStrokeOpacity});\n rx: var(${variables.sankeyNodeSelectionBorderRadius});\n ry: var(${variables.sankeyNodeSelectionBorderRadius});\n`\n\nexport const background = css`\n label: background;\n`\n"],"names":[],"mappings":";;;;AAIO,MAAM,gBAAgB,GAAG,GAAE;AAE3B,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;EAEtB;AAEY,MAAA,cAAc,GAAG;;AAE5B,IAAA,0BAA0B,EAAE,SAAS;AACrC,IAAA,yBAAyB,EAAE,6BAA6B;AACxD,IAAA,2BAA2B,EAAE,KAAK;AAClC,IAAA,iCAAiC,EAAE,KAAK;;AAGxC,IAAA,0BAA0B,EAAE,SAAS;AACrC,IAAA,yBAAyB,EAAE,uBAAuB;AAClD,IAAA,+BAA+B,EAAE,SAAS;AAC1C,IAAA,2BAA2B,EAAE,KAAK;AAClC,IAAA,iCAAiC,EAAE,KAAK;;AAGxC,IAAA,0CAA0C,EAAE,OAAO;AACnD,IAAA,4CAA4C,EAAE,KAAK;AACnD,IAAA,2CAA2C,EAAE,KAAK;;AAGlD,IAAA,+CAA+C,EAAE,SAAS;AAC1D,IAAA,iDAAiD,EAAE,SAAS;AAC5D,IAAA,4CAA4C,EAAE,KAAK;AACnD,IAAA,gCAAgC,EAAE,SAAS;AAC3C,IAAA,qCAAqC,EAAE,KAAK;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BAAiB,GAAG,GAAG,CAAA,CAAA;;;AAGpB,cAAA,EAAA,SAAS,CAAC,eAAe,CAAA;AACnB,oBAAA,EAAA,SAAS,CAAC,8BAA8B,CAAA;AACtC,sBAAA,EAAA,SAAS,CAAC,gCAAgC,CAAA;AACtD,UAAA,EAAA,SAAS,CAAC,+BAA+B,CAAA;AACzC,UAAA,EAAA,SAAS,CAAC,+BAA+B,CAAA;EACpD;AAEM,MAAM,UAAU,GAAG,GAAG,CAAA,CAAA;;;;;;"}
|
|
@@ -37,8 +37,6 @@ export declare type SankeyNode<N extends SankeyInputNode, L extends SankeyInputL
|
|
|
37
37
|
_state?: {
|
|
38
38
|
greyout?: boolean;
|
|
39
39
|
precalculatedHeight?: number;
|
|
40
|
-
/** Whether this node is collapsed (hides all connected links) */
|
|
41
|
-
collapsed?: boolean;
|
|
42
40
|
};
|
|
43
41
|
};
|
|
44
42
|
export declare type SankeyLink<N extends SankeyInputNode, L extends SankeyInputLink> = GraphLinkCore<N, L> & {
|
|
@@ -84,3 +82,8 @@ export declare enum SankeyEnterTransitionType {
|
|
|
84
82
|
Default = "default",
|
|
85
83
|
FromAncestor = "from ancestor"
|
|
86
84
|
}
|
|
85
|
+
export declare enum SankeyZoomMode {
|
|
86
|
+
XY = "xy",
|
|
87
|
+
X = "x",
|
|
88
|
+
Y = "y"
|
|
89
|
+
}
|
|
@@ -28,7 +28,14 @@ var SankeyEnterTransitionType;
|
|
|
28
28
|
(function (SankeyEnterTransitionType) {
|
|
29
29
|
SankeyEnterTransitionType["Default"] = "default";
|
|
30
30
|
SankeyEnterTransitionType["FromAncestor"] = "from ancestor";
|
|
31
|
-
})(SankeyEnterTransitionType || (SankeyEnterTransitionType = {}));
|
|
31
|
+
})(SankeyEnterTransitionType || (SankeyEnterTransitionType = {}));
|
|
32
|
+
var SankeyZoomMode;
|
|
33
|
+
(function (SankeyZoomMode) {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
|
+
SankeyZoomMode["XY"] = "xy";
|
|
36
|
+
SankeyZoomMode["X"] = "x";
|
|
37
|
+
SankeyZoomMode["Y"] = "y";
|
|
38
|
+
})(SankeyZoomMode || (SankeyZoomMode = {}));
|
|
32
39
|
|
|
33
|
-
export { SankeyEnterTransitionType, SankeyExitTransitionType, SankeyLayout, SankeyNodeAlign, SankeySubLabelPlacement };
|
|
40
|
+
export { SankeyEnterTransitionType, SankeyExitTransitionType, SankeyLayout, SankeyNodeAlign, SankeySubLabelPlacement, SankeyZoomMode };
|
|
34
41
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/components/sankey/types.ts"],"sourcesContent":["/* eslint-disable no-use-before-define */\nimport { sankeyLeft, sankeyRight, sankeyCenter, sankeyJustify } from 'd3-sankey'\nimport { GraphInputLink, GraphLinkCore, GraphNodeCore } from 'types/graph'\nimport { GraphInputNode } from '../../types'\n\nexport type SankeyInputNode = GraphInputNode\n\nexport type SankeyInputLink = GraphInputLink\n\nexport type SankeyNode<N extends SankeyInputNode, L extends SankeyInputLink> = GraphNodeCore<N, L> & {\n id: string;\n /** the node’s value; this is the sum of link.value for the node’s incoming links, or node.fixedValue if defined */\n value: number;\n /** */\n fixedValue?: number;\n /** the node’s zero-based column index, corresponding to its horizontal position */\n layer: number;\n /** */\n isConnected: boolean;\n /** the array of incoming links which have this node as their source */\n sourceLinks?: SankeyLink<N, L>[];\n /** the array of outgoing links which have this node as their target */\n targetLinks: SankeyLink<N, L>[];\n /** the node’s zero-based index within the array of nodes */\n index: number;\n /** the node’s zero-based graph depth, derived from the graph topology */\n depth: number;\n /** node.height - the node’s zero-based graph height, derived from the graph topology */\n height: number;\n /** the node’s minimum horizontal position, derived from node.depth */\n x0: number;\n /** the node’s maximum horizontal position (node.x0 + sankey.nodeWidth) */\n x1: number;\n /** the node’s minimum vertical position */\n y0: number;\n /** the node’s maximum vertical position (node.y1 - node.y0 is proportional to node.value) */\n y1: number;\n /** calculated node width */\n width: number;\n /** internal ui state */\n _state?: {\n greyout?: boolean;\n /* Pre-calculated node height value in pixels that will be used to manually generate the layout when data has no links */\n precalculatedHeight?: number;\n
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/sankey/types.ts"],"sourcesContent":["/* eslint-disable no-use-before-define */\nimport { sankeyLeft, sankeyRight, sankeyCenter, sankeyJustify } from 'd3-sankey'\nimport { GraphInputLink, GraphLinkCore, GraphNodeCore } from 'types/graph'\nimport { GraphInputNode } from '../../types'\n\nexport type SankeyInputNode = GraphInputNode\n\nexport type SankeyInputLink = GraphInputLink\n\nexport type SankeyNode<N extends SankeyInputNode, L extends SankeyInputLink> = GraphNodeCore<N, L> & {\n id: string;\n /** the node’s value; this is the sum of link.value for the node’s incoming links, or node.fixedValue if defined */\n value: number;\n /** */\n fixedValue?: number;\n /** the node’s zero-based column index, corresponding to its horizontal position */\n layer: number;\n /** */\n isConnected: boolean;\n /** the array of incoming links which have this node as their source */\n sourceLinks?: SankeyLink<N, L>[];\n /** the array of outgoing links which have this node as their target */\n targetLinks: SankeyLink<N, L>[];\n /** the node’s zero-based index within the array of nodes */\n index: number;\n /** the node’s zero-based graph depth, derived from the graph topology */\n depth: number;\n /** node.height - the node’s zero-based graph height, derived from the graph topology */\n height: number;\n /** the node’s minimum horizontal position, derived from node.depth */\n x0: number;\n /** the node’s maximum horizontal position (node.x0 + sankey.nodeWidth) */\n x1: number;\n /** the node’s minimum vertical position */\n y0: number;\n /** the node’s maximum vertical position (node.y1 - node.y0 is proportional to node.value) */\n y1: number;\n /** calculated node width */\n width: number;\n /** internal ui state */\n _state?: {\n greyout?: boolean;\n /* Pre-calculated node height value in pixels that will be used to manually generate the layout when data has no links */\n precalculatedHeight?: number;\n };\n}\n\nexport type SankeyLink<N extends SankeyInputNode, L extends SankeyInputLink> = GraphLinkCore<N, L> & {\n value: number;\n /** the link’s source node */\n source: SankeyNode<N, L>;\n /** the link’s target node */\n target: SankeyNode<N, L>;\n /** the link’s vertical starting position (at source node) */\n y0: number;\n /** the link’s vertical end position (at target node) */\n y1: number;\n /** the link’s width (proportional to link.value) */\n width: number;\n /** the zero-based index of link within the array of links */\n index: number;\n /** internal ui state */\n _state?: {\n greyout?: boolean;\n };\n}\n\nexport enum SankeySubLabelPlacement {\n Inline = 'inline',\n Below = 'below',\n}\n\nexport enum SankeyNodeAlign {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n Justify = 'justify',\n}\n\nexport const SankeyLayout = {\n [SankeyNodeAlign.Left]: sankeyLeft,\n [SankeyNodeAlign.Right]: sankeyRight,\n [SankeyNodeAlign.Center]: sankeyCenter,\n [SankeyNodeAlign.Justify]: sankeyJustify,\n}\n\nexport enum SankeyExitTransitionType {\n Default = 'default',\n ToAncestor = 'to ancestor',\n}\n\nexport enum SankeyEnterTransitionType {\n Default = 'default',\n FromAncestor = 'from ancestor',\n}\n\nexport enum SankeyZoomMode {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n XY = 'xy',\n X = 'x',\n Y = 'y',\n}\n"],"names":[],"mappings":";;AAAA;IAmEY,wBAGX;AAHD,CAAA,UAAY,uBAAuB,EAAA;AACjC,IAAA,uBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,uBAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,GAGlC,EAAA,CAAA,CAAA,CAAA;IAEW,gBAKX;AALD,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,eAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EALW,eAAe,KAAf,eAAe,GAK1B,EAAA,CAAA,CAAA,CAAA;AAEY,MAAA,YAAY,GAAG;AAC1B,IAAA,CAAC,eAAe,CAAC,IAAI,GAAG,UAAU;AAClC,IAAA,CAAC,eAAe,CAAC,KAAK,GAAG,WAAW;AACpC,IAAA,CAAC,eAAe,CAAC,MAAM,GAAG,YAAY;AACtC,IAAA,CAAC,eAAe,CAAC,OAAO,GAAG,aAAa;EACzC;IAEW,yBAGX;AAHD,CAAA,UAAY,wBAAwB,EAAA;AAClC,IAAA,wBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,wBAAA,CAAA,YAAA,CAAA,GAAA,aAA0B,CAAA;AAC5B,CAAC,EAHW,wBAAwB,KAAxB,wBAAwB,GAGnC,EAAA,CAAA,CAAA,CAAA;IAEW,0BAGX;AAHD,CAAA,UAAY,yBAAyB,EAAA;AACnC,IAAA,yBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,yBAAA,CAAA,cAAA,CAAA,GAAA,eAA8B,CAAA;AAChC,CAAC,EAHW,yBAAyB,KAAzB,yBAAyB,GAGpC,EAAA,CAAA,CAAA,CAAA;IAEW,eAKX;AALD,CAAA,UAAY,cAAc,EAAA;;AAExB,IAAA,cAAA,CAAA,IAAA,CAAA,GAAA,IAAS,CAAA;AACT,IAAA,cAAA,CAAA,GAAA,CAAA,GAAA,GAAO,CAAA;AACP,IAAA,cAAA,CAAA,GAAA,CAAA,GAAA,GAAO,CAAA;AACT,CAAC,EALW,cAAc,KAAd,cAAc,GAKzB,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -225,8 +225,8 @@ class Tooltip {
|
|
|
225
225
|
if (node !== html)
|
|
226
226
|
this.div.html('').append(() => html);
|
|
227
227
|
}
|
|
228
|
-
else if (html) {
|
|
229
|
-
this.div.html(html);
|
|
228
|
+
else if (html !== null) {
|
|
229
|
+
this.div.html(html || '');
|
|
230
230
|
}
|
|
231
231
|
this.div
|
|
232
232
|
.classed((_a = config.className) !== null && _a !== void 0 ? _a : '', Boolean(config.className))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/tooltip/index.ts"],"sourcesContent":["import { select, Selection, pointer } from 'd3-selection'\n\n// Core\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\n// Utils\nimport { merge, throttle } from 'utils/data'\n\n// Config\nimport { TooltipDefaultConfig, TooltipConfigInterface } from './config'\n\n// Style\nimport * as s from './style'\n\nexport class Tooltip {\n element: HTMLElement\n div: Selection<HTMLElement, unknown, null, undefined>\n protected _defaultConfig = TooltipDefaultConfig as TooltipConfigInterface\n public config: TooltipConfigInterface = this._defaultConfig\n prevConfig: TooltipConfigInterface\n components: ComponentCore<unknown>[]\n static selectors = s\n private _setUpEventsThrottled = throttle(this._setUpEvents, 500)\n private _setContainerPositionThrottled = throttle(this._setContainerPosition, 500)\n private _isShown = false\n private _container: HTMLElement\n private _mutationObserver: MutationObserver\n private _hoveredElement: HTMLElement | SVGElement\n private _position: [number, number]\n private _overriddenHorizontalPlacement: Position.Left | Position.Right | string | undefined\n private _hideDelayTimeoutId: ReturnType<typeof setTimeout> | undefined\n private _showDelayTimeoutId: ReturnType<typeof setTimeout> | undefined\n\n constructor (config: TooltipConfigInterface = {}) {\n this.element = document.createElement('div')\n this.div = select(this.element)\n .attr('class', s.root)\n .classed(s.show, false)\n .classed(s.hidden, true)\n\n this.setConfig(config)\n this.components = this.config.components\n\n // Set up MutationObserver to automatically re-position the tooltip\n // if the content has been dynamically changed\n this._mutationObserver = new MutationObserver(() => {\n if (!this._isShown) return\n\n // Handle changes to the content of this.div\n // Add your logic here\n if (!this.config.followCursor && this._hoveredElement) {\n this.placeByElement(this._hoveredElement)\n } else if (this._position) {\n this.place({ x: this._position[0], y: this._position[1] })\n }\n })\n\n this._mutationObserver.observe(this.div.node(), { childList: true, subtree: true })\n }\n\n public setConfig (config: TooltipConfigInterface): void {\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\n\n // Reset `this._overriddenHorizontalPlacement` if the `horizontalPlacement` has changed\n if (this.prevConfig.horizontalPlacement !== this.config.horizontalPlacement) {\n this.overrideHorizontalPlacement(undefined)\n }\n\n if (this.config.container && (this.config.container !== this.prevConfig?.container)) {\n this.setContainer(this.config.container)\n }\n\n this._setUpAttributes()\n }\n\n public setContainer (container: HTMLElement): void {\n this.element.parentNode?.removeChild(this.element)\n\n this._container = container\n this._container.appendChild(this.element)\n\n this._setContainerPositionThrottled()\n }\n\n public getContainer (): HTMLElement {\n return this._container\n }\n\n public hasContainer (): boolean {\n return !!this._container && this._container.isConnected\n }\n\n public setComponents (components: ComponentCore<unknown>[]): void {\n this.components = components\n }\n\n public update (): void {\n if (!this._container) return\n\n this._setUpEventsThrottled()\n }\n\n /** Show the tooltip immediately by providing content and position */\n public show (html: string | HTMLElement | null | void, pos: { x: number; y: number }): void {\n this.render(html)\n this.place(pos)\n }\n\n private _hide (): void {\n this.div\n .classed(s.show, false) // The `show` class triggers the opacity transition\n .on('transitionend', () => {\n // We hide the element once the transition completes\n // This ensures container overflow will not occur when the window is resized\n this.div.classed(s.hidden, !this._isShown)\n })\n\n this._isShown = false\n }\n\n /** Hides the tooltip after `hideDelay` */\n public hide (): void {\n window.clearTimeout(this._showDelayTimeoutId)\n if (this.config.hideDelay) {\n window.clearTimeout(this._hideDelayTimeoutId)\n this._hideDelayTimeoutId = setTimeout(() => this._hide(), this.config.hideDelay)\n } else {\n this._hide()\n }\n }\n\n private _display (): void {\n window.clearTimeout(this._hideDelayTimeoutId)\n this.div\n .classed(s.hidden, false) // The `hidden` class sets `display: none;`\n .classed(s.show, true) // The `show` class triggers the opacity transition\n\n this._isShown = true\n }\n\n /** Simply display the tooltip with its previous content on position, taking into account `showDelay` */\n public display (): void {\n if (this._isShown) return\n\n if (this.config.showDelay) {\n window.clearTimeout(this._showDelayTimeoutId)\n this._showDelayTimeoutId = setTimeout(() => {\n this._display()\n this.place({ x: this._position[0], y: this._position[1] })\n }, this.config.showDelay)\n } else {\n this._display()\n }\n }\n\n public place (pos: { x: number; y: number }): void {\n this._position = [pos.x, pos.y]\n\n if (!this.hasContainer()) {\n console.warn('Unovis | Tooltip: Container was not set or is not initialized yet')\n return\n }\n\n const { config } = this\n const tooltipWidth = this.element.offsetWidth\n const tooltipHeight = this.element.offsetHeight\n\n const horizontalPlacement = this._overriddenHorizontalPlacement ||\n (config.horizontalPlacement === Position.Auto\n ? Position.Center\n : config.horizontalPlacement)\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? ((pos.y - tooltipHeight) < 0 ? Position.Bottom : Position.Top)\n : config.verticalPlacement\n\n // Todo: Get rid of the hardcoded margin in version 2.0\n // Can be simply replaced with `verticalShift` and `horizontalShift`\n // but it'll be a breaking change\n const margin = 5\n const translateX = horizontalPlacement === Position.Left ? -tooltipWidth - margin - config.horizontalShift\n : horizontalPlacement === Position.Center ? -tooltipWidth / 2\n : margin + config.horizontalShift\n\n const translateY = verticalPlacement === Position.Bottom ? margin + config.verticalShift\n : verticalPlacement === Position.Center ? -tooltipHeight / 2\n : -margin - config.verticalShift - tooltipHeight\n\n // translateX and translateY variables shift the tooltip from the default position (above the cursor, centred horizontally)\n const [top, left] = this._constraintPosToContainer(pos.x + translateX, pos.y + translateY, tooltipWidth, tooltipHeight)\n this._applyPosition(top, left, tooltipHeight)\n }\n\n public placeByElement (hoveredElement: SVGElement | HTMLElement): void {\n const { config } = this\n\n // Store the hovered element and the event for future reference,\n // i.e. to re-position the tooltip if the content has been changed\n // by something else and it was captured by the MutationObserver\n this._hoveredElement = hoveredElement\n\n // Todo: Get rid of the hardcoded margin in version 2.0\n // Can be simply replaced with `verticalShift` and `horizontalShift`\n // but it'll be a breaking change\n const margin = 5\n const tooltipWidth = this.element.offsetWidth\n const tooltipHeight = this.element.offsetHeight\n const isContainerBody = this.isContainerBody()\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n const hoveredElementRect = hoveredElement.getBoundingClientRect()\n\n // We use D3's point transformation to get the correct position of the element by pretending it's a pointer event\n // See more: https://github.com/d3/d3-selection/blob/main/src/pointer.js\n const elementPos = isContainerBody ? [hoveredElementRect.x, hoveredElementRect.y] : pointer({\n clientX: hoveredElementRect.x,\n clientY: hoveredElementRect.y,\n pageX: hoveredElementRect.x,\n pageY: hoveredElementRect.y,\n }, this._container)\n\n const horizontalPlacement = this._overriddenHorizontalPlacement || (\n config.horizontalPlacement === Position.Auto\n ? (elementPos[0] - tooltipWidth < 0 ? Position.Right\n : elementPos[0] + tooltipWidth > containerWidth ? Position.Left : Position.Center)\n : config.horizontalPlacement\n )\n\n let translateX = 0\n switch (horizontalPlacement) {\n case Position.Left:\n translateX = -tooltipWidth - margin - config.horizontalShift\n break\n case Position.Right:\n translateX = hoveredElementRect.width + margin + config.horizontalShift\n break\n case Position.Center:\n default:\n translateX = (-tooltipWidth + hoveredElementRect.width) / 2\n break\n }\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? (horizontalPlacement !== Position.Center ? Position.Center\n : elementPos[1] - tooltipHeight < 0 ? Position.Bottom : Position.Top)\n : config.verticalPlacement\n\n let translateY = -tooltipHeight\n switch (verticalPlacement) {\n case Position.Center:\n translateY += (tooltipHeight + hoveredElementRect.height) / 2\n break\n case Position.Bottom:\n translateY += tooltipHeight + hoveredElementRect.height + margin + config.verticalShift\n break\n case Position.Top:\n default:\n translateY += -margin - config.verticalShift\n break\n }\n\n const [top, left] = this._constraintPosToContainer(elementPos[0] + translateX, elementPos[1] + translateY, tooltipWidth, tooltipHeight)\n this._applyPosition(top, left, tooltipHeight)\n }\n\n public isContainerBody (): boolean {\n return this._container === document.body\n }\n\n /** Allows to override the horizontal placement of the tooltip which is useful when you want to define custom positioning behavior.\n * This method has been added for Crosshair to allow it position tooltip left or right of the crosshair line\n * (see the `_showTooltip` method of the Crosshair component).\n */\n public overrideHorizontalPlacement (placement: Position.Left | Position.Right | string | undefined): void {\n this._overriddenHorizontalPlacement = placement\n }\n\n public render (html: string | HTMLElement | null | void): void {\n const { config, prevConfig } = this\n if (html instanceof HTMLElement) {\n const node = this.div.select(':first-child').node()\n if (node !== html) this.div.html('').append(() => html)\n } else if (html) {\n this.div.html(html)\n }\n\n this.div\n .classed(config.className ?? '', Boolean(config.className))\n .classed(s.nonInteractive, !config.allowHover)\n\n // Remove the previous class name if it was set\n if (prevConfig?.className && prevConfig.className !== config.className) {\n this.div.classed(prevConfig.className, false)\n }\n\n this.display()\n }\n\n private _applyPosition (x: number, y: number, tooltipHeight: number): void {\n const isContainerBody = this.isContainerBody()\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n\n this.div\n .classed(s.positionFixed, isContainerBody)\n .style('top', isContainerBody ? `${y}px` : 'unset')\n .style('bottom', !isContainerBody ? `${containerHeight - y - tooltipHeight}px` : 'unset')\n .style('left', `${x}px`)\n }\n\n private _constraintPosToContainer (top: number, left: number, tooltipWidth: number, tooltipHeight: number): [number, number] {\n const isContainerBody = this.isContainerBody()\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n\n // // Constraint to container\n const paddingX = 10\n const hitRight = top > (containerWidth - tooltipWidth - paddingX)\n const hitLeft = top < paddingX\n const constrainedLeft = hitRight ? containerWidth - tooltipWidth - paddingX\n : hitLeft ? paddingX : top\n\n const paddingY = 10\n const hitBottom = left > (containerHeight - tooltipHeight - paddingY)\n const hitTop = left < paddingY\n const constrainedTop = hitBottom ? containerHeight - tooltipHeight - paddingY\n : hitTop ? paddingY : left\n\n return [\n containerWidth < tooltipWidth ? 0 : constrainedLeft,\n containerHeight < tooltipHeight ? 0 : constrainedTop,\n ]\n }\n\n private _setContainerPosition (): void {\n // Tooltip position calculation relies on the parent position\n // If it's not set (static), we set it to `relative` (not a good practice)\n if (this._container !== document.body && getComputedStyle(this._container)?.position === 'static') {\n this._container.style.position = 'relative'\n }\n }\n\n private _setUpEvents (): void {\n const { config } = this\n\n // We use the Event Delegation pattern to set up Tooltip events\n // Every component will have single `mousemove` and `mouseleave` event listener functions, where we'll check\n // the `path` of the event and trigger corresponding callbacks\n this.components.forEach(component => {\n const selection = select(component.element)\n selection\n .on('mousemove.tooltip', (e: MouseEvent) => {\n const { config: currentConfig } = this // get latest config because it could have been changed after the event was triggered\n const path: (HTMLElement | SVGGElement)[] = (e.composedPath && e.composedPath()) || (e as any).path || [e.target]\n\n // Go through all of the configured triggers\n for (const className of Object.keys(currentConfig.triggers)) {\n const template = currentConfig.triggers[className]\n if (!template) continue // Skip if the trigger is not configured\n\n const els = selection.selectAll<HTMLElement | SVGGElement, unknown>(`.${className}`).nodes()\n\n // Go through all of the elements in the event path (from the deepest element upwards)\n for (const el of path) {\n if (el === selection.node()) break // Break on the component's level (usually the `<g>` element)\n if (el.classList.contains(className)) { // If there's a match, show the tooltip\n const i = els.indexOf(el)\n const d = select(el).datum()\n const content = template(d, i, els)\n const [x, y] = this.isContainerBody() ? [e.clientX, e.clientY] : pointer(e, this._container)\n if (content === null) {\n // If the content is `null`, we hide the tooltip\n this.hide()\n } else {\n // Otherwise we show the tooltip, but don't render the content if it's `undefined` or\n // an empty string. This way we can allow it to work with things like `createPortal` in React\n this.render(content)\n if (currentConfig.followCursor) this.place({ x, y })\n else this.placeByElement(el)\n }\n\n // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n e.stopPropagation()\n\n // Stop looking for other matches\n return\n }\n }\n }\n\n // Hide the tooltip if the event didn't pass through any of the configured triggers.\n // We use the `this._isShown` condition as a little performance optimization tweak\n // (we don't want the tooltip to update its class on every mouse movement, see `this.hide()`).\n if (this._isShown) this.hide()\n })\n .on('mouseleave.tooltip', (e: MouseEvent) => {\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n this.hide()\n })\n })\n\n // Set up Tooltip hover\n if (config.allowHover) {\n this.div\n .on('mouseenter.tooltip', this._display.bind(this))\n .on('mouseleave.tooltip', this.hide.bind(this))\n } else {\n this.div\n .on('mouseenter.tooltip', null)\n .on('mouseleave.tooltip', null)\n }\n }\n\n private _setUpAttributes (): void {\n const attributesMap = this.config.attributes\n if (!attributesMap) return\n\n Object.keys(attributesMap).forEach(attr => {\n this.div.attr(attr, attributesMap[attr])\n })\n }\n\n public destroy (): void {\n this._mutationObserver.disconnect()\n window.clearTimeout(this._hideDelayTimeoutId)\n window.clearTimeout(this._showDelayTimeoutId)\n this.div?.remove()\n }\n}\n"],"names":["s.root","s.show","s.hidden","s.nonInteractive","s.positionFixed","s"],"mappings":";;;;;;;MAiBa,OAAO,CAAA;AAmBlB,IAAA,WAAA,CAAa,SAAiC,EAAE,EAAA;QAhBtC,IAAc,CAAA,cAAA,GAAG,oBAA8C,CAAA;AAClE,QAAA,IAAA,CAAA,MAAM,GAA2B,IAAI,CAAC,cAAc,CAAA;QAInD,IAAqB,CAAA,qBAAA,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;QACxD,IAA8B,CAAA,8BAAA,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAA;QAC1E,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAA;QAUtB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC5C,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;AAC5B,aAAA,IAAI,CAAC,OAAO,EAAEA,IAAM,CAAC;AACrB,aAAA,OAAO,CAACC,IAAM,EAAE,KAAK,CAAC;AACtB,aAAA,OAAO,CAACC,MAAQ,EAAE,IAAI,CAAC,CAAA;AAE1B,QAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA;;;AAIxC,QAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI,gBAAgB,CAAC,MAAK;YACjD,IAAI,CAAC,IAAI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E,CAAC,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClD,iBAAA,EAAE,CAAC,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AAClD,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,GAAG;AACL,iBAAA,EAAE,CAAC,oBAAoB,EAAE,IAAI,CAAC;AAC9B,iBAAA,EAAE,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAA;AAClC,SAAA;KACF;IAEO,gBAAgB,GAAA;AACtB,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA;AAC5C,QAAA,IAAI,CAAC,aAAa;YAAE,OAAM;QAE1B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;AACxC,YAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;AAC1C,SAAC,CAAC,CAAA;KACH;IAEM,OAAO,GAAA;;AACZ,QAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,CAAA;AACnC,QAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;AAC7C,QAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;AAC7C,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,GAAG,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAM,EAAE,CAAA;KACnB;;AArZM,OAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/tooltip/index.ts"],"sourcesContent":["import { select, Selection, pointer } from 'd3-selection'\n\n// Core\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\n// Utils\nimport { merge, throttle } from 'utils/data'\n\n// Config\nimport { TooltipDefaultConfig, TooltipConfigInterface } from './config'\n\n// Style\nimport * as s from './style'\n\nexport class Tooltip {\n element: HTMLElement\n div: Selection<HTMLElement, unknown, null, undefined>\n protected _defaultConfig = TooltipDefaultConfig as TooltipConfigInterface\n public config: TooltipConfigInterface = this._defaultConfig\n prevConfig: TooltipConfigInterface\n components: ComponentCore<unknown>[]\n static selectors = s\n private _setUpEventsThrottled = throttle(this._setUpEvents, 500)\n private _setContainerPositionThrottled = throttle(this._setContainerPosition, 500)\n private _isShown = false\n private _container: HTMLElement\n private _mutationObserver: MutationObserver\n private _hoveredElement: HTMLElement | SVGElement\n private _position: [number, number]\n private _overriddenHorizontalPlacement: Position.Left | Position.Right | string | undefined\n private _hideDelayTimeoutId: ReturnType<typeof setTimeout> | undefined\n private _showDelayTimeoutId: ReturnType<typeof setTimeout> | undefined\n\n constructor (config: TooltipConfigInterface = {}) {\n this.element = document.createElement('div')\n this.div = select(this.element)\n .attr('class', s.root)\n .classed(s.show, false)\n .classed(s.hidden, true)\n\n this.setConfig(config)\n this.components = this.config.components\n\n // Set up MutationObserver to automatically re-position the tooltip\n // if the content has been dynamically changed\n this._mutationObserver = new MutationObserver(() => {\n if (!this._isShown) return\n\n // Handle changes to the content of this.div\n // Add your logic here\n if (!this.config.followCursor && this._hoveredElement) {\n this.placeByElement(this._hoveredElement)\n } else if (this._position) {\n this.place({ x: this._position[0], y: this._position[1] })\n }\n })\n\n this._mutationObserver.observe(this.div.node(), { childList: true, subtree: true })\n }\n\n public setConfig (config: TooltipConfigInterface): void {\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\n\n // Reset `this._overriddenHorizontalPlacement` if the `horizontalPlacement` has changed\n if (this.prevConfig.horizontalPlacement !== this.config.horizontalPlacement) {\n this.overrideHorizontalPlacement(undefined)\n }\n\n if (this.config.container && (this.config.container !== this.prevConfig?.container)) {\n this.setContainer(this.config.container)\n }\n\n this._setUpAttributes()\n }\n\n public setContainer (container: HTMLElement): void {\n this.element.parentNode?.removeChild(this.element)\n\n this._container = container\n this._container.appendChild(this.element)\n\n this._setContainerPositionThrottled()\n }\n\n public getContainer (): HTMLElement {\n return this._container\n }\n\n public hasContainer (): boolean {\n return !!this._container && this._container.isConnected\n }\n\n public setComponents (components: ComponentCore<unknown>[]): void {\n this.components = components\n }\n\n public update (): void {\n if (!this._container) return\n\n this._setUpEventsThrottled()\n }\n\n /** Show the tooltip immediately by providing content and position */\n public show (html: string | HTMLElement | null | void, pos: { x: number; y: number }): void {\n this.render(html)\n this.place(pos)\n }\n\n private _hide (): void {\n this.div\n .classed(s.show, false) // The `show` class triggers the opacity transition\n .on('transitionend', () => {\n // We hide the element once the transition completes\n // This ensures container overflow will not occur when the window is resized\n this.div.classed(s.hidden, !this._isShown)\n })\n\n this._isShown = false\n }\n\n /** Hides the tooltip after `hideDelay` */\n public hide (): void {\n window.clearTimeout(this._showDelayTimeoutId)\n if (this.config.hideDelay) {\n window.clearTimeout(this._hideDelayTimeoutId)\n this._hideDelayTimeoutId = setTimeout(() => this._hide(), this.config.hideDelay)\n } else {\n this._hide()\n }\n }\n\n private _display (): void {\n window.clearTimeout(this._hideDelayTimeoutId)\n this.div\n .classed(s.hidden, false) // The `hidden` class sets `display: none;`\n .classed(s.show, true) // The `show` class triggers the opacity transition\n\n this._isShown = true\n }\n\n /** Simply display the tooltip with its previous content on position, taking into account `showDelay` */\n public display (): void {\n if (this._isShown) return\n\n if (this.config.showDelay) {\n window.clearTimeout(this._showDelayTimeoutId)\n this._showDelayTimeoutId = setTimeout(() => {\n this._display()\n this.place({ x: this._position[0], y: this._position[1] })\n }, this.config.showDelay)\n } else {\n this._display()\n }\n }\n\n public place (pos: { x: number; y: number }): void {\n this._position = [pos.x, pos.y]\n\n if (!this.hasContainer()) {\n console.warn('Unovis | Tooltip: Container was not set or is not initialized yet')\n return\n }\n\n const { config } = this\n const tooltipWidth = this.element.offsetWidth\n const tooltipHeight = this.element.offsetHeight\n\n const horizontalPlacement = this._overriddenHorizontalPlacement ||\n (config.horizontalPlacement === Position.Auto\n ? Position.Center\n : config.horizontalPlacement)\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? ((pos.y - tooltipHeight) < 0 ? Position.Bottom : Position.Top)\n : config.verticalPlacement\n\n // Todo: Get rid of the hardcoded margin in version 2.0\n // Can be simply replaced with `verticalShift` and `horizontalShift`\n // but it'll be a breaking change\n const margin = 5\n const translateX = horizontalPlacement === Position.Left ? -tooltipWidth - margin - config.horizontalShift\n : horizontalPlacement === Position.Center ? -tooltipWidth / 2\n : margin + config.horizontalShift\n\n const translateY = verticalPlacement === Position.Bottom ? margin + config.verticalShift\n : verticalPlacement === Position.Center ? -tooltipHeight / 2\n : -margin - config.verticalShift - tooltipHeight\n\n // translateX and translateY variables shift the tooltip from the default position (above the cursor, centred horizontally)\n const [top, left] = this._constraintPosToContainer(pos.x + translateX, pos.y + translateY, tooltipWidth, tooltipHeight)\n this._applyPosition(top, left, tooltipHeight)\n }\n\n public placeByElement (hoveredElement: SVGElement | HTMLElement): void {\n const { config } = this\n\n // Store the hovered element and the event for future reference,\n // i.e. to re-position the tooltip if the content has been changed\n // by something else and it was captured by the MutationObserver\n this._hoveredElement = hoveredElement\n\n // Todo: Get rid of the hardcoded margin in version 2.0\n // Can be simply replaced with `verticalShift` and `horizontalShift`\n // but it'll be a breaking change\n const margin = 5\n const tooltipWidth = this.element.offsetWidth\n const tooltipHeight = this.element.offsetHeight\n const isContainerBody = this.isContainerBody()\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n const hoveredElementRect = hoveredElement.getBoundingClientRect()\n\n // We use D3's point transformation to get the correct position of the element by pretending it's a pointer event\n // See more: https://github.com/d3/d3-selection/blob/main/src/pointer.js\n const elementPos = isContainerBody ? [hoveredElementRect.x, hoveredElementRect.y] : pointer({\n clientX: hoveredElementRect.x,\n clientY: hoveredElementRect.y,\n pageX: hoveredElementRect.x,\n pageY: hoveredElementRect.y,\n }, this._container)\n\n const horizontalPlacement = this._overriddenHorizontalPlacement || (\n config.horizontalPlacement === Position.Auto\n ? (elementPos[0] - tooltipWidth < 0 ? Position.Right\n : elementPos[0] + tooltipWidth > containerWidth ? Position.Left : Position.Center)\n : config.horizontalPlacement\n )\n\n let translateX = 0\n switch (horizontalPlacement) {\n case Position.Left:\n translateX = -tooltipWidth - margin - config.horizontalShift\n break\n case Position.Right:\n translateX = hoveredElementRect.width + margin + config.horizontalShift\n break\n case Position.Center:\n default:\n translateX = (-tooltipWidth + hoveredElementRect.width) / 2\n break\n }\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? (horizontalPlacement !== Position.Center ? Position.Center\n : elementPos[1] - tooltipHeight < 0 ? Position.Bottom : Position.Top)\n : config.verticalPlacement\n\n let translateY = -tooltipHeight\n switch (verticalPlacement) {\n case Position.Center:\n translateY += (tooltipHeight + hoveredElementRect.height) / 2\n break\n case Position.Bottom:\n translateY += tooltipHeight + hoveredElementRect.height + margin + config.verticalShift\n break\n case Position.Top:\n default:\n translateY += -margin - config.verticalShift\n break\n }\n\n const [top, left] = this._constraintPosToContainer(elementPos[0] + translateX, elementPos[1] + translateY, tooltipWidth, tooltipHeight)\n this._applyPosition(top, left, tooltipHeight)\n }\n\n public isContainerBody (): boolean {\n return this._container === document.body\n }\n\n /** Allows to override the horizontal placement of the tooltip which is useful when you want to define custom positioning behavior.\n * This method has been added for Crosshair to allow it position tooltip left or right of the crosshair line\n * (see the `_showTooltip` method of the Crosshair component).\n */\n public overrideHorizontalPlacement (placement: Position.Left | Position.Right | string | undefined): void {\n this._overriddenHorizontalPlacement = placement\n }\n\n public render (html: string | HTMLElement | null | void): void {\n const { config, prevConfig } = this\n if (html instanceof HTMLElement) {\n const node = this.div.select(':first-child').node()\n if (node !== html) this.div.html('').append(() => html)\n } else if (html !== null) {\n this.div.html(html || '')\n }\n\n this.div\n .classed(config.className ?? '', Boolean(config.className))\n .classed(s.nonInteractive, !config.allowHover)\n\n // Remove the previous class name if it was set\n if (prevConfig?.className && prevConfig.className !== config.className) {\n this.div.classed(prevConfig.className, false)\n }\n\n this.display()\n }\n\n private _applyPosition (x: number, y: number, tooltipHeight: number): void {\n const isContainerBody = this.isContainerBody()\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n\n this.div\n .classed(s.positionFixed, isContainerBody)\n .style('top', isContainerBody ? `${y}px` : 'unset')\n .style('bottom', !isContainerBody ? `${containerHeight - y - tooltipHeight}px` : 'unset')\n .style('left', `${x}px`)\n }\n\n private _constraintPosToContainer (top: number, left: number, tooltipWidth: number, tooltipHeight: number): [number, number] {\n const isContainerBody = this.isContainerBody()\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n\n // // Constraint to container\n const paddingX = 10\n const hitRight = top > (containerWidth - tooltipWidth - paddingX)\n const hitLeft = top < paddingX\n const constrainedLeft = hitRight ? containerWidth - tooltipWidth - paddingX\n : hitLeft ? paddingX : top\n\n const paddingY = 10\n const hitBottom = left > (containerHeight - tooltipHeight - paddingY)\n const hitTop = left < paddingY\n const constrainedTop = hitBottom ? containerHeight - tooltipHeight - paddingY\n : hitTop ? paddingY : left\n\n return [\n containerWidth < tooltipWidth ? 0 : constrainedLeft,\n containerHeight < tooltipHeight ? 0 : constrainedTop,\n ]\n }\n\n private _setContainerPosition (): void {\n // Tooltip position calculation relies on the parent position\n // If it's not set (static), we set it to `relative` (not a good practice)\n if (this._container !== document.body && getComputedStyle(this._container)?.position === 'static') {\n this._container.style.position = 'relative'\n }\n }\n\n private _setUpEvents (): void {\n const { config } = this\n\n // We use the Event Delegation pattern to set up Tooltip events\n // Every component will have single `mousemove` and `mouseleave` event listener functions, where we'll check\n // the `path` of the event and trigger corresponding callbacks\n this.components.forEach(component => {\n const selection = select(component.element)\n selection\n .on('mousemove.tooltip', (e: MouseEvent) => {\n const { config: currentConfig } = this // get latest config because it could have been changed after the event was triggered\n const path: (HTMLElement | SVGGElement)[] = (e.composedPath && e.composedPath()) || (e as any).path || [e.target]\n\n // Go through all of the configured triggers\n for (const className of Object.keys(currentConfig.triggers)) {\n const template = currentConfig.triggers[className]\n if (!template) continue // Skip if the trigger is not configured\n\n const els = selection.selectAll<HTMLElement | SVGGElement, unknown>(`.${className}`).nodes()\n\n // Go through all of the elements in the event path (from the deepest element upwards)\n for (const el of path) {\n if (el === selection.node()) break // Break on the component's level (usually the `<g>` element)\n if (el.classList.contains(className)) { // If there's a match, show the tooltip\n const i = els.indexOf(el)\n const d = select(el).datum()\n const content = template(d, i, els)\n const [x, y] = this.isContainerBody() ? [e.clientX, e.clientY] : pointer(e, this._container)\n if (content === null) {\n // If the content is `null`, we hide the tooltip\n this.hide()\n } else {\n // Otherwise we show the tooltip, but don't render the content if it's `undefined` or\n // an empty string. This way we can allow it to work with things like `createPortal` in React\n this.render(content)\n if (currentConfig.followCursor) this.place({ x, y })\n else this.placeByElement(el)\n }\n\n // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n e.stopPropagation()\n\n // Stop looking for other matches\n return\n }\n }\n }\n\n // Hide the tooltip if the event didn't pass through any of the configured triggers.\n // We use the `this._isShown` condition as a little performance optimization tweak\n // (we don't want the tooltip to update its class on every mouse movement, see `this.hide()`).\n if (this._isShown) this.hide()\n })\n .on('mouseleave.tooltip', (e: MouseEvent) => {\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n this.hide()\n })\n })\n\n // Set up Tooltip hover\n if (config.allowHover) {\n this.div\n .on('mouseenter.tooltip', this._display.bind(this))\n .on('mouseleave.tooltip', this.hide.bind(this))\n } else {\n this.div\n .on('mouseenter.tooltip', null)\n .on('mouseleave.tooltip', null)\n }\n }\n\n private _setUpAttributes (): void {\n const attributesMap = this.config.attributes\n if (!attributesMap) return\n\n Object.keys(attributesMap).forEach(attr => {\n this.div.attr(attr, attributesMap[attr])\n })\n }\n\n public destroy (): void {\n this._mutationObserver.disconnect()\n window.clearTimeout(this._hideDelayTimeoutId)\n window.clearTimeout(this._showDelayTimeoutId)\n this.div?.remove()\n }\n}\n"],"names":["s.root","s.show","s.hidden","s.nonInteractive","s.positionFixed","s"],"mappings":";;;;;;;MAiBa,OAAO,CAAA;AAmBlB,IAAA,WAAA,CAAa,SAAiC,EAAE,EAAA;QAhBtC,IAAc,CAAA,cAAA,GAAG,oBAA8C,CAAA;AAClE,QAAA,IAAA,CAAA,MAAM,GAA2B,IAAI,CAAC,cAAc,CAAA;QAInD,IAAqB,CAAA,qBAAA,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;QACxD,IAA8B,CAAA,8BAAA,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAA;QAC1E,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAA;QAUtB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC5C,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;AAC5B,aAAA,IAAI,CAAC,OAAO,EAAEA,IAAM,CAAC;AACrB,aAAA,OAAO,CAACC,IAAM,EAAE,KAAK,CAAC;AACtB,aAAA,OAAO,CAACC,MAAQ,EAAE,IAAI,CAAC,CAAA;AAE1B,QAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA;;;AAIxC,QAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI,gBAAgB,CAAC,MAAK;YACjD,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAAE,OAAM;;;YAI1B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,IAAI,CAAC,eAAe,EAAE;AACrD,gBAAA,IAAI,CAAC,cAAc,CAAC,IAAI,C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C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AAClD,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,GAAG;AACL,iBAAA,EAAE,CAAC,oBAAoB,EAAE,IAAI,CAAC;AAC9B,iBAAA,EAAE,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAA;AAClC,SAAA;KACF;IAEO,gBAAgB,GAAA;AACtB,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA;AAC5C,QAAA,IAAI,CAAC,aAAa;YAAE,OAAM;QAE1B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;AACxC,YAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;AAC1C,SAAC,CAAC,CAAA;KACH;IAEM,OAAO,GAAA;;AACZ,QAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,CAAA;AACnC,QAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;AAC7C,QAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;AAC7C,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,GAAG,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAM,EAAE,CAAA;KACnB;;AArZM,OAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
@@ -236,11 +236,9 @@ class Treemap extends ComponentCore {
|
|
|
236
236
|
trimSVGText(text, tileWidth, config.labelTrimMode, true, fontSize);
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
|
-
// Transition group position
|
|
240
|
-
smartTransition(mergedTiles.select(`g.${labelGroup}`), duration)
|
|
241
|
-
.attr('transform', d => `translate(${d.x0 + config.labelOffsetX},${d.y0 + config.labelOffsetY})`);
|
|
242
|
-
// Transition text opacity only (fade-in)
|
|
239
|
+
// Transition group position and text opacity (fade-in)
|
|
243
240
|
smartTransition(mergedTiles.select(`g.${labelGroup}`), duration)
|
|
241
|
+
.attr('transform', d => `translate(${d.x0 + config.labelOffsetX},${d.y0 + config.labelOffsetY})`)
|
|
244
242
|
.style('opacity', 1);
|
|
245
243
|
// Hide labels that don't meet criteria
|
|
246
244
|
mergedTiles.select(`text.${label}`)
|