@unovis/ts 1.6.0-pre.2 → 1.6.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 (167) hide show
  1. package/components/area/index.js +2 -1
  2. package/components/area/index.js.map +1 -1
  3. package/components/axis/config.d.ts +4 -0
  4. package/components/axis/config.js +2 -2
  5. package/components/axis/config.js.map +1 -1
  6. package/components/axis/index.d.ts +0 -1
  7. package/components/axis/index.js +51 -19
  8. package/components/axis/index.js.map +1 -1
  9. package/components/axis/style.d.ts +40 -1
  10. package/components/axis/style.js +34 -35
  11. package/components/axis/style.js.map +1 -1
  12. package/components/brush/config.d.ts +1 -1
  13. package/components/brush/config.js.map +1 -1
  14. package/components/bullet-legend/config.d.ts +2 -0
  15. package/components/bullet-legend/config.js +1 -0
  16. package/components/bullet-legend/config.js.map +1 -1
  17. package/components/bullet-legend/index.js +10 -2
  18. package/components/bullet-legend/index.js.map +1 -1
  19. package/components/bullet-legend/modules/shape.d.ts +1 -0
  20. package/components/bullet-legend/modules/shape.js +61 -41
  21. package/components/bullet-legend/modules/shape.js.map +1 -1
  22. package/components/bullet-legend/types.d.ts +1 -1
  23. package/components/bullet-legend/types.js.map +1 -1
  24. package/components/crosshair/config.d.ts +20 -7
  25. package/components/crosshair/config.js +1 -1
  26. package/components/crosshair/config.js.map +1 -1
  27. package/components/crosshair/index.d.ts +8 -7
  28. package/components/crosshair/index.js +144 -72
  29. package/components/crosshair/index.js.map +1 -1
  30. package/components/graph/config.d.ts +8 -0
  31. package/components/graph/config.js +1 -1
  32. package/components/graph/config.js.map +1 -1
  33. package/components/graph/index.d.ts +1 -0
  34. package/components/graph/index.js +14 -9
  35. package/components/graph/index.js.map +1 -1
  36. package/components/graph/modules/layout.js +33 -31
  37. package/components/graph/modules/layout.js.map +1 -1
  38. package/components/graph/modules/link/index.js +1 -1
  39. package/components/graph/modules/link/index.js.map +1 -1
  40. package/components/graph/types.d.ts +2 -1
  41. package/components/graph/types.js.map +1 -1
  42. package/components/nested-donut/config.d.ts +1 -1
  43. package/components/nested-donut/config.js.map +1 -1
  44. package/components/plotband/config.d.ts +59 -0
  45. package/components/plotband/config.js +9 -0
  46. package/components/plotband/config.js.map +1 -0
  47. package/components/plotband/constants.d.ts +5 -0
  48. package/components/plotband/constants.js +413 -0
  49. package/components/plotband/constants.js.map +1 -0
  50. package/components/plotband/index.d.ts +15 -0
  51. package/components/plotband/index.js +92 -0
  52. package/components/plotband/index.js.map +1 -0
  53. package/components/plotband/style.d.ts +4 -0
  54. package/components/plotband/style.js +38 -0
  55. package/components/plotband/style.js.map +1 -0
  56. package/components/plotband/types.d.ts +51 -0
  57. package/components/plotband/types.js +27 -0
  58. package/components/plotband/types.js.map +1 -0
  59. package/components/plotline/config.d.ts +91 -0
  60. package/components/plotline/config.js +9 -0
  61. package/components/plotline/config.js.map +1 -0
  62. package/components/plotline/constants.d.ts +6 -0
  63. package/components/plotline/constants.js +58 -0
  64. package/components/plotline/constants.js.map +1 -0
  65. package/components/plotline/index.d.ts +14 -0
  66. package/components/plotline/index.js +102 -0
  67. package/components/plotline/index.js.map +1 -0
  68. package/components/plotline/style.d.ts +4 -0
  69. package/components/plotline/style.js +42 -0
  70. package/components/plotline/style.js.map +1 -0
  71. package/components/plotline/types.d.ts +53 -0
  72. package/components/plotline/types.js +33 -0
  73. package/components/plotline/types.js.map +1 -0
  74. package/components/rolling-pin-legend/config.d.ts +19 -0
  75. package/components/rolling-pin-legend/config.js +11 -0
  76. package/components/rolling-pin-legend/config.js.map +1 -0
  77. package/components/rolling-pin-legend/index.d.ts +16 -0
  78. package/components/rolling-pin-legend/index.js +69 -0
  79. package/components/rolling-pin-legend/index.js.map +1 -0
  80. package/components/rolling-pin-legend/style.d.ts +22 -0
  81. package/components/rolling-pin-legend/style.js +39 -0
  82. package/components/rolling-pin-legend/style.js.map +1 -0
  83. package/components/rolling-pin-legend/types.d.ts +1 -0
  84. package/components/rolling-pin-legend/types.js +2 -0
  85. package/components/rolling-pin-legend/types.js.map +1 -0
  86. package/components/scatter/index.d.ts +1 -0
  87. package/components/scatter/index.js +11 -1
  88. package/components/scatter/index.js.map +1 -1
  89. package/components/timeline/config.d.ts +65 -14
  90. package/components/timeline/config.js +15 -1
  91. package/components/timeline/config.js.map +1 -1
  92. package/components/timeline/constants.d.ts +3 -0
  93. package/components/timeline/constants.js +6 -0
  94. package/components/timeline/constants.js.map +1 -0
  95. package/components/timeline/index.d.ts +21 -10
  96. package/components/timeline/index.js +380 -95
  97. package/components/timeline/index.js.map +1 -1
  98. package/components/timeline/style.d.ts +7 -0
  99. package/components/timeline/style.js +40 -1
  100. package/components/timeline/style.js.map +1 -1
  101. package/components/timeline/types.d.ts +62 -0
  102. package/components/timeline/types.js +2 -0
  103. package/components/timeline/types.js.map +1 -0
  104. package/components/timeline/utils.d.ts +2 -0
  105. package/components/timeline/utils.js +16 -0
  106. package/components/timeline/utils.js.map +1 -0
  107. package/components/tooltip/index.js +4 -3
  108. package/components/tooltip/index.js.map +1 -1
  109. package/components/treemap/config.d.ts +52 -0
  110. package/components/treemap/config.js +6 -0
  111. package/components/treemap/config.js.map +1 -0
  112. package/components/treemap/index.d.ts +18 -0
  113. package/components/treemap/index.js +274 -0
  114. package/components/treemap/index.js.map +1 -0
  115. package/components/treemap/style.d.ts +25 -0
  116. package/components/treemap/style.js +69 -0
  117. package/components/treemap/style.js.map +1 -0
  118. package/components/treemap/types.d.ts +11 -0
  119. package/components/treemap/types.js +2 -0
  120. package/components/treemap/types.js.map +1 -0
  121. package/components/xy-labels/index.js +1 -1
  122. package/components/xy-labels/index.js.map +1 -1
  123. package/components.d.ts +10 -2
  124. package/components.js +4 -0
  125. package/components.js.map +1 -1
  126. package/containers/single-container/index.js +3 -1
  127. package/containers/single-container/index.js.map +1 -1
  128. package/containers/xy-container/config.d.ts +2 -0
  129. package/containers/xy-container/config.js +1 -1
  130. package/containers/xy-container/config.js.map +1 -1
  131. package/containers/xy-container/index.js +17 -7
  132. package/containers/xy-container/index.js.map +1 -1
  133. package/core/component/index.d.ts +4 -0
  134. package/core/component/index.js +6 -0
  135. package/core/component/index.js.map +1 -1
  136. package/core/xy-component/index.d.ts +1 -0
  137. package/core/xy-component/index.js +3 -1
  138. package/core/xy-component/index.js.map +1 -1
  139. package/index.js +10 -3
  140. package/index.js.map +1 -1
  141. package/package.json +2 -2
  142. package/styles/index.js +1 -0
  143. package/styles/index.js.map +1 -1
  144. package/types/data.d.ts +5 -0
  145. package/types/data.js +7 -0
  146. package/types/data.js.map +1 -1
  147. package/types/position.d.ts +2 -1
  148. package/types/position.js +1 -0
  149. package/types/position.js.map +1 -1
  150. package/types/text.d.ts +1 -1
  151. package/types/text.js.map +1 -1
  152. package/types.d.ts +5 -0
  153. package/types.js +6 -1
  154. package/types.js.map +1 -1
  155. package/utils/color.d.ts +7 -0
  156. package/utils/color.js +14 -2
  157. package/utils/color.js.map +1 -1
  158. package/utils/data.d.ts +4 -4
  159. package/utils/data.js +41 -10
  160. package/utils/data.js.map +1 -1
  161. package/utils/index.js +3 -3
  162. package/utils/path.d.ts +8 -0
  163. package/utils/path.js +109 -1
  164. package/utils/path.js.map +1 -1
  165. package/utils/text.d.ts +3 -2
  166. package/utils/text.js +22 -10
  167. package/utils/text.js.map +1 -1
@@ -0,0 +1,51 @@
1
+ export declare enum PlotbandLabelPosition {
2
+ TopLeftInside = "top-left-inside",
3
+ TopLeftOutside = "top-left-outside",
4
+ TopInside = "top-inside",
5
+ TopOutside = "top-outside",
6
+ TopRightInside = "top-right-inside",
7
+ TopRightOutside = "top-right-outside",
8
+ RightInside = "right-inside",
9
+ RightOutside = "right-outside",
10
+ BottomRightInside = "bottom-right-inside",
11
+ BottomRightOutside = "bottom-right-outside",
12
+ BottomInside = "bottom-inside",
13
+ BottomOutside = "bottom-outside",
14
+ BottomLeftInside = "bottom-left-inside",
15
+ BottomLeftOutside = "bottom-left-outside",
16
+ LeftInside = "left-inside",
17
+ LeftOutside = "left-outside"
18
+ }
19
+ export declare enum PlotbandLabelOrientation {
20
+ Horizontal = "horizontal",
21
+ Vertical = "vertical"
22
+ }
23
+ export interface PlotbandLabelOptions {
24
+ labelText?: string;
25
+ labelPosition: PlotbandLabelPosition;
26
+ labelOffsetX: number;
27
+ labelOffsetY: number;
28
+ labelOrientation: PlotbandLabelOrientation;
29
+ labelColor?: string;
30
+ labelSize?: number;
31
+ }
32
+ export declare type PlotbandLayoutValue = {
33
+ x: number;
34
+ y: number;
35
+ textAnchor: string;
36
+ dominantBaseline: string;
37
+ };
38
+ export declare type PlotbandLabelLayout = {
39
+ rotation: number;
40
+ transform: string;
41
+ } & PlotbandLayoutValue;
42
+ declare type LabelLayoutFn = (params: {
43
+ startX: number;
44
+ startY: number;
45
+ width: number;
46
+ height: number;
47
+ offsetX: number;
48
+ offsetY: number;
49
+ }) => PlotbandLayoutValue;
50
+ export declare type PlotbandLayoutMap = Record<PlotbandLabelPosition, LabelLayoutFn>;
51
+ export {};
@@ -0,0 +1,27 @@
1
+ var PlotbandLabelPosition;
2
+ (function (PlotbandLabelPosition) {
3
+ PlotbandLabelPosition["TopLeftInside"] = "top-left-inside";
4
+ PlotbandLabelPosition["TopLeftOutside"] = "top-left-outside";
5
+ PlotbandLabelPosition["TopInside"] = "top-inside";
6
+ PlotbandLabelPosition["TopOutside"] = "top-outside";
7
+ PlotbandLabelPosition["TopRightInside"] = "top-right-inside";
8
+ PlotbandLabelPosition["TopRightOutside"] = "top-right-outside";
9
+ PlotbandLabelPosition["RightInside"] = "right-inside";
10
+ PlotbandLabelPosition["RightOutside"] = "right-outside";
11
+ PlotbandLabelPosition["BottomRightInside"] = "bottom-right-inside";
12
+ PlotbandLabelPosition["BottomRightOutside"] = "bottom-right-outside";
13
+ PlotbandLabelPosition["BottomInside"] = "bottom-inside";
14
+ PlotbandLabelPosition["BottomOutside"] = "bottom-outside";
15
+ PlotbandLabelPosition["BottomLeftInside"] = "bottom-left-inside";
16
+ PlotbandLabelPosition["BottomLeftOutside"] = "bottom-left-outside";
17
+ PlotbandLabelPosition["LeftInside"] = "left-inside";
18
+ PlotbandLabelPosition["LeftOutside"] = "left-outside";
19
+ })(PlotbandLabelPosition || (PlotbandLabelPosition = {}));
20
+ var PlotbandLabelOrientation;
21
+ (function (PlotbandLabelOrientation) {
22
+ PlotbandLabelOrientation["Horizontal"] = "horizontal";
23
+ PlotbandLabelOrientation["Vertical"] = "vertical";
24
+ })(PlotbandLabelOrientation || (PlotbandLabelOrientation = {}));
25
+
26
+ export { PlotbandLabelOrientation, PlotbandLabelPosition };
27
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../src/components/plotband/types.ts"],"sourcesContent":["export enum PlotbandLabelPosition {\n TopLeftInside = 'top-left-inside',\n TopLeftOutside = 'top-left-outside',\n TopInside = 'top-inside',\n TopOutside = 'top-outside',\n TopRightInside = 'top-right-inside',\n TopRightOutside = 'top-right-outside',\n RightInside = 'right-inside',\n RightOutside = 'right-outside',\n BottomRightInside = 'bottom-right-inside',\n BottomRightOutside = 'bottom-right-outside',\n BottomInside = 'bottom-inside',\n BottomOutside = 'bottom-outside',\n BottomLeftInside = 'bottom-left-inside',\n BottomLeftOutside = 'bottom-left-outside',\n LeftInside = 'left-inside',\n LeftOutside = 'left-outside',\n}\n\nexport enum PlotbandLabelOrientation {\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n}\n\nexport interface PlotbandLabelOptions {\n labelText?: string;\n labelPosition: PlotbandLabelPosition;\n labelOffsetX: number;\n labelOffsetY: number;\n labelOrientation: PlotbandLabelOrientation;\n labelColor?: string;\n labelSize?: number;\n}\n\nexport type PlotbandLayoutValue = {\n x: number;\n y: number;\n textAnchor: string;\n dominantBaseline: string;\n}\n\nexport type PlotbandLabelLayout = {\n rotation: number;\n transform: string;\n} & PlotbandLayoutValue\n\n\ntype LabelLayoutFn = (params: {\n startX: number;\n startY: number;\n width: number;\n height: number;\n offsetX: number;\n offsetY: number;\n}) => PlotbandLay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A;AACzB,IAAA,wBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EAHW,wBAAwB,KAAxB,wBAAwB,GAGnC,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,91 @@
1
+ import { XYComponentConfigInterface } from "../../core/xy-component/config";
2
+ import { AxisType } from "../axis/types";
3
+ import { PlotlineLabelPosition, PlotlineLabelOrientation, PlotlineLineStylePresets } from './types';
4
+ export interface PlotlineConfigInterface<Datum> extends Partial<XYComponentConfigInterface<Datum>> {
5
+ /**
6
+ * Color of the plotline.
7
+ * Uses CSS variable: `--vis-plotline-color`.
8
+ *
9
+ * @default 'var(--vis-plotline-color)'
10
+ */
11
+ color?: string;
12
+ /**
13
+ * Line width in pixels.
14
+ * Uses CSS variable: `--vis-plotline-width`.
15
+ *
16
+ * @default 2
17
+ */
18
+ lineWidth?: number;
19
+ /**
20
+ * Plotline direction type.
21
+ * Should be either `AxisType.X` or `AxisType.Y`.
22
+ *
23
+ * @default AxisType.Y
24
+ */
25
+ axis?: AxisType | string;
26
+ /**
27
+ * Value to draw the plotline at.
28
+ *
29
+ * @default 0
30
+ */
31
+ value?: number | null | undefined;
32
+ /**
33
+ * Duration of the animation in milliseconds.
34
+ *
35
+ * @default 300
36
+ */
37
+ duration?: number;
38
+ /**
39
+ * Line style of the plotline.
40
+ * Can be a named preset or an array of numbers representing `stroke-dasharray`.
41
+ * Uses CSS variable: `--vis-plotline-dasharray`.
42
+ *
43
+ * @default PlotlineLineStylePresets.Solid
44
+ */
45
+ lineStyle?: PlotlineLineStylePresets | number[];
46
+ /**
47
+ * Label text to display on the plotline.
48
+ *
49
+ * @default undefined
50
+ */
51
+ labelText?: string;
52
+ /**
53
+ * Position of the label relative to the plotline.
54
+ *
55
+ * @default PlotlineLabelPosition.TopRight
56
+ */
57
+ labelPosition?: PlotlineLabelPosition;
58
+ /**
59
+ * Horizontal offset of the label in pixels.
60
+ *
61
+ * @default 14
62
+ */
63
+ labelOffsetX?: number;
64
+ /**
65
+ * Vertical offset of the label in pixels.
66
+ *
67
+ * @default 14
68
+ */
69
+ labelOffsetY?: number;
70
+ /**
71
+ * Orientation of the label: horizontal or vertical.
72
+ *
73
+ * @default PlotlineLabelOrientation.Horizontal
74
+ */
75
+ labelOrientation?: PlotlineLabelOrientation;
76
+ /**
77
+ * Color of the label text.
78
+ * Uses CSS variable: `--vis-plotline-label-color`.
79
+ *
80
+ * @default 'var(--vis-plotline-label-color)'
81
+ */
82
+ labelColor?: string;
83
+ /**
84
+ * Font size of the label text in pixels.
85
+ * Uses CSS variable: `--vis-plotline-label-font-size`.
86
+ *
87
+ * @default 'var(--vis-plotline-label-font-size)'
88
+ */
89
+ labelSize?: number;
90
+ }
91
+ export declare const PlotlineDefaultConfig: PlotlineConfigInterface<unknown>;
@@ -0,0 +1,9 @@
1
+ import { XYComponentDefaultConfig } from '../../core/xy-component/config.js';
2
+ import { AxisType } from '../axis/types.js';
3
+ import { PlotlineLineStylePresets, PlotlineLabelPosition, PlotlineLabelOrientation } from './types.js';
4
+
5
+ // Config
6
+ const PlotlineDefaultConfig = Object.assign(Object.assign({}, XYComponentDefaultConfig), { lineWidth: 2, axis: AxisType.Y, value: 0, duration: 300, color: undefined, lineStyle: PlotlineLineStylePresets.Solid, labelPosition: PlotlineLabelPosition.TopRight, labelOffsetX: 14, labelOffsetY: 14, labelOrientation: PlotlineLabelOrientation.Horizontal });
7
+
8
+ export { PlotlineDefaultConfig };
9
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sources":["../../../src/components/plotline/config.ts"],"sourcesContent":["// Config\nimport { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { AxisType } from 'components/axis/types'\nimport { PlotlineLabelPosition, PlotlineLabelOrientation, PlotlineLineStylePresets } from './types'\n\nexport interface PlotlineConfigInterface<Datum> extends Partial<XYComponentConfigInterface<Datum>> {\n /**\n * Color of the plotline.\n * Uses CSS variable: `--vis-plotline-color`.\n *\n * @default 'var(--vis-plotline-color)'\n */\n color?: string;\n\n /**\n * Line width in pixels.\n * Uses CSS variable: `--vis-plotline-width`.\n *\n * @default 2\n */\n lineWidth?: number;\n\n /**\n * Plotline direction type.\n * Should be either `AxisType.X` or `AxisType.Y`.\n *\n * @default AxisType.Y\n */\n axis?: AxisType | string;\n\n /**\n * Value to draw the plotline at.\n *\n * @default 0\n */\n value?: number | null | undefined;\n\n /**\n * Duration of the animation in milliseconds.\n *\n * @default 300\n */\n duration?: number;\n\n /**\n * Line style of the plotline.\n * Can be a named preset or an array of numbers representing `stroke-dasharray`.\n * Uses CSS variable: `--vis-plotline-dasharray`.\n *\n * @default PlotlineLineStylePresets.Solid\n */\n lineStyle?: PlotlineLineStylePresets | number[];\n\n /**\n * Label text to display on the plotline.\n *\n * @default undefined\n */\n labelText?: string;\n\n /**\n * Position of the label relative to the plotline.\n *\n * @default PlotlineLabelPosition.TopRight\n */\n labelPosition?: PlotlineLabelPosition;\n\n /**\n * Horizontal offset of the label in pixels.\n *\n * @default 14\n */\n labelOffsetX?: number;\n\n /**\n * Vertical offset of the label in pixels.\n *\n * @default 14\n */\n labelOffsetY?: number;\n\n /**\n * Orientation of the label: horizontal or vertical.\n *\n * @default PlotlineLabelOrientation.Horizontal\n */\n labelOrientation?: PlotlineLabelOrientation;\n\n /**\n * Color of the label text.\n * Uses CSS variable: `--vis-plotline-label-color`.\n *\n * @default 'var(--vis-plotline-label-color)'\n */\n labelColor?: string;\n\n /**\n * Font size of the label text in pixels.\n * Uses CSS variable: `--vis-plotline-label-font-size`.\n *\n * @default 'var(--vis-plotline-label-font-size)'\n */\n labelSize?: number;\n}\n\nexport const PlotlineDefaultConfig: PlotlineConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n lineWidth: 2,\n axis: AxisType.Y,\n value: 0,\n duration: 300,\n color: undefined,\n lineStyle: PlotlineLineStylePresets.Solid,\n labelPosition: PlotlineLabelPosition.TopRight,\n labelOffsetX: 14,\n labelOffsetY: 14,\n labelOrientation: PlotlineLabelOrientation.Horizontal,\n}\n"],"names":[],"mappings":";;;;AAAA;AA2Ga,MAAA,qBAAqB,GAC7B,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,wBAAwB,KAC3B,SAAS,EAAE,CAAC,EACZ,IAAI,EAAE,QAAQ,CAAC,CAAC,EAChB,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,GAAG,EACb,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,wBAAwB,CAAC,KAAK,EACzC,aAAa,EAAE,qBAAqB,CAAC,QAAQ,EAC7C,YAAY,EAAE,EAAE,EAChB,YAAY,EAAE,EAAE,EAChB,gBAAgB,EAAE,wBAAwB,CAAC,UAAU,EAAA;;;;"}
@@ -0,0 +1,6 @@
1
+ import { PlotlineLineStylePresets, PlotlineLayoutMap, LineStyleValue } from './types';
2
+ export declare const LINE_STYLE: Record<PlotlineLineStylePresets, LineStyleValue | 'none'>;
3
+ export declare const HORIZONTAL_X: PlotlineLayoutMap;
4
+ export declare const VERTICAL_X: PlotlineLayoutMap;
5
+ export declare const HORIZONTAL_Y: PlotlineLayoutMap;
6
+ export declare const VERTICAL_Y: PlotlineLayoutMap;
@@ -0,0 +1,58 @@
1
+ import { PlotlineLabelPosition } from './types.js';
2
+
3
+ const LINE_STYLE = {
4
+ solid: 'none',
5
+ shortDash: '6,2',
6
+ shortDot: '2,2',
7
+ shortDashDot: '6,2,2,2',
8
+ shortDashDotDot: '6,2,2,2,2,2',
9
+ dot: '2,6',
10
+ dash: '8,6',
11
+ longDash: '16,6',
12
+ dashDot: '8,6,2,6',
13
+ longDashDot: '16,6,2,6',
14
+ longDashDotDot: '16,6,2,6,2,6',
15
+ };
16
+ const HORIZONTAL_X = {
17
+ [PlotlineLabelPosition.TopLeft]: ({ width, offsetX, offsetY }) => ({ x: width - offsetX, y: offsetY, textAnchor: 'end', dominantBaseline: 'text-before-edge' }),
18
+ [PlotlineLabelPosition.Top]: ({ width, offsetY }) => ({ x: width, y: offsetY, textAnchor: 'middle', dominantBaseline: 'text-before-edge' }),
19
+ [PlotlineLabelPosition.TopRight]: ({ width, offsetX, offsetY }) => ({ x: width + offsetX, y: offsetY, textAnchor: 'start', dominantBaseline: 'text-before-edge' }),
20
+ [PlotlineLabelPosition.Right]: ({ width, height, offsetX }) => ({ x: width + offsetX, y: height / 2, textAnchor: 'start', dominantBaseline: 'middle' }),
21
+ [PlotlineLabelPosition.BottomRight]: ({ width, height, offsetX, offsetY }) => ({ x: width + offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-after-edge' }),
22
+ [PlotlineLabelPosition.Bottom]: ({ width, height, offsetY }) => ({ x: width, y: height - offsetY, textAnchor: 'middle', dominantBaseline: 'text-after-edge' }),
23
+ [PlotlineLabelPosition.BottomLeft]: ({ width, height, offsetX, offsetY }) => ({ x: width - offsetX, y: height - offsetY, textAnchor: 'end', dominantBaseline: 'text-after-edge' }),
24
+ [PlotlineLabelPosition.Left]: ({ width, height, offsetX }) => ({ x: width - offsetX, y: height / 2, textAnchor: 'end', dominantBaseline: 'middle' }),
25
+ };
26
+ const VERTICAL_X = {
27
+ [PlotlineLabelPosition.TopLeft]: ({ width, offsetX, offsetY }) => ({ x: width - offsetX, y: offsetY, textAnchor: 'end', dominantBaseline: 'text-after-edge' }),
28
+ [PlotlineLabelPosition.Top]: ({ width, offsetY }) => ({ x: width, y: offsetY, textAnchor: 'end', dominantBaseline: 'middle' }),
29
+ [PlotlineLabelPosition.TopRight]: ({ width, offsetX, offsetY }) => ({ x: width + offsetX, y: offsetY, textAnchor: 'end', dominantBaseline: 'text-before-edge' }),
30
+ [PlotlineLabelPosition.Right]: ({ width, height, offsetX }) => ({ x: width + offsetX, y: height / 2, textAnchor: 'middle', dominantBaseline: 'text-before-edge' }),
31
+ [PlotlineLabelPosition.BottomRight]: ({ width, height, offsetX, offsetY }) => ({ x: width + offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-before-edge' }),
32
+ [PlotlineLabelPosition.Bottom]: ({ width, height, offsetY }) => ({ x: width, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'middle' }),
33
+ [PlotlineLabelPosition.BottomLeft]: ({ width, height, offsetX, offsetY }) => ({ x: width - offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-after-edge' }),
34
+ [PlotlineLabelPosition.Left]: ({ width, height, offsetX }) => ({ x: width - offsetX, y: height / 2, textAnchor: 'middle', dominantBaseline: 'text-after-edge' }),
35
+ };
36
+ const HORIZONTAL_Y = {
37
+ [PlotlineLabelPosition.TopLeft]: ({ offsetX, height, offsetY }) => ({ x: offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-after-edge' }),
38
+ [PlotlineLabelPosition.Top]: ({ width, height, offsetY }) => ({ x: width / 2, y: height - offsetY, textAnchor: 'middle', dominantBaseline: 'text-after-edge' }),
39
+ [PlotlineLabelPosition.TopRight]: ({ width, offsetX, height, offsetY }) => ({ x: width - offsetX, y: height - offsetY, textAnchor: 'end', dominantBaseline: 'text-after-edge' }),
40
+ [PlotlineLabelPosition.Right]: ({ width, offsetX, height }) => ({ x: width - offsetX, y: height, textAnchor: 'end', dominantBaseline: 'middle' }),
41
+ [PlotlineLabelPosition.BottomRight]: ({ width, offsetX, height, offsetY }) => ({ x: width - offsetX, y: height + offsetY, textAnchor: 'end', dominantBaseline: 'text-before-edge' }),
42
+ [PlotlineLabelPosition.Bottom]: ({ width, height, offsetY }) => ({ x: width / 2, y: height + offsetY, textAnchor: 'middle', dominantBaseline: 'text-before-edge' }),
43
+ [PlotlineLabelPosition.BottomLeft]: ({ offsetX, height, offsetY }) => ({ x: offsetX, y: height + offsetY, textAnchor: 'start', dominantBaseline: 'text-before-edge' }),
44
+ [PlotlineLabelPosition.Left]: ({ offsetX, height }) => ({ x: offsetX, y: height, textAnchor: 'start', dominantBaseline: 'middle' }),
45
+ };
46
+ const VERTICAL_Y = {
47
+ [PlotlineLabelPosition.TopLeft]: ({ offsetX, height, offsetY }) => ({ x: offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-before-edge' }),
48
+ [PlotlineLabelPosition.Top]: ({ width, height, offsetY }) => ({ x: width / 2, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'central' }),
49
+ [PlotlineLabelPosition.TopRight]: ({ width, offsetX, height, offsetY }) => ({ x: width - offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-after-edge' }),
50
+ [PlotlineLabelPosition.Right]: ({ width, offsetX, height }) => ({ x: width - offsetX, y: height, textAnchor: 'middle', dominantBaseline: 'text-after-edge' }),
51
+ [PlotlineLabelPosition.BottomRight]: ({ width, offsetX, height, offsetY }) => ({ x: width - offsetX, y: height + offsetY, textAnchor: 'end', dominantBaseline: 'text-after-edge' }),
52
+ [PlotlineLabelPosition.Bottom]: ({ width, height, offsetY }) => ({ x: width / 2, y: height + offsetY, textAnchor: 'end', dominantBaseline: 'central' }),
53
+ [PlotlineLabelPosition.BottomLeft]: ({ offsetX, height, offsetY }) => ({ x: offsetX, y: height + offsetY, textAnchor: 'end', dominantBaseline: 'text-before-edge' }),
54
+ [PlotlineLabelPosition.Left]: ({ offsetX, height }) => ({ x: offsetX, y: height, textAnchor: 'middle', dominantBaseline: 'text-before-edge' }),
55
+ };
56
+
57
+ export { HORIZONTAL_X, HORIZONTAL_Y, LINE_STYLE, VERTICAL_X, VERTICAL_Y };
58
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../src/components/plotline/constants.ts"],"sourcesContent":["import { PlotlineLineStylePresets, PlotlineLabelPosition, PlotlineLayoutMap, LineStyleValue } from './types'\n\nexport const LINE_STYLE: Record<PlotlineLineStylePresets, LineStyleValue | 'none'> = {\n solid: 'none',\n shortDash: '6,2',\n shortDot: '2,2',\n shortDashDot: '6,2,2,2',\n shortDashDotDot: '6,2,2,2,2,2',\n dot: '2,6',\n dash: '8,6',\n longDash: '16,6',\n dashDot: '8,6,2,6',\n longDashDot: '16,6,2,6',\n longDashDotDot: '16,6,2,6,2,6',\n}\n\nexport const HORIZONTAL_X: PlotlineLayoutMap = {\n [PlotlineLabelPosition.TopLeft]: ({ width, offsetX, offsetY }) => ({ x: width - offsetX, y: offsetY, textAnchor: 'end', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.Top]: ({ width, offsetY }) => ({ x: width, y: offsetY, textAnchor: 'middle', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.TopRight]: ({ width, offsetX, offsetY }) => ({ x: width + offsetX, y: offsetY, textAnchor: 'start', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.Right]: ({ width, height, offsetX }) => ({ x: width + offsetX, y: height / 2, textAnchor: 'start', dominantBaseline: 'middle' }),\n [PlotlineLabelPosition.BottomRight]: ({ width, height, offsetX, offsetY }) => ({ x: width + offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.Bottom]: ({ width, height, offsetY }) => ({ x: width, y: height - offsetY, textAnchor: 'middle', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.BottomLeft]: ({ width, height, offsetX, offsetY }) => ({ x: width - offsetX, y: height - offsetY, textAnchor: 'end', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.Left]: ({ width, height, offsetX }) => ({ x: width - offsetX, y: height / 2, textAnchor: 'end', dominantBaseline: 'middle' }),\n}\n\nexport const VERTICAL_X: PlotlineLayoutMap = {\n [PlotlineLabelPosition.TopLeft]: ({ width, offsetX, offsetY }) => ({ x: width - offsetX, y: offsetY, textAnchor: 'end', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.Top]: ({ width, offsetY }) => ({ x: width, y: offsetY, textAnchor: 'end', dominantBaseline: 'middle' }),\n [PlotlineLabelPosition.TopRight]: ({ width, offsetX, offsetY }) => ({ x: width + offsetX, y: offsetY, textAnchor: 'end', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.Right]: ({ width, height, offsetX }) => ({ x: width + offsetX, y: height / 2, textAnchor: 'middle', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.BottomRight]: ({ width, height, offsetX, offsetY }) => ({ x: width + offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.Bottom]: ({ width, height, offsetY }) => ({ x: width, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'middle' }),\n [PlotlineLabelPosition.BottomLeft]: ({ width, height, offsetX, offsetY }) => ({ x: width - offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.Left]: ({ width, height, offsetX }) => ({ x: width - offsetX, y: height / 2, textAnchor: 'middle', dominantBaseline: 'text-after-edge' }),\n}\n\nexport const HORIZONTAL_Y: PlotlineLayoutMap = {\n [PlotlineLabelPosition.TopLeft]: ({ offsetX, height, offsetY }) => ({ x: offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.Top]: ({ width, height, offsetY }) => ({ x: width / 2, y: height - offsetY, textAnchor: 'middle', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.TopRight]: ({ width, offsetX, height, offsetY }) => ({ x: width - offsetX, y: height - offsetY, textAnchor: 'end', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.Right]: ({ width, offsetX, height }) => ({ x: width - offsetX, y: height, textAnchor: 'end', dominantBaseline: 'middle' }),\n [PlotlineLabelPosition.BottomRight]: ({ width, offsetX, height, offsetY }) => ({ x: width - offsetX, y: height + offsetY, textAnchor: 'end', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.Bottom]: ({ width, height, offsetY }) => ({ x: width / 2, y: height + offsetY, textAnchor: 'middle', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.BottomLeft]: ({ offsetX, height, offsetY }) => ({ x: offsetX, y: height + offsetY, textAnchor: 'start', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.Left]: ({ offsetX, height }) => ({ x: offsetX, y: height, textAnchor: 'start', dominantBaseline: 'middle' }),\n}\n\nexport const VERTICAL_Y: PlotlineLayoutMap = {\n [PlotlineLabelPosition.TopLeft]: ({ offsetX, height, offsetY }) => ({ x: offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.Top]: ({ width, height, offsetY }) => ({ x: width / 2, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'central' }),\n [PlotlineLabelPosition.TopRight]: ({ width, offsetX, height, offsetY }) => ({ x: width - offsetX, y: height - offsetY, textAnchor: 'start', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.Right]: ({ width, offsetX, height }) => ({ x: width - offsetX, y: height, textAnchor: 'middle', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.BottomRight]: ({ width, offsetX, height, offsetY }) => ({ x: width - offsetX, y: height + offsetY, textAnchor: 'end', dominantBaseline: 'text-after-edge' }),\n [PlotlineLabelPosition.Bottom]: ({ width, height, offsetY }) => ({ x: width / 2, y: height + offsetY, textAnchor: 'end', dominantBaseline: 'central' }),\n [PlotlineLabelPosition.BottomLeft]: ({ offsetX, height, offsetY }) => ({ x: offsetX, y: height + offsetY, textAnchor: 'end', dominantBaseline: 'text-before-edge' }),\n [PlotlineLabelPosition.Left]: ({ offsetX, height }) => ({ x: offsetX, y: height, textAnchor: 'middle', dominantBaseline: 'text-before-edge' }),\n}\n"],"names":[],"mappings":";;AAEa,MAAA,UAAU,GAA8D;AACnF,IAAA,KAAK,EAAE,MAAM;AACb,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,YAAY,EAAE,SAAS;AACvB,IAAA,eAAe,EAAE,aAAa;AAC9B,IAAA,GAAG,EAAE,KAAK;AACV,I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EAAE,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;AACpK,IAAA,CAAC,qBAAqB,CAAC,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;;;;;"}
@@ -0,0 +1,14 @@
1
+ import { Selection } from 'd3-selection';
2
+ import { XYComponentCore } from "../../core/xy-component";
3
+ import { PlotlineConfigInterface } from './config';
4
+ import * as s from './style';
5
+ export declare class Plotline<Datum> extends XYComponentCore<Datum, PlotlineConfigInterface<Datum>> {
6
+ static selectors: typeof s;
7
+ protected _defaultConfig: PlotlineConfigInterface<Datum>;
8
+ value: number | null | undefined;
9
+ plotline: Selection<SVGLineElement, unknown, null, undefined>;
10
+ label: Selection<SVGTextElement, unknown, null, undefined>;
11
+ constructor(config: PlotlineConfigInterface<Datum>);
12
+ _render(customDuration?: number): void;
13
+ private computeLabel;
14
+ }
@@ -0,0 +1,102 @@
1
+ import { smartTransition } from '../../utils/d3.js';
2
+ import { XYComponentCore } from '../../core/xy-component/index.js';
3
+ import { AxisType } from '../axis/types.js';
4
+ import { LINE_STYLE, VERTICAL_X, HORIZONTAL_X, VERTICAL_Y, HORIZONTAL_Y } from './constants.js';
5
+ import { PlotlineDefaultConfig } from './config.js';
6
+ import { PlotlineLabelOrientation } from './types.js';
7
+ import * as style from './style.js';
8
+ import { plotline, label } from './style.js';
9
+
10
+ // Utils
11
+ class Plotline extends XYComponentCore {
12
+ constructor(config) {
13
+ super();
14
+ this._defaultConfig = PlotlineDefaultConfig;
15
+ if (config)
16
+ this.setConfig(config);
17
+ this.plotline = this.g
18
+ .append('line')
19
+ .attr('class', plotline);
20
+ this.label = this.g
21
+ .append('text')
22
+ .attr('class', label);
23
+ }
24
+ _render(customDuration) {
25
+ super._render(customDuration);
26
+ const { config } = this;
27
+ this.value = config.value;
28
+ let strokeDashArray;
29
+ if (typeof (config === null || config === void 0 ? void 0 : config.lineStyle) === 'string') {
30
+ strokeDashArray = LINE_STYLE[config.lineStyle];
31
+ }
32
+ else if (Array.isArray(config.lineStyle)) {
33
+ strokeDashArray = config.lineStyle.join(',');
34
+ }
35
+ else {
36
+ strokeDashArray = 'none';
37
+ }
38
+ this.value = config.value;
39
+ this.plotline
40
+ .attr('stroke-opacity', 1)
41
+ .style('stroke-width', config.lineWidth)
42
+ .style('stroke-dasharray', strokeDashArray)
43
+ .style('stroke', config.color);
44
+ let x1 = 0;
45
+ let x2 = 0;
46
+ let y1 = 0;
47
+ let y2 = 0;
48
+ if (config.axis === AxisType.Y) {
49
+ y1 = this.yScale(this.value);
50
+ y2 = this.yScale(this.value);
51
+ x1 = 0;
52
+ x2 = this._width;
53
+ }
54
+ else {
55
+ y1 = 0;
56
+ y2 = this._height;
57
+ x1 = this.xScale(this.value);
58
+ x2 = this.xScale(this.value);
59
+ }
60
+ smartTransition(this.plotline, config.duration)
61
+ .attr('x1', x1)
62
+ .attr('x2', x2)
63
+ .attr('y1', y1)
64
+ .attr('y2', y2);
65
+ if (config.labelText) {
66
+ const labelProps = this.computeLabel(config.axis, x2, y2, config.labelPosition, config.labelOffsetX, config.labelOffsetY, config.labelOrientation);
67
+ this.label
68
+ .text(config.labelText)
69
+ .attr('transform', labelProps.transform)
70
+ .attr('dominant-baseline', labelProps.dominantBaseline)
71
+ .style('fill', config.labelColor)
72
+ .style('text-anchor', labelProps.textAnchor)
73
+ .style('font-size', config.labelSize ? `${config.labelSize}px` : undefined);
74
+ smartTransition(this.label, config.duration)
75
+ .attr('x', labelProps.x)
76
+ .attr('y', labelProps.y);
77
+ }
78
+ smartTransition(this.plotline.exit())
79
+ .style('opacity', 0)
80
+ .remove();
81
+ }
82
+ computeLabel(axis, width, height, position, offsetX, offsetY, orientation) {
83
+ const isVertical = orientation === PlotlineLabelOrientation.Vertical;
84
+ const rotation = isVertical ? -90 : 0;
85
+ let layout;
86
+ if (axis === AxisType.X) {
87
+ const map = isVertical ? VERTICAL_X : HORIZONTAL_X;
88
+ layout = map[position]({ width, height, offsetX, offsetY });
89
+ }
90
+ else {
91
+ const map = isVertical ? VERTICAL_Y : HORIZONTAL_Y;
92
+ layout = map[position]({ width, height, offsetX, offsetY });
93
+ }
94
+ const transform = rotation ? `rotate(${rotation}, ${layout.x}, ${layout.y})` : '';
95
+ return Object.assign(Object.assign({}, layout), { rotation,
96
+ transform });
97
+ }
98
+ }
99
+ Plotline.selectors = style;
100
+
101
+ export { Plotline };
102
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/plotline/index.ts"],"sourcesContent":["import { Selection } from 'd3-selection'\n\n// Utils\nimport { smartTransition } from 'utils/d3'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\nimport { AxisType } from 'components/axis/types'\n\n// Config\nimport { LINE_STYLE, VERTICAL_X, HORIZONTAL_X, VERTICAL_Y, HORIZONTAL_Y } from './constants'\nimport { PlotlineDefaultConfig, PlotlineConfigInterface } from './config'\nimport { PlotlineLabelPosition, PlotlineLabelOrientation, PlotlineLabelLayout, PlotlineLayoutValue } from './types'\n\n// Styles\nimport * as s from './style'\n\nexport class Plotline<Datum> extends XYComponentCore<Datum, PlotlineConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = PlotlineDefaultConfig as PlotlineConfigInterface<Datum>\n value: number | null | undefined\n plotline: Selection<SVGLineElement, unknown, null, undefined>\n label: Selection<SVGTextElement, unknown, null, undefined>\n\n constructor (config: PlotlineConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n this.plotline = this.g\n .append('line')\n .attr('class', s.plotline)\n\n this.label = this.g\n .append('text')\n .attr('class', s.label)\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config } = this\n this.value = config.value\n\n let strokeDashArray\n\n if (typeof config?.lineStyle === 'string') {\n strokeDashArray = LINE_STYLE[config.lineStyle]\n } else if (Array.isArray(config.lineStyle)) {\n strokeDashArray = config.lineStyle.join(',')\n } else {\n strokeDashArray = 'none'\n }\n\n this.value = config.value\n\n this.plotline\n .attr('stroke-opacity', 1)\n .style('stroke-width', config.lineWidth)\n .style('stroke-dasharray', strokeDashArray)\n .style('stroke', config.color)\n\n let x1 = 0\n let x2 = 0\n let y1 = 0\n let y2 = 0\n\n if (config.axis === AxisType.Y) {\n y1 = this.yScale(this.value)\n y2 = this.yScale(this.value)\n x1 = 0\n x2 = this._width\n } else {\n y1 = 0\n y2 = this._height\n x1 = this.xScale(this.value)\n x2 = this.xScale(this.value)\n }\n\n smartTransition(this.plotline, config.duration)\n .attr('x1', x1)\n .attr('x2', x2)\n .attr('y1', y1)\n .attr('y2', y2)\n\n if (config.labelText) {\n const labelProps = this.computeLabel(\n config.axis,\n x2,\n y2,\n config.labelPosition,\n config.labelOffsetX,\n config.labelOffsetY,\n config.labelOrientation\n )\n\n this.label\n .text(config.labelText)\n .attr('transform', labelProps.transform)\n .attr('dominant-baseline', labelProps.dominantBaseline)\n .style('fill', config.labelColor)\n .style('text-anchor', labelProps.textAnchor)\n .style('font-size', config.labelSize ? `${config.labelSize}px` : undefined)\n\n smartTransition(this.label, config.duration)\n .attr('x', labelProps.x)\n .attr('y', labelProps.y)\n }\n\n smartTransition(this.plotline.exit())\n .style('opacity', 0)\n .remove()\n }\n\n private computeLabel (\n axis: AxisType | string,\n width: number,\n height: number,\n position: PlotlineLabelPosition,\n offsetX: number,\n offsetY: number,\n orientation: PlotlineLabelOrientation\n ): PlotlineLabelLayout {\n const isVertical = orientation === PlotlineLabelOrientation.Vertical\n const rotation = isVertical ? -90 : 0\n\n let layout: PlotlineLayoutValue\n\n if (axis === AxisType.X) {\n const map = isVertical ? VERTICAL_X : HORIZONTAL_X\n layout = map[position]({ width, height, offsetX, offsetY })\n } else {\n const map = isVertical ? VERTICAL_Y : HORIZONTAL_Y\n layout = map[position]({ width, height, offsetX, offsetY })\n }\n\n const transform = rotation ? `rotate(${rotation}, ${layout.x}, ${layout.y})` : ''\n\n return {\n ...layout,\n rotation,\n transform,\n }\n }\n}\n"],"names":["s.plotline","s.label","s"],"mappings":";;;;;;;;;AAEA;AAeM,MAAO,QAAgB,SAAQ,eAAsD,CAAA;AAOzF,IAAA,WAAA,CAAa,MAAsC,EAAA;AACjD,QAAA,KAAK,EAAE,CAAA;QANC,IAAc,CAAA,cAAA,GAAG,qBAAuD,CAAA;AAOhF,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;AAElC,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;aACnB,MAAM,CAAC,MAAM,CAAC;AACd,aAAA,IAAI,CAAC,OAAO,EAAEA,QAAU,CAAC,CAAA;AAE5B,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;aAChB,MAAM,CAAC,MAAM,CAAC;AACd,aAAA,IAAI,CAAC,OAAO,EAAEC,KAAO,CAAC,CAAA;KAC1B;AAED,IAAA,OAAO,CAAE,cAAuB,EAAA;AAC9B,QAAA,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;AAC7B,QAAA,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;AACvB,QAAA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;AAEzB,QAAA,IAAI,eAAe,CAAA;AAEnB,QAAA,IAAI,QAAO,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAN,MAAM,CAAE,SAAS,CAAA,KAAK,QAAQ,EAAE;AACzC,YAAA,eAAe,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;AAC/C,SAAA;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAC1C,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,I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B,KAAa,EACb,MAAc,EACd,QAA+B,EAC/B,OAAe,EACf,OAAe,EACf,WAAqC,EAAA;AAErC,QAAA,MAAM,UAAU,GAAG,WAAW,KAAK,wBAAwB,CAAC,QAAQ,CAAA;AACpE,QAAA,MAAM,QAAQ,GAAG,UAAU,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;AAErC,QAAA,IAAI,MAA2B,CAAA;AAE/B,QAAA,IAAI,IAAI,KAAK,QAAQ,CAAC,CAAC,EAAE;YACvB,MAAM,GAAG,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAA;AAClD,YAAA,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;AAC5D,SAAA;AAAM,aAAA;YACL,MAAM,GAAG,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAA;AAClD,YAAA,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;AAC5D,SAAA;QAED,MAAM,SAAS,GAAG,QAAQ,GAAG,CAAA,OAAA,EAAU,QAAQ,CAAK,EAAA,EAAA,MAAM,CAAC,CAAC,CAAA,EAAA,EAAK,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,CAAA;QAEjF,OACK,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,MAAM,KACT,QAAQ;AACR,YAAA,SAAS,EACV,CAAA,CAAA;KACF;;AA3HM,QAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
@@ -0,0 +1,4 @@
1
+ export declare const globalStyles: void;
2
+ export declare const root: string;
3
+ export declare const plotline: string;
4
+ export declare const label: string;
@@ -0,0 +1,42 @@
1
+ import { injectGlobal, css } from '@emotion/css';
2
+
3
+ const globalStyles = injectGlobal `
4
+ :root {
5
+ --vis-plotline-color: rgb(226, 32, 58);
6
+ --vis-plotline-width: 2;
7
+ --vis-plotline-dasharray: none;
8
+ --vis-plotline-stroke-dashoffset: 0;
9
+ --vis-plotline-label-font-size: 12px;
10
+ --vis-plotline-label-color: #000;
11
+
12
+ --vis-dark-plotline-label-color: #e5e9f7;
13
+ }
14
+
15
+ body.theme-dark {
16
+ --vis-plotline-label-color: var(--vis-dark-tooltip-text-color);
17
+ }
18
+ `;
19
+ const root = css `
20
+ label: plotline-component;
21
+ `;
22
+ const plotline = css `
23
+ label: plotline;
24
+ transition: opacity 200ms;
25
+ stroke-linecap: round;
26
+ stroke-linejoin: round;
27
+ stroke: var(--vis-plotline-color);
28
+ stroke-width: var(--vis-plotline-width);
29
+ stroke-dasharray: var(--vis-plotline-dasharray);
30
+ stroke-dashoffset: var(--vis-plotline-stroke-dashoffset);
31
+ `;
32
+ const label = css `
33
+ label: plotline-label;
34
+ text-anchor: middle;
35
+ /* dominant-baseline: middle; */
36
+ pointer-events: none;
37
+ font-size: var(--vis-plotline-label-font-size);
38
+ fill: var(--vis-plotline-label-color);
39
+ `;
40
+
41
+ export { globalStyles, label, plotline, root };
42
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sources":["../../../src/components/plotline/style.ts"],"sourcesContent":["import { css, injectGlobal } from '@emotion/css'\n\nexport const globalStyles = injectGlobal`\n :root {\n --vis-plotline-color: rgb(226, 32, 58);\n --vis-plotline-width: 2;\n --vis-plotline-dasharray: none;\n --vis-plotline-stroke-dashoffset: 0;\n --vis-plotline-label-font-size: 12px;\n --vis-plotline-label-color: #000;\n\n --vis-dark-plotline-label-color: #e5e9f7;\n }\n\n body.theme-dark {\n --vis-plotline-label-color: var(--vis-dark-tooltip-text-color);\n }\n`\n\nexport const root = css`\n label: plotline-component;\n`\n\nexport const plotline = css`\n label: plotline;\n transition: opacity 200ms;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke: var(--vis-plotline-color);\n stroke-width: var(--vis-plotline-width);\n stroke-dasharray: var(--vis-plotline-dasharray);\n stroke-dashoffset: var(--vis-plotline-stroke-dashoffset);\n`\n\nexport const label = css`\n label: plotline-label;\n text-anchor: middle;\n /* dominant-baseline: middle; */\n pointer-events: none;\n font-size: var(--vis-plotline-label-font-size);\n fill: var(--vis-plotline-label-color);\n`\n"],"names":[],"mappings":";;AAEO,MAAM,YAAY,GAAG,YAAY,CAAA,CAAA;;;;;;;;;;;;;;;EAevC;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;EAEtB;AAEM,MAAM,QAAQ,GAAG,GAAG,CAAA,CAAA;;;;;;;;;EAS1B;AAEM,MAAM,KAAK,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;"}
@@ -0,0 +1,53 @@
1
+ export declare enum PlotlineLineStylePresets {
2
+ Solid = "solid",
3
+ Dash = "dash",
4
+ DashDot = "dashDot",
5
+ Dot = "dot",
6
+ LongDash = "longDash",
7
+ LongDashDot = "longDashDot",
8
+ LongDashDotDot = "longDashDotDot",
9
+ ShortDash = "shortDash",
10
+ ShortDashDot = "shortDashDot",
11
+ ShortDashDotDot = "shortDashDotDot",
12
+ ShortDot = "shortDot"
13
+ }
14
+ export declare enum PlotlineLabelPosition {
15
+ TopLeft = "top-left",
16
+ Top = "top",
17
+ TopRight = "top-right",
18
+ Right = "right",
19
+ BottomRight = "bottom-right",
20
+ Bottom = "bottom",
21
+ BottomLeft = "bottom-left",
22
+ Left = "left"
23
+ }
24
+ export declare enum PlotlineLabelOrientation {
25
+ Horizontal = "horizontal",
26
+ Vertical = "vertical"
27
+ }
28
+ export interface PlotlineLabelOptions {
29
+ labelText?: string;
30
+ labelPosition: PlotlineLabelPosition;
31
+ labelOffsetX: number;
32
+ labelOffsetY: number;
33
+ labelOrientation: PlotlineLabelOrientation;
34
+ labelColor?: string;
35
+ labelSize?: number;
36
+ }
37
+ export declare type PlotlineLayoutValue = {
38
+ x: number;
39
+ y: number;
40
+ textAnchor: string;
41
+ dominantBaseline: string;
42
+ };
43
+ export declare type PlotlineLabelLayout = {
44
+ rotation: number;
45
+ transform: string;
46
+ } & PlotlineLayoutValue;
47
+ export declare type LineStyleValue = `${number}` | `${number},${number}` | `${number},${number},${number}` | `${number},${number},${number},${number}` | `${number},${number},${number},${number},${number}` | `${number},${number},${number},${number},${number},${number}`;
48
+ export declare type PlotlineLayoutMap = Record<PlotlineLabelPosition, (params: {
49
+ width: number;
50
+ height: number;
51
+ offsetX: number;
52
+ offsetY: number;
53
+ }) => PlotlineLayoutValue>;
@@ -0,0 +1,33 @@
1
+ var PlotlineLineStylePresets;
2
+ (function (PlotlineLineStylePresets) {
3
+ PlotlineLineStylePresets["Solid"] = "solid";
4
+ PlotlineLineStylePresets["Dash"] = "dash";
5
+ PlotlineLineStylePresets["DashDot"] = "dashDot";
6
+ PlotlineLineStylePresets["Dot"] = "dot";
7
+ PlotlineLineStylePresets["LongDash"] = "longDash";
8
+ PlotlineLineStylePresets["LongDashDot"] = "longDashDot";
9
+ PlotlineLineStylePresets["LongDashDotDot"] = "longDashDotDot";
10
+ PlotlineLineStylePresets["ShortDash"] = "shortDash";
11
+ PlotlineLineStylePresets["ShortDashDot"] = "shortDashDot";
12
+ PlotlineLineStylePresets["ShortDashDotDot"] = "shortDashDotDot";
13
+ PlotlineLineStylePresets["ShortDot"] = "shortDot";
14
+ })(PlotlineLineStylePresets || (PlotlineLineStylePresets = {}));
15
+ var PlotlineLabelPosition;
16
+ (function (PlotlineLabelPosition) {
17
+ PlotlineLabelPosition["TopLeft"] = "top-left";
18
+ PlotlineLabelPosition["Top"] = "top";
19
+ PlotlineLabelPosition["TopRight"] = "top-right";
20
+ PlotlineLabelPosition["Right"] = "right";
21
+ PlotlineLabelPosition["BottomRight"] = "bottom-right";
22
+ PlotlineLabelPosition["Bottom"] = "bottom";
23
+ PlotlineLabelPosition["BottomLeft"] = "bottom-left";
24
+ PlotlineLabelPosition["Left"] = "left";
25
+ })(PlotlineLabelPosition || (PlotlineLabelPosition = {}));
26
+ var PlotlineLabelOrientation;
27
+ (function (PlotlineLabelOrientation) {
28
+ PlotlineLabelOrientation["Horizontal"] = "horizontal";
29
+ PlotlineLabelOrientation["Vertical"] = "vertical";
30
+ })(PlotlineLabelOrientation || (PlotlineLabelOrientation = {}));
31
+
32
+ export { PlotlineLabelOrientation, PlotlineLabelPosition, PlotlineLineStylePresets };
33
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../src/components/plotline/types.ts"],"sourcesContent":["export enum PlotlineLineStylePresets {\n Solid = 'solid',\n Dash = 'dash',\n DashDot = 'dashDot',\n Dot = 'dot',\n LongDash = 'longDash',\n LongDashDot = 'longDashDot',\n LongDashDotDot = 'longDashDotDot',\n ShortDash = 'shortDash',\n ShortDashDot = 'shortDashDot',\n ShortDashDotDot = 'shortDashDotDot',\n ShortDot = 'shortDot',\n}\n\nexport enum PlotlineLabelPosition {\n TopLeft = 'top-left',\n Top = 'top',\n TopRight = 'top-right',\n Right = 'right',\n BottomRight = 'bottom-right',\n Bottom = 'bottom',\n BottomLeft = 'bottom-left',\n Left = 'left',\n}\n\nexport enum PlotlineLabelOrientation {\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n}\n\nexport interface PlotlineLabelOptions {\n labelText?: string;\n labelPosition: PlotlineLabelPosition;\n labelOffsetX: number;\n labelOffsetY: number;\n labelOrientation: PlotlineLabelOrientation;\n labelColor?: string;\n labelSize?: number;\n}\n\nexport type PlotlineLayoutValue = {\n x: number;\n y: number;\n textAnchor: string;\n dominantBaseline: string;\n}\n\nexport type PlotlineLabelLayout = {\n rotation: number;\n transform: string;\n} & PlotlineLayoutValue\n\nexport type LineStyleValue =\n | `${number}`\n | `${number},${number}`\n | `${number},${number},${number}`\n | `${number},${number},${number},${number}`\n | `${number},${number},${number},${number},${number}`\n | `${number},${number},${number},${number},${number},${number}`;\n\nexport type PlotlineLayoutMap = Record<PlotlineLabelPosition, (params: { width: number; height: number; offset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,IAAA,qBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACf,CAAC,EATW,qBAAqB,KAArB,qBAAqB,GAShC,EAAA,CAAA,CAAA,CAAA;IAEW,yBAGX;AAHD,CAAA,UAAY,wBAAwB,EAAA;AAClC,IAAA,wBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzB,IAAA,wBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EAHW,wBAAwB,KAAxB,wBAAwB,GAGnC,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,19 @@
1
+ import { RollingPinLegendItem } from "./types";
2
+ export interface RollingPinLegendConfigInterface {
3
+ /** Rects forming a legend. Array of `string`, representing colors.
4
+ *
5
+ * Default: `[]` */
6
+ rects: RollingPinLegendItem[];
7
+ /** Label on the left side of the legend. Default: `undefined` */
8
+ leftLabelText?: string;
9
+ /** Label on the right side of the legend. Default: `undefined` */
10
+ rightLabelText?: string;
11
+ /** Apply a specific class to the labels. Default: `''` */
12
+ labelClassName?: string;
13
+ /** Label text (<span> element) font-size CSS. Default: `null` */
14
+ labelFontSize?: string | null;
15
+ /** If set to true, the legend will be rendered directly into the HTML element provided to the constructor
16
+ * without creating additional `div` element. Default: `false` */
17
+ renderIntoProvidedDomNode?: boolean;
18
+ }
19
+ export declare const RollingPinLegendDefaultConfig: RollingPinLegendConfigInterface;
@@ -0,0 +1,11 @@
1
+ const RollingPinLegendDefaultConfig = {
2
+ rects: [],
3
+ leftLabelText: undefined,
4
+ rightLabelText: undefined,
5
+ labelClassName: '',
6
+ labelFontSize: null,
7
+ renderIntoProvidedDomNode: false,
8
+ };
9
+
10
+ export { RollingPinLegendDefaultConfig };
11
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sources":["../../../src/components/rolling-pin-legend/config.ts"],"sourcesContent":["import { RollingPinLegendItem } from 'components/rolling-pin-legend/types'\n\nexport interface RollingPinLegendConfigInterface {\n /** Rects forming a legend. Array of `string`, representing colors.\n *\n * Default: `[]` */\n rects: RollingPinLegendItem[];\n /** Label on the left side of the legend. Default: `undefined` */\n leftLabelText?: string;\n /** Label on the right side of the legend. Default: `undefined` */\n rightLabelText?: string;\n /** Apply a specific class to the labels. Default: `''` */\n labelClassName?: string;\n /** Label text (<span> element) font-size CSS. Default: `null` */\n labelFontSize?: string | null;\n /** If set to true, the legend will be rendered directly into the HTML element provided to the constructor\n * without creating additional `div` element. Default: `false` */\n renderIntoProvidedDomNode?: boolean;\n}\n\nexport const RollingPinLegendDefaultConfig: RollingPinLegendConfigInterface = {\n rects: [],\n leftLabelText: undefined,\n rightLabelText: undefined,\n labelClassName: '',\n labelFontSize: null,\n renderIntoProvidedDomNode: false,\n}\n"],"names":[],"mappings":"AAoBa,MAAA,6BAA6B,GAAoC;AAC5E,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,cAAc,EAAE,SAAS;AACzB,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,yBAAyB,EAAE,KAAK;;;;;"}