@funnest/charts-ui 0.11.65 → 0.11.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/i18n.d.ts CHANGED
@@ -233,6 +233,8 @@ export declare const STRINGS: {
233
233
  lock: string;
234
234
  unlock: string;
235
235
  duplicate: string;
236
+ copyDrawing: string;
237
+ pasteDrawing: string;
236
238
  moreActions: string;
237
239
  moveBar: string;
238
240
  indicators: string;
@@ -316,6 +318,7 @@ export declare const STRINGS: {
316
318
  moreToolsDown: string;
317
319
  lockView: string;
318
320
  unlockView: string;
321
+ hideNavButtons: string;
319
322
  lockRatio: string;
320
323
  settingAutoScale: string;
321
324
  hintAutoScale: string;
@@ -639,6 +642,8 @@ export declare const STRINGS: {
639
642
  lock: string;
640
643
  unlock: string;
641
644
  duplicate: string;
645
+ copyDrawing: string;
646
+ pasteDrawing: string;
642
647
  moreActions: string;
643
648
  moveBar: string;
644
649
  indicators: string;
@@ -722,6 +727,7 @@ export declare const STRINGS: {
722
727
  moreToolsDown: string;
723
728
  lockView: string;
724
729
  unlockView: string;
730
+ hideNavButtons: string;
725
731
  lockRatio: string;
726
732
  settingAutoScale: string;
727
733
  hintAutoScale: string;
package/dist/index.js CHANGED
@@ -668,6 +668,8 @@ var STRINGS = {
668
668
  lock: "\uC7A0\uADF8\uAE30",
669
669
  unlock: "\uC7A0\uAE08 \uD480\uAE30",
670
670
  duplicate: "\uBCF5\uC81C",
671
+ copyDrawing: "\uBCF5\uC0AC",
672
+ pasteDrawing: "\uBD99\uC5EC\uB123\uAE30",
671
673
  moreActions: "\uB354\uBCF4\uAE30",
672
674
  moveBar: "\uB04C\uC5B4\uC11C \uC62E\uAE30\uAE30 (\uB450 \uBC88 \uB204\uB974\uBA74 \uC81C\uC790\uB9AC)",
673
675
  indicators: "\uC9C0\uD45C",
@@ -751,6 +753,7 @@ var STRINGS = {
751
753
  moreToolsDown: "\uC544\uB798 \uB3C4\uAD6C \uB354 \uBCF4\uAE30",
752
754
  lockView: "\uCC28\uD2B8 \uACE0\uC815",
753
755
  unlockView: "\uCC28\uD2B8 \uACE0\uC815 \uD480\uAE30",
756
+ hideNavButtons: "\uD655\uB300\xB7\uC774\uB3D9 \uBC84\uD2BC \uC228\uAE30\uAE30",
754
757
  lockRatio: "\uAC00\uACA9 \uCD95 \uBE44\uC728 \uACE0\uC815",
755
758
  settingAutoScale: "\uC790\uB3D9 \uB9DE\uCDA4",
756
759
  hintAutoScale: "\uD654\uBA74\uC5D0 \uBCF4\uC774\uB294 \uCE94\uB4E4\uC5D0 \uB9DE\uCDB0 \uAC00\uACA9 \uCD95\uC744 \uB298\uC774\uACE0 \uC904\uC5EC\uC694. \uAC00\uACA9 \uCD95\uC744 \uB04C\uC5B4 \uC9C1\uC811 \uB9DE\uCD94\uBA74 \uAEBC\uC9C0\uACE0, \uAC00\uACA9 \uCD95\uC744 \uB354\uBE14\uD074\uB9AD\uD558\uBA74 \uB2E4\uC2DC \uCF1C\uC838\uC694.",
@@ -1076,6 +1079,8 @@ var STRINGS = {
1076
1079
  lock: "Lock",
1077
1080
  unlock: "Unlock",
1078
1081
  duplicate: "Duplicate",
1082
+ copyDrawing: "Copy",
1083
+ pasteDrawing: "Paste",
1079
1084
  moreActions: "More",
1080
1085
  moveBar: "Drag to move (double-click to reset)",
1081
1086
  indicators: "Indicators",
@@ -1159,6 +1164,7 @@ var STRINGS = {
1159
1164
  moreToolsDown: "More tools below",
1160
1165
  lockView: "Lock chart",
1161
1166
  unlockView: "Unlock chart",
1167
+ hideNavButtons: "Hide zoom & scroll buttons",
1162
1168
  lockRatio: "Lock price to bar ratio",
1163
1169
  settingAutoScale: "Auto (fit to screen)",
1164
1170
  hintAutoScale: "The price axis stretches to fit the candles on screen. Dragging the axis turns it off; double-click the axis to turn it back on.",
@@ -2078,8 +2084,11 @@ var CSS = (
2078
2084
  opacity: 0;
2079
2085
  transition: opacity 0.15s;
2080
2086
  }
2081
- .fnc-body:hover .fnc-nav, .fnc-nav:focus-within { opacity: 1; }
2087
+ /* Shown while the mouse is near the chart's bottom (overlay.tsx): unseen, they don't take clicks either. */
2088
+ .fnc-nav.is-near, .fnc-nav:focus-within { opacity: 1; }
2089
+ .fnc-nav:not(.is-near):not(:focus-within):not(.fnc-nav-locked) .fnc-btn { pointer-events: none; }
2082
2090
  .fnc-nav .fnc-btn { width: 32px; height: 32px; }
2091
+ .fnc-nav .fnc-sep { align-self: center; height: 18px; margin: 0 1px; }
2083
2092
  .fnc-realtime {
2084
2093
  position: absolute;
2085
2094
  display: flex;
@@ -2491,9 +2500,6 @@ var CSS = (
2491
2500
  .fnc-resizing-x, .fnc-resizing-x * { cursor: col-resize !important; user-select: none; }
2492
2501
  .fnc-resizing-y, .fnc-resizing-y * { cursor: row-resize !important; user-select: none; }
2493
2502
  .fnc-parking { display: none; }
2494
- /* Navigation controls follow the hovered pane, not the whole widget. */
2495
- .fnc-multi .fnc-body:hover .fnc-nav { opacity: 0; }
2496
- .fnc-multi .fnc-stage:hover .fnc-nav, .fnc-multi .fnc-nav:focus-within { opacity: 1; }
2497
2503
  .fnc-pane-max {
2498
2504
  position: absolute;
2499
2505
  top: 6px;
@@ -2618,6 +2624,11 @@ var CSS = (
2618
2624
  .fnc-levels-menu { min-width: 340px; }
2619
2625
  .fnc-level-text { flex: 1; min-width: 0; width: 110px; height: 28px; padding: 0 8px; font-size: 13px; }
2620
2626
  .fnc-options-menu { min-width: 280px; max-height: min(70vh, 560px); overflow-y: auto; }
2627
+ /* \u2699 on a computer: \uC635\uC158 \xB7 \uC88C\uD45C \xB7 \uBCF4\uC784 as tabs over one body. */
2628
+ .fnc-menu.fnc-settings-pop { width: 340px; padding: 0; }
2629
+ .fnc-settings-pop .fnc-tabs { position: sticky; top: 0; z-index: 1; padding: 8px 10px; background: var(--fnc-bg); }
2630
+ .fnc-settings-pop-body { display: flex; flex-direction: column; padding: 6px; }
2631
+ .fnc-settings-pop-body > .fnc-coords, .fnc-settings-pop-body > .fnc-hint { padding: 4px 6px; }
2621
2632
  .fnc-option-row { display: flex; align-items: center; gap: 8px; }
2622
2633
  .fnc-option-row input[type='checkbox'] { width: 15px; height: 15px; margin: 0; accent-color: var(--fnc-accent, #3182f6); }
2623
2634
  .fnc-option-field { justify-content: space-between; padding: 4px 10px; font-size: 13px; color: var(--fnc-text); }
@@ -2637,6 +2648,10 @@ var CSS = (
2637
2648
  .fnc-template-name { width: calc(100% - 8px); margin: 4px; }
2638
2649
  .fnc-menu-note { padding: 8px 10px; color: var(--fnc-text-2); font-size: 12px; }
2639
2650
  .fnc-menu-sep { height: 1px; margin: 4px 6px; background: var(--fnc-border); }
2651
+ /* \u22EF on the drawing bar: \uBCF5\uC81C \xB7 \uBCF5\uC0AC \xB7 \uBD99\uC5EC\uB123\uAE30, then \uC21C\uC11C. */
2652
+ .fnc-more-menu { min-width: 180px; }
2653
+ .fnc-more-menu .fnc-menu-item kbd { margin-left: auto; font: inherit; font-size: 12px; color: var(--fnc-text-3); }
2654
+ .fnc-more-title { padding: 6px 10px 2px; font-size: 11px; font-weight: 700; color: var(--fnc-text-2); }
2640
2655
  .fnc-tools-layouts { display: flex; flex-direction: column; gap: 2px; padding: 0 2px 4px; }
2641
2656
  .fnc-tools-sep { height: 1px; margin: 6px 4px; background: var(--fnc-border); }
2642
2657
  .fnc-tools-icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
@@ -3924,10 +3939,6 @@ var GearIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: [
3924
3939
  /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "2.4" }),
3925
3940
  /* @__PURE__ */ a3("path", { d: "M10 3v2M10 15v2M3 10h2M15 10h2M5 5l1.4 1.4M13.6 13.6L15 15M5 15l1.4-1.4M13.6 6.4L15 5" })
3926
3941
  ] });
3927
- var LayersIcon = () => /* @__PURE__ */ a3(Icon, { children: [
3928
- /* @__PURE__ */ a3("path", { d: "M10 4 3 7.5 10 11l7-3.5z", fill: "currentColor", "fill-opacity": "0.25" }),
3929
- /* @__PURE__ */ a3("path", { d: "M3 11l7 3.5 7-3.5" })
3930
- ] });
3931
3942
  var LevelsIcon = () => /* @__PURE__ */ a3(Icon, { children: [
3932
3943
  /* @__PURE__ */ a3("path", { d: "M3 5h9M3 10h14M3 15h11" }),
3933
3944
  /* @__PURE__ */ a3("circle", { cx: "15", cy: "5", r: "1.4" }),
@@ -3968,10 +3979,6 @@ var DiceIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: [
3968
3979
  /* @__PURE__ */ a3("circle", { cx: "12.8", cy: "12.8", r: "1.1", fill: "currentColor", stroke: "none" }),
3969
3980
  /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "1.1", fill: "currentColor", stroke: "none" })
3970
3981
  ] });
3971
- var ClockIcon = () => /* @__PURE__ */ a3(Icon, { size: 13, children: [
3972
- /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "7" }),
3973
- /* @__PURE__ */ a3("path", { d: "M10 6v4l2.5 1.5" })
3974
- ] });
3975
3982
  var SettingsIcon = () => /* @__PURE__ */ a3(Icon, { children: [
3976
3983
  /* @__PURE__ */ a3("path", { d: "M10 12.6a2.6 2.6 0 1 0 0-5.2 2.6 2.6 0 0 0 0 5.2z" }),
3977
3984
  /* @__PURE__ */ a3("path", { d: "M16.2 12a1.3 1.3 0 0 0 .26 1.43l.05.05a1.6 1.6 0 1 1-2.26 2.26l-.05-.05a1.3 1.3 0 0 0-1.43-.26 1.3 1.3 0 0 0-.79 1.19v.14a1.6 1.6 0 0 1-3.2 0v-.07a1.3 1.3 0 0 0-.85-1.19 1.3 1.3 0 0 0-1.43.26l-.05.05a1.6 1.6 0 1 1-2.26-2.26l.05-.05A1.3 1.3 0 0 0 4.5 12a1.3 1.3 0 0 0-1.19-.79h-.14a1.6 1.6 0 0 1 0-3.2h.07a1.3 1.3 0 0 0 1.19-.85 1.3 1.3 0 0 0-.26-1.43l-.05-.05a1.6 1.6 0 1 1 2.26-2.26l.05.05a1.3 1.3 0 0 0 1.43.26h.06a1.3 1.3 0 0 0 .79-1.19v-.14a1.6 1.6 0 0 1 3.2 0v.07a1.3 1.3 0 0 0 .79 1.19 1.3 1.3 0 0 0 1.43-.26l.05-.05a1.6 1.6 0 1 1 2.26 2.26l-.05.05a1.3 1.3 0 0 0-.26 1.43v.06a1.3 1.3 0 0 0 1.19.79h.14a1.6 1.6 0 0 1 0 3.2h-.07a1.3 1.3 0 0 0-1.19.79z" })
@@ -4046,10 +4053,6 @@ var DrawingsEyeIcon = ({ off = false }) => /* @__PURE__ */ a3(Icon, { children:
4046
4053
  /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "2.3" }),
4047
4054
  off && /* @__PURE__ */ a3("path", { d: "M3.5 3.5l13 13" })
4048
4055
  ] });
4049
- var CopyIcon = () => /* @__PURE__ */ a3(Icon, { children: [
4050
- /* @__PURE__ */ a3("rect", { x: "7", y: "7", width: "9.5", height: "9.5", rx: "1.8" }),
4051
- /* @__PURE__ */ a3("path", { d: "M13 7V5a1.5 1.5 0 0 0-1.5-1.5h-6A1.5 1.5 0 0 0 4 5v6a1.5 1.5 0 0 0 1.5 1.5H7" })
4052
- ] });
4053
4056
  var TextIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M4.5 5V3.8h11V5M10 3.8v12.5M7.5 16.3h5" }) });
4054
4057
 
4055
4058
  // src/store.ts
@@ -4510,6 +4513,7 @@ function DrawingToolbar({ ctx }) {
4510
4513
  ] });
4511
4514
  }
4512
4515
  var SWATCHES = ["#3182F6", "#F04452", "#12B886", "#FF9F0A", "#7048E8"];
4516
+ var MOD = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform) ? "\u2318" : "Ctrl+";
4513
4517
  var WIDTHS = [1, 2, 3, 4];
4514
4518
  var FONT_SIZES = [10, 12, 14, 16, 20, 24, 32];
4515
4519
  var DASH_ORDER = ["solid", "dashed", "dotted"];
@@ -4602,6 +4606,7 @@ function SelectionBar({ ctx }) {
4602
4606
  const [lift, setLift] = d2(() => readJson(LIFT_KEY, 0));
4603
4607
  const [menu, setMenu] = d2(null);
4604
4608
  const [sheet, setSheet] = d2(false);
4609
+ const [settingsTab, setSettingsTab] = d2("options");
4605
4610
  const [templates, setTemplates] = d2(() => readJson(TEMPLATES_KEY, {}));
4606
4611
  const [naming, setNaming] = d2(null);
4607
4612
  const bar = T2(null);
@@ -4640,7 +4645,10 @@ function SelectionBar({ ctx }) {
4640
4645
  const setStyleRaw = (next) => ctx.chart.updateDrawing(d3.id, { style: next });
4641
4646
  const current = d3.color ?? SWATCHES[0];
4642
4647
  const pickColor = (color) => {
4643
- if (style.colors || style.levels?.some((l3) => l3.color)) {
4648
+ if (def?.levels) {
4649
+ const { colors: _drop, ...rest } = style;
4650
+ ctx.chart.updateDrawing(d3.id, { color, style: { ...rest, levels: drawingLevels(def, d3).map((l3) => ({ ...l3, color })) } });
4651
+ } else if (style.colors || style.levels?.some((l3) => l3.color)) {
4644
4652
  const { colors: _drop, ...rest } = style;
4645
4653
  const levels = rest.levels?.map(({ color: _c, ...l3 }) => l3);
4646
4654
  ctx.chart.updateDrawing(d3.id, { color, style: { ...rest, ...levels ? { levels } : {} } });
@@ -4726,6 +4734,12 @@ function SelectionBar({ ctx }) {
4726
4734
  document.addEventListener("pointerup", up);
4727
4735
  };
4728
4736
  const phone = touchDevice();
4737
+ const hasOptions = !!def?.options && def.options.length > 0;
4738
+ const settingsTabs = [
4739
+ ...hasOptions ? [["options", t3.drawingOptions]] : [],
4740
+ ["coords", t3.coordinates],
4741
+ ["visibility", t3.tabVisibility]
4742
+ ];
4729
4743
  const widthIndex = Math.max(0, WIDTHS.indexOf(style.width ?? 2));
4730
4744
  const fontIndex = Math.max(0, FONT_SIZES.indexOf(style.fontSize ?? 14));
4731
4745
  const colorsBody = () => /* @__PURE__ */ a3($, { children: [
@@ -5016,7 +5030,21 @@ function SelectionBar({ ctx }) {
5016
5030
  children: /* @__PURE__ */ a3(GripIcon, {})
5017
5031
  }
5018
5032
  ),
5019
- !def?.levels && !def?.plain && /* @__PURE__ */ a3(ColorPicker, { class: "fnc-btn fnc-selbar-brush", boardClass: "fnc-palette-big", value: current, label: t3.color, tip: t3.color, t: t3, onPick: pickColor, onOpen: () => setMenu(null), children: /* @__PURE__ */ a3(BrushIcon, { color: current }) }),
5033
+ !def?.plain && /* @__PURE__ */ a3(ColorPicker, { class: "fnc-btn fnc-selbar-brush", boardClass: "fnc-palette-big", value: current, label: t3.color, tip: t3.color, t: t3, onPick: pickColor, onOpen: () => setMenu(null), children: /* @__PURE__ */ a3(BrushIcon, { color: current }) }),
5034
+ !phone && def && !def.text && !def.plain && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5035
+ /* @__PURE__ */ a3(
5036
+ "button",
5037
+ {
5038
+ class: style.text ? "fnc-btn fnc-btn-on" : "fnc-btn",
5039
+ "data-tip": t3.note,
5040
+ "aria-label": t3.note,
5041
+ "aria-expanded": menu === "note",
5042
+ onClick: () => setMenu(menu === "note" ? null : "note"),
5043
+ children: /* @__PURE__ */ a3(TextIcon, {})
5044
+ }
5045
+ ),
5046
+ menu === "note" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-note-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: noteBody() })
5047
+ ] }),
5020
5048
  phone && def && (def.text || !def.plain) && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5021
5049
  /* @__PURE__ */ a3(
5022
5050
  "button",
@@ -5081,9 +5109,29 @@ function SelectionBar({ ctx }) {
5081
5109
  /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.partColors, "aria-label": t3.partColors, "aria-expanded": menu === "colors", onClick: () => setMenu(menu === "colors" ? null : "colors"), children: /* @__PURE__ */ a3(PaletteIcon, {}) }),
5082
5110
  menu === "colors" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-part-menu", role: "menu", children: colorsBody() })
5083
5111
  ] }),
5084
- def?.options && def.options.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5085
- /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.drawingOptions, "aria-label": t3.drawingOptions, "aria-expanded": menu === "options", onClick: () => setMenu(menu === "options" ? null : "options"), children: /* @__PURE__ */ a3(SettingsIcon, {}) }),
5086
- menu === "options" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-options-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: optionsBody() })
5112
+ def && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5113
+ /* @__PURE__ */ a3(
5114
+ "button",
5115
+ {
5116
+ class: style.intervals ? "fnc-btn fnc-btn-on" : "fnc-btn",
5117
+ "data-tip": t3.drawingOptions,
5118
+ "aria-label": t3.drawingOptions,
5119
+ "aria-expanded": menu === "options",
5120
+ onClick: () => {
5121
+ setSettingsTab(hasOptions ? "options" : "coords");
5122
+ setMenu(menu === "options" ? null : "options");
5123
+ },
5124
+ children: /* @__PURE__ */ a3(SettingsIcon, {})
5125
+ }
5126
+ ),
5127
+ menu === "options" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-options-menu fnc-settings-pop", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
5128
+ /* @__PURE__ */ a3("div", { class: "fnc-tabs", role: "tablist", "aria-label": t3.drawingOptions, children: settingsTabs.map(([k2, label]) => /* @__PURE__ */ a3("button", { type: "button", class: "fnc-tab", role: "tab", "aria-selected": settingsTab === k2, onClick: () => setSettingsTab(k2), children: label })) }),
5129
+ /* @__PURE__ */ a3("div", { class: "fnc-settings-pop-body", children: [
5130
+ settingsTab === "options" && hasOptions && optionsBody(),
5131
+ settingsTab === "coords" && coordsBody(),
5132
+ settingsTab === "visibility" && visibilityBody()
5133
+ ] })
5134
+ ] })
5087
5135
  ] }),
