@funnest/charts-ui 0.11.66 → 0.11.68

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;
@@ -640,6 +642,8 @@ export declare const STRINGS: {
640
642
  lock: string;
641
643
  unlock: string;
642
644
  duplicate: string;
645
+ copyDrawing: string;
646
+ pasteDrawing: string;
643
647
  moreActions: string;
644
648
  moveBar: string;
645
649
  indicators: 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,7 +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",
754
- hideNavButtons: "\uD655\uB300\xB7\uC774\uB3D9 \uBC84\uD2BC \uC228\uAE30\uAE30 (\uCC28\uD2B8 \uC124\uC815\uC5D0\uC11C \uB2E4\uC2DC \uCF1C\uC694)",
756
+ hideNavButtons: "\uD655\uB300\xB7\uC774\uB3D9 \uBC84\uD2BC \uC228\uAE30\uAE30",
755
757
  lockRatio: "\uAC00\uACA9 \uCD95 \uBE44\uC728 \uACE0\uC815",
756
758
  settingAutoScale: "\uC790\uB3D9 \uB9DE\uCDA4",
757
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.",
@@ -1077,6 +1079,8 @@ var STRINGS = {
1077
1079
  lock: "Lock",
1078
1080
  unlock: "Unlock",
1079
1081
  duplicate: "Duplicate",
1082
+ copyDrawing: "Copy",
1083
+ pasteDrawing: "Paste",
1080
1084
  moreActions: "More",
1081
1085
  moveBar: "Drag to move (double-click to reset)",
1082
1086
  indicators: "Indicators",
@@ -1160,7 +1164,7 @@ var STRINGS = {
1160
1164
  moreToolsDown: "More tools below",
1161
1165
  lockView: "Lock chart",
1162
1166
  unlockView: "Unlock chart",
1163
- hideNavButtons: "Hide zoom & scroll buttons (turn them back on in chart settings)",
1167
+ hideNavButtons: "Hide zoom & scroll buttons",
1164
1168
  lockRatio: "Lock price to bar ratio",
1165
1169
  settingAutoScale: "Auto (fit to screen)",
1166
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.",
@@ -2172,6 +2176,9 @@ var CSS = (
2172
2176
  }
2173
2177
  .fnc-selbar-action.is-text { width: auto; padding: 0 8px; font-size: 12px; font-weight: 600; }
2174
2178
  .fnc-selbar-action.is-on { color: var(--fnc-accent); }
2179
+ /* \uC0AD\uC81C turns red and \uC54C\uB9BC yellow under the mouse. */
2180
+ .fnc-selbar .fnc-selbar-delete:hover { background: color-mix(in srgb, var(--fnc-danger, #F04452) 14%, transparent); color: var(--fnc-danger, #F04452); }
2181
+ .fnc-selbar .fnc-selbar-action.is-alert:hover { background: color-mix(in srgb, #FFB400 20%, transparent); color: #D99A00; }
2175
2182
  .fnc-selbar-action.is-on svg path:first-child { fill: currentColor; }
2176
2183
  .fnc-axis-plus-menu .fnc-menu-item { color: var(--fnc-text); font-weight: 600; }
2177
2184
  /* A menu row's glyph: one 18px column, so every label starts at the same x. */
@@ -2620,6 +2627,11 @@ var CSS = (
2620
2627
  .fnc-levels-menu { min-width: 340px; }
2621
2628
  .fnc-level-text { flex: 1; min-width: 0; width: 110px; height: 28px; padding: 0 8px; font-size: 13px; }
2622
2629
  .fnc-options-menu { min-width: 280px; max-height: min(70vh, 560px); overflow-y: auto; }
2630
+ /* \u2699 on a computer: \uC635\uC158 \xB7 \uC88C\uD45C \xB7 \uBCF4\uC784 as tabs over one body. */
2631
+ .fnc-menu.fnc-settings-pop { width: 340px; padding: 0; }
2632
+ .fnc-settings-pop .fnc-tabs { position: sticky; top: 0; z-index: 1; padding: 8px 10px; background: var(--fnc-bg); }
2633
+ .fnc-settings-pop-body { display: flex; flex-direction: column; padding: 6px; }
2634
+ .fnc-settings-pop-body > .fnc-coords, .fnc-settings-pop-body > .fnc-hint { padding: 4px 6px; }
2623
2635
  .fnc-option-row { display: flex; align-items: center; gap: 8px; }
2624
2636
  .fnc-option-row input[type='checkbox'] { width: 15px; height: 15px; margin: 0; accent-color: var(--fnc-accent, #3182f6); }
2625
2637
  .fnc-option-field { justify-content: space-between; padding: 4px 10px; font-size: 13px; color: var(--fnc-text); }
@@ -2639,6 +2651,10 @@ var CSS = (
2639
2651
  .fnc-template-name { width: calc(100% - 8px); margin: 4px; }
2640
2652
  .fnc-menu-note { padding: 8px 10px; color: var(--fnc-text-2); font-size: 12px; }
2641
2653
  .fnc-menu-sep { height: 1px; margin: 4px 6px; background: var(--fnc-border); }
2654
+ /* \u22EF on the drawing bar: \uBCF5\uC81C \xB7 \uBCF5\uC0AC \xB7 \uBD99\uC5EC\uB123\uAE30, then \uC21C\uC11C. */
2655
+ .fnc-more-menu { min-width: 220px; }
2656
+ .fnc-more-menu .fnc-menu-item kbd { margin-left: auto; font: inherit; font-size: 12px; color: var(--fnc-text-3); }
2657
+ .fnc-more-title { padding: 6px 10px 2px; font-size: 11px; font-weight: 700; color: var(--fnc-text-2); }
2642
2658
  .fnc-tools-layouts { display: flex; flex-direction: column; gap: 2px; padding: 0 2px 4px; }
2643
2659
  .fnc-tools-sep { height: 1px; margin: 6px 4px; background: var(--fnc-border); }
2644
2660
  .fnc-tools-icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
@@ -3926,19 +3942,11 @@ var GearIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: [
3926
3942
  /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "2.4" }),
3927
3943
  /* @__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" })
3928
3944
  ] });
3929
- var LayersIcon = () => /* @__PURE__ */ a3(Icon, { children: [
3930
- /* @__PURE__ */ a3("path", { d: "M10 4 3 7.5 10 11l7-3.5z", fill: "currentColor", "fill-opacity": "0.25" }),
3931
- /* @__PURE__ */ a3("path", { d: "M3 11l7 3.5 7-3.5" })
3932
- ] });
3933
3945
  var LevelsIcon = () => /* @__PURE__ */ a3(Icon, { children: [
3934
3946
  /* @__PURE__ */ a3("path", { d: "M3 5h9M3 10h14M3 15h11" }),
3935
3947
  /* @__PURE__ */ a3("circle", { cx: "15", cy: "5", r: "1.4" }),
3936
3948
  /* @__PURE__ */ a3("circle", { cx: "17", cy: "15", r: "1.4" })
3937
3949
  ] });
3938
- var TemplateIcon = () => /* @__PURE__ */ a3(Icon, { children: [
3939
- /* @__PURE__ */ a3("rect", { x: "3", y: "7", width: "10", height: "10", rx: "2" }),
3940
- /* @__PURE__ */ a3("path", { d: "M7 4h8a2 2 0 0 1 2 2v8" })
3941
- ] });
3942
3950
  var SmallPlusIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M5 10h10M10 5v10" }) });
3943
3951
  var SmallCloseIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M6 6l8 8M14 6l-8 8" }) });
3944
3952
  var EyeIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: [
@@ -3970,10 +3978,6 @@ var DiceIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: [
3970
3978
  /* @__PURE__ */ a3("circle", { cx: "12.8", cy: "12.8", r: "1.1", fill: "currentColor", stroke: "none" }),
3971
3979
  /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "1.1", fill: "currentColor", stroke: "none" })
3972
3980
  ] });
3973
- var ClockIcon = () => /* @__PURE__ */ a3(Icon, { size: 13, children: [
3974
- /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "7" }),
3975
- /* @__PURE__ */ a3("path", { d: "M10 6v4l2.5 1.5" })
3976
- ] });
3977
3981
  var SettingsIcon = () => /* @__PURE__ */ a3(Icon, { children: [
3978
3982
  /* @__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" }),
3979
3983
  /* @__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" })
@@ -4048,10 +4052,6 @@ var DrawingsEyeIcon = ({ off = false }) => /* @__PURE__ */ a3(Icon, { children:
4048
4052
  /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "2.3" }),
4049
4053
  off && /* @__PURE__ */ a3("path", { d: "M3.5 3.5l13 13" })
4050
4054
  ] });
4051
- var CopyIcon = () => /* @__PURE__ */ a3(Icon, { children: [
4052
- /* @__PURE__ */ a3("rect", { x: "7", y: "7", width: "9.5", height: "9.5", rx: "1.8" }),
4053
- /* @__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" })
4054
- ] });
4055
4055
  var TextIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M4.5 5V3.8h11V5M10 3.8v12.5M7.5 16.3h5" }) });
4056
4056
 
4057
4057
  // src/store.ts
@@ -4512,6 +4512,7 @@ function DrawingToolbar({ ctx }) {
4512
4512
  ] });
4513
4513
  }
4514
4514
  var SWATCHES = ["#3182F6", "#F04452", "#12B886", "#FF9F0A", "#7048E8"];
4515
+ var MOD = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform) ? "\u2318" : "Ctrl+";
4515
4516
  var WIDTHS = [1, 2, 3, 4];
4516
4517
  var FONT_SIZES = [10, 12, 14, 16, 20, 24, 32];
4517
4518
  var DASH_ORDER = ["solid", "dashed", "dotted"];
@@ -4604,6 +4605,7 @@ function SelectionBar({ ctx }) {
4604
4605
  const [lift, setLift] = d2(() => readJson(LIFT_KEY, 0));
4605
4606
  const [menu, setMenu] = d2(null);
4606
4607
  const [sheet, setSheet] = d2(false);
4608
+ const [settingsTab, setSettingsTab] = d2("options");
4607
4609
  const [templates, setTemplates] = d2(() => readJson(TEMPLATES_KEY, {}));
4608
4610
  const [naming, setNaming] = d2(null);
4609
4611
  const bar = T2(null);
@@ -4642,7 +4644,10 @@ function SelectionBar({ ctx }) {
4642
4644
  const setStyleRaw = (next) => ctx.chart.updateDrawing(d3.id, { style: next });
4643
4645
  const current = d3.color ?? SWATCHES[0];
4644
4646
  const pickColor = (color) => {
4645
- if (style.colors || style.levels?.some((l3) => l3.color)) {
4647
+ if (def?.levels) {
4648
+ const { colors: _drop, ...rest } = style;
4649
+ ctx.chart.updateDrawing(d3.id, { color, style: { ...rest, levels: drawingLevels(def, d3).map((l3) => ({ ...l3, color })) } });
4650
+ } else if (style.colors || style.levels?.some((l3) => l3.color)) {
4646
4651
  const { colors: _drop, ...rest } = style;
4647
4652
  const levels = rest.levels?.map(({ color: _c, ...l3 }) => l3);
4648
4653
  ctx.chart.updateDrawing(d3.id, { color, style: { ...rest, ...levels ? { levels } : {} } });
@@ -4728,6 +4733,12 @@ function SelectionBar({ ctx }) {
4728
4733
  document.addEventListener("pointerup", up);
4729
4734
  };
4730
4735
  const phone = touchDevice();
4736
+ const hasOptions = !!def?.options && def.options.length > 0;
4737
+ const settingsTabs = [
4738
+ ...hasOptions ? [["options", t3.drawingOptions]] : [],
4739
+ ["coords", t3.coordinates],
4740
+ ["visibility", t3.tabVisibility]
4741
+ ];
4731
4742
  const widthIndex = Math.max(0, WIDTHS.indexOf(style.width ?? 2));
4732
4743
  const fontIndex = Math.max(0, FONT_SIZES.indexOf(style.fontSize ?? 14));
4733
4744
  const colorsBody = () => /* @__PURE__ */ a3($, { children: [
@@ -5018,7 +5029,21 @@ function SelectionBar({ ctx }) {
5018
5029
  children: /* @__PURE__ */ a3(GripIcon, {})
5019
5030
  }
5020
5031
  ),
5021
- !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 }) }),
5032
+ !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
+ !phone && def && !def.text && !def.plain && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5034
+ /* @__PURE__ */ a3(
5035
+ "button",
5036
+ {
5037
+ class: style.text ? "fnc-btn fnc-btn-on" : "fnc-btn",
5038
+ "data-tip": t3.note,
5039
+ "aria-label": t3.note,
5040
+ "aria-expanded": menu === "note",
5041
+ onClick: () => setMenu(menu === "note" ? null : "note"),
5042
+ children: /* @__PURE__ */ a3(TextIcon, {})
5043
+ }
5044
+ ),
5045
+ 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() })
5046
+ ] }),
5022
5047
  phone && def && (def.text || !def.plain) && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5023
5048
  /* @__PURE__ */ a3(
5024
5049
  "button",
@@ -5065,28 +5090,11 @@ function SelectionBar({ ctx }) {
5065
5090
  ] })
5066
5091
  ] })
