@funnest/charts-ui 0.11.53 → 0.11.55

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
@@ -67,6 +67,12 @@ export declare const STRINGS: {
67
67
  settingHighLow: string;
68
68
  settingLastPrice: string;
69
69
  settingVolume: string;
70
+ settingOhlcValues: string;
71
+ hintOhlcValues: string;
72
+ ohlcAuto: string;
73
+ ohlcAlways: string;
74
+ ohlcCrosshair: string;
75
+ ohlcOff: string;
70
76
  settingNavButtons: string;
71
77
  settingCountdown: string;
72
78
  settingExtendedPrice: string;
@@ -466,6 +472,12 @@ export declare const STRINGS: {
466
472
  settingHighLow: string;
467
473
  settingLastPrice: string;
468
474
  settingVolume: string;
475
+ settingOhlcValues: string;
476
+ hintOhlcValues: string;
477
+ ohlcAuto: string;
478
+ ohlcAlways: string;
479
+ ohlcCrosshair: string;
480
+ ohlcOff: string;
469
481
  settingNavButtons: string;
470
482
  settingCountdown: string;
471
483
  settingExtendedPrice: string;
package/dist/index.js CHANGED
@@ -502,6 +502,12 @@ var STRINGS = {
502
502
  settingHighLow: "\uCD5C\uACE0\xB7\uCD5C\uC800 \uD45C\uC2DC",
503
503
  settingLastPrice: "\uD604\uC7AC\uAC00 \uC120",
504
504
  settingVolume: "\uAC70\uB798\uB7C9",
505
+ settingOhlcValues: "\uC2DC\xB7\uACE0\xB7\uC800\xB7\uC885 \uAC12",
506
+ hintOhlcValues: "\uCC28\uD2B8 \uC67C\uCABD \uC704, \uC885\uBAA9 \uC774\uB984 \uC544\uB798\uC5D0 \uB098\uC624\uB294 \uBD09\uC758 \uC2DC\uAC00\xB7\uACE0\uAC00\xB7\uC800\uAC00\xB7\uC885\uAC00\uC640 \uAC70\uB798\uB7C9\uC774\uC5D0\uC694.",
507
+ ohlcAuto: "\uC790\uB3D9 (\uAE30\uAE30\uC5D0 \uB9DE\uAC8C)",
508
+ ohlcAlways: "\uD56D\uC0C1 \uBCF4\uAE30",
509
+ ohlcCrosshair: "\uC2ED\uC790\uC120\uC744 \uB308 \uB54C\uB9CC",
510
+ ohlcOff: "\uC228\uAE30\uAE30",
505
511
  settingNavButtons: "\uD655\uB300\xB7\uC774\uB3D9 \uBC84\uD2BC",
506
512
  settingCountdown: "\uBD09 \uB9C8\uAC10\uAE4C\uC9C0 \uB0A8\uC740 \uC2DC\uAC04",
507
513
  settingExtendedPrice: "\uC7A5\uC678 \uAC00\uACA9\uC120 (\uD504\uB9AC\xB7\uC560\uD504\uD130\uB9C8\uCF13)",
@@ -903,6 +909,12 @@ var STRINGS = {
903
909
  settingHighLow: "High/low markers",
904
910
  settingLastPrice: "Last price line",
905
911
  settingVolume: "Volume",
912
+ settingOhlcValues: "OHLC values",
913
+ hintOhlcValues: "The bar's open, high, low, close and volume, at the top left under the symbol's name.",
914
+ ohlcAuto: "Auto (by device)",
915
+ ohlcAlways: "Always",
916
+ ohlcCrosshair: "With the crosshair only",
917
+ ohlcOff: "Hidden",
906
918
  settingNavButtons: "Zoom & scroll buttons",
907
919
  settingCountdown: "Time to bar close",
908
920
  settingExtendedPrice: "Pre / after-market price line",
@@ -4394,6 +4406,25 @@ var CSS = (
4394
4406
  .fnc-ind-handle span { width: 24px; height: 4px; border-radius: 2px; background: currentColor; opacity: 0.55; }
4395
4407
  .fnc-ind-handle:hover span { opacity: 0.9; }
4396
4408
  .fnc-ind b { font-weight: 600; }
4409
+ /* \uCC28\uD2B8 \uC704 \uCEE8\uD2B8\uB864: small, in the row's text size. */
4410
+ .fnc-ind-controls { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
4411
+ .fnc-ind-toggle, .fnc-ind-select, .fnc-ind-step {
4412
+ height: 20px;
4413
+ border: 1px solid var(--fnc-border);
4414
+ border-radius: 6px;
4415
+ background: var(--fnc-bg);
4416
+ color: var(--fnc-text-2);
4417
+ font: inherit;
4418
+ font-size: 11.5px;
4419
+ }
4420
+ .fnc-ind-toggle { padding: 0 7px; cursor: pointer; }
4421
+ .fnc-ind-toggle:hover, .fnc-ind-select:hover, .fnc-ind-step button:hover { color: var(--fnc-text); }
4422
+ .fnc-ind-toggle[aria-pressed='true'] { border-color: var(--fnc-accent); background: color-mix(in srgb, var(--fnc-accent) 14%, transparent); color: var(--fnc-accent); }
4423
+ .fnc-ind-select { padding: 0 2px 0 5px; cursor: pointer; }
4424
+ .fnc-ind-step { display: inline-flex; align-items: center; }
4425
+ .fnc-ind-step button { width: 18px; height: 18px; border: 0; background: none; color: var(--fnc-text-2); font: inherit; cursor: pointer; }
4426
+ .fnc-ind-step button:disabled { opacity: 0.35; cursor: default; }
4427
+ .fnc-ind-step b { min-width: 22px; color: var(--fnc-text); text-align: center; font-variant-numeric: tabular-nums; }
4397
4428
  .fnc-ind-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
4398
4429
  .fnc-ind:hover .fnc-ind-actions, .fnc-ind:focus-within .fnc-ind-actions { opacity: 1; }
4399
4430
  .fnc-ind-btn {
@@ -6120,6 +6151,12 @@ var PRICE_MARK_ROWS = [
6120
6151
  { key: "extendedPriceLine", label: "settingExtendedPrice" },
6121
6152
  { key: "highLowMarkers", label: "settingHighLow" }
6122
6153
  ];
6154
+ var OHLC_CHOICES = [
6155
+ ["auto", "ohlcAuto"],
6156
+ ["always", "ohlcAlways"],
6157
+ ["crosshair", "ohlcCrosshair"],
6158
+ ["off", "ohlcOff"]
6159
+ ];
6123
6160
  var VIEW_ROWS = [{ key: "volume", label: "settingVolume" }];
6124
6161
  var CONTROL_ROWS = [
6125
6162
  { key: "navigationButtons", label: "settingNavButtons" },
@@ -6337,6 +6374,20 @@ function SettingsDialog({ ctx }) {
6337
6374
  shown === "view" && /* @__PURE__ */ a3($, { children: [
6338
6375
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsShown }),
6339
6376
  toggles(VIEW_ROWS),
6377
+ /* @__PURE__ */ a3("label", { class: "fnc-row fnc-toggle-row", children: [
6378
+ /* @__PURE__ */ a3("span", { class: "fnc-toggle-label", children: t3.settingOhlcValues }),
6379
+ /* @__PURE__ */ a3(Info, { text: t3.hintOhlcValues }),
6380
+ /* @__PURE__ */ a3(
6381
+ "select",
6382
+ {
6383
+ class: "fnc-settings-select fnc-app-select",
6384
+ "aria-label": t3.settingOhlcValues,
6385
+ value: settings.ohlcValues,
6386
+ onChange: (e3) => set({ ohlcValues: e3.currentTarget.value }),
6387
+ children: OHLC_CHOICES.map(([v3, label]) => /* @__PURE__ */ a3("option", { value: v3, children: t3[label] }))
6388
+ }
6389
+ )
6390
+ ] }),
6340
6391
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsControl }),
6341
6392
  toggles(CONTROL_ROWS),
6342
6393
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsWatermark }),
@@ -7837,6 +7888,39 @@ function PriceAxisPlus({ ctx }) {
7837
7888
  var ZOOM_STEP = 1.25;
7838
7889
  var CONTROL_OFFSET = 52;
7839
7890
  var dirClass = (v3) => v3 > 0 ? "fnc-up" : v3 < 0 ? "fnc-down" : "fnc-flat";
7891
+ function IndicatorControls({ ctx, id, controls }) {
7892
+ const set = (key, value) => ctx.chart.setIndicatorControl(id, key, value);
7893
+ const keep = (e3) => e3.stopPropagation();
7894
+ return /* @__PURE__ */ a3("span", { class: "fnc-ind-controls", onClick: keep, onPointerDown: keep, onKeyDown: keep, children: controls.map((c3) => {
7895
+ if (c3.kind === "toggle")
7896
+ return /* @__PURE__ */ a3("button", { type: "button", class: "fnc-ind-toggle", "aria-pressed": c3.value === true, title: c3.label, onClick: () => set(c3.key, c3.value !== true), children: c3.label });
7897
+ if (c3.kind === "select")
7898
+ return /* @__PURE__ */ a3(
7899
+ "select",
7900
+ {
7901
+ class: "fnc-ind-select",
7902
+ "aria-label": c3.label,
7903
+ title: c3.label,
7904
+ value: String(c3.value),
7905
+ onChange: (e3) => {
7906
+ const raw = e3.currentTarget.value;
7907
+ const option = c3.options?.find((o4) => String(o4.value) === raw);
7908
+ if (option) set(c3.key, option.value);
7909
+ },
7910
+ children: (c3.options ?? []).map((o4) => /* @__PURE__ */ a3("option", { value: String(o4.value), children: o4.label }))
7911
+ }
7912
+ );
7913
+ const n2 = Number(c3.value);
7914
+ const step2 = c3.step && c3.step > 0 ? c3.step : 1;
7915
+ const decimals = Math.max(0, (String(step2).split(".")[1] ?? "").length);
7916
+ const bound = (v3) => Math.min(c3.max ?? Infinity, Math.max(c3.min ?? -Infinity, Number(v3.toFixed(decimals))));
7917
+ return /* @__PURE__ */ a3("span", { class: "fnc-ind-step", title: c3.label, children: [
7918
+ /* @__PURE__ */ a3("button", { type: "button", "aria-label": `${c3.label} \u2212`, disabled: c3.min !== void 0 && n2 <= c3.min, onClick: () => set(c3.key, bound(n2 - step2)), children: "\u2212" }),
7919
+ /* @__PURE__ */ a3("b", { children: Number.isFinite(n2) ? n2.toFixed(decimals) : "\u2014" }),
7920
+ /* @__PURE__ */ a3("button", { type: "button", "aria-label": `${c3.label} +`, disabled: c3.max !== void 0 && n2 >= c3.max, onClick: () => set(c3.key, bound(n2 + step2)), children: "+" })
7921
+ ] });
7922
+ }) });
7923
+ }
7840
7924
  function IndicatorItem({ ctx, item, values = true }) {
7841
7925
  const t3 = stringsOf(ctx.store.get());
7842
7926
  return /* @__PURE__ */ a3(
@@ -7867,6 +7951,7 @@ function IndicatorItem({ ctx, item, values = true }) {
7867
7951
  }
7868
7952
  ),
7869
7953
  /* @__PURE__ */ a3("span", { class: "fnc-ind-title", children: item.title }),
7954
+ item.controls && item.visible && /* @__PURE__ */ a3(IndicatorControls, { ctx, id: item.id, controls: item.controls }),
7870
7955
  values && item.visible && item.values.map((v3) => /* @__PURE__ */ a3("b", { style: { color: v3.color }, "data-tip": v3.label, children: v3.value })),
7871
7956
  /* @__PURE__ */ a3("span", { class: "fnc-ind-actions", children: [
7872
7957
  ctx.chart.canMoveIndicator(item.id, -1) && /* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "data-tip": t3.moveIndicatorUp, "aria-label": `${item.title} ${t3.moveIndicatorUp}`, onClick: (e3) => {
@@ -8002,14 +8087,20 @@ function Legend({ ctx }) {
8002
8087
  (info) => setHover(info ? { bar: info.bar, prev: ctx.chart.bars[info.index - 1], index: info.index } : null)
8003
8088
  ),
8004
8089
  ctx.chart.on("dataChange", () => refresh(void 0)),
8090
+ // 차트 설정 › 시·고·저·종 값.
8091
+ ctx.chart.on("settingsChange", () => refresh(void 0)),
8005
8092
  // Compare values are % from the first visible bar, so they change while scrolling.
8006
8093
  ctx.chart.on("visibleRangeChange", () => ctx.store.get().compares.length > 0 && refresh(void 0))
8007
8094
  ];
8008
8095
  return () => offs.forEach((off) => off());
8009
8096
  }, [ctx.chart]);
8010
8097
  const ref = T2(null);
8098
+ const chosen = ctx.chart.settings.ohlcValues;
8099
+ const mode = chosen === "auto" || !chosen ? ctx.legendValues : chosen;
8100
+ const modeRef = T2(mode);
8101
+ modeRef.current = mode;
8011
8102
  const tracking = T2(false);
8012
- tracking.current = ctx.legendValues === "crosshair" && !!hover;
8103
+ tracking.current = mode === "crosshair" && !!hover;
8013
8104
  const hovering = T2(false);
8014
8105
  hovering.current = !!hover;
8015
8106
  const measure = T2(() => {
@@ -8020,7 +8111,7 @@ function Legend({ ctx }) {
8020
8111
  if (!el) return;
8021
8112
  const update = () => {
8022
8113
  if (tracking.current || hovering.current) return;
8023
- const floating = ctx.legendValues === "crosshair" ? el.querySelector(".fnc-legend-values") : null;
8114
+ const floating = modeRef.current === "crosshair" ? el.querySelector(".fnc-legend-values") : null;
8024
8115
  const px = el.offsetTop + el.offsetHeight - (floating ? floating.offsetHeight + 2 : 0) + 4;
8025
8116
  const { symbol, resolution } = ctx.store.get();
8026
8117
  const key = `${symbol?.symbol ?? ""}|${resolution}|${el.offsetWidth}|${el.getElementsByTagName("*").length}`;
@@ -8041,12 +8132,12 @@ function Legend({ ctx }) {
8041
8132
  const prev = hover ? hover.prev : bars[bars.length - 2];
8042
8133
  const fmt = (p3) => formatPrice3(p3, s3.symbol.pricePrecision);
8043
8134
  let values = null;
8044
- if (bar && (ctx.legendValues === "always" || hover)) {
8135
+ if (bar && mode !== "off" && (mode === "always" || hover)) {
8045
8136
  const cls = dirClass(bar.close - bar.open);
8046
8137
  const change = prev ? bar.close - prev.close : 0;
8047
8138
  const pct = prev && prev.close ? change / Math.abs(prev.close) * 100 : 0;
8048
8139
  const sign = change > 0 ? "+" : "";
8049
- values = /* @__PURE__ */ a3("div", { class: ctx.legendValues === "crosshair" ? "fnc-legend-values fnc-legend-values-float" : "fnc-legend-values", children: [
8140
+ values = /* @__PURE__ */ a3("div", { class: mode === "crosshair" ? "fnc-legend-values fnc-legend-values-float" : "fnc-legend-values", children: [
8050
8141
  /* @__PURE__ */ a3("span", { children: [
8051
8142
  t3.open,
8052
8143
  " ",
@@ -8083,7 +8174,7 @@ function Legend({ ctx }) {
8083
8174
  ] });
8084
8175
  }
8085
8176
  const items = s3.indicators.length ? ctx.chart.indicatorLegend(hover?.index) : [];
8086
- const showValues = ctx.legendValues === "always" || !!hover;
8177
+ const showValues = mode !== "crosshair" || !!hover;
8087
8178
  const overlayItems = items.filter((i3) => i3.overlay);
8088
8179
  const paneLegends = s3.layout.panes.filter((p3) => p3.kind === "indicator").map((pane) => ({ pane, item: items.find((i3) => i3.id === pane.id), kids: items.filter((i3) => i3.parent === pane.id) }));
8089
8180
  const volumePane = s3.layout.panes.find((p3) => p3.kind === "volume");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.53",
3
+ "version": "0.11.55",
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.53"
45
+ "@funnest/charts": "0.11.55"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"