5088
5136
  def?.levels && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5089
5137
  /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.levels, "aria-label": t3.levels, "aria-expanded": menu === "levels", onClick: () => setMenu(menu === "levels" ? null : "levels"), children: /* @__PURE__ */ a3(LevelsIcon, {}) }),
@@ -5189,78 +5237,71 @@ function SelectionBar({ ctx }) {
5189
5237
  }
5190
5238
  )),
5191
5239
  /* @__PURE__ */ a3("div", { class: "fnc-sep" }),
5192
- !phone && /* @__PURE__ */ a3($, { children: [
5193
- /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5194
- /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.drawingOrder, "aria-label": t3.drawingOrder, "aria-expanded": menu === "order", onClick: () => setMenu(menu === "order" ? null : "order"), children: /* @__PURE__ */ a3(LayersIcon, {}) }),
5195
- menu === "order" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop", role: "menu", children: orderBody() })
5196
- ] }),
5197
- def && !def.text && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5240
+ !phone && /* @__PURE__ */ a3($, {}),
5241
+ /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": locked ? t3.unlock : t3.lock, "aria-label": locked ? t3.unlock : t3.lock, "aria-pressed": locked, onClick: () => setStyle({ locked: !locked }), children: /* @__PURE__ */ a3(LockIcon, { open: !locked }) }),
5242
+ /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5243
+ /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.moreActions, "aria-label": t3.moreActions, "aria-expanded": menu === "more", onClick: () => setMenu(menu === "more" ? null : "more"), children: /* @__PURE__ */ a3(MoreIcon, {}) }),
5244
+ menu === "more" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-more-menu", role: "menu", children: [
5198
5245
  /* @__PURE__ */ a3(
5199
5246
  "button",
5200
5247
  {
5201
- class: style.text ? "fnc-btn fnc-btn-on" : "fnc-btn",
5202
- "data-tip": t3.note,
5203
- "aria-label": t3.note,
5204
- "aria-expanded": menu === "note",
5205
- onClick: () => setMenu(menu === "note" ? null : "note"),
5206
- children: /* @__PURE__ */ a3(TextIcon, {})
5248
+ class: "fnc-menu-item",
5249
+ role: "menuitem",
5250
+ onClick: () => {
5251
+ setMenu(null);
5252
+ const id = ctx.chart.addDrawing({ type: d3.type, points: d3.points.map((p3) => ({ ...p3 })), ...d3.color ? { color: d3.color } : {}, style: { ...style, locked: false } });
5253
+ ctx.chart.selectDrawing(id);
5254
+ },
5255
+ children: /* @__PURE__ */ a3("span", { children: t3.duplicate })
5207
5256
  }
5208
5257
  ),