5067
5092
  ] }),
5068
- phone && /* @__PURE__ */ a3(
5069
- "button",
5070
- {
5071
- class: "fnc-btn",
5072
- "aria-label": t3.style,
5073
- "aria-expanded": sheet,
5074
- onClick: () => {
5075
- setMenu(null);
5076
- setSheet(true);
5077
- },
5078
- children: /* @__PURE__ */ a3(SettingsIcon, {})
5079
- }
5080
- ),
5081
5093
  !phone && /* @__PURE__ */ a3($, { children: [
5082
5094
  slots.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5083
5095
  /* @__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, {}) }),
5084
5096
  menu === "colors" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-part-menu", role: "menu", children: colorsBody() })
5085
5097
  ] }),
5086
- def?.options && def.options.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5087
- /* @__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, {}) }),
5088
- 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() })
5089
- ] }),
5090
5098
  def?.levels && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5091
5099
  /* @__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, {}) }),
5092
5100
  menu === "levels" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-levels-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: levelsBody() })
@@ -5156,30 +5164,13 @@ function SelectionBar({ ctx }) {
5156
5164
  ] })
5157
5165
  }
5158
5166
  )) })
5159
- ] }),
5160
- /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5161
- /* @__PURE__ */ a3(
5162
- "button",
5163
- {
5164
- class: "fnc-btn",
5165
- "data-tip": t3.templates,
5166
- "aria-label": t3.templates,
5167
- "aria-expanded": menu === "template",
5168
- onClick: () => {
5169
- setNaming(null);
5170
- setMenu(menu === "template" ? null : "template");
5171
- },
5172
- children: /* @__PURE__ */ a3(TemplateIcon, {})
5173
- }
5174
- ),
5175
- menu === "template" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-template-menu", role: "menu", children: templateBody() })
5176
5167
  ] })
