@funnest/charts-ui 0.11.5 → 0.11.7

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.
@@ -1,7 +1,7 @@
1
1
  import type { WidgetContext } from '../context.js';
2
2
  /**
3
3
  * Right-click menu on the chart (mouse only): undo/redo, the host's own items
4
- * (`contextMenuItems`), a horizontal line at the clicked price, reset and settings.
4
+ * (`contextMenuItems`), go to date, lock chart, reset and settings.
5
5
  */
6
6
  export declare function ContextMenu({ ctx }: {
7
7
  ctx: WidgetContext;
@@ -5,3 +5,12 @@
5
5
  * Attach the returned ref to the menu element.
6
6
  */
7
7
  export declare function useKeepInView<T extends HTMLElement>(open: boolean): import("preact").RefObject<T | null>;
8
+ /**
9
+ * A menu that opens beside its button (the drawing bar's tool lists): placed in the viewport
10
+ * (position: fixed), so a drawing bar that scrolls — a short chart — can't clip it behind the chart.
11
+ * A transformed ancestor moves where fixed boxes land; that offset is measured and taken out. Kept
12
+ * on screen vertically, and moved along when the bar scrolls or the window changes.
13
+ */
14
+ export declare function useBesideAnchor<T extends HTMLElement>(open: boolean, anchor: {
15
+ current: HTMLElement | null;
16
+ }): import("preact").RefObject<T | null>;
package/dist/i18n.d.ts CHANGED
@@ -76,6 +76,24 @@ export declare const STRINGS: {
76
76
  scalePercentLong: string;
77
77
  scaleIndexed: string;
78
78
  scaleIndexedShort: string;
79
+ settingsChart: string;
80
+ settingBackground: string;
81
+ bgSolid: string;
82
+ bgGradient: string;
83
+ bgGradientBottom: string;
84
+ settingGridColor: string;
85
+ settingPaneBorder: string;
86
+ settingCrosshair: string;
87
+ settingAxisText: string;
88
+ settingAxisBg: string;
89
+ settingUpBody: string;
90
+ settingDownBody: string;
91
+ settingUpBorder: string;
92
+ settingDownBorder: string;
93
+ settingUpWick: string;
94
+ settingDownWick: string;
95
+ settingVolumeUp: string;
96
+ settingVolumeDown: string;
79
97
  settingsTabLook: string;
80
98
  settingsTabMotion: string;
81
99
  settingsWatermark: string;
@@ -387,6 +405,24 @@ export declare const STRINGS: {
387
405
  scalePercentLong: string;
388
406
  scaleIndexed: string;
389
407
  scaleIndexedShort: string;
408
+ settingsChart: string;
409
+ settingBackground: string;
410
+ bgSolid: string;
411
+ bgGradient: string;
412
+ bgGradientBottom: string;
413
+ settingGridColor: string;
414
+ settingPaneBorder: string;
415
+ settingCrosshair: string;
416
+ settingAxisText: string;
417
+ settingAxisBg: string;
418
+ settingUpBody: string;
419
+ settingDownBody: string;
420
+ settingUpBorder: string;
421
+ settingDownBorder: string;
422
+ settingUpWick: string;
423
+ settingDownWick: string;
424
+ settingVolumeUp: string;
425
+ settingVolumeDown: string;
390
426
  settingsTabLook: string;
391
427
  settingsTabMotion: string;
392
428
  settingsWatermark: string;
package/dist/index.js CHANGED
@@ -511,6 +511,24 @@ var STRINGS = {
511
511
  scalePercentLong: "\uD37C\uC13C\uD2B8",
512
512
  scaleIndexed: "100 \uAE30\uC900",
513
513
  scaleIndexedShort: "100",
514
+ settingsChart: "\uCC28\uD2B8",
515
+ settingBackground: "\uBC30\uACBD",
516
+ bgSolid: "\uB2E8\uC0C9",
517
+ bgGradient: "\uADF8\uB77C\uB370\uC774\uC158",
518
+ bgGradientBottom: "\uBC30\uACBD \uC544\uB798\uCABD",
519
+ settingGridColor: "\uACA9\uC790",
520
+ settingPaneBorder: "\uCC3D \uAD6C\uBD84\uC120",
521
+ settingCrosshair: "\uD06C\uB85C\uC2A4\uD5E4\uC5B4",
522
+ settingAxisText: "\uCD95 \uD14D\uC2A4\uD2B8",
523
+ settingAxisBg: "\uCD95 \uBC30\uACBD",
524
+ settingUpBody: "\uC0C1\uC2B9 \uCE94\uB4E4",
525
+ settingDownBody: "\uD558\uB77D \uCE94\uB4E4",
526
+ settingUpBorder: "\uC0C1\uC2B9 \uD14C\uB450\uB9AC",
527
+ settingDownBorder: "\uD558\uB77D \uD14C\uB450\uB9AC",
528
+ settingUpWick: "\uC0C1\uC2B9 \uAF2C\uB9AC",
529
+ settingDownWick: "\uD558\uB77D \uAF2C\uB9AC",
530
+ settingVolumeUp: "\uC0C1\uC2B9 \uAC70\uB798\uB7C9",
531
+ settingVolumeDown: "\uD558\uB77D \uAC70\uB798\uB7C9",
514
532
  settingsTabLook: "\uBAA8\uC2B5",
515
533
  settingsTabMotion: "\uC560\uB2C8\uBA54\uC774\uC158",
516
534
  settingsWatermark: "\uC6CC\uD130\uB9C8\uD06C",
@@ -824,6 +842,24 @@ var STRINGS = {
824
842
  scalePercentLong: "Percent",
825
843
  scaleIndexed: "Indexed to 100",
826
844
  scaleIndexedShort: "100",
845
+ settingsChart: "Chart",
846
+ settingBackground: "Background",
847
+ bgSolid: "Solid",
848
+ bgGradient: "Gradient",
849
+ bgGradientBottom: "Background bottom",
850
+ settingGridColor: "Grid",
851
+ settingPaneBorder: "Pane separators",
852
+ settingCrosshair: "Crosshair",
853
+ settingAxisText: "Axis text",
854
+ settingAxisBg: "Axis background",
855
+ settingUpBody: "Up candles",
856
+ settingDownBody: "Down candles",
857
+ settingUpBorder: "Up borders",
858
+ settingDownBorder: "Down borders",
859
+ settingUpWick: "Up wicks",
860
+ settingDownWick: "Down wicks",
861
+ settingVolumeUp: "Up volume",
862
+ settingVolumeDown: "Down volume",
827
863
  settingsTabLook: "Appearance",
828
864
  settingsTabMotion: "Animation",
829
865
  settingsWatermark: "Watermark",
@@ -1147,6 +1183,66 @@ function IntervalVisibilityEditor({ t: t3, value, onChange }) {
1147
1183
  }) });
1148
1184
  }
1149
1185
 
1186
+ // src/components/keep-in-view.ts
1187
+ var MARGIN = 8;
1188
+ function useKeepInView(open) {
1189
+ const ref = T2(null);
1190
+ F2(() => {
1191
+ const el = ref.current;
1192
+ if (!open || !el) return;
1193
+ el.style.translate = "";
1194
+ const fit2 = () => {
1195
+ el.style.translate = "";
1196
+ el.style.maxHeight = "";
1197
+ const r3 = el.getBoundingClientRect();
1198
+ const root = el.closest(".fnc-root")?.getBoundingClientRect();
1199
+ const maxY = Math.min(document.documentElement.clientHeight, root?.bottom ?? Infinity) - MARGIN;
1200
+ if (r3.bottom > maxY) {
1201
+ el.style.maxHeight = `${Math.max(120, Math.floor(maxY - r3.top))}px`;
1202
+ el.style.overflowY = "auto";
1203
+ }
1204
+ const minX = Math.max(0, root?.left ?? 0) + MARGIN;
1205
+ const maxX = Math.min(document.documentElement.clientWidth, root?.right ?? Infinity) - MARGIN;
1206
+ let dx = 0;
1207
+ if (r3.right > maxX) dx = maxX - r3.right;
1208
+ if (r3.left + dx < minX) dx = minX - r3.left;
1209
+ if (dx) el.style.translate = `${Math.round(dx)}px 0`;
1210
+ };
1211
+ fit2();
1212
+ window.addEventListener("resize", fit2);
1213
+ return () => window.removeEventListener("resize", fit2);
1214
+ }, [open]);
1215
+ return ref;
1216
+ }
1217
+ function useBesideAnchor(open, anchor) {
1218
+ const ref = T2(null);
1219
+ F2(() => {
1220
+ const el = ref.current;
1221
+ const a4 = anchor.current;
1222
+ if (!open || !el || !a4) return;
1223
+ const place = () => {
1224
+ const r3 = a4.getBoundingClientRect();
1225
+ el.style.position = "fixed";
1226
+ el.style.left = "0px";
1227
+ el.style.top = "0px";
1228
+ const origin = el.getBoundingClientRect();
1229
+ const vh = document.documentElement.clientHeight;
1230
+ const top = Math.max(MARGIN, Math.min(r3.top, vh - MARGIN - el.offsetHeight));
1231
+ el.style.left = `${Math.round(r3.right + 8 - origin.left)}px`;
1232
+ el.style.top = `${Math.round(top - origin.top)}px`;
1233
+ };
1234
+ place();
1235
+ const bar = a4.closest(".fnc-drawbar");
1236
+ window.addEventListener("resize", place);
1237
+ bar?.addEventListener("scroll", place);
1238
+ return () => {
1239
+ window.removeEventListener("resize", place);
1240
+ bar?.removeEventListener("scroll", place);
1241
+ };
1242
+ }, [open]);
1243
+ return ref;
1244
+ }
1245
+
1150
1246
  // src/icons.tsx
1151
1247
  function Icon({ children, size = 20 }) {
1152
1248
  return /* @__PURE__ */ a3(
@@ -1460,6 +1556,7 @@ function ToolGroup({
1460
1556
  const current = armed ?? tools.find((d3) => d3.type === chosen) ?? tools[0];
1461
1557
  const name = current.name[s3.locale];
1462
1558
  const ref = T2(null);
1559
+ const menu = useBesideAnchor(open, ref);
1463
1560
  A2(() => {
1464
1561
  if (!open) return;
1465
1562
  const close = (e3) => !ref.current?.contains(e3.target) && onOpen(false);
@@ -1482,7 +1579,7 @@ function ToolGroup({
1482
1579
  /* @__PURE__ */ a3("span", { class: "fnc-tool-corner", children: /* @__PURE__ */ a3(CornerIcon, {}) }),
1483
1580
  /* @__PURE__ */ a3("span", { class: "fnc-tool-chevron", children: /* @__PURE__ */ a3(ChevronRightIcon, {}) })
1484
1581
  ] }),
1485
- open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-tool-menu", role: "menu", children: tools.map((def, i3) => {
1582
+ open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-tool-menu", role: "menu", ref: menu, children: tools.map((def, i3) => {
1486
1583
  const section = def.section?.[s3.locale];
1487
1584
  const heading = section && section !== tools[i3 - 1]?.section?.[s3.locale];
1488
1585
  return /* @__PURE__ */ a3($, { children: [
@@ -1519,6 +1616,7 @@ function CursorGroup({ ctx, open, onOpen, onPick }) {
1519
1616
  const s3 = useStore(ctx.store);
1520
1617
  const t3 = stringsOf(s3);
1521
1618
  const ref = T2(null);
1619
+ const menu = useBesideAnchor(open, ref);
1522
1620
  const current = CURSORS.find((c3) => c3.mode === s3.cursorMode) ?? CURSORS[0];
1523
1621
  A2(() => {
1524
1622
  if (!open) return;
@@ -1538,7 +1636,7 @@ function CursorGroup({ ctx, open, onOpen, onPick }) {
1538
1636
  /* @__PURE__ */ a3("span", { class: "fnc-tool-corner", children: /* @__PURE__ */ a3(CornerIcon, {}) }),
1539
1637
  /* @__PURE__ */ a3("span", { class: "fnc-tool-chevron", children: /* @__PURE__ */ a3(ChevronRightIcon, {}) })
1540
1638
  ] }),
1541
- open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-tool-menu", role: "menu", children: [
1639
+ open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-tool-menu", role: "menu", ref: menu, children: [
1542
1640
  /* @__PURE__ */ a3("div", { class: "fnc-tool-section", role: "presentation", children: t3.cursorModes }),
1543
1641
  CURSORS.map((c3) => /* @__PURE__ */ a3(
1544
1642
  "button",
@@ -2915,6 +3013,7 @@ import {
2915
3013
  CHART_THEMES,
2916
3014
  DEFAULT_CHART_SETTINGS,
2917
3015
  matchChartTheme,
3016
+ themeSettings,
2918
3017
  resolutionToMs as resolutionToMs2
2919
3018
  } from "@funnest/charts";
2920
3019
  function toHex(color) {
@@ -2951,6 +3050,25 @@ var MOTION_ROWS = [
2951
3050
  { key: "priceAnimation", label: "settingPriceAnimation", hint: "hintPriceAnimation" },
2952
3051
  { key: "drawOnLoad", label: "settingDrawOnLoad", hint: "hintDrawOnLoad" }
2953
3052
  ];
3053
+ var CHART_COLORS = [
3054
+ { key: "gridColor", label: "settingGridColor", shown: (p3) => p3.grid },
3055
+ { key: "paneBorderColor", label: "settingPaneBorder", shown: (p3) => p3.border },
3056
+ { key: "crosshairColor", label: "settingCrosshair", shown: (p3) => p3.crosshair },
3057
+ { key: "axisTextColor", label: "settingAxisText", shown: (p3) => p3.axisText },
3058
+ { key: "axisBackground", label: "settingAxisBg", shown: (p3) => p3.axisBackground }
3059
+ ];
3060
+ var CANDLE_COLORS = [
3061
+ { key: "upColor", label: "settingUpBody", shown: (p3) => p3.up },
3062
+ { key: "downColor", label: "settingDownBody", shown: (p3) => p3.down },
3063
+ { key: "upBorderColor", label: "settingUpBorder", shown: (p3) => p3.upBorder },
3064
+ { key: "downBorderColor", label: "settingDownBorder", shown: (p3) => p3.downBorder },
3065
+ { key: "upWickColor", label: "settingUpWick", shown: (p3) => p3.upWick },
3066
+ { key: "downWickColor", label: "settingDownWick", shown: (p3) => p3.downWick }
3067
+ ];
3068
+ var VOLUME_COLORS = [
3069
+ { key: "volumeUpColor", label: "settingVolumeUp", shown: (p3) => p3.volumeUp, seeThrough: true },
3070
+ { key: "volumeDownColor", label: "settingVolumeDown", shown: (p3) => p3.volumeDown, seeThrough: true }
3071
+ ];
2954
3072
  var SCALES = [
2955
3073
  { mode: "normal", label: "scaleNormal" },
2956
3074
  { mode: "percent", label: "scalePercentLong" },
@@ -2969,6 +3087,12 @@ function SettingsDialog({ ctx }) {
2969
3087
  const set = (patch) => ctx.chart.setSettings(patch);
2970
3088
  const themeColor = (name) => toHex(getComputedStyle(ctx.root).getPropertyValue(name).trim());
2971
3089
  const currentTheme = matchChartTheme(settings);
3090
+ const palette = ctx.chart.paletteInUse;
3091
+ const colorRow = ({ key, label, shown: shown2, seeThrough }) => /* @__PURE__ */ a3("div", { class: "fnc-row fnc-color-row", children: [
3092
+ /* @__PURE__ */ a3("span", { class: "fnc-toggle-label", children: t3[label] }),
3093
+ settings[key] && /* @__PURE__ */ a3("button", { type: "button", class: "fnc-color-reset", title: t3.followTheme, "aria-label": `${t3[label]} ${t3.followTheme}`, onClick: () => set({ [key]: null }), children: /* @__PURE__ */ a3(ResetIcon, {}) }),
3094
+ /* @__PURE__ */ a3(Swatch, { label: t3[label], color: toHex(shown2(palette)), seeThrough, onPick: (c3) => set({ [key]: c3 }) })
3095
+ ] });
2972
3096
  const tabs = [
2973
3097
  ["look", t3.settingsTabLook],
2974
3098
  ["scale", t3.settingsScale],
@@ -3001,7 +3125,7 @@ function SettingsDialog({ ctx }) {
3001
3125
  const grid = c3.gridColor ?? themeColor("--fnc-border");
3002
3126
  const up = c3.upColor ?? themeColor("--fnc-up");
3003
3127
  const down = c3.downColor ?? themeColor("--fnc-down");
3004
- return /* @__PURE__ */ a3("button", { type: "button", role: "radio", class: "fnc-theme", "aria-checked": currentTheme?.id === theme.id, onClick: () => set({ ...c3 }), children: [
3128
+ return /* @__PURE__ */ a3("button", { type: "button", role: "radio", class: "fnc-theme", "aria-checked": currentTheme?.id === theme.id, onClick: () => set(themeSettings(theme)), children: [
3005
3129
  /* @__PURE__ */ a3("svg", { class: "fnc-theme-swatch", viewBox: "0 0 56 36", "aria-hidden": "true", children: [
3006
3130
  /* @__PURE__ */ a3("rect", { x: "0.5", y: "0.5", width: "55", height: "35", rx: "5", fill: bg, stroke: grid }),
3007
3131
  /* @__PURE__ */ a3("path", { d: "M4 12h48M4 24h48", stroke: grid }),
@@ -3013,12 +3137,41 @@ function SettingsDialog({ ctx }) {
3013
3137
  /* @__PURE__ */ a3("span", { children: theme.name[locale === "en" ? "en" : "ko"] })
3014
3138
  ] });
3015
3139
  }) }),
3140
+ /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsChart }),
3141
+ /* @__PURE__ */ a3("div", { class: "fnc-row fnc-color-row", children: [
3142
+ /* @__PURE__ */ a3("span", { class: "fnc-toggle-label", children: t3.settingBackground }),
3143
+ (settings.background || settings.backgroundBottom || settings.backgroundStyle !== "solid") && /* @__PURE__ */ a3(
3144
+ "button",
3145
+ {
3146
+ type: "button",
3147
+ class: "fnc-color-reset",
3148
+ title: t3.followTheme,
3149
+ "aria-label": `${t3.settingBackground} ${t3.followTheme}`,
3150
+ onClick: () => set({ background: null, backgroundBottom: null, backgroundStyle: "solid" }),
3151
+ children: /* @__PURE__ */ a3(ResetIcon, {})
3152
+ }
3153
+ ),
3154
+ /* @__PURE__ */ a3(
3155
+ "select",
3156
+ {
3157
+ class: "fnc-settings-select",
3158
+ "aria-label": t3.settingBackground,
3159
+ value: settings.backgroundStyle,
3160
+ onChange: (e3) => set({ backgroundStyle: e3.currentTarget.value }),
3161
+ children: [
3162
+ /* @__PURE__ */ a3("option", { value: "solid", children: t3.bgSolid }),
3163
+ /* @__PURE__ */ a3("option", { value: "gradient", children: t3.bgGradient })
3164
+ ]
3165
+ }
3166
+ ),
3167
+ /* @__PURE__ */ a3(Swatch, { label: t3.settingBackground, color: toHex(palette.background), onPick: (c3) => set({ background: c3 }) }),
3168
+ settings.backgroundStyle === "gradient" && /* @__PURE__ */ a3(Swatch, { label: t3.bgGradientBottom, color: toHex(palette.backgroundBottom ?? palette.background), onPick: (c3) => set({ backgroundBottom: c3 }) })
3169
+ ] }),
3170
+ CHART_COLORS.map(colorRow),
3016
3171
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsCandles }),
3017
- ["upColor", "downColor"].map((key) => /* @__PURE__ */ a3("label", { class: "fnc-row", children: [
3018
- /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: key === "upColor" ? t3.settingUpColor : t3.settingDownColor }),
3019
- /* @__PURE__ */ a3("input", { type: "color", class: "fnc-color", value: settings[key] ?? themeColor(key === "upColor" ? "--fnc-up" : "--fnc-down"), onInput: (e3) => set({ [key]: e3.currentTarget.value }) }),
3020
- settings[key] && /* @__PURE__ */ a3("button", { type: "button", class: "fnc-link", onClick: () => set({ [key]: null }), children: t3.followTheme })
3021
- ] })),
3172
+ CANDLE_COLORS.map(colorRow),
3173
+ /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingVolume }),
3174
+ VOLUME_COLORS.map(colorRow),
3022
3175
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsGrid }),
3023
3176
  toggles(GRID)
3024
3177
  ] }),
@@ -3106,6 +3259,12 @@ function usePageLayer(anchor, settings) {
3106
3259
  }, [layer, settings]);
3107
3260
  return layer;
3108
3261
  }
3262
+ function Swatch({ label, color, seeThrough, onPick }) {
3263
+ return /* @__PURE__ */ a3("label", { class: seeThrough ? "fnc-swatch-pick is-see-through" : "fnc-swatch-pick", title: label, children: [
3264
+ /* @__PURE__ */ a3("span", { style: { background: color } }),
3265
+ /* @__PURE__ */ a3("input", { type: "color", "aria-label": label, value: color, onInput: (e3) => onPick(e3.currentTarget.value) })
3266
+ ] });
3267
+ }
3109
3268
  function Info({ text }) {
3110
3269
  return /* @__PURE__ */ a3("span", { class: "fnc-info", tabIndex: 0, role: "img", "aria-label": text, onClick: (e3) => e3.preventDefault(), children: [
3111
3270
  /* @__PURE__ */ a3("svg", { width: "18", height: "18", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
@@ -3341,40 +3500,6 @@ function Dialogs({ ctx }) {
3341
3500
 
3342
3501
  // src/components/interval-picker.tsx
3343
3502
  import { derivedBase as derivedBase2, resolutionToMs as resolutionToMs3 } from "@funnest/charts";
3344
-
3345
- // src/components/keep-in-view.ts
3346
- var MARGIN = 8;
3347
- function useKeepInView(open) {
3348
- const ref = T2(null);
3349
- F2(() => {
3350
- const el = ref.current;
3351
- if (!open || !el) return;
3352
- el.style.translate = "";
3353
- const fit2 = () => {
3354
- el.style.translate = "";
3355
- el.style.maxHeight = "";
3356
- const r3 = el.getBoundingClientRect();
3357
- const root = el.closest(".fnc-root")?.getBoundingClientRect();
3358
- const maxY = Math.min(document.documentElement.clientHeight, root?.bottom ?? Infinity) - MARGIN;
3359
- if (r3.bottom > maxY) {
3360
- el.style.maxHeight = `${Math.max(120, Math.floor(maxY - r3.top))}px`;
3361
- el.style.overflowY = "auto";
3362
- }
3363
- const minX = Math.max(0, root?.left ?? 0) + MARGIN;
3364
- const maxX = Math.min(document.documentElement.clientWidth, root?.right ?? Infinity) - MARGIN;
3365
- let dx = 0;
3366
- if (r3.right > maxX) dx = maxX - r3.right;
3367
- if (r3.left + dx < minX) dx = minX - r3.left;
3368
- if (dx) el.style.translate = `${Math.round(dx)}px 0`;
3369
- };
3370
- fit2();
3371
- window.addEventListener("resize", fit2);
3372
- return () => window.removeEventListener("resize", fit2);
3373
- }, [open]);
3374
- return ref;
3375
- }
3376
-
3377
- // src/components/interval-picker.tsx
3378
3503
  var GROUP_LABEL = {
3379
3504
  minutes: "intervalMinutes",
3380
3505
  hours: "intervalHours",
@@ -4234,10 +4359,7 @@ function Toolbar({ ctx }) {
4234
4359
  import { browserLocale, createChart } from "@funnest/charts";
4235
4360
 
4236
4361
  // src/components/overlay.tsx
4237
- import { formatCompact, formatPrice as formatPrice4 } from "@funnest/charts";
4238
-
4239
- // src/components/context-menu.tsx
4240
- import { formatPrice as formatPrice2 } from "@funnest/charts";
4362
+ import { formatCompact, formatPrice as formatPrice3 } from "@funnest/charts";
4241
4363
 
4242
4364
  // src/components/menu-icon.tsx
4243
4365
  function Glyph({ children }) {
@@ -4322,8 +4444,6 @@ function ContextMenu({ ctx }) {
4322
4444
  if (!target) return null;
4323
4445
  const mac = /Mac|iPhone|iPad/.test(navigator.platform);
4324
4446
  const mod = mac ? "\u2318" : "Ctrl+";
4325
- const price = target.price;
4326
- const precision = s3.symbol?.pricePrecision ?? 2;
4327
4447
  const extra = ctx.contextMenuItems?.({ ...target, chart: ctx.chart }) ?? [];
4328
4448
  const items = [
4329
4449
  { label: t3.undo, icon: "undo", shortcut: `${mod}Z`, disabled: !s3.canUndo, onSelect: () => ctx.chart.undo() },
@@ -4331,21 +4451,10 @@ function ContextMenu({ ctx }) {
4331
4451
  "separator",
4332
4452
  ...extra.length ? [...extra, "separator"] : []
4333
4453
  ];
4334
- if (price !== null) {
4335
- const time = target.time ?? ctx.chart.bars[ctx.chart.bars.length - 1]?.time ?? Date.now();
4336
- items.push({
4337
- label: t3.horizontalAt.replace("{price}", formatPrice2(price, precision)),
4338
- icon: "line",
4339
- onSelect: () => ctx.chart.addDrawing({ type: "horizontal", points: [{ time, price }] })
4340
- });
4341
- }
4342
- const { zoomAnimation, scrollInertia, lockView, lockRatio } = ctx.chart.settings;
4343
- const smooth = zoomAnimation && scrollInertia;
4454
+ const { lockView } = ctx.chart.settings;
4344
4455
  items.push(
4345
4456
  { label: t3.goToDateMore, icon: "date", onSelect: () => ctx.store.set({ dialog: { kind: "goToDate" } }) },
4346
- { label: t3.smoothScroll, icon: "smooth", checked: smooth, onSelect: () => ctx.chart.setSettings({ smoothScroll: !smooth }) },
4347
4457
  { label: t3.lockView, icon: "lock", checked: lockView, onSelect: () => ctx.chart.setSettings({ lockView: !lockView }) },
4348
- { label: t3.lockRatio, icon: "ratio", checked: lockRatio, onSelect: () => ctx.chart.setSettings({ lockRatio: !lockRatio }) },
4349
4458
  "separator",
4350
4459
  { label: t3.resetChart, icon: "reset", disabled: lockView, onSelect: () => ctx.chart.resetView() },
4351
4460
  { label: t3.chartSettingsMore, icon: "settings", onSelect: () => ctx.store.set({ dialog: { kind: "chartSettings" } }) }
@@ -4374,7 +4483,7 @@ function ContextMenu({ ctx }) {
4374
4483
  }
4375
4484
 
4376
4485
  // src/components/price-axis-plus.tsx
4377
- import { formatPrice as formatPrice3 } from "@funnest/charts";
4486
+ import { formatPrice as formatPrice2 } from "@funnest/charts";
4378
4487
  function PriceAxisPlus({ ctx }) {
4379
4488
  const s3 = useStore(ctx.store);
4380
4489
  const t3 = stringsOf(s3);
@@ -4411,7 +4520,7 @@ function PriceAxisPlus({ ctx }) {
4411
4520
  const items = open ? [
4412
4521
  ...ctx.priceAxisActions({ price, chart: ctx.chart }),
4413
4522
  {
4414
- label: t3.horizontalAt.replace("{price}", formatPrice3(price, precision)),
4523
+ label: t3.horizontalAt.replace("{price}", formatPrice2(price, precision)),
4415
4524
  icon: "line",
4416
4525
  onSelect: () => {
4417
4526
  const time = ctx.chart.bars[ctx.chart.bars.length - 1]?.time ?? Date.now();
@@ -4629,7 +4738,7 @@ function Legend({ ctx }) {
4629
4738
  const bars = ctx.chart.bars;
4630
4739
  const bar = hover?.bar ?? bars[bars.length - 1];
4631
4740
  const prev = hover ? hover.prev : bars[bars.length - 2];
4632
- const fmt = (p3) => formatPrice4(p3, s3.symbol.pricePrecision);
4741
+ const fmt = (p3) => formatPrice3(p3, s3.symbol.pricePrecision);
4633
4742
  let values = null;
4634
4743
  if (bar && (ctx.legendValues === "always" || hover)) {
4635
4744
  const cls = dirClass(bar.close - bar.open);
@@ -6225,12 +6334,41 @@ var CSS = (
6225
6334
  .fnc-dialog.fnc-settings-dialog { width: min(940px, calc(100% - 32px)); height: min(660px, 100%); max-height: none; }
6226
6335
  .fnc-settings-body { display: flex; flex: 1; min-height: 0; }
6227
6336
  .fnc-settings-side { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; border-right: 1px solid var(--fnc-border); }
6228
- /* The tabs as wide as their words (the pill hugs the label), from the left: the first word starts
6229
- where the sections' titles (\uD14C\uB9C8, \uCE94\uB4E4\u2026) do \u2014 the row has the form's side padding, and the first
6230
- pill reaches left by its own padding. */
6231
- .fnc-settings-side .fnc-settings-tabs { flex: none; gap: 4px; padding: 10px 20px; }
6232
- .fnc-settings-tabs .fnc-tab { display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 0 14px; }
6233
- .fnc-settings-tabs .fnc-tab:first-child { margin-left: -14px; }
6337
+ /* Tabs as words with a line under the chosen one (nothing reaches past the words): the row has
6338
+ the form's side padding, so the first word starts where the sections' titles (\uD14C\uB9C8, \uCC28\uD2B8\u2026) do. */
6339
+ .fnc-settings-side .fnc-settings-tabs { flex: none; gap: 22px; padding: 0 20px; }
6340
+ .fnc-settings-tabs .fnc-tab { display: inline-flex; align-items: center; flex: none; height: 46px; padding: 0; border-radius: 0; font-size: 14px; }
6341
+ .fnc-settings-tabs .fnc-tab[aria-selected='true'] { background: none; color: var(--fnc-text); box-shadow: inset 0 -2px 0 var(--fnc-text); }
6342
+ /* Settings rows packed like a list; section titles (\uD14C\uB9C8, \uCC28\uD2B8, \uCE94\uB4E4\u2026) in the text color, set apart. */
6343
+ .fnc-root .fnc-dialog form.fnc-settings-form { gap: 2px; }
6344
+ .fnc-settings-form .fnc-section { margin: 14px 0 4px; color: var(--fnc-text); font-size: 13px; font-weight: 700; }
6345
+ .fnc-settings-form .fnc-section:first-child { margin-top: 0; }
6346
+ .fnc-settings-form .fnc-toggle-row { min-height: 40px; }
6347
+ .fnc-settings-form .fnc-themes, .fnc-settings-form .fnc-settings-seg { margin-bottom: 4px; }
6348
+ /* Color rows: the name, then (when changed) back-to-theme, then the square. */
6349
+ .fnc-color-row { gap: 8px; min-height: 40px; }
6350
+ .fnc-color-reset { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; color: var(--fnc-text-2); }
6351
+ .fnc-color-reset:hover { background: var(--fnc-surface); color: var(--fnc-text); }
6352
+ .fnc-color-reset svg { width: 16px; height: 16px; }
6353
+ .fnc-swatch-pick { position: relative; display: inline-flex; flex: none; width: 26px; height: 26px; border-radius: 7px; overflow: hidden; cursor: pointer; box-shadow: inset 0 0 0 1px var(--fnc-border); }
6354
+ .fnc-swatch-pick > span { position: absolute; inset: 3px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgb(127 127 127 / 0.25); }
6355
+ .fnc-swatch-pick.is-see-through { background: repeating-conic-gradient(#8885 0% 25%, transparent 0% 50%) 50% / 8px 8px; }
6356
+ .fnc-swatch-pick.is-see-through > span { opacity: 0.35; }
6357
+ .fnc-swatch-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
6358
+ .fnc-swatch-pick:focus-within { outline: 2px solid var(--fnc-accent); outline-offset: 2px; }
6359
+ .fnc-settings-select {
6360
+ height: 32px;
6361
+ padding: 0 28px 0 12px;
6362
+ border: 0;
6363
+ border-radius: 8px;
6364
+ background: var(--fnc-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
6365
+ color: var(--fnc-text);
6366
+ font: inherit;
6367
+ font-size: 13px;
6368
+ font-weight: 600;
6369
+ appearance: none;
6370
+ cursor: pointer;
6371
+ }
6234
6372
  .fnc-root .fnc-dialog form.fnc-settings-form { flex: 1; min-height: 0; overflow-y: auto; }
6235
6373
  .fnc-settings-preview { display: flex; flex-direction: column; gap: 8px; flex: 1.2 1 0; min-width: 0; padding: 20px; }
6236
6374
  .fnc-settings-preview-chart { position: relative; flex: 1; min-height: 160px; border: 1px solid var(--fnc-border); border-radius: 12px; overflow: hidden; }
@@ -6239,9 +6377,8 @@ var CSS = (
6239
6377
  .fnc-backdrop:has(> .fnc-settings-dialog) { padding: 0; align-items: stretch; }
6240
6378
  .fnc-dialog.fnc-settings-dialog { width: 100%; height: 100%; border-radius: 0; }
6241
6379
  .fnc-settings-dialog .fnc-dialog-head { height: 44px; }
6242
- .fnc-settings-side .fnc-settings-tabs { padding: 6px 16px; }
6243
- .fnc-settings-tabs .fnc-tab { padding: 0 12px; }
6244
- .fnc-settings-tabs .fnc-tab:first-child { margin-left: -12px; }
6380
+ .fnc-settings-side .fnc-settings-tabs { gap: 18px; padding: 0 16px; }
6381
+ .fnc-settings-tabs .fnc-tab { height: 38px; }
6245
6382
  .fnc-settings-preview { padding: 8px 12px; }
6246
6383
  .fnc-settings-preview .fnc-section, .fnc-settings-preview .fnc-toggle-hint { display: none; }
6247
6384
  .fnc-settings-preview-chart .fnc-ranges { display: none; }
@@ -6304,9 +6441,8 @@ var CSS = (
6304
6441
  .fnc-settings-preview-chart { flex: none; height: clamp(170px, 34dvh, 280px); min-height: 0; }
6305
6442
  .fnc-settings-preview-chart .fnc-ranges { display: none; }
6306
6443
  .fnc-settings-side { flex: 1; min-height: 0; border-right: 0; }
6307
- .fnc-settings-side .fnc-settings-tabs { padding: 8px 20px; }
6308
- .fnc-settings-tabs .fnc-tab { padding: 0 12px; }
6309
- .fnc-settings-tabs .fnc-tab:first-child { margin-left: -12px; }
6444
+ .fnc-settings-side .fnc-settings-tabs { gap: 18px; padding: 0 20px; }
6445
+ .fnc-settings-tabs .fnc-tab { height: 42px; }
6310
6446
  .fnc-form-actions.fnc-settings-actions { padding: 8px 16px; }
6311
6447
  }
6312
6448
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.5",
3
+ "version": "0.11.7",
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.5"
45
+ "@funnest/charts": "0.11.7"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"