5209
- menu === "note" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-note-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: noteBody() })
5210
- ] }),
5211
- /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5212
- /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.coordinates, "aria-label": t3.coordinates, "aria-expanded": menu === "coords", onClick: () => setMenu(menu === "coords" ? null : "coords"), children: /* @__PURE__ */ a3(CrossCursorIcon, {}) }),
5213
- menu === "coords" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-coords-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: coordsBody() })
5214
- ] }),
5215
- /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5216
5258
  /* @__PURE__ */ a3(
5217
5259
  "button",
5218
5260
  {
5219
- class: style.intervals ? "fnc-btn fnc-btn-on" : "fnc-btn",
5220
- "data-tip": t3.tabVisibility,
5221
- "aria-label": t3.tabVisibility,
5222
- "aria-expanded": menu === "visibility",
5223
- onClick: () => setMenu(menu === "visibility" ? null : "visibility"),
5224
- children: /* @__PURE__ */ a3(ClockIcon, {})
5261
+ class: "fnc-menu-item",
5262
+ role: "menuitem",
5263
+ onClick: () => {
5264
+ ctx.chart.copyDrawing(d3.id);
5265
+ setMenu(null);
5266
+ },
5267
+ children: [
5268
+ /* @__PURE__ */ a3("span", { children: t3.copyDrawing }),
5269
+ !phone && /* @__PURE__ */ a3("kbd", { children: [
5270
+ MOD,
5271
+ "C"
5272
+ ] })
5273
+ ]
5225
5274
  }
5226
5275
  ),