5177
5168
  ] }),
5178
5169
  actions.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-sep" }),
5179
5170
  actions.map((a4) => /* @__PURE__ */ a3(
5180
5171
  "button",
5181
5172
  {
5182
- class: `fnc-btn fnc-selbar-action${a4.icon ? "" : " is-text"}${a4.pressed ? " is-on" : ""}`,
5173
+ class: `fnc-btn fnc-selbar-action${a4.icon ? "" : " is-text"}${a4.icon === "alert" ? " is-alert" : ""}${a4.pressed ? " is-on" : ""}`,
5183
5174
  "data-tip": a4.label,
5184
5175
  "aria-label": a4.label,
5185
5176
  "aria-pressed": a4.pressed,
@@ -5191,78 +5182,126 @@ function SelectionBar({ ctx }) {
5191
5182
  }
5192
5183
  )),
5193
5184
  /* @__PURE__ */ a3("div", { class: "fnc-sep" }),
5194
- !phone && /* @__PURE__ */ a3($, { children: [
5195
- /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5196
- /* @__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, {}) }),
5197
- menu === "order" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop", role: "menu", children: orderBody() })
5198
- ] }),
5199
- def && !def.text && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5185
+ !phone && /* @__PURE__ */ a3($, {}),
5186
+ /* @__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 }) }),
5187
+ /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5188
+ /* @__PURE__ */ a3(
5189
+ "button",
5190
+ {
5191
+ class: "fnc-btn",
5192
+ "data-tip": t3.moreActions,
5193
+ "aria-label": t3.moreActions,
5194
+ "aria-expanded": menu === "more",
5195
+ onClick: () => {
5196
+ setNaming(null);
5197
+ setMenu(menu === "more" ? null : "more");
5198
+ },
5199
+ children: /* @__PURE__ */ a3(MoreIcon, {})
5200
+ }
5201
+ ),
5202
+ menu === "more" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-more-menu", role: "menu", children: [
5200
5203
  /* @__PURE__ */ a3(
5201
5204
  "button",
5202
5205
  {
5203
- class: style.text ? "fnc-btn fnc-btn-on" : "fnc-btn",
5204
- "data-tip": t3.note,
5205
- "aria-label": t3.note,
5206
- "aria-expanded": menu === "note",
5207
- onClick: () => setMenu(menu === "note" ? null : "note"),
5208
- children: /* @__PURE__ */ a3(TextIcon, {})
5206
+ class: "fnc-menu-item",
5207
+ role: "menuitem",
5208
+ onClick: () => {
5209
+ setMenu(null);
5210
+ const id = ctx.chart.addDrawing({ type: d3.type, points: d3.points.map((p3) => ({ ...p3 })), ...d3.color ? { color: d3.color } : {}, style: { ...style, locked: false } });
5211
+ ctx.chart.selectDrawing(id);
5212
+ },
5213
+ children: /* @__PURE__ */ a3("span", { children: t3.duplicate })
5209
5214
  }
5210
5215
  ),
5211
- 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() })
5212
- ] }),
5213
- /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5214
- /* @__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, {}) }),
5215
- 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() })
5216
- ] }),
5217
- /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5218
5216
  /* @__PURE__ */ a3(
5219
5217
  "button",
5220
5218
  {
5221
- class: style.intervals ? "fnc-btn fnc-btn-on" : "fnc-btn",
5222
- "data-tip": t3.tabVisibility,
5223
- "aria-label": t3.tabVisibility,
5224
- "aria-expanded": menu === "visibility",
5225
- onClick: () => setMenu(menu === "visibility" ? null : "visibility"),
5226
- children: /* @__PURE__ */ a3(ClockIcon, {})
5219
+ class: "fnc-menu-item",
5220
+ role: "menuitem",
5221
+ onClick: () => {
5222
+ ctx.chart.copyDrawing(d3.id);
5223
+ setMenu(null);
5224
+ },
5225
+ children: [
5226
+ /* @__PURE__ */ a3("span", { children: t3.copyDrawing }),
5227
+ !phone && /* @__PURE__ */ a3("kbd", { children: [
5228
+ MOD,
5229
+ "C"
5230
+ ] })
5231
+ ]
5227
5232
  }
5228
5233
  ),
