@unovis/ts 1.4.0-alpha.9 → 1.4.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.
Files changed (99) hide show
  1. package/components/annotations/config.d.ts +19 -0
  2. package/components/annotations/config.js +6 -0
  3. package/components/annotations/config.js.map +1 -0
  4. package/components/annotations/index.d.ts +24 -0
  5. package/components/annotations/index.js +116 -0
  6. package/components/annotations/index.js.map +1 -0
  7. package/components/annotations/style.d.ts +13 -0
  8. package/components/annotations/style.js +43 -0
  9. package/components/annotations/style.js.map +1 -0
  10. package/components/annotations/types.d.ts +43 -0
  11. package/components/annotations/types.js +8 -0
  12. package/components/annotations/types.js.map +1 -0
  13. package/components/area/config.d.ts +1 -1
  14. package/components/area/config.js.map +1 -1
  15. package/components/area/index.js.map +1 -1
  16. package/components/bullet-legend/config.d.ts +4 -2
  17. package/components/bullet-legend/config.js +1 -2
  18. package/components/bullet-legend/config.js.map +1 -1
  19. package/components/bullet-legend/index.js +15 -17
  20. package/components/bullet-legend/index.js.map +1 -1
  21. package/components/bullet-legend/modules/shape.d.ts +1 -2
  22. package/components/bullet-legend/modules/shape.js +39 -48
  23. package/components/bullet-legend/modules/shape.js.map +1 -1
  24. package/components/bullet-legend/style.js +2 -5
  25. package/components/bullet-legend/style.js.map +1 -1
  26. package/components/bullet-legend/types.d.ts +14 -5
  27. package/components/bullet-legend/types.js +4 -6
  28. package/components/bullet-legend/types.js.map +1 -1
  29. package/components/graph/config.d.ts +15 -22
  30. package/components/graph/config.js +2 -4
  31. package/components/graph/config.js.map +1 -1
  32. package/components/graph/index.d.ts +2 -7
  33. package/components/graph/index.js +116 -117
  34. package/components/graph/index.js.map +1 -1
  35. package/components/graph/modules/layout.js +19 -30
  36. package/components/graph/modules/layout.js.map +1 -1
  37. package/components/graph/modules/link/helper.d.ts +6 -4
  38. package/components/graph/modules/link/helper.js +25 -15
  39. package/components/graph/modules/link/helper.js.map +1 -1
  40. package/components/graph/modules/link/index.d.ts +3 -3
  41. package/components/graph/modules/link/index.js +89 -111
  42. package/components/graph/modules/link/index.js.map +1 -1
  43. package/components/graph/modules/link/style.d.ts +5 -5
  44. package/components/graph/modules/link/style.js +22 -26
  45. package/components/graph/modules/link/style.js.map +1 -1
  46. package/components/graph/modules/node/helper.d.ts +0 -1
  47. package/components/graph/modules/node/helper.js +1 -4
  48. package/components/graph/modules/node/helper.js.map +1 -1
  49. package/components/graph/modules/node/index.js +11 -28
  50. package/components/graph/modules/node/index.js.map +1 -1
  51. package/components/graph/modules/node/style.d.ts +1 -1
  52. package/components/graph/modules/node/style.js +6 -13
  53. package/components/graph/modules/node/style.js.map +1 -1
  54. package/components/graph/modules/shape.d.ts +2 -0
  55. package/components/graph/modules/shape.js +9 -7
  56. package/components/graph/modules/shape.js.map +1 -1
  57. package/components/graph/types.d.ts +5 -63
  58. package/components/graph/types.js +0 -1
  59. package/components/graph/types.js.map +1 -1
  60. package/components/stacked-bar/index.js.map +1 -1
  61. package/components/tooltip/config.d.ts +1 -1
  62. package/components/tooltip/config.js.map +1 -1
  63. package/components/tooltip/index.js +1 -3
  64. package/components/tooltip/index.js.map +1 -1
  65. package/components/vis-controls/index.d.ts +0 -3
  66. package/components/vis-controls/index.js +1 -6
  67. package/components/vis-controls/index.js.map +1 -1
  68. package/components.d.ts +2 -0
  69. package/components.js +1 -0
  70. package/components.js.map +1 -1
  71. package/containers/single-container/config.d.ts +3 -0
  72. package/containers/single-container/config.js.map +1 -1
  73. package/containers/single-container/index.js +10 -1
  74. package/containers/single-container/index.js.map +1 -1
  75. package/containers/xy-container/config.d.ts +3 -0
  76. package/containers/xy-container/config.js +1 -1
  77. package/containers/xy-container/config.js.map +1 -1
  78. package/containers/xy-container/index.js +17 -5
  79. package/containers/xy-container/index.js.map +1 -1
  80. package/core/component/index.d.ts +3 -3
  81. package/core/component/index.js +1 -1
  82. package/core/component/index.js.map +1 -1
  83. package/index.js +2 -0
  84. package/index.js.map +1 -1
  85. package/package.json +1 -1
  86. package/types/misc.d.ts +1 -0
  87. package/types/scale.d.ts +3 -2
  88. package/types/scale.js +2 -1
  89. package/types/scale.js.map +1 -1
  90. package/types.d.ts +1 -0
  91. package/types.js +1 -0
  92. package/types.js.map +1 -1
  93. package/utils/misc.d.ts +2 -1
  94. package/utils/misc.js +13 -1
  95. package/utils/misc.js.map +1 -1
  96. package/utils/svg.d.ts +0 -3
  97. package/utils/text.js.map +1 -1
  98. package/utils/svg.js +0 -61
  99. package/utils/svg.js.map +0 -1
@@ -1,19 +1,21 @@
1
1
  import { select } from 'd3-selection';
2
2
  import { polygon } from '../../../utils/path.js';
3
3
  import { getString } from '../../../utils/data.js';
4
- import { isStringSvg, sanitizeSvgString } from '../../../utils/svg.js';
5
4
  import { GraphNodeShape } from '../types.js';
6
5
  import { getNodeSize } from './node/helper.js';
7
6
 
7
+ function isCustomXml(shape) {
8
+ return /<[a-z][\s\S]*>/i.test(shape);
9
+ }
8
10
  function appendShape(selection, shapeAccessor, shapeSelector, customShapeSelector, index, insertSelector = ':last-child') {
9
11
  selection.each((d, i, elements) => {
10
12
  const element = select(elements[i]);
11
13
  const shape = getString(d, shapeAccessor, index);
12
14
  let shapeElement;
13
- const isCustomShape = isStringSvg(shape);
14
- if (isCustomShape) {
15
+ const isCustomXmlShape = isCustomXml(shape);
16
+ if (isCustomXmlShape) {
15
17
  shapeElement = element.insert('g', insertSelector)
16
- .html(sanitizeSvgString(shape));
18
+ .html(shape);
17
19
  }
18
20
  else {
19
21
  switch (shape) {
@@ -31,7 +33,7 @@ function appendShape(selection, shapeAccessor, shapeSelector, customShapeSelecto
31
33
  shapeElement = element.insert('circle', insertSelector);
32
34
  }
33
35
  }
34
- shapeElement.classed(customShapeSelector, isCustomShape);
36
+ shapeElement.classed(customShapeSelector, isCustomXmlShape);
35
37
  return shapeElement.attr('class', shapeSelector);
36
38
  });
37
39
  }
@@ -64,7 +66,7 @@ function updateShape(selection, shape, size, index) {
64
66
  return polygon(nodeSize, n);
65
67
  });
66
68
  selection.filter('g')
67
- .filter(() => !isStringSvg(getString(d, shape, index)))
69
+ .filter(() => !isCustomXml(getString(d, shape, index)))
68
70
  .html(getString(d, shape, index));
69
71
  selection.filter('g')
70
72
  .each((d, i, elements) => {
@@ -74,5 +76,5 @@ function updateShape(selection, shape, size, index) {
74
76
  });
75
77
  }
76
78
 
77
- export { appendShape, updateShape };
79
+ export { appendShape, isCustomXml, updateShape };
78
80
  //# sourceMappingURL=shape.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shape.js","sources":["../../../../src/components/graph/modules/shape.ts"],"sourcesContent":["import { Selection, select } from 'd3-selection'\n\n// Types\nimport { NumericAccessor, StringAccessor } from 'types/accessor'\n\n// Utils\nimport { polygon } from 'utils/path'\nimport { getString } from 'utils/data'\nimport { isStringSvg, sanitizeSvgString } from 'utils/svg'\n\n// Types\n\n// Local Types\nimport { GraphNodeShape } from '../types'\n\n// Helpers\nimport { getNodeSize } from './node/helper'\n\nexport function appendShape<T> (\n selection: Selection<SVGGElement, T, SVGGElement, unknown>,\n shapeAccessor: StringAccessor<T>,\n shapeSelector: string,\n customShapeSelector: string,\n index?: number,\n insertSelector = ':last-child'\n): void {\n selection.each((d, i, elements) => {\n const element = select(elements[i])\n const shape = getString(d, shapeAccessor, index) as GraphNodeShape\n\n let shapeElement: Selection<SVGPathElement, unknown, null, undefined>\n | Selection<SVGRectElement, unknown, null, undefined>\n | Selection<SVGGElement, unknown, null, undefined>\n | Selection<SVGCircleElement, unknown, null, undefined>\n const isCustomShape = isStringSvg(shape)\n if (isCustomShape) {\n shapeElement = element.insert('g', insertSelector)\n .html(sanitizeSvgString(shape))\n } else {\n switch (shape) {\n case GraphNodeShape.Square:\n shapeElement = element.insert('rect', insertSelector)\n .attr('rx', 5)\n .attr('ry', 5)\n break\n case GraphNodeShape.Hexagon:\n case GraphNodeShape.Triangle:\n shapeElement = element.insert('path', insertSelector)\n break\n case GraphNodeShape.Circle:\n default:\n shapeElement = element.insert('circle', insertSelector)\n }\n }\n\n shapeElement.classed(customShapeSelector, isCustomShape)\n return shapeElement.attr('class', shapeSelector)\n })\n}\n\nexport function updateShape<T> (\n selection: Selection<SVGGElement, T, SVGGElement, unknown>,\n shape: StringAccessor<T>,\n size: NumericAccessor<T>,\n index: number\n): void {\n if (selection.size() === 0) return\n\n const d: T = selection.datum()\n const nodeSize = getNodeSize(d, size, index)\n selection.filter('circle')\n .attr('r', nodeSize / 2)\n\n selection.filter('rect')\n .attr('width', nodeSize)\n .attr('height', nodeSize)\n .attr('x', -nodeSize / 2)\n .attr('y', -nodeSize / 2)\n\n selection.filter('path')\n .attr('d', () => {\n let n: number\n switch (getString(d, shape, index)) {\n case GraphNodeShape.Square:\n n = 4\n break\n case GraphNodeShape.Triangle:\n n = 3\n break\n case GraphNodeShape.Hexagon:\n default:\n n = 6\n }\n\n return polygon(nodeSize, n)\n })\n\n selection.filter('g')\n .filter(() => !isStringSvg(getString(d, shape, index) as GraphNodeShape))\n .html(getString(d, shape, index))\n\n selection.filter('g')\n .each((d, i, elements) => {\n const el = select(elements[i])\n const bBox = el.node().getBBox()\n el.attr('transform', `translate(${-bBox.width / 2},${-bBox.height / 2})`)\n })\n}\n"],"names":[],"mappings":";;;;;;;AAkBgB,SAAA,WAAW,CACzB,SAA0D,EAC1D,aAAgC,EAChC,aAAqB,EACrB,mBAA2B,EAC3B,KAAc,EACd,cAAc,GAAG,aAAa,EAAA;IAE9B,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,KAAI;QAChC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QACnC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAmB,CAAA;AAElE,QAAA,IAAI,YAGmD,CAAA;AACvD,QAAA,MAAM,aAAa,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;AACxC,QAAA,IAAI,aAAa,EA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CAAC,CAAC,CAAA;QAC9B,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;QAChC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAa,UAAA,EAAA,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA,CAAA,EAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAG,CAAA,CAAA,CAAC,CAAA;AAC3E,KAAC,CAAC,CAAA;AACN;;;;"}
1
+ {"version":3,"file":"shape.js","sources":["../../../../src/components/graph/modules/shape.ts"],"sourcesContent":["import { Selection, select } from 'd3-selection'\n\n// Types\nimport { NumericAccessor, StringAccessor } from 'types/accessor'\n\n// Utils\nimport { polygon } from 'utils/path'\nimport { getString } from 'utils/data'\n\n// Types\n\n// Local Types\nimport { GraphNodeShape } from '../types'\n\n// Helpers\nimport { getNodeSize } from './node/helper'\n\nexport function isCustomXml (shape: GraphNodeShape): boolean {\n return /<[a-z][\\s\\S]*>/i.test(shape)\n}\n\nexport function appendShape<T> (\n selection: Selection<SVGGElement, T, SVGGElement, unknown>,\n shapeAccessor: StringAccessor<T>,\n shapeSelector: string,\n customShapeSelector: string,\n index?: number,\n insertSelector = ':last-child'\n): void {\n selection.each((d, i, elements) => {\n const element = select(elements[i])\n const shape = getString(d, shapeAccessor, index) as GraphNodeShape\n\n let shapeElement: Selection<SVGPathElement, unknown, null, undefined>\n | Selection<SVGRectElement, unknown, null, undefined>\n | Selection<SVGGElement, unknown, null, undefined>\n | Selection<SVGCircleElement, unknown, null, undefined>\n const isCustomXmlShape = isCustomXml(shape)\n if (isCustomXmlShape) {\n shapeElement = element.insert('g', insertSelector)\n .html(shape)\n } else {\n switch (shape) {\n case GraphNodeShape.Square:\n shapeElement = element.insert('rect', insertSelector)\n .attr('rx', 5)\n .attr('ry', 5)\n break\n case GraphNodeShape.Hexagon:\n case GraphNodeShape.Triangle:\n shapeElement = element.insert('path', insertSelector)\n break\n case GraphNodeShape.Circle:\n default:\n shapeElement = element.insert('circle', insertSelector)\n }\n }\n\n shapeElement.classed(customShapeSelector, isCustomXmlShape)\n return shapeElement.attr('class', shapeSelector)\n })\n}\n\nexport function updateShape<T> (\n selection: Selection<SVGGElement, T, SVGGElement, unknown>,\n shape: StringAccessor<T>,\n size: NumericAccessor<T>,\n index: number\n): void {\n if (selection.size() === 0) return\n\n const d: T = selection.datum()\n const nodeSize = getNodeSize(d, size, index)\n selection.filter('circle')\n .attr('r', nodeSize / 2)\n\n selection.filter('rect')\n .attr('width', nodeSize)\n .attr('height', nodeSize)\n .attr('x', -nodeSize / 2)\n .attr('y', -nodeSize / 2)\n\n selection.filter('path')\n .attr('d', () => {\n let n: number\n switch (getString(d, shape, index)) {\n case GraphNodeShape.Square:\n n = 4\n break\n case GraphNodeShape.Triangle:\n n = 3\n break\n case GraphNodeShape.Hexagon:\n default:\n n = 6\n }\n\n return polygon(nodeSize, n)\n })\n\n selection.filter('g')\n .filter(() => !isCustomXml(getString(d, shape, index) as GraphNodeShape))\n .html(getString(d, shape, index))\n\n selection.filter('g')\n .each((d, i, elements) => {\n const el = select(elements[i])\n const bBox = el.node().getBBox()\n el.attr('transform', `translate(${-bBox.width / 2},${-bBox.height / 2})`)\n })\n}\n"],"names":[],"mappings":";;;;;;AAiBM,SAAU,WAAW,CAAE,KAAqB,EAAA;AAChD,IAAA,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACtC,CAAC;AAEe,SAAA,WAAW,CACzB,SAA0D,EAC1D,aAAgC,EAChC,aAAqB,EACrB,mBAA2B,EAC3B,KAAc,EACd,cAAc,GAAG,aAAa,EAAA;IAE9B,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,KAAI;QAChC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QACnC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,EAAE,aAAa,EAAE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AC;SAClB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,KAAI;QACvB,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9B,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;QAChC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAa,UAAA,EAAA,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA,CAAA,EAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAG,CAAA,CAAA,CAAC,CAAA;AAC3E,KAAC,CAAC,CAAA;AACN;;;;"}
@@ -16,10 +16,6 @@ export declare type GraphNode<N extends GraphInputNode = GraphInputNode, L exten
16
16
  _panels?: GraphPanel<N, L>[];
17
17
  _isConnected?: boolean;
18
18
  };