5227
- menu === "visibility" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-visibility-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: visibilityBody() })
5276
+ ctx.chart.canPasteDrawing() && /* @__PURE__ */ a3(
5277
+ "button",
5278
+ {
5279
+ class: "fnc-menu-item",
5280
+ role: "menuitem",
5281
+ onClick: () => {
5282
+ setMenu(null);
5283
+ ctx.chart.pasteDrawing();
5284
+ },
5285
+ children: [
5286
+ /* @__PURE__ */ a3("span", { children: t3.pasteDrawing }),
5287
+ !phone && /* @__PURE__ */ a3("kbd", { children: [
5288
+ MOD,
5289
+ "V"
5290
+ ] })
5291
+ ]
5292
+ }
5293
+ ),
5294
+ /* @__PURE__ */ a3("div", { class: "fnc-menu-sep", role: "separator" }),
5295
+ /* @__PURE__ */ a3("div", { class: "fnc-more-title", children: t3.drawingOrder }),
5296
+ orderBody()
5228
5297
  ] })
5229
5298
  ] }),
5230
- phone && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5231
- /* @__PURE__ */ a3("button", { class: "fnc-btn", "aria-label": t3.moreActions, "aria-expanded": menu === "more", onClick: () => setMenu(menu === "more" ? null : "more"), children: /* @__PURE__ */ a3(MoreIcon, {}) }),
5232
- menu === "more" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop", role: "menu", children: orderBody() })
5233
- ] }),
5234
- /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": locked ? t3.unlock : t3.lock, "aria-label": locked ? t3.unlock : t3.lock, "aria-pressed": locked, onClick: () => setStyle({ locked: !locked }), children: /* @__PURE__ */ a3(LockIcon, { open: !locked }) }),
5235
- /* @__PURE__ */ a3(
5236
- "button",
5237
- {
5238
- class: "fnc-btn",
5239
- "data-tip": t3.duplicate,
5240
- "aria-label": t3.duplicate,
5241
- onClick: () => {
5242
- const id = ctx.chart.addDrawing({ type: d3.type, points: d3.points.map((p3) => ({ ...p3 })), ...d3.color ? { color: d3.color } : {}, style: { ...style, locked: false } });
5243
- ctx.chart.selectDrawing(id);
5244
- },
5245
- children: /* @__PURE__ */ a3(CopyIcon, {})
5246
- }
5247
- ),
5248
5299
  /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.remove, "aria-label": t3.remove, onClick: () => ctx.chart.removeDrawing(d3.id), children: /* @__PURE__ */ a3(TrashIcon, {}) }),