5229
- 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() })
5234
+ ctx.chart.canPasteDrawing() && /* @__PURE__ */ a3(
5235
+ "button",
5236
+ {
5237
+ class: "fnc-menu-item",
5238
+ role: "menuitem",
5239
+ onClick: () => {
5240
+ setMenu(null);
5241
+ ctx.chart.pasteDrawing();
5242
+ },
5243
+ children: [
5244
+ /* @__PURE__ */ a3("span", { children: t3.pasteDrawing }),
5245
+ !phone && /* @__PURE__ */ a3("kbd", { children: [
5246
+ MOD,
5247
+ "V"
5248
+ ] })
5249
+ ]
5250
+ }
5251
+ ),
5252
+ /* @__PURE__ */ a3("div", { class: "fnc-menu-sep", role: "separator" }),
5253
+ /* @__PURE__ */ a3("div", { class: "fnc-more-title", children: t3.drawingOrder }),
5254
+ orderBody(),
5255
+ !phone && /* @__PURE__ */ a3($, { children: [
5256
+ /* @__PURE__ */ a3("div", { class: "fnc-menu-sep", role: "separator" }),
5257
+ /* @__PURE__ */ a3("div", { class: "fnc-more-title", children: t3.templates }),
5258
+ templateBody()
5259
+ ] })
5230
5260
  ] })