19
- export declare type GraphForceSimulationNode<N extends GraphInputNode = GraphInputNode, L extends GraphInputLink = GraphInputLink> = GraphNode<N, L> & {
20
- fx?: number;
21
- fy?: number;
22
- };
23
19
  export declare type GraphLink<N extends GraphInputNode = GraphInputNode, L extends GraphInputLink = GraphInputLink> = GraphLinkCore<N, L> & {
24
20
  id?: number | string;
25
21
  source: number | string | GraphNode<N>;
@@ -42,8 +38,7 @@ export declare enum GraphLayoutType {
42
38
  ParallelHorizontal = "parallel horizontal",
43
39
  Dagre = "dagre",
44
40
  Force = "force",
45
- Elk = "elk",
46
- Precalculated = "precalculated"
41
+ Elk = "elk"
47
42
  }
48
43
  export declare type GraphCircleLabel = {
49
44
  text: string;
@@ -53,7 +48,6 @@ export declare type GraphCircleLabel = {
53
48
  fontSize?: string | null;
54
49
  radius?: number;
55
50
  };
56
- export declare type GraphLinkLabel = GraphCircleLabel;
57
51
  export declare enum GraphLinkStyle {
58
52
  Dashed = "dashed",
59
53
  Solid = "solid"
@@ -116,68 +110,16 @@ export declare type GraphNodeAnimationState = {
116
110
  export declare type GraphNodeAnimatedElement<T = SVGElement> = T & {
117
111
  _animState: GraphNodeAnimationState;
118
112
  };
119
- export declare type GraphForceLayoutSettings<N extends GraphInputNode = GraphInputNode, L extends GraphInputLink = GraphInputLink> = {
113
+ export declare type GraphForceLayoutSettings = {
120
114
  /** Preferred Link Distance. Default: `60` */
121
- linkDistance?: number | ((l: GraphLink<N, L>, i: number) => number);
115
+ linkDistance?: number;
122
116
  /** Link Strength [0:1]. Default: `0.45` */
123
- linkStrength?: number | ((l: GraphLink<N, L>, i: number) => number);
117
+ linkStrength?: number;
124
118
  /** Charge Force (<0 repulsion, >0 attraction). Default: `-500` */
125
- charge?: number | ((l: GraphNode<N, L>, i: number) => number);
119
+ charge?: number;
126
120
  /** X-centring force. Default: `0.15` */
127
121
  forceXStrength?: number;
128
122
  /** Y-centring force. Default: `0.25` */
129
123
  forceYStrength?: number;
130
- /** Number if simulation iterations. Default: automatic */
131
- numIterations?: number;
132
- /** Set to true if you want to fix the node positions after the simulation
133
- * Helpful when you want to update graph settings without re-calculating the layout.
134
- * Default: `false` */
135
- fixNodePositionAfterSimulation?: boolean;
136
124
  };
137
125
  export declare type GraphElkLayoutSettings = Record<string, string>;
138
- /**
139
- * Settings for configuring the layout of a Dagre graph.
140
- */
141
- export declare type GraphDagreLayoutSetting = {
142
- /**
143
- * Direction for rank nodes. Can be TB, BT, LR, or RL, where T = top, B = bottom, L = left, and R = right.
144
- * Additional custom values can also be provided as a string.
145
- */
146
- rankdir?: 'TB' | 'BT' | 'LR' | 'RL' | string;
147
- /**
148
- * Alignment for rank nodes. Can be UL, UR, DL, or DR, where U = up, D = down, L = left, and R = right.
149
- * Additional custom values can also be provided as a string.
150
- */
151
- align?: 'UL' | 'UR' | 'DL' | 'DR' | string;
152
- /**
153
- * Number of pixels that separate nodes horizontally in the layout.
154
- */
155
- nodesep?: number;
156
- /**
157
- * Number of pixels that separate edges horizontally in the layout.
158
- */
159
- edgesep?: number;
160
- /**
161
- * Number of pixels between each rank in the layout.
162
- */
163
- ranksep?: number;
164
- /**
165
- * Number of pixels to use as a margin around the left and right of the graph.
166
- */
167
- marginx?: number;
168
- /**
169
- * Number of pixels to use as a margin around the top and bottom of the graph.
170
- */
171
- marginy?: number;
172
- /**
173
- * If set to 'greedy', uses a greedy heuristic for finding a feedback arc set for a graph.
174
- * A feedback arc set is a set of edges that can be removed to make a graph acyclic.
175
- */
176
- acyclicer?: 'greedy' | undefined;
177
- /**
178
- * Type of algorithm to assign a rank to each node in the input graph.
179
- * Possible values are 'network-simplex', 'tight-tree', or 'longest-path'.
180
- * Additional custom values can also be provided as a string.
181
- */
182
- ranker?: 'network-simplex' | 'tight-tree' | 'longest-path' | string;
183
- };
@@ -7,7 +7,6 @@ var GraphLayoutType;
7
7
  GraphLayoutType["Dagre"] = "dagre";
8
8
  GraphLayoutType["Force"] = "force";
9
9
  GraphLayoutType["Elk"] = "elk";
10
- GraphLayoutType["Precalculated"] = "precalculated";
11
10
  })(GraphLayoutType || (GraphLayoutType = {}));
12
11
  var GraphLinkStyle;
13
12
  (function (GraphLinkStyle) {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../src/components/graph/types.ts"],"sourcesContent":["// Types\nimport { Position } from 'types/position'\nimport { GraphInputLink, GraphInputNode, GraphNodeCore, GraphLinkCore } from 'types/graph'\nimport { Spacing } from 'types/spacing'\n\nexport type GraphNode<\n N extends GraphInputNode = GraphInputNode,\n L extends GraphInputLink = GraphInputLink,\n> = GraphNodeCore<N, L> & {\n x?: number;\n y?: number;\n\n _id?: number | string;\n _index?: number;\n _state?: {\n isDragged?: boolean;\n fx?: number;\n fy?: number;\n selected?: boolean;\n greyout?: boolean;\n };\n\n _panels?: GraphPanel<N, L>[];\n _isConnected?: boolean;\n}\n\nexport type GraphForceSimulationNode<\n N extends GraphInputNode = GraphInputNode,\n L extends GraphInputLink = GraphInputLink,\n> = GraphNode<N, L> & {\n fx?: number;\n fy?: number;\n}\n\nexport type GraphLink<\n N extends GraphInputNode = GraphInputNode,\n L extends GraphInputLink = GraphInputLink,\n> = GraphLinkCore<N, L> & {\n id?: number | string;\n source: number | string | GraphNode<N>;\n target: number | string | GraphNode<N>;\n\n _id?: number | string;\n _direction?: number;\n _index?: number;\n _neighbours?: number;\n\n _state?: {\n flowAnimTime?: number;\n hovered?: boolean;\n selected?: boolean;\n greyout?: boolean;\n };\n}\n\nexport enum GraphLayoutType {\n Circular = 'circular',\n Concentric = 'concentric',\n Parallel = 'parallel',\n ParallelHorizontal = 'parallel horizontal',\n Dagre = 'dagre',\n Force = 'force',\n Elk = 'elk',\n Precalculated = 'precalculated',\n}\n\nexport type GraphCircleLabel = {\n text: string;\n textColor?: string | null;\n color?: string | null;\n cursor?: string | null;\n fontSize?: string | null;\n radius?: number;\n}\n\nexport type GraphLinkLabel = GraphCircleLabel\n\nexport enum GraphLinkStyle {\n Dashed = 'dashed',\n Solid = 'solid',\n}\n\nexport enum GraphLinkArrowStyle {\n Single = 'single',\n Double = 'double',\n}\n\nexport enum GraphNodeShape {\n Circle = 'circle',\n Square = 'square',\n Hexagon = 'hexagon',\n Triangle = 'triangle',\n}\n\nexport type GraphPanelConfig = {\n /** Panel nodes references by unique ids */\n nodes: (string|number)[];\n /** Panel label */\n label?: string;\n /** Position of the label */\n labelPosition?: Position.Top | Position.Bottom | string;\n /** Color of the panel's border */\n borderColor?: string;\n /** Border width of the panel in pixels */\n borderWidth?: number;\n /** Inner padding */\n padding?: number | Spacing;\n /** Dashed outline showing that the panel is selected */\n dashedOutline?: boolean;\n /** Side icon symbol */\n sideIconSymbol?: string;\n /** Size of the icon as a CSS string. e.g.: `12pt` or `12px` */\n sideIconFontSize?: string;\n /** Color of the icon */\n sideIconSymbolColor?: string;\n /** Shape of the icon's background */\n sideIconShape?: GraphNodeShape | string;\n /** Size of the icon's background shape */\n sideIconShapeSize?: number;\n /** Stroke color of the icon's background shape */\n sideIconShapeStroke?: string;\n /** Cursor, when hovering over the icon */\n sideIconCursor?: string;\n}\n\nexport type GraphPanel<\n N extends GraphInputNode = GraphInputNode,\n L extends GraphInputLink = GraphInputLink,\n> = GraphPanelConfig & {\n _numNodes?: number;\n _x?: number;\n _y?: number;\n _width?: number;\n _height?: number;\n _disabled?: boolean;\n _padding?: Spacing;\n}\n\nexport type GraphNodeAnimationState = {\n endAngle: number;\n nodeIndex: number;\n nodeSize?: number;\n borderWidth?: number;\n}\n\nexport type GraphNodeAnimatedElement<T = SVGElement> = T & {\n _animState: GraphNodeAnimationState;\n}\n\nexport type GraphForceLayoutSettings<\n N extends GraphInputNode = GraphInputNode,\n L extends GraphInputLink = GraphInputLink,\n> = {\n /** Preferred Link Distance. Default: `60` */\n linkDistance?: number | ((l: GraphLink<N, L>, i: number) => number);\n /** Link Strength [0:1]. Default: `0.45` */\n linkStrength?: number | ((l: GraphLink<N, L>, i: number) => number);\n /** Charge Force (<0 repulsion, >0 attraction). Default: `-500` */\n charge?: number | ((l: GraphNode<N, L>, i: number) => number);\n /** X-centring force. Default: `0.15` */\n forceXStrength?: number;\n /** Y-centring force. Default: `0.25` */\n forceYStrength?: number;\n /** Number if simulation iterations. Default: automatic */\n numIterations?: number;\n /** Set to true if you want to fix the node positions after the simulation\n * Helpful when you want to update graph settings without re-calculating the layout.\n * Default: `false` */\n fixNodePositionAfterSimulation?: boolean;\n}\n\nexport type GraphElkLayoutSettings = Record<string, string>\n\n/**\n * Settings for configuring the layout of a Dagre graph.\n */\nexport type GraphDagreLayoutSetting = {\n /**\n * Direction for rank nodes. Can be TB, BT, LR, or RL, where T = top, B = bottom, L = left, and R = right.\n * Additional custom values can also be provided as a string.\n */\n rankdir?: 'TB' | 'BT' | 'LR' | 'RL' | string;\n\n /**\n * Alignment for rank nodes. Can be UL, UR, DL, or DR, where U = up, D = down, L = left, and R = right.\n * Additional custom values can also be provided as a string.\n */\n align?: 'UL' | 'UR' | 'DL' | 'DR' | string;\n\n /**\n * Number of pixels that separate nodes horizontally in the layout.\n */\n nodesep?: number;\n\n /**\n * Number of pixels that separate edges horizontally in the layout.\n */\n edgesep?: number;\n\n /**\n * Number of pixels between each rank in the layout.\n */\n ranksep?: number;\n\n /**\n * Number of pixels to use as a margin around the left and right of the graph.\n */\n marginx?: number;\n\n /**\n * Number of pixels to use as a margin around the top and bottom of the graph.\n */\n marginy?: number;\n\n /**\n * If set to 'greedy', uses a greedy heuristic for finding a feedback arc set for a graph.\n * A feedback arc set is a set of edges that can be removed to make a graph acyclic.\n */\n acyclicer?: 'greedy' | undefined;\n\n /**\n * Type of algorithm to assign a rank to each node in the input graph.\n * Possible values are 'network-simplex', 'tight-tree', or 'longest-path'.\n * Additional custom values can also be provided as a string.\n */\n ranker?: 'network-simplex' | 'tight-tree' | 'longest-path' | string;\n}\n\n"],"names":[],"mappings":"IAuDY,gBASX;AATD,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,eAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,eAAA,CAAA,oBAAA,CAAA,GAAA,qBAA0C,CAAA;AAC1C,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,eAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,eAAA,CAAA,eAAA,CAAA,GAAA,eAA+B,CAAA;AACjC,CAAC,EATW,eAAe,KAAf,eAAe,GAS1B,EAAA,CAAA,CAAA,CAAA;IAaW,eAGX;AAHD,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,cAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EAHW,cAAc,KAAd,cAAc,GAGzB,EAAA,CAAA,CAAA,CAAA;IAEW,oBAGX;AAHD,CAAA,UAAY,mBAAmB,EAAA;AAC7B,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACnB,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,GAG9B,EAAA,CAAA,CAAA,CAAA;IAEW,eAKX;AALD,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EALW,cAAc,KAAd,cAAc,GAKzB,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"types.js","sources":["../../../src/components/graph/types.ts"],"sourcesContent":["// Types\nimport { Position } from 'types/position'\nimport { GraphInputLink, GraphInputNode, GraphNodeCore, GraphLinkCore } from 'types/graph'\nimport { Spacing } from 'types/spacing'\n\nexport type GraphNode<\n N extends GraphInputNode = GraphInputNode,\n L extends GraphInputLink = GraphInputLink,\n> = GraphNodeCore<N, L> & {\n x?: number;\n y?: number;\n\n _id?: number | string;\n _index?: number;\n _state?: {\n isDragged?: boolean;\n fx?: number;\n fy?: number;\n selected?: boolean;\n greyout?: boolean;\n };\n\n _panels?: GraphPanel<N, L>[];\n _isConnected?: boolean;\n}\n\nexport type GraphLink<\n N extends GraphInputNode = GraphInputNode,\n L extends GraphInputLink = GraphInputLink,\n> = GraphLinkCore<N, L> & {\n id?: number | string;\n source: number | string | GraphNode<N>;\n target: number | string | GraphNode<N>;\n\n _id?: number | string;\n _direction?: number;\n _index?: number;\n _neighbours?: number;\n\n _state?: {\n flowAnimTime?: number;\n hovered?: boolean;\n selected?: boolean;\n greyout?: boolean;\n };\n}\n\nexport enum GraphLayoutType {\n Circular = 'circular',\n Concentric = 'concentric',\n Parallel = 'parallel',\n ParallelHorizontal = 'parallel horizontal',\n Dagre = 'dagre',\n Force = 'force',\n Elk = 'elk',\n}\n\nexport type GraphCircleLabel = {\n text: string;\n textColor?: string | null;\n color?: string | null;\n cursor?: string | null;\n fontSize?: string | null;\n radius?: number;\n}\n\nexport enum GraphLinkStyle {\n Dashed = 'dashed',\n Solid = 'solid',\n}\n\nexport enum GraphLinkArrowStyle {\n Single = 'single',\n Double = 'double',\n}\n\nexport enum GraphNodeShape {\n Circle = 'circle',\n Square = 'square',\n Hexagon = 'hexagon',\n Triangle = 'triangle',\n}\n\nexport type GraphPanelConfig = {\n /** Panel nodes references by unique ids */\n nodes: (string|number)[];\n /** Panel label */\n label?: string;\n /** Position of the label */\n labelPosition?: Position.Top | Position.Bottom | string;\n /** Color of the panel's border */\n borderColor?: string;\n /** Border width of the panel in pixels */\n borderWidth?: number;\n /** Inner padding */\n padding?: number | Spacing;\n /** Dashed outline showing that the panel is selected */\n dashedOutline?: boolean;\n /** Side icon symbol */\n sideIconSymbol?: string;\n /** Size of the icon as a CSS string. e.g.: `12pt` or `12px` */\n sideIconFontSize?: string;\n /** Color of the icon */\n sideIconSymbolColor?: string;\n /** Shape of the icon's background */\n sideIconShape?: GraphNodeShape | string;\n /** Size of the icon's background shape */\n sideIconShapeSize?: number;\n /** Stroke color of the icon's background shape */\n sideIconShapeStroke?: string;\n /** Cursor, when hovering over the icon */\n sideIconCursor?: string;\n}\n\nexport type GraphPanel<\n N extends GraphInputNode = GraphInputNode,\n L extends GraphInputLink = GraphInputLink,\n> = GraphPanelConfig & {\n _numNodes?: number;\n _x?: number;\n _y?: number;\n _width?: number;\n _height?: number;\n _disabled?: boolean;\n _padding?: Spacing;\n}\n\nexport type GraphNodeAnimationState = {\n endAngle: number;\n nodeIndex: number;\n nodeSize?: number;\n borderWidth?: number;\n}\n\nexport type GraphNodeAnimatedElement<T = SVGElement> = T & {\n _animState: GraphNodeAnimationState;\n}\n\nexport type GraphForceLayoutSettings = {\n /** Preferred Link Distance. Default: `60` */\n linkDistance?: number;\n /** Link Strength [0:1]. Default: `0.45` */\n linkStrength?: number;\n /** Charge Force (<0 repulsion, >0 attraction). Default: `-500` */\n charge?: number;\n /** X-centring force. Default: `0.15` */\n forceXStrength?: number;\n /** Y-centring force. Default: `0.25` */\n forceYStrength?: number;\n}\n\nexport type GraphElkLayoutSettings = Record<string, string>\n"],"names":[],"mappings":"IA+CY,gBAQX;AARD,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,eAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,eAAA,CAAA,oBAAA,CAAA,GAAA,qBAA0C,CAAA;AAC1C,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,eAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACb,CAAC,EARW,eAAe,KAAf,eAAe,GAQ1B,EAAA,CAAA,CAAA,CAAA;IAWW,eAGX;AAHD,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,cAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EAHW,cAAc,KAAd,cAAc,GAGzB,EAAA,CAAA,CAAA,CAAA;IAEW,oBAGX;AAHD,CAAA,UAAY,mBAAmB,EAAA;AAC7B,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACnB,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,GAG9B,EAAA,CAAA,CAAA,CAAA;IAEW,eAKX;AALD,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,cAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EALW,cAAc,KAAd,cAAc,GAKzB,EAAA,CAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/stacked-bar/index.ts"],"sourcesContent":["import { min, max } from 'd3-array'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { isNumber, isArray, isEmpty, clamp, getStackedExtent, getString, getNumber, getStackedData, getExtent } from 'utils/data'\nimport { roundedRectPath } from 'utils/path'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { ContinuousScale } from 'types/scale'\nimport { NumericAccessor } from 'types/accessor'\nimport { Spacing } from 'types/spacing'\nimport { Orientation } from 'types/position'\n\n// Local Types\nimport { StackedBarDataRecord } from './types'\n\n// Config\nimport { StackedBarDefaultConfig, StackedBarConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class StackedBar<Datum> extends XYComponentCore<Datum, StackedBarConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = StackedBarDefaultConfig as StackedBarConfigInterface<Datum>\n public config: StackedBarConfigInterface<Datum> = this._defaultConfig\n\n getAccessors = (): NumericAccessor<Datum>[] => (isArray(this.config.y) ? this.config.y : [this.config.y])\n stacked = true\n events = {}\n private _prevNegative: boolean[] | undefined // To help guessing the bar direction when an accessor was set to null or 0\n private _barData: Datum[] = []\n\n constructor (config?: StackedBarConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n }\n\n get bleed (): Spacing {\n this._barData = this._getVisibleData()\n if (this._barData.length === 0) return { top: 0, bottom: 0, left: 0, right: 0 }\n\n // By default, horizontal orientation is \"flipped\", i.e. the `yDirection` of `XYContainer` is set to `Direction.North`\n const isHorizontalAndFlipped = !this.isVertical() && (this.dataScale.range()[0] > this.dataScale.range()[1])\n const dataDomain = this.dataScale.domain()\n const halfGroupWidth = this._getBarWidth() / 2\n\n const dataScaleValues = this._barData.map((d, i) => getNumber(d, this.config.x, i))\n const firstDataValue = min(dataScaleValues)\n const lastDataValue = max(dataScaleValues)\n const firstValuePx = this.dataScale(firstDataValue)\n const lastValuePx = this.dataScale(lastDataValue)\n\n const dataDomainRequiredStart = this.dataScale.invert(firstValuePx + (isHorizontalAndFlipped ? halfGroupWidth : -halfGroupWidth))\n const dataDomainRequiredEnd = this.dataScale.invert(lastValuePx + (isHorizontalAndFlipped ? -halfGroupWidth : halfGroupWidth))\n const bleedPxStart = dataDomainRequiredStart <= dataDomain[0] ? this.dataScale(dataDomain[0]) - this.dataScale(dataDomainRequiredStart) : 0\n const bleedPxEnd = dataDomainRequiredEnd > dataDomain[1] ? this.dataScale(dataDomainRequiredEnd) - this.dataScale(dataDomain[1]) : 0\n\n return {\n top: this.isVertical() ? 0 : (isHorizontalAndFlipped ? -bleedPxEnd : bleedPxStart),\n bottom: this.isVertical() ? 0 : (isHorizontalAndFlipped ? -bleedPxStart : bleedPxEnd),\n left: this.isVertical() ? bleedPxStart : 0,\n right: this.isVertical() ? bleedPxEnd : 0,\n }\n }\n\n private get dataScale (): ContinuousScale {\n return this.isVertical() ? this.xScale : this.yScale\n }\n\n private get valueScale (): ContinuousScale {\n return this.isVertical() ? this.yScale : this.xScale\n }\n\n private isVertical (): boolean {\n return this.config.orientation === Orientation.Vertical\n }\n\n _render (customDuration?: number): void {\n const { config } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n const yAccessors = this.getAccessors()\n const stacked = getStackedData(this._barData, 0, yAccessors, this._prevNegative)\n this._prevNegative = stacked.map(s => !!s.negative)\n\n const barGroups = this.g\n .selectAll<SVGGElement, Datum>(`.${s.barGroup}`)\n .data(this._barData, (d, i) => `${getString(d, config.id, i) ?? i}`)\n\n const getBarGroupsTransform = (d: Datum, i: number): string => {\n const v = this.dataScale(getNumber(d, config.x, i))\n const x = this.isVertical() ? v : 0\n const y = this.isVertical() ? 0 : v\n return `translate(${x},${y})`\n }\n\n const barGroupsEnter = barGroups.enter().append('g')\n .attr('class', s.barGroup)\n .attr('transform', getBarGroupsTransform)\n .style('opacity', 1)\n\n const barGroupsMerged = barGroupsEnter.merge(barGroups)\n smartTransition(barGroupsMerged, duration)\n .attr('transform', getBarGroupsTransform)\n .style('opacity', 1)\n\n const barGroupExit = barGroups.exit()\n .attr('class', s.barGroupExit)\n\n smartTransition(barGroupExit, duration)\n .style('opacity', 0)\n .remove()\n\n // Animate bars from exiting groups going down\n smartTransition(barGroupExit.selectAll(`.${s.bar}`), duration)\n .attr('transform', this.isVertical()\n ? `translate(0,${this._height / 3})`\n : `translate(${this._width / 6},0)`\n )\n\n // Render Bars\n const bars = barGroupsMerged\n .selectAll<SVGPathElement, StackedBarDataRecord<Datum>>(`.${s.bar}`)\n .data((d, j) => stacked.map((s) =>\n ({ ...d, _stacked: s[j], _negative: s.negative, _ending: s.ending }))\n )\n\n const barsEnter = bars.enter().append('path')\n .attr('class', s.bar)\n .attr('d', (d, j) => this._getBarPath(d, j, true))\n .style('fill', (d, j) => getColor(d, config.color, j))\n\n const barsMerged = barsEnter.merge(bars)\n\n smartTransition(barsMerged, duration)\n .attr('d', (d, j) => this._getBarPath(d, j))\n .style('fill', (d, j) => getColor(d, config.color, j))\n .style('cursor', (d, j) => getString(d, config.cursor, j))\n\n smartTransition(bars.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n\n _getBarWidth (): number {\n const { config, datamodel: { data } } = this\n if (isEmpty(data)) return 0\n if (config.barWidth) return min([config.barWidth, config.barMaxWidth])\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const isOrdinal = this.dataScale.bandwidth\n const domain = (this.dataScale.domain ? this.dataScale.domain() : []) as number[]\n const domainLength = isOrdinal ? domain.length : domain[1] - domain[0]\n\n // If the dataStep property is provided the amount of data elements is calculates as domainLength / dataStep\n // otherwise we get the number of data elements within the domain range\n // Or if the scale is ordinal we use data.length\n let dataSize = (1 + domainLength / config.dataStep) ||\n (!isOrdinal && data.filter((d, i) => {\n const value = getNumber(d, config.x, i)\n return (value >= domain[0]) && (value <= domain[1])\n }).length) ||\n data.length\n\n // We increase the dataSize by 1 to take into account possible additional domain space\n if (!isOrdinal && dataSize >= 2) dataSize += 1\n\n const c = dataSize < 2 ? 1 : 1 - config.barPadding\n const barWidth = c * (this.isVertical() ? this._width : this._height) / dataSize\n\n return min([barWidth, config.barMaxWidth])\n }\n\n _getVisibleData (): Datum[] {\n const { config, datamodel: { data } } = this\n\n const groupWidth = this._getBarWidth()\n const halfGroupWidthPx = data.length < 2 ? 0 : groupWidth / 2\n\n const scale = this.dataScale\n const halfGroupWidth = Math.abs((scale.invert(halfGroupWidthPx) as number) - (scale.invert(0) as number))\n const filtered = data?.filter((d, i) => {\n const v = getNumber(d, config.x, i)\n const domain: number[] | Date[] = scale.domain()\n const domainMin = +domain[0]\n const domainMax = +domain[1]\n return (v >= (domainMin - halfGroupWidth)) && (v <= (domainMax + halfGroupWidth))\n })\n\n return filtered\n }\n\n _getBarPath (d: StackedBarDataRecord<Datum>, accessorIndex: number, isEntering = false): string {\n const { config } = this\n const yAccessors = this.getAccessors()\n const barWidth = this._getBarWidth()\n\n const isNegative = d._negative\n const isEnding = d._ending // The most top bar or, if the value is negative, the most bottom bar\n // Todo: Find a way to pass the datum index to `getNumber` below\n const value = getNumber(d, yAccessors[accessorIndex])\n\n const height = isEntering ? 0 : Math.abs(this.valueScale(d._stacked[0]) - this.valueScale(d._stacked[1]))\n const h = !isEntering && config.barMinHeight1Px && (height < 1) && isFinite(value) && (value !== config.barMinHeightZeroValue) ? 1 : height\n const y = isEntering\n ? this.valueScale(0)\n : this.valueScale(isNegative ? d._stacked[0] : d._stacked[1]) - (height < 1 && config.barMinHeight1Px ? 1 : 0)\n\n const x = -barWidth / 2\n const width = barWidth\n\n const cornerRadius = config.roundedCorners\n ? isNumber(config.roundedCorners) ? +config.roundedCorners : width / 2\n : 0\n const cornerRadiusClamped = clamp(cornerRadius, 0, Math.min(height, width) / 2)\n const isNorthDirected = this.yScale.range()[0] > this.yScale.range()[1]\n\n return roundedRectPath({\n x: this.isVertical() ? x : y - h,\n y: this.isVertical() ? y + (isNorthDirected ? 0 : -h) : x,\n w: this.isVertical() ? width : h,\n h: this.isVertical() ? h : width,\n tl: isEnding && (this.isVertical()\n ? (!isNegative && isNorthDirected) || (isNegative && !isNorthDirected)\n : isNegative\n ),\n tr: isEnding && (this.isVertical()\n ? (!isNegative && isNorthDirected) || (isNegative && !isNorthDirected)\n : !isNegative\n ),\n br: isEnding && (this.isVertical()\n ? (isNegative && isNorthDirected) || (!isNegative && !isNorthDirected)\n : !isNegative\n ),\n bl: isEnding && (this.isVertical()\n ? (isNegative && isNorthDirected) || (!isNegative && !isNorthDirected)\n : isNegative\n ),\n r: cornerRadiusClamped,\n })\n }\n\n getValueScaleExtent (scaleByVisibleData: boolean): number[] {\n const { datamodel } = this\n const yAccessors = this.getAccessors()\n\n const data = scaleByVisibleData ? this._getVisibleData() : datamodel.data\n return getStackedExtent(data, ...yAccessors)\n }\n\n getDataScaleExtent (): number[] {\n const { config, datamodel } = this\n return getExtent(datamodel.data, config.x)\n }\n\n getYDataExtent (scaleByVisibleData: boolean): number[] {\n return this.isVertical() ? this.getValueScaleExtent(scaleByVisibleData) : this.getDataScaleExtent()\n }\n\n getXDataExtent (): number[] {\n return this.isVertical() ? this.getDataScaleExtent() : this.getValueScaleExtent(false)\n }\n}\n"],"names":["s.barGroup","barGroupExit","s.barGroupExit","s.bar","s"],"mappings":";;;;;;;;;;;AA0BM,MAAO,UAAkB,SAAQ,eAAwD,CAAA;AAW7F,IAAA,WAAA,CAAa,MA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IAAI,GAAG,kBAAkB,GAAG,IAAI,CAAC,eAAe,EAAE,GAAG,SAAS,CAAC,IAAI,CAAA;AACzE,QAAA,OAAO,gBAAgB,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAA;KAC7C;IAED,kBAAkB,GAAA;AAChB,QAAA,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;QAClC,OAAO,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;KAC3C;AAED,IAAA,cAAc,CAAE,kBAA2B,EAAA;QACzC,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;KACpG;IAED,cAAc,GAAA;QACZ,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAA;KACvF;;AAhPM,UAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/stacked-bar/index.ts"],"sourcesContent":["import { min, max } from 'd3-array'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { isNumber, isArray, isEmpty, clamp, getStackedExtent, getString, getNumber, getStackedData, getExtent } from 'utils/data'\nimport { roundedRectPath } from 'utils/path'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { ContinuousScale } from 'types/scale'\nimport { NumericAccessor } from 'types/accessor'\nimport { Spacing } from 'types/spacing'\nimport { Orientation } from 'types/position'\n\n// Local Types\nimport { StackedBarDataRecord } from './types'\n\n// Config\nimport { StackedBarDefaultConfig, StackedBarConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class StackedBar<Datum> extends XYComponentCore<Datum, StackedBarConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = StackedBarDefaultConfig as StackedBarConfigInterface<Datum>\n public config: StackedBarConfigInterface<Datum> = this._defaultConfig\n\n getAccessors = (): NumericAccessor<Datum>[] => (isArray(this.config.y) ? this.config.y : [this.config.y])\n stacked = true\n events = {}\n private _prevNegative: boolean[] | undefined // To help guessing the bar direction when an accessor was set to null or 0\n private _barData: Datum[] = []\n\n constructor (config?: StackedBarConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n }\n\n get bleed (): Spacing {\n this._barData = this._getVisibleData()\n if (this._barData.length === 0) return { top: 0, bottom: 0, left: 0, right: 0 }\n\n // By default, horizontal orientation is \"flipped\", i.e. the `yDirection` of `XYContainer` is set to `Direction.North`\n const isHorizontalAndFlipped = !this.isVertical() && (this.dataScale.range()[0] > this.dataScale.range()[1])\n const dataDomain = this.dataScale.domain()\n const halfGroupWidth = this._getBarWidth() / 2\n\n const dataScaleValues = this._barData.map((d, i) => getNumber(d, this.config.x, i))\n const firstDataValue = min(dataScaleValues)\n const lastDataValue = max(dataScaleValues)\n const firstValuePx = this.dataScale(firstDataValue)\n const lastValuePx = this.dataScale(lastDataValue)\n\n const dataDomainRequiredStart = this.dataScale.invert(firstValuePx + (isHorizontalAndFlipped ? halfGroupWidth : -halfGroupWidth))\n const dataDomainRequiredEnd = this.dataScale.invert(lastValuePx + (isHorizontalAndFlipped ? -halfGroupWidth : halfGroupWidth))\n const bleedPxStart = dataDomainRequiredStart <= dataDomain[0] ? this.dataScale(dataDomain[0]) - this.dataScale(dataDomainRequiredStart) : 0\n const bleedPxEnd = dataDomainRequiredEnd > dataDomain[1] ? this.dataScale(dataDomainRequiredEnd) - this.dataScale(dataDomain[1]) : 0\n\n return {\n top: this.isVertical() ? 0 : (isHorizontalAndFlipped ? -bleedPxEnd : bleedPxStart),\n bottom: this.isVertical() ? 0 : (isHorizontalAndFlipped ? -bleedPxStart : bleedPxEnd),\n left: this.isVertical() ? bleedPxStart : 0,\n right: this.isVertical() ? bleedPxEnd : 0,\n }\n }\n\n private get dataScale (): ContinuousScale {\n return this.isVertical() ? this.xScale : this.yScale\n }\n\n private get valueScale (): ContinuousScale {\n return this.isVertical() ? this.yScale : this.xScale\n }\n\n private isVertical (): boolean {\n return this.config.orientation === Orientation.Vertical\n }\n\n _render (customDuration?: number): void {\n const { config } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n const yAccessors = this.getAccessors()\n const stacked = getStackedData(this._barData, 0, yAccessors, this._prevNegative)\n this._prevNegative = stacked.map(s => !!s.negative)\n\n const barGroups = this.g\n .selectAll<SVGGElement, Datum>(`.${s.barGroup}`)\n .data(this._barData, (d, i) => `${getString(d, config.id, i) ?? i}`)\n\n const getBarGroupsTransform = (d: Datum, i: number): string => {\n const v = this.dataScale(getNumber(d, config.x, i))\n const x = this.isVertical() ? v : 0\n const y = this.isVertical() ? 0 : v\n return `translate(${x},${y})`\n }\n\n const barGroupsEnter = barGroups.enter().append('g')\n .attr('class', s.barGroup)\n .attr('transform', getBarGroupsTransform)\n .style('opacity', 1)\n\n const barGroupsMerged = barGroupsEnter.merge(barGroups)\n smartTransition(barGroupsMerged, duration)\n .attr('transform', getBarGroupsTransform)\n .style('opacity', 1)\n\n const barGroupExit = barGroups.exit()\n .attr('class', s.barGroupExit)\n\n smartTransition(barGroupExit, duration)\n .style('opacity', 0)\n .remove()\n\n // Animate bars from exiting groups going down\n smartTransition(barGroupExit.selectAll(`.${s.bar}`), duration)\n .attr('transform', this.isVertical()\n ? `translate(0,${this._height / 3})`\n : `translate(${this._width / 6},0)`\n )\n\n // Render Bars\n const bars = barGroupsMerged\n .selectAll<SVGPathElement, StackedBarDataRecord<Datum>>(`.${s.bar}`)\n .data((d, j) => stacked.map((s) =>\n ({ ...d, _stacked: s[j], _negative: s.negative, _ending: s.ending }))\n )\n\n const barsEnter = bars.enter().append('path')\n .attr('class', s.bar)\n .attr('d', (d, j) => this._getBarPath(d, j, true))\n .style('fill', (d, j) => getColor(d, config.color, j))\n\n const barsMerged = barsEnter.merge(bars)\n\n smartTransition(barsMerged, duration)\n .attr('d', (d, j) => this._getBarPath(d, j))\n .style('fill', (d, j) => getColor(d, config.color, j))\n .style('cursor', (d, j) => getString(d, config.cursor, j))\n\n smartTransition(bars.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n\n _getBarWidth (): number {\n const { config, datamodel: { data } } = this\n if (isEmpty(data)) return 0\n if (config.barWidth) return min([config.barWidth, config.barMaxWidth])\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const isOrdinal = this.dataScale.bandwidth\n const domain = (this.dataScale.domain ? this.dataScale.domain() : []) as number[]\n const domainLength = isOrdinal ? domain.length : domain[1] - domain[0]\n\n // If the dataStep property is provided the amount of data elements is calculates as domainLength / dataStep\n // otherwise we get the number of data elements within the domain range\n // Or if the scale is ordinal we use data.length\n let dataSize = (1 + domainLength / config.dataStep) ||\n (!isOrdinal && data.filter((d, i) => {\n const value = getNumber(d, config.x, i)\n return (value >= domain[0]) && (value <= domain[1])\n }).length) ||\n data.length\n\n // We increase the dataSize by 1 to take into account possible additional domain space\n if (!isOrdinal && dataSize >= 2) dataSize += 1\n\n const c = dataSize < 2 ? 1 : 1 - config.barPadding\n const barWidth = c * (this.isVertical() ? this._width : this._height) / dataSize\n\n return min([barWidth, config.barMaxWidth])\n }\n\n _getVisibleData (): Datum[] {\n const { config, datamodel: { data } } = this\n\n const groupWidth = this._getBarWidth()\n const halfGroupWidthPx = data.length < 2 ? 0 : groupWidth / 2\n\n const scale = this.dataScale\n const halfGroupWidth = Math.abs((scale.invert(halfGroupWidthPx) as number) - (scale.invert(0) as number))\n const filtered = data?.filter((d, i) => {\n const v = getNumber(d, config.x, i)\n const domain: number[] | Date[] = scale.domain()\n const domainMin = +domain[0]\n const domainMax = +domain[1]\n return (v >= (domainMin - halfGroupWidth)) && (v <= (domainMax + halfGroupWidth))\n })\n\n return filtered\n }\n\n _getBarPath (d: StackedBarDataRecord<Datum>, accessorIndex: number, isEntering = false): string {\n const { config } = this\n const yAccessors = this.getAccessors()\n const barWidth = this._getBarWidth()\n\n const isNegative = d._negative\n const isEnding = d._ending // The most top bar or, if the value is negative, the most bottom bar\n // Todo: Find a way to pass the datum index to `getNumber` below\n const value = getNumber(d, yAccessors[accessorIndex])\n const height = isEntering ? 0 : Math.abs(this.valueScale(d._stacked[0]) - this.valueScale(d._stacked[1]))\n const h = !isEntering && config.barMinHeight1Px && (height < 1) && isFinite(value) && (value !== config.barMinHeightZeroValue) ? 1 : height\n const y = isEntering\n ? this.valueScale(0)\n : this.valueScale(isNegative ? d._stacked[0] : d._stacked[1]) - (height < 1 && config.barMinHeight1Px ? 1 : 0)\n\n const x = -barWidth / 2\n const width = barWidth\n\n const cornerRadius = config.roundedCorners\n ? isNumber(config.roundedCorners) ? +config.roundedCorners : width / 2\n : 0\n const cornerRadiusClamped = clamp(cornerRadius, 0, Math.min(height, width) / 2)\n const isNorthDirected = this.yScale.range()[0] > this.yScale.range()[1]\n\n return roundedRectPath({\n x: this.isVertical() ? x : y - h,\n y: this.isVertical() ? y + (isNorthDirected ? 0 : -h) : x,\n w: this.isVertical() ? width : h,\n h: this.isVertical() ? h : width,\n tl: isEnding && (this.isVertical()\n ? (!isNegative && isNorthDirected) || (isNegative && !isNorthDirected)\n : isNegative\n ),\n tr: isEnding && (this.isVertical()\n ? (!isNegative && isNorthDirected) || (isNegative && !isNorthDirected)\n : !isNegative\n ),\n br: isEnding && (this.isVertical()\n ? (isNegative && isNorthDirected) || (!isNegative && !isNorthDirected)\n : !isNegative\n ),\n bl: isEnding && (this.isVertical()\n ? (isNegative && isNorthDirected) || (!isNegative && !isNorthDirected)\n : isNegative\n ),\n r: cornerRadiusClamped,\n })\n }\n\n getValueScaleExtent (scaleByVisibleData: boolean): number[] {\n const { datamodel } = this\n const yAccessors = this.getAccessors()\n\n const data = scaleByVisibleData ? this._getVisibleData() : datamodel.data\n return getStackedExtent(data, ...yAccessors)\n }\n\n getDataScaleExtent (): number[] {\n const { config, datamodel } = this\n return getExtent(datamodel.data, config.x)\n }\n\n getYDataExtent (scaleByVisibleData: boolean): number[] {\n return this.isVertical() ? this.getValueScaleExtent(scaleByVisibleData) : this.getDataScaleExtent()\n }\n\n getXDataExtent (): number[] {\n return this.isVertical() ? this.getDataScaleExtent() : this.getValueScaleExtent(false)\n }\n}\n"],"names":["s.barGroup","barGroupExit","s.barGroupExit","s.bar","s"],"mappings":";;;;;;;;;;;AA0BM,MAAO,UAAkB,SAAQ,eAAwD,CAAA;AAW7F,IAAA,WAAA,CAAa,MAAyC,EAAA;AACpD,QAAA,KAAK,EAAE,CAAA;QAVC,IAAc,CAAA,cAAA,GAAG,uBAA2D,CAAA;AAC/E,QAAA,IAAA,CAAA,MAAM,GAAqC,IAAI,CAAC,cAAc,CAAA;AAErE,QAAA,IAAA,CAAA,YAAY,GAAG,OAAiC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QACzG,IAAO,CAAA,OAAA,GAAG,IAAI,CAAA;QACd,IAAM,CAAA,MAAA,GAAG,EAAE,CAAA;QAEH,IAAQ,CAAA,QAAA,GAAY,EAAE,CAAA;AAI5B,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;KACnC;AAED,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;AACtC,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;;AAG/E,QAAA,MAAM,sBAAsB,GAAG,CAAC,IAAI,CAAC,UAAU,EAA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EAAE;AAChC,kBAAE,CAAC,UAAU,IAAI,eAAe,MAAM,CAAC,UAAU,IAAI,CAAC,eAAe,CAAC;kBACpE,UAAU,CACb;AACD,YAAA,CAAC,EAAE,mBAAmB;AACvB,SAAA,CAAC,CAAA;KACH;AAED,IAAA,mBAAmB,CAAE,kBAA2B,EAAA;AAC9C,QAAA,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;AAC1B,QAAA,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,CAAA;AAEtC,QAAA,MAAM,IAAI,GAAG,kBAAkB,GAAG,IAAI,CAAC,eAAe,EAAE,GAAG,SAAS,CAAC,IAAI,CAAA;AACzE,QAAA,OAAO,gBAAgB,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAA;KAC7C;IAED,kBAAkB,GAAA;AAChB,QAAA,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;QAClC,OAAO,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;KAC3C;AAED,IAAA,cAAc,CAAE,kBAA2B,EAAA;QACzC,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;KACpG;IAED,cAAc,GAAA;QACZ,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAA;KACvF;;AA/OM,UAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
@@ -29,7 +29,7 @@ export interface TooltipConfigInterface {
29
29
  * ```
30
30
  */
31
31
  triggers?: {
32
- [selector: string]: ((data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null) | undefined | null;
32
+ [selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;
33
33
  };
34
34
  /** Custom DOM attributes for the tooltip. Useful when you need to refer to a specific tooltip instance
35
35
  * by using a CSS selector. Attributes configuration object has the following structure:
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/components/tooltip/config.ts"],"sourcesContent":["/* eslint-disable no-irregular-whitespace */\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\nexport interface TooltipConfigInterface {\n /** An array of visualization components to interact with. Default: `[]` */\n components?: ComponentCore<unknown>[];\n /** Container to where the Tooltip component should be inserted. Default: `undefined` */\n container?: HTMLElement;\n /** Horizontal placement of the tooltip. Default: `Position.Auto` */\n horizontalPlacement?: Position | string | undefined;\n /** Horizontal shift of the tooltip in pixels. Default: `0` */\n horizontalShift?: number;\n /** Vertical placement of the tooltip. Default: `Position.Top` */\n verticalPlacement?: Position | string | undefined;\n /** Vertical shift of the tooltip in pixels. Default: `0` */\n verticalShift?: number;\n /** Defines the content of the tooltip and hovering over which elements should trigger it.\n * An object containing properties in the following format:\n *\n * ```\n * {\n *  [selectorString]: (d: unknown) => string | HTMLElement\n * }\n * ```\n * e.g.:\n * ```\n * {\n *  [Area.selectors.area]: (d: AreaDatum[]) => `<div>${d.value.toString()}</div>\n * }\n * ```\n */\n triggers?: {\n [selector: string]: ((data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null) | undefined | null;\n };\n /** Custom DOM attributes for the tooltip. Useful when you need to refer to a specific tooltip instance\n * by using a CSS selector. Attributes configuration object has the following structure:\n *\n * ```\n * {\n *  [attributeName]: attribute value\n * }\n * ```\n * e.g.:\n * ```\n * {\n *  'type': 'area-tooltip',\n *  'value': 42\n * }\n * ```\n */\n attributes?: { [attr: string]: string | number | boolean };\n}\n\nexport const TooltipDefaultConfig: TooltipConfigInterface = {\n components: [],\n container: undefined,\n horizontalPlacement: Position.Auto,\n horizontalShift: 0,\n verticalPlacement: Position.Top,\n verticalShift: 0,\n attributes: {},\n triggers: {},\n}\n\n"],"names":[],"mappings":";;AAGA;AAqDa,MAAA,oBAAoB,GAA2B;AAC1D,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,SAAS,EAAE,SAAS;IACpB,mBAAmB,EAAE,QAAQ,CAAC,IAAI;AAClC,IAAA,eAAe,EAAE,CAAC;IAClB,iBAAiB,EAAE,QAAQ,CAAC,GAAG;AAC/B,IAAA,aAAa,EAAE,CAAC;AAChB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,QAAQ,EAAE,EAAE;;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/components/tooltip/config.ts"],"sourcesContent":["/* eslint-disable no-irregular-whitespace */\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\nexport interface TooltipConfigInterface {\n /** An array of visualization components to interact with. Default: `[]` */\n components?: ComponentCore<unknown>[];\n /** Container to where the Tooltip component should be inserted. Default: `undefined` */\n container?: HTMLElement;\n /** Horizontal placement of the tooltip. Default: `Position.Auto` */\n horizontalPlacement?: Position | string | undefined;\n /** Horizontal shift of the tooltip in pixels. Default: `0` */\n horizontalShift?: number;\n /** Vertical placement of the tooltip. Default: `Position.Top` */\n verticalPlacement?: Position | string | undefined;\n /** Vertical shift of the tooltip in pixels. Default: `0` */\n verticalShift?: number;\n /** Defines the content of the tooltip and hovering over which elements should trigger it.\n * An object containing properties in the following format:\n *\n * ```\n * {\n *  [selectorString]: (d: unknown) => string | HTMLElement\n * }\n * ```\n * e.g.:\n * ```\n * {\n *  [Area.selectors.area]: (d: AreaDatum[]) => `<div>${d.value.toString()}</div>\n * }\n * ```\n */\n triggers?: {\n [selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;\n };\n /** Custom DOM attributes for the tooltip. Useful when you need to refer to a specific tooltip instance\n * by using a CSS selector. Attributes configuration object has the following structure:\n *\n * ```\n * {\n *  [attributeName]: attribute value\n * }\n * ```\n * e.g.:\n * ```\n * {\n *  'type': 'area-tooltip',\n *  'value': 42\n * }\n * ```\n */\n attributes?: { [attr: string]: string | number | boolean };\n}\n\nexport const TooltipDefaultConfig: TooltipConfigInterface = {\n components: [],\n container: undefined,\n horizontalPlacement: Position.Auto,\n horizontalShift: 0,\n verticalPlacement: Position.Top,\n verticalShift: 0,\n attributes: {},\n triggers: {},\n}\n\n"],"names":[],"mappings":";;AAGA;AAqDa,MAAA,oBAAoB,GAA2B;AAC1D,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,SAAS,EAAE,SAAS;IACpB,mBAAmB,EAAE,QAAQ,CAAC,IAAI;AAClC,IAAA,eAAe,EAAE,CAAC;IAClB,iBAAiB,EAAE,QAAQ,CAAC,GAAG;AAC/B,IAAA,aAAa,EAAE,CAAC;AAChB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,QAAQ,EAAE,EAAE;;;;;"}
@@ -125,7 +125,7 @@ class Tooltip {
125
125
  var _a;
126
126
  // Tooltip position calculation relies on the parent position
127
127
  // If it's not set (static), we set it to `relative` (not a good practice)
128
- if (this._container !== document.body && ((_a = getComputedStyle(this._container)) === null || _a === void 0 ? void 0 : _a.position) === 'static') {
128
+ if (((_a = getComputedStyle(this._container)) === null || _a === void 0 ? void 0 : _a.position) === 'static') {
129
129
  this._container.style.position = 'relative';
130
130
  }
131
131
  }
@@ -144,8 +144,6 @@ class Tooltip {
144
144
  // Go through all of the configured triggers
145
145
  for (const className of Object.keys(triggers)) {
146
146
  const template = triggers[className];
147
- if (!template)
148
- continue; // Skip if the trigger is not configured
149
147
  const els = selection.selectAll(`.${className}`).nodes();
150
148
  // Go through all of the elements in the event path (from the deepest element upwards)
151
149
  for (const el of path) {
@@ -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\n constructor (config: TooltipConfigInterface = {}) {\n this.element = document.createElement('div')\n this.div = select(this.element)\n .attr('class', s.tooltip)\n\n this.setConfig(config)\n this.components = this.config.components\n }\n\n public setConfig (config: TooltipConfigInterface): void {\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\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 public show (html: string | HTMLElement, pos: { x: number; y: number }): void {\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 {\n this.div.html(html)\n }\n\n this.div\n .classed(s.hidden, false)\n .classed(s.show, true)\n\n this._isShown = true\n this.place(pos)\n }\n\n public hide (): void {\n this.div.classed(s.show, false)\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 public place (pos: { x: number; y: number }): void {\n if (!this.hasContainer()) {\n console.warn('Unovis | Tooltip: Container was not set or is not initialized yet')\n return\n }\n const { config } = this\n const isContainerBody = this.isContainerBody()\n const width = this.element.offsetWidth\n const height = this.element.offsetHeight\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n\n const horizontalPlacement = config.horizontalPlacement === Position.Auto\n ? (pos.x > containerWidth / 2 ? Position.Left : Position.Right)\n : config.horizontalPlacement\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? (pos.y > containerHeight / 2 ? Position.Top : Position.Bottom)\n : config.verticalPlacement\n\n // dx and dy variables shift the tooltip from the default position (above the cursor, centred horizontally)\n const margin = 5\n const dx = horizontalPlacement === Position.Left ? -width - margin - config.horizontalShift\n : horizontalPlacement === Position.Center ? -width / 2\n : margin + config.horizontalShift\n const dy = verticalPlacement === Position.Bottom ? height + margin + config.verticalShift\n : verticalPlacement === Position.Center ? height / 2\n : -margin - config.verticalShift\n\n // Constraint to container\n const paddingX = 10\n const hitRight = pos.x > (containerWidth - width - dx - paddingX)\n const hitLeft = pos.x < -dx + paddingX\n const constraintX = hitRight ? (containerWidth - width - dx) - pos.x - paddingX\n : hitLeft ? -dx - pos.x + paddingX : 0\n\n const paddingY = 10\n const hitBottom = pos.y > (containerHeight - dy - paddingY)\n const hitTop = pos.y < (height - dy + paddingY)\n const constraintY = hitBottom ? containerHeight - dy - pos.y - paddingY\n : hitTop ? height - dy - pos.y + paddingY : 0\n\n // Placing\n // If the container size is smaller than the the tooltip size we just stick the tooltip to the top / left\n const x = containerWidth < width ? 0 : pos.x + constraintX + dx\n const y = containerHeight < height ? height : pos.y + constraintY + dy\n\n this.div\n .classed(s.positionFixed, isContainerBody)\n .style('top', isContainerBody ? `${y - height}px` : 'unset')\n .style('bottom', !isContainerBody ? `${containerHeight - y}px` : 'unset')\n .style('left', `${x}px`)\n }\n\n public isContainerBody (): boolean {\n return this._container === document.body\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: { triggers } } = this\n const isContainerBody = this.isContainerBody()\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 [x, y] = isContainerBody ? [e.clientX, e.clientY] : pointer(e, this._container)\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(triggers)) {\n const template = 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 if (content) this.show(content, { x, y })\n else this.hide()\n\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n return // Stop looking for other matches\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\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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C,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,CAAA,EAAA,GAAA,IAAI,CAAC,GAAG,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAM,EAAE,CAAA;KACnB;;AA9MM,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\n constructor (config: TooltipConfigInterface = {}) {\n this.element = document.createElement('div')\n this.div = select(this.element)\n .attr('class', s.tooltip)\n\n this.setConfig(config)\n this.components = this.config.components\n }\n\n public setConfig (config: TooltipConfigInterface): void {\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\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 public show (html: string | HTMLElement, pos: { x: number; y: number }): void {\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 {\n this.div.html(html)\n }\n\n this.div\n .classed(s.hidden, false)\n .classed(s.show, true)\n\n this._isShown = true\n this.place(pos)\n }\n\n public hide (): void {\n this.div.classed(s.show, false)\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 public place (pos: { x: number; y: number }): void {\n if (!this.hasContainer()) {\n console.warn('Unovis | Tooltip: Container was not set or is not initialized yet')\n return\n }\n const { config } = this\n const isContainerBody = this.isContainerBody()\n const width = this.element.offsetWidth\n const height = this.element.offsetHeight\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n\n const horizontalPlacement = config.horizontalPlacement === Position.Auto\n ? (pos.x > containerWidth / 2 ? Position.Left : Position.Right)\n : config.horizontalPlacement\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? (pos.y > containerHeight / 2 ? Position.Top : Position.Bottom)\n : config.verticalPlacement\n\n // dx and dy variables shift the tooltip from the default position (above the cursor, centred horizontally)\n const margin = 5\n const dx = horizontalPlacement === Position.Left ? -width - margin - config.horizontalShift\n : horizontalPlacement === Position.Center ? -width / 2\n : margin + config.horizontalShift\n const dy = verticalPlacement === Position.Bottom ? height + margin + config.verticalShift\n : verticalPlacement === Position.Center ? height / 2\n : -margin - config.verticalShift\n\n // Constraint to container\n const paddingX = 10\n const hitRight = pos.x > (containerWidth - width - dx - paddingX)\n const hitLeft = pos.x < -dx + paddingX\n const constraintX = hitRight ? (containerWidth - width - dx) - pos.x - paddingX\n : hitLeft ? -dx - pos.x + paddingX : 0\n\n const paddingY = 10\n const hitBottom = pos.y > (containerHeight - dy - paddingY)\n const hitTop = pos.y < (height - dy + paddingY)\n const constraintY = hitBottom ? containerHeight - dy - pos.y - paddingY\n : hitTop ? height - dy - pos.y + paddingY : 0\n\n // Placing\n // If the container size is smaller than the the tooltip size we just stick the tooltip to the top / left\n const x = containerWidth < width ? 0 : pos.x + constraintX + dx\n const y = containerHeight < height ? height : pos.y + constraintY + dy\n\n this.div\n .classed(s.positionFixed, isContainerBody)\n .style('top', isContainerBody ? `${y - height}px` : 'unset')\n .style('bottom', !isContainerBody ? `${containerHeight - y}px` : 'unset')\n .style('left', `${x}px`)\n }\n\n public isContainerBody (): boolean {\n return this._container === document.body\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 (getComputedStyle(this._container)?.position === 'static') {\n this._container.style.position = 'relative'\n }\n }\n\n private _setUpEvents (): void {\n const { config: { triggers } } = this\n const isContainerBody = this.isContainerBody()\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 [x, y] = isContainerBody ? [e.clientX, e.clientY] : pointer(e, this._container)\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(triggers)) {\n const template = triggers[className]\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 if (content) this.show(content, { x, y })\n else this.hide()\n\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n return // Stop looking for other matches\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\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.div?.remove()\n }\n}\n"],"names":["s.tooltip","s.hidden","s.show","s.positionFixed","s"],"mappings":";;;;;;;MAiBa,OAAO,CAAA;AAalB,IAAA,WAAA,CAAa,SAAiC,EAAE,EAAA;QAVtC,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;QAItB,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,OAAS,CAAC,CAAA;AAE3B,QAAA,IAAI,CAAC,SAAS,CAAC,M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;AACF,iBAAA;;;;gBAKD,IAAI,IAAI,CAAC,QAAQ;oBAAE,IAAI,CAAC,IAAI,EAAE,CAAA;AAChC,aAAC,CAAC;AACD,iBAAA,EAAE,CAAC,oBAAoB,EAAE,CAAC,CAAa,KAAI;AAC1C,gBAAA,CAAC,CAAC,eAAe,EAAE,CAAA;gBACnB,IAAI,CAAC,IAAI,EAAE,CAAA;AACb,aAAC,CAAC,CAAA;AACN,SAAC,CAAC,CAAA;KACH;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,CAAA,EAAA,GAAA,IAAI,CAAC,GAAG,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAM,EAAE,CAAA;KACnB;;AA5MM,OAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
@@ -1,9 +1,7 @@
1
1
  import { Selection } from 'd3-selection';
2
2
  import { VisControlItemInterface } from './types';
3
3
  import { VisControlsConfigInterface } from './config';
4
- import * as s from './style';
5
4
  export declare class VisControls {
6
- static selectors: typeof s;
7
5
  div: Selection<HTMLDivElement, unknown, null, undefined>;
8
6
  element: HTMLDivElement;
9
7
  protected _defaultConfig: VisControlsConfigInterface;
@@ -14,5 +12,4 @@ export declare class VisControls {
14
12
  update(config: VisControlsConfigInterface): void;
15
13
  render(): void;
16
14
  _onItemClick(event: MouseEvent, item: VisControlItemInterface): void;
17
- destroy(): void;
18
15
  }
@@ -2,7 +2,6 @@ import { select } from 'd3-selection';
2
2
  import { merge } from '../../utils/data.js';
3
3
  import { VisControlsOrientation } from './types.js';
4
4
  import { VisControlsDefaultConfig } from './config.js';
5
- import * as style from './style.js';
6
5
  import { root, items, horizontalItems, item, itemButton, borderLeft, borderTop, borderRight, borderBottom, disabled } from './style.js';
7
6
 
8
7
  class VisControls {
@@ -50,11 +49,7 @@ class VisControls {
50
49
  var _a;
51
50
  (_a = item.callback) === null || _a === void 0 ? void 0 : _a.call(item, event);
52
51
  }
53
- destroy() {
54
- this.div.remove();
55
- }
56
- }
57
- VisControls.selectors = style;
52
+ }
58
53
 
59
54
  export { VisControls };
60
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/vis-controls/index.ts"],"sourcesContent":["import { Selection, select } from 'd3-selection'\n\n// Utils\nimport { merge } from 'utils/data'\n\n// Local Types\nimport { VisControlItemInterface, VisControlsOrientation } from './types'\n\n// Config\nimport { VisControlsDefaultConfig, VisControlsConfigInterface } from './config'\n\n// Style\nimport * as s from './style'\n\nexport class VisControls {\n static selectors = s\n div: Selection<HTMLDivElement, unknown, null, undefined>\n element: HTMLDivElement\n protected _defaultConfig = VisControlsDefaultConfig as VisControlsConfigInterface\n public config: VisControlsConfigInterface = this._defaultConfig\n\n protected _container: HTMLElement\n protected _items: Selection<HTMLDivElement, unknown, null, undefined>\n\n constructor (element: HTMLElement, config?: VisControlsConfigInterface) {\n this._container = element\n\n this.div = select(this._container)\n .append('div')\n .attr('class', s.root)\n this.element = this.div.node()\n this._items = this.div.append('div')\n .attr('class', s.items)\n\n if (config) this.update(config)\n }\n\n update (config: VisControlsConfigInterface): void {\n this.config = merge(this._defaultConfig, config)\n this.render()\n }\n\n render (): void {\n const { config: { items, orientation } } = this\n this._items\n .classed(s.horizontalItems, orientation === VisControlsOrientation.Horizontal)\n const controlItems = this._items.selectAll<HTMLDivElement, VisControlItemInterface>(`.${s.item}`)\n .data(items)\n\n const controlItemsEnter = controlItems.enter()\n .append('div')\n .attr('class', s.item)\n .on('click', this._onItemClick.bind(this))\n\n controlItemsEnter.append('button')\n .attr('class', s.itemButton)\n\n const controlItemsMerged = controlItemsEnter.merge(controlItems)\n controlItemsMerged\n .classed(s.borderLeft, d => d.borderLeft)\n .classed(s.borderTop, d => d.borderTop)\n .classed(s.borderRight, d => d.borderRight)\n .classed(s.borderBottom, d => d.borderBottom)\n .classed(s.disabled, d => d.disabled)\n controlItemsMerged.select(`.${s.itemButton}`)\n .html(item => item.icon)\n\n controlItems.exit().remove()\n }\n\n _onItemClick (event: MouseEvent, item: VisControlItemInterface): void {\n item.callback?.(event)\n }\n\n public destroy (): void {\n this.div.remove()\n }\n}\n"],"names":["s.root","s.items","s.horizontalItems","s.item","s.itemButton","s.borderLeft","s.borderTop","s.borderRight","s.borderBottom","s.disabled","s"],"mappings":";;;;;;;MAca,WAAW,CAAA;IAUtB,WAAa,CAAA,OAAoB,EAAE,MAAmC,EAAA;QAN5D,IAAc,CAAA,cAAA,GAAG,wBAAsD,CAAA;AAC1E,QAAA,IAAA,CAAA,MAAM,GAA+B,IAAI,CAAC,cAAc,CAAA;AAM7D,QAAA,IAAI,CAAC,UAAU,GAAG,OAAO,CAAA;QAEzB,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;aAC/B,MAAM,CAAC,KAAK,CAAC;AACb,aAAA,IAAI,CAAC,OAAO,EAAEA,IAAM,CAAC,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;AACjC,aAAA,IAAI,CAAC,OAAO,EAAEC,KAAO,CAAC,CAAA;AAEzB,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;KAChC;AAED,IAAA,MAAM,C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C,QAAU,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAA;QACvC,kBAAkB,CAAC,MAAM,CAAC,CAAA,CAAA,EAAIL,UAAY,EAAE,CAAC;aAC1C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;AAE1B,QAAA,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAA;KAC7B;IAED,YAAY,CAAE,KAAiB,EAAE,IAA6B,EAAA;;QAC5D,CAAA,EAAA,GAAA,IAAI,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAb,IAAI,EAAY,KAAK,CAAC,CAAA;KACvB;IAEM,OAAO,GAAA;AACZ,QAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;KAClB;;AA7DM,WAAS,CAAA,SAAA,GAAGM,KAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/vis-controls/index.ts"],"sourcesContent":["import { Selection, select } from 'd3-selection'\n\n// Utils\nimport { merge } from 'utils/data'\n\n// Local Types\nimport { VisControlItemInterface, VisControlsOrientation } from './types'\n\n// Config\nimport { VisControlsDefaultConfig, VisControlsConfigInterface } from './config'\n\n// Style\nimport * as s from './style'\n\nexport class VisControls {\n div: Selection<HTMLDivElement, unknown, null, undefined>\n element: HTMLDivElement\n protected _defaultConfig = VisControlsDefaultConfig as VisControlsConfigInterface\n public config: VisControlsConfigInterface = this._defaultConfig\n\n protected _container: HTMLElement\n protected _items: Selection<HTMLDivElement, unknown, null, undefined>\n\n constructor (element: HTMLElement, config?: VisControlsConfigInterface) {\n this._container = element\n\n this.div = select(this._container)\n .append('div')\n .attr('class', s.root)\n this.element = this.div.node()\n this._items = this.div.append('div')\n .attr('class', s.items)\n\n if (config) this.update(config)\n }\n\n update (config: VisControlsConfigInterface): void {\n this.config = merge(this._defaultConfig, config)\n this.render()\n }\n\n render (): void {\n const { config: { items, orientation } } = this\n this._items\n .classed(s.horizontalItems, orientation === VisControlsOrientation.Horizontal)\n const controlItems = this._items.selectAll<HTMLDivElement, VisControlItemInterface>(`.${s.item}`)\n .data(items)\n\n const controlItemsEnter = controlItems.enter()\n .append('div')\n .attr('class', s.item)\n .on('click', this._onItemClick.bind(this))\n\n controlItemsEnter.append('button')\n .attr('class', s.itemButton)\n\n const controlItemsMerged = controlItemsEnter.merge(controlItems)\n controlItemsMerged\n .classed(s.borderLeft, d => d.borderLeft)\n .classed(s.borderTop, d => d.borderTop)\n .classed(s.borderRight, d => d.borderRight)\n .classed(s.borderBottom, d => d.borderBottom)\n .classed(s.disabled, d => d.disabled)\n controlItemsMerged.select(`.${s.itemButton}`)\n .html(item => item.icon)\n\n controlItems.exit().remove()\n }\n\n _onItemClick (event: MouseEvent, item: VisControlItemInterface): void {\n item.callback?.(event)\n }\n}\n"],"names":["s.root","s.items","s.horizontalItems","s.item","s.itemButton","s.borderLeft","s.borderTop","s.borderRight","s.borderBottom","s.disabled"],"mappings":";;;;;;MAca,WAAW,CAAA;IAStB,WAAa,CAAA,OAAoB,EAAE,MAAmC,EAAA;QAN5D,IAAc,CAAA,cAAA,GAAG,wBAAsD,CAAA;AAC1E,QAAA,IAAA,CAAA,MAAM,GAA+B,IAAI,CAAC,cAAc,CAAA;AAM7D,QAAA,IAAI,CAAC,UAAU,GAAG,OAAO,CAAA;QAEzB,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;aAC/B,MAAM,CAAC,KAAK,CAAC;AACb,aAAA,IAAI,CAAC,OAAO,EAAEA,IAAM,CAAC,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;AACjC,aAAA,IAAI,CAAC,OAAO,EAAEC,KAAO,CA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AAC,WAAW,CAAC;AAC1C,aAAA,OAAO,CAACC,YAAc,EAAE,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC;AAC5C,aAAA,OAAO,CAACC,QAAU,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAA;QACvC,kBAAkB,CAAC,MAAM,CAAC,CAAA,CAAA,EAAIL,UAAY,EAAE,CAAC;aAC1C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;AAE1B,QAAA,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAA;KAC7B;IAED,YAAY,CAAE,KAAiB,EAAE,IAA6B,EAAA;;QAC5D,CAAA,EAAA,GAAA,IAAI,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAb,IAAI,EAAY,KAAK,CAAC,CAAA;KACvB;AACF;;;;"}
package/components.d.ts CHANGED
@@ -26,6 +26,7 @@ export { Donut } from './components/donut';
26
26
  export { FreeBrush } from './components/free-brush';
27
27
  export { XYLabels } from './components/xy-labels';
28
28
  export { NestedDonut } from './components/nested-donut';
29
+ export { Annotations } from "./components/annotations";
29
30
  export type { LineConfigInterface } from './components/line/config';
30
31
  export type { StackedBarConfigInterface } from './components/stacked-bar/config';
31
32
  export type { GroupedBarConfigInterface } from './components/grouped-bar/config';
@@ -49,3 +50,4 @@ export type { DonutConfigInterface } from './components/donut/config';
49
50
  export type { FreeBrushConfigInterface } from './components/free-brush/config';
50
51
  export type { XYLabelsConfigInterface } from './components/xy-labels/config';
51
52
  export type { NestedDonutConfigInterface } from './components/nested-donut/config';
53
+ export type { AnnotationsConfigInterface } from './components/annotations/config';
package/components.js CHANGED
@@ -24,6 +24,7 @@ export { Donut } from './components/donut/index.js';
24
24
  export { FreeBrush } from './components/free-brush/index.js';
25
25
  export { XYLabels } from './components/xy-labels/index.js';
26
26
  export { NestedDonut } from './components/nested-donut/index.js';
27
+ export { Annotations } from './components/annotations/index.js';
27
28
 
28
29
  // Core
29
30
  //# sourceMappingURL=components.js.map
package/components.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sources":["../src/components.ts"],"sourcesContent":["// Core\nexport { ComponentCore } from 'core/component'\nexport type { ComponentConfigInterface } from 'core/component/config'\nexport { XYComponentCore } from 'core/xy-component'\nexport type { XYComponentConfigInterface } from 'core/xy-component/config'\n\n// Components\nexport { Tooltip } from 'components/tooltip'\nexport { Line } from './components/line'\nexport { StackedBar } from './components/stacked-bar'\nexport { GroupedBar } from './components/grouped-bar'\nexport { Axis } from './components/axis'\nexport { Scatter } from './components/scatter'\nexport { Brush } from './components/brush'\nexport { BulletLegend } from './components/bullet-legend'\nexport { FlowLegend } from './components/flow-legend'\nexport { Crosshair } from './components/crosshair'\nexport { Timeline } from './components/timeline'\nexport { Sankey } from './components/sankey'\nexport { Area } from './components/area'\nexport { TopoJSONMap } from './components/topojson-map'\nexport { LeafletMap } from './components/leaflet-map'\nexport { MapLibreArcticDark, MapLibreArcticLight } from './components/leaflet-map/renderer/map-style'\nexport { LeafletFlowMap } from './components/leaflet-flow-map'\nexport { ChordDiagram } from './components/chord-diagram'\nexport { Graph } from './components/graph'\nexport { VisControls } from './components/vis-controls'\nexport { Donut } from './components/donut'\nexport { FreeBrush } from './components/free-brush'\nexport { XYLabels } from './components/xy-labels'\nexport { NestedDonut } from './components/nested-donut'\n\n// Config Interfaces\nexport type { LineConfigInterface } from './components/line/config'\nexport type { StackedBarConfigInterface } from './components/stacked-bar/config'\nexport type { GroupedBarConfigInterface } from './components/grouped-bar/config'\nexport type { ScatterConfigInterface } from './components/scatter/config'\nexport type { TooltipConfigInterface } from './components/tooltip/config'\nexport type { BrushConfigInterface } from './components/brush/config'\nexport type { AxisConfigInterface } from './components/axis/config'\nexport type { BulletLegendConfigInterface } from './components/bullet-legend/config'\nexport type { FlowLegendConfigInterface } from './components/flow-legend/config'\nexport type { CrosshairConfigInterface } from './components/crosshair/config'\nexport type { TimelineConfigInterface } from './components/timeline/config'\nexport type { SankeyConfigInterface } from './components/sankey/config'\nexport type { AreaConfigInterface } from './components/area/config'\nexport type { TopoJSONMapConfigInterface } from './components/topojson-map/config'\nexport type { LeafletMapConfigInterface } from './components/leaflet-map/config'\nexport type { LeafletFlowMapConfigInterface } from './components/leaflet-flow-map/config'\nexport type { ChordDiagramConfigInterface } from './components/chord-diagram/config'\nexport type { GraphConfigInterface } from './components/graph/config'\nexport type { VisControlsConfigInterface } from './components/vis-controls/config'\nexport type { DonutConfigInterface } from './components/donut/config'\nexport type { FreeBrushConfigInterface } from './components/free-brush/config'\nexport type { XYLabelsConfigInterface } from './components/xy-labels/config'\nexport type { NestedDonutConfigInterface } from './components/nested-donut/config'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA"}
1
+ {"version":3,"file":"components.js","sources":["../src/components.ts"],"sourcesContent":["// Core\nexport { ComponentCore } from 'core/component'\nexport type { ComponentConfigInterface } from 'core/component/config'\nexport { XYComponentCore } from 'core/xy-component'\nexport type { XYComponentConfigInterface } from 'core/xy-component/config'\n\n// Components\nexport { Tooltip } from 'components/tooltip'\nexport { Line } from './components/line'\nexport { StackedBar } from './components/stacked-bar'\nexport { GroupedBar } from './components/grouped-bar'\nexport { Axis } from './components/axis'\nexport { Scatter } from './components/scatter'\nexport { Brush } from './components/brush'\nexport { BulletLegend } from './components/bullet-legend'\nexport { FlowLegend } from './components/flow-legend'\nexport { Crosshair } from './components/crosshair'\nexport { Timeline } from './components/timeline'\nexport { Sankey } from './components/sankey'\nexport { Area } from './components/area'\nexport { TopoJSONMap } from './components/topojson-map'\nexport { LeafletMap } from './components/leaflet-map'\nexport { MapLibreArcticDark, MapLibreArcticLight } from './components/leaflet-map/renderer/map-style'\nexport { LeafletFlowMap } from './components/leaflet-flow-map'\nexport { ChordDiagram } from './components/chord-diagram'\nexport { Graph } from './components/graph'\nexport { VisControls } from './components/vis-controls'\nexport { Donut } from './components/donut'\nexport { FreeBrush } from './components/free-brush'\nexport { XYLabels } from './components/xy-labels'\nexport { NestedDonut } from './components/nested-donut'\nexport { Annotations } from 'components/annotations'\n\n// Config Interfaces\nexport type { LineConfigInterface } from './components/line/config'\nexport type { StackedBarConfigInterface } from './components/stacked-bar/config'\nexport type { GroupedBarConfigInterface } from './components/grouped-bar/config'\nexport type { ScatterConfigInterface } from './components/scatter/config'\nexport type { TooltipConfigInterface } from './components/tooltip/config'\nexport type { BrushConfigInterface } from './components/brush/config'\nexport type { AxisConfigInterface } from './components/axis/config'\nexport type { BulletLegendConfigInterface } from './components/bullet-legend/config'\nexport type { FlowLegendConfigInterface } from './components/flow-legend/config'\nexport type { CrosshairConfigInterface } from './components/crosshair/config'\nexport type { TimelineConfigInterface } from './components/timeline/config'\nexport type { SankeyConfigInterface } from './components/sankey/config'\nexport type { AreaConfigInterface } from './components/area/config'\nexport type { TopoJSONMapConfigInterface } from './components/topojson-map/config'\nexport type { LeafletMapConfigInterface } from './components/leaflet-map/config'\nexport type { LeafletFlowMapConfigInterface } from './components/leaflet-flow-map/config'\nexport type { ChordDiagramConfigInterface } from './components/chord-diagram/config'\nexport type { GraphConfigInterface } from './components/graph/config'\nexport type { VisControlsConfigInterface } from './components/vis-controls/config'\nexport type { DonutConfigInterface } from './components/donut/config'\nexport type { FreeBrushConfigInterface } from './components/free-brush/config'\nexport type { XYLabelsConfigInterface } from './components/xy-labels/config'\nexport type { NestedDonutConfigInterface } from './components/nested-donut/config'\nexport type { AnnotationsConfigInterface } from './components/annotations/config'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA"}
@@ -1,10 +1,13 @@
1
1
  import { ContainerConfigInterface } from "../../core/container/config";
2
2
  import { ComponentCore } from "../../core/component";
3
3
  import { Tooltip } from "../../components/tooltip";
4
+ import { Annotations } from "../../components/annotations";
4
5
  export interface SingleContainerConfigInterface<Datum> extends ContainerConfigInterface {
5
6
  /** Visualization component. Default: `undefined` */
6
7
  component?: ComponentCore<Datum>;
7
8
  /** Tooltip component. Default: `undefined` */
8
9
  tooltip?: Tooltip;
10
+ /** Annotations component. Default: `undefined` */
11
+ annotations?: Annotations | undefined;
9
12
  }
10
13
  export declare const SingleContainerDefaultConfig: SingleContainerConfigInterface<unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/containers/single-container/config.ts"],"sourcesContent":["// Core\nimport { ContainerDefaultConfig, ContainerConfigInterface } from 'core/container/config'\nimport { ComponentCore } from 'core/component'\nimport { Tooltip } from 'components/tooltip'\n\nexport interface SingleContainerConfigInterface<Datum> extends ContainerConfigInterface {\n /** Visualization component. Default: `undefined` */\n component?: ComponentCore<Datum>;\n /** Tooltip component. Default: `undefined` */\n tooltip?: Tooltip;\n}\n\nexport const SingleContainerDefaultConfig: SingleContainerConfigInterface<unknown> = {\n ...ContainerDefaultConfig,\n tooltip: undefined,\n}\n"],"names":[],"mappings":";;AAAA;AAYa,MAAA,4BAA4B,GACpC,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,sBAAsB,KACzB,OAAO,EAAE,SAAS,EAAA;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/containers/single-container/config.ts"],"sourcesContent":["// Core\nimport { ContainerDefaultConfig, ContainerConfigInterface } from 'core/container/config'\nimport { ComponentCore } from 'core/component'\nimport { Tooltip } from 'components/tooltip'\nimport { Annotations } from 'components/annotations'\n\nexport interface SingleContainerConfigInterface<Datum> extends ContainerConfigInterface {\n /** Visualization component. Default: `undefined` */\n component?: ComponentCore<Datum>;\n /** Tooltip component. Default: `undefined` */\n tooltip?: Tooltip;\n /** Annotations component. Default: `undefined` */\n annotations?: Annotations | undefined;\n}\n\nexport const SingleContainerDefaultConfig: SingleContainerConfigInterface<unknown> = {\n ...ContainerDefaultConfig,\n tooltip: undefined,\n}\n"],"names":[],"mappings":";;AAAA;AAea,MAAA,4BAA4B,GACpC,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,sBAAsB,KACzB,OAAO,EAAE,SAAS,EAAA;;;;"}