5249
5300
  phone && sheet && /* @__PURE__ */ a3(StyleSheet, { ctx, title: t3.style, resetLabel: t3.resetDefaults, onReset: resetLook, onClose: () => setSheet(false), children: [
5250
5301
  !def?.plain && /* @__PURE__ */ a3("section", { class: "fnc-ss-section", children: [
5251
- !def?.levels && /* @__PURE__ */ a3("div", { class: "fnc-ss-row", children: [
5302
+ /* @__PURE__ */ a3("div", { class: "fnc-ss-row", children: [
5252
5303
  /* @__PURE__ */ a3("span", { children: t3.color }),
5253
- /* @__PURE__ */ a3(
5254
- ColorPicker,
5255
- {
5256
- class: "fnc-swatch fnc-ss-color",
5257
- style: { background: current },
5258
- value: current,
5259
- label: t3.color,
5260
- t: t3,
5261
- onPick: pickColor
5262
- }
5263
- )
5304
+ /* @__PURE__ */ a3(ColorPicker, { class: "fnc-swatch fnc-ss-color", style: { background: current }, value: current, label: t3.color, t: t3, onPick: pickColor })
5264
5305
  ] }),
5265
5306
  /* @__PURE__ */ a3("div", { class: "fnc-ss-row", children: [
5266
5307
  /* @__PURE__ */ a3("span", { children: t3.lineStyle }),
@@ -8315,6 +8356,7 @@ function PriceAxisPlus({ ctx }) {
8315
8356
  // src/components/overlay.tsx
8316
8357
  var ZOOM_STEP = 1.25;
8317
8358
  var CONTROL_OFFSET = 52;
8359
+ var NAV_NEAR = 100;
8318
8360
  var dirClass = (v3) => v3 > 0 ? "fnc-up" : v3 < 0 ? "fnc-down" : "fnc-flat";
8319
8361
  function IndicatorControls({ ctx, id, controls }) {
8320
8362
  const set = (key, value) => ctx.chart.setIndicatorControl(id, key, value);
@@ -8721,14 +8763,35 @@ function NavControls({ ctx }) {
8721
8763
  }),
8722
8764
  [ctx.chart]
8723
8765
  );
8766
+ const nav = T2(null);
8767
+ const [near, setNear] = d2(false);
8724
8768
  const { plotWidth, panesHeight } = s3.layout;
8769
+ const shown = (showButtons || locked) && !(s3.replay.active || s3.replay.selecting);
8770
+ A2(() => {
8771
+ const overlay = nav.current?.closest(".fnc-overlay");
8772
+ const host = overlay?.parentElement;
8773
+ if (!shown || !overlay || !host) return;
8774
+ const move = (e3) => {
8775
+ if (e3.pointerType !== "mouse") return;
8776
+ const r3 = overlay.getBoundingClientRect();
8777
+ const x2 = e3.clientX - r3.left;
8778
+ const y3 = e3.clientY - r3.top;
8779
+ setNear(x2 >= 0 && x2 <= plotWidth && y3 >= panesHeight - NAV_NEAR && y3 <= panesHeight + 30);
8780
+ };
8781
+ const leave = () => setNear(false);
8782
+ host.addEventListener("pointermove", move);
8783
+ host.addEventListener("pointerleave", leave);
8784
+ return () => {
8785
+ host.removeEventListener("pointermove", move);
8786
+ host.removeEventListener("pointerleave", leave);
8787
+ };
8788
+ }, [shown, plotWidth, panesHeight]);
8725
8789
  if (plotWidth <= 0) return null;
8726
8790
  const top = panesHeight - CONTROL_OFFSET;
8727
8791
  const page = () => Math.max(1, Math.round(plotWidth / ctx.chart.timeScale.barSpacing / 3));
8728
8792
  const button = (label, onClick, icon) => /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": label, "aria-label": label, onClick, children: icon });
8729
- const replaying = s3.replay.active || s3.replay.selecting;
8730
8793
  return /* @__PURE__ */ a3($, { children: [
8731
- (showButtons || locked) && !replaying && /* @__PURE__ */ a3("div", { class: locked ? "fnc-nav fnc-nav-locked" : "fnc-nav", style: { left: `${plotWidth / 2}px`, top: `${top}px` }, children: [
8794
+ shown && /* @__PURE__ */ a3("div", { ref: nav, class: `fnc-nav${locked ? " fnc-nav-locked" : ""}${near ? " is-near" : ""}`, style: { left: `${plotWidth / 2}px`, top: `${top}px` }, children: [
8732
8795
  !locked && button(t3.zoomOut, () => ctx.chart.zoom(1 / ZOOM_STEP), /* @__PURE__ */ a3(MinusIcon, {})),
8733
8796
  !locked && button(t3.zoomIn, () => ctx.chart.zoom(ZOOM_STEP), /* @__PURE__ */ a3(PlusIcon, {})),
8734
8797
  !locked && button(t3.scrollBack, () => ctx.chart.scrollBars(-page()), /* @__PURE__ */ a3(ChevronLeftIcon, {})),
@@ -8744,7 +8807,11 @@ function NavControls({ ctx }) {
8744
8807
  onClick: () => ctx.chart.setSettings({ lockView: !locked }),
8745
8808
  children: /* @__PURE__ */ a3(LockIcon, { open: !locked })
8746
8809
  }
8747
- )
8810
+ ),
8811
+ !locked && /* @__PURE__ */ a3($, { children: [
8812
+ /* @__PURE__ */ a3("div", { class: "fnc-sep" }),
8813
+ button(t3.hideNavButtons, () => ctx.chart.setSettings({ navigationButtons: false }), /* @__PURE__ */ a3(SmallCloseIcon, {}))
8814
+ ] })
8748
8815
  ] }),
8749
8816
  !s3.atRealtime && /* @__PURE__ */ a3(
8750
8817
  "button",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.65",
3
+ "version": "0.11.67",
4
4
  "description": "Pro trading UI (toolbar, drawing tools, sheets) for Funnest Charts. Framework-agnostic.",
5
5
  "keywords": [
6
6
  "chart",
@@ -42,7 +42,7 @@
42
42
  "NOTICE"
43
43
  ],
44
44
  "dependencies": {
45
- "@funnest/charts": "0.11.65"
45
+ "@funnest/charts": "0.11.67"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"