5231
5261
  ] }),
5232
- phone && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5233
- /* @__PURE__ */ a3("button", { class: "fnc-btn", "aria-label": t3.moreActions, "aria-expanded": menu === "more", onClick: () => setMenu(menu === "more" ? null : "more"), children: /* @__PURE__ */ a3(MoreIcon, {}) }),
5234
- menu === "more" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop", role: "menu", children: orderBody() })
5235
- ] }),
5236
- /* @__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 }) }),
5237
- /* @__PURE__ */ a3(
5262
+ phone && /* @__PURE__ */ a3(
5238
5263
  "button",
5239
5264
  {
5240
5265
  class: "fnc-btn",
5241
- "data-tip": t3.duplicate,
5242
- "aria-label": t3.duplicate,
5266
+ "aria-label": t3.style,
5267
+ "aria-expanded": sheet,
5243
5268
  onClick: () => {
5244
- const id = ctx.chart.addDrawing({ type: d3.type, points: d3.points.map((p3) => ({ ...p3 })), ...d3.color ? { color: d3.color } : {}, style: { ...style, locked: false } });
5245
- ctx.chart.selectDrawing(id);
5269
+ setMenu(null);
5270
+ setSheet(true);
5246
5271
  },
5247
- children: /* @__PURE__ */ a3(CopyIcon, {})
5272
+ children: /* @__PURE__ */ a3(SettingsIcon, {})
5248
5273
  }
5249
5274
  ),
5250
- /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.remove, "aria-label": t3.remove, onClick: () => ctx.chart.removeDrawing(d3.id), children: /* @__PURE__ */ a3(TrashIcon, {}) }),
5275
+ !phone && def && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
5276
+ /* @__PURE__ */ a3(
5277
+ "button",
5278
+ {
5279
+ class: style.intervals ? "fnc-btn fnc-btn-on" : "fnc-btn",
5280
+ "data-tip": t3.drawingOptions,
5281
+ "aria-label": t3.drawingOptions,
5282
+ "aria-expanded": menu === "options",
5283
+ onClick: () => {
5284
+ setSettingsTab(hasOptions ? "options" : "coords");
5285
+ setMenu(menu === "options" ? null : "options");
5286
+ },
5287
+ children: /* @__PURE__ */ a3(SettingsIcon, {})
5288
+ }
5289
+ ),
5290
+ 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: [
5291
+ /* @__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 })) }),
5292
+ /* @__PURE__ */ a3("div", { class: "fnc-settings-pop-body", children: [
5293
+ settingsTab === "options" && hasOptions && optionsBody(),
5294
+ settingsTab === "coords" && coordsBody(),
5295
+ settingsTab === "visibility" && visibilityBody()
5296
+ ] })
5297
+ ] })
5298
+ ] }),
5299
+ /* @__PURE__ */ a3("button", { class: "fnc-btn fnc-selbar-delete", "data-tip": t3.remove, "aria-label": t3.remove, onClick: () => ctx.chart.removeDrawing(d3.id), children: /* @__PURE__ */ a3(TrashIcon, {}) }),
5251
5300
  phone && sheet && /* @__PURE__ */ a3(StyleSheet, { ctx, title: t3.style, resetLabel: t3.resetDefaults, onReset: resetLook, onClose: () => setSheet(false), children: [
5252
5301
  !def?.plain && /* @__PURE__ */ a3("section", { class: "fnc-ss-section", children: [
5253
- !def?.levels && /* @__PURE__ */ a3("div", { class: "fnc-ss-row", children: [
5302
+ /* @__PURE__ */ a3("div", { class: "fnc-ss-row", children: [
5254
5303
  /* @__PURE__ */ a3("span", { children: t3.color }),
5255
- /* @__PURE__ */ a3(
5256
- ColorPicker,
5257
- {
5258
- class: "fnc-swatch fnc-ss-color",
5259
- style: { background: current },
5260
- value: current,
5261
- label: t3.color,
5262
- t: t3,
5263
- onPick: pickColor
5264
- }
5265
- )
5304
+ /* @__PURE__ */ a3(ColorPicker, { class: "fnc-swatch fnc-ss-color", style: { background: current }, value: current, label: t3.color, t: t3, onPick: pickColor })
5266
5305
  ] }),
5267
5306
  /* @__PURE__ */ a3("div", { class: "fnc-ss-row", children: [
5268
5307
  /* @__PURE__ */ a3("span", { children: t3.lineStyle }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.66",
3
+ "version": "0.11.68",
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.66"
45
+ "@funnest/charts": "0.11.68"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"