hyperprop-charting-library 0.1.18 → 0.1.19

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.
@@ -104,6 +104,7 @@ var DEFAULT_ORDER_LINE_OPTIONS = {
104
104
  labelBorderRadius: 3,
105
105
  showCloseButton: true,
106
106
  widgetPosition: "left",
107
+ widgetPaddingRight: 10,
107
108
  draggable: false,
108
109
  actionButtonAction: "execute",
109
110
  actionButtonTextColor: "#dbeafe",
@@ -630,7 +631,16 @@ function createChart(element, options = {}) {
630
631
  const closeWidth = showCloseButton ? 24 : 0;
631
632
  const mainWidgetWidth = qtyWidth + centerWidth + closeWidth;
632
633
  const totalWidth = mainWidgetWidth + actionButtonsGap + actionButtonsTotalWidth;
633
- const rightMarginInsideChart = 10;
634
+ const crosshair = { ...DEFAULT_CROSSHAIR_OPTIONS, ...mergedOptions.crosshair ?? {} };
635
+ const crosshairActionInset = crosshair.visible && crosshair.showPriceLabel && crosshair.showPriceActionButton ? Math.max(
636
+ 0,
637
+ Math.round(crosshair.priceActionButtonGap) + (clamp(Math.round(crosshair.priceActionButtonSize), 12, Math.max(12, labelHeight - 4)) + 10) - 4
638
+ ) + 6 : 0;
639
+ const rightMarginInsideChart = Math.max(
640
+ 0,
641
+ mergedLine.widgetPaddingRight,
642
+ crosshairActionInset
643
+ );
634
644
  const maxWidgetX = chartRight - totalWidth - rightMarginInsideChart;
635
645
  const leftWidgetXBase = chartLeft + 8;
636
646
  let leftWidgetX = leftWidgetXBase;
@@ -126,6 +126,7 @@ interface OrderLineOptions {
126
126
  labelBorderRadius?: number;
127
127
  showCloseButton?: boolean;
128
128
  widgetPosition?: "left" | "center" | "right";
129
+ widgetPaddingRight?: number;
129
130
  draggable?: boolean;
130
131
  actionButtonText?: string;
131
132
  actionButtonAction?: "execute" | "cancel" | "close" | string;
@@ -80,6 +80,7 @@ var DEFAULT_ORDER_LINE_OPTIONS = {
80
80
  labelBorderRadius: 3,
81
81
  showCloseButton: true,
82
82
  widgetPosition: "left",
83
+ widgetPaddingRight: 10,
83
84
  draggable: false,
84
85
  actionButtonAction: "execute",
85
86
  actionButtonTextColor: "#dbeafe",
@@ -606,7 +607,16 @@ function createChart(element, options = {}) {
606
607
  const closeWidth = showCloseButton ? 24 : 0;
607
608
  const mainWidgetWidth = qtyWidth + centerWidth + closeWidth;
608
609
  const totalWidth = mainWidgetWidth + actionButtonsGap + actionButtonsTotalWidth;
609
- const rightMarginInsideChart = 10;
610
+ const crosshair = { ...DEFAULT_CROSSHAIR_OPTIONS, ...mergedOptions.crosshair ?? {} };
611
+ const crosshairActionInset = crosshair.visible && crosshair.showPriceLabel && crosshair.showPriceActionButton ? Math.max(
612
+ 0,
613
+ Math.round(crosshair.priceActionButtonGap) + (clamp(Math.round(crosshair.priceActionButtonSize), 12, Math.max(12, labelHeight - 4)) + 10) - 4
614
+ ) + 6 : 0;
615
+ const rightMarginInsideChart = Math.max(
616
+ 0,
617
+ mergedLine.widgetPaddingRight,
618
+ crosshairActionInset
619
+ );
610
620
  const maxWidgetX = chartRight - totalWidth - rightMarginInsideChart;
611
621
  const leftWidgetXBase = chartLeft + 8;
612
622
  let leftWidgetX = leftWidgetXBase;
package/dist/index.cjs CHANGED
@@ -104,6 +104,7 @@ var DEFAULT_ORDER_LINE_OPTIONS = {
104
104
  labelBorderRadius: 3,
105
105
  showCloseButton: true,
106
106
  widgetPosition: "left",
107
+ widgetPaddingRight: 10,
107
108
  draggable: false,
108
109
  actionButtonAction: "execute",
109
110
  actionButtonTextColor: "#dbeafe",
@@ -630,7 +631,16 @@ function createChart(element, options = {}) {
630
631
  const closeWidth = showCloseButton ? 24 : 0;
631
632
  const mainWidgetWidth = qtyWidth + centerWidth + closeWidth;
632
633
  const totalWidth = mainWidgetWidth + actionButtonsGap + actionButtonsTotalWidth;
633
- const rightMarginInsideChart = 10;
634
+ const crosshair = { ...DEFAULT_CROSSHAIR_OPTIONS, ...mergedOptions.crosshair ?? {} };
635
+ const crosshairActionInset = crosshair.visible && crosshair.showPriceLabel && crosshair.showPriceActionButton ? Math.max(
636
+ 0,
637
+ Math.round(crosshair.priceActionButtonGap) + (clamp(Math.round(crosshair.priceActionButtonSize), 12, Math.max(12, labelHeight - 4)) + 10) - 4
638
+ ) + 6 : 0;
639
+ const rightMarginInsideChart = Math.max(
640
+ 0,
641
+ mergedLine.widgetPaddingRight,
642
+ crosshairActionInset
643
+ );
634
644
  const maxWidgetX = chartRight - totalWidth - rightMarginInsideChart;
635
645
  const leftWidgetXBase = chartLeft + 8;
636
646
  let leftWidgetX = leftWidgetXBase;
package/dist/index.d.cts CHANGED
@@ -126,6 +126,7 @@ interface OrderLineOptions {
126
126
  labelBorderRadius?: number;
127
127
  showCloseButton?: boolean;
128
128
  widgetPosition?: "left" | "center" | "right";
129
+ widgetPaddingRight?: number;
129
130
  draggable?: boolean;
130
131
  actionButtonText?: string;
131
132
  actionButtonAction?: "execute" | "cancel" | "close" | string;
package/dist/index.d.ts CHANGED
@@ -126,6 +126,7 @@ interface OrderLineOptions {
126
126
  labelBorderRadius?: number;
127
127
  showCloseButton?: boolean;
128
128
  widgetPosition?: "left" | "center" | "right";
129
+ widgetPaddingRight?: number;
129
130
  draggable?: boolean;
130
131
  actionButtonText?: string;
131
132
  actionButtonAction?: "execute" | "cancel" | "close" | string;
package/dist/index.js CHANGED
@@ -80,6 +80,7 @@ var DEFAULT_ORDER_LINE_OPTIONS = {
80
80
  labelBorderRadius: 3,
81
81
  showCloseButton: true,
82
82
  widgetPosition: "left",
83
+ widgetPaddingRight: 10,
83
84
  draggable: false,
84
85
  actionButtonAction: "execute",
85
86
  actionButtonTextColor: "#dbeafe",
@@ -606,7 +607,16 @@ function createChart(element, options = {}) {
606
607
  const closeWidth = showCloseButton ? 24 : 0;
607
608
  const mainWidgetWidth = qtyWidth + centerWidth + closeWidth;
608
609
  const totalWidth = mainWidgetWidth + actionButtonsGap + actionButtonsTotalWidth;
609
- const rightMarginInsideChart = 10;
610
+ const crosshair = { ...DEFAULT_CROSSHAIR_OPTIONS, ...mergedOptions.crosshair ?? {} };
611
+ const crosshairActionInset = crosshair.visible && crosshair.showPriceLabel && crosshair.showPriceActionButton ? Math.max(
612
+ 0,
613
+ Math.round(crosshair.priceActionButtonGap) + (clamp(Math.round(crosshair.priceActionButtonSize), 12, Math.max(12, labelHeight - 4)) + 10) - 4
614
+ ) + 6 : 0;
615
+ const rightMarginInsideChart = Math.max(
616
+ 0,
617
+ mergedLine.widgetPaddingRight,
618
+ crosshairActionInset
619
+ );
610
620
  const maxWidgetX = chartRight - totalWidth - rightMarginInsideChart;
611
621
  const leftWidgetXBase = chartLeft + 8;
612
622
  let leftWidgetX = leftWidgetXBase;
package/docs/API.md CHANGED
@@ -205,6 +205,7 @@ Common optional fields:
205
205
  - `labelBorderRadius?: number` (default `3`)
206
206
  - `showCloseButton?: boolean` (default `true`)
207
207
  - `widgetPosition?: "left" | "center" | "right"` (default `"left"`)
208
+ - `widgetPaddingRight?: number` (default `10`, extra right margin when `widgetPosition` is `"right"`)
208
209
  - `draggable?: boolean` (default `false`)
209
210
 
210
211
  Legacy single action button:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",