@funnest/charts-ui 0.6.21 → 0.6.23

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
@@ -93,6 +93,8 @@ export declare const STRINGS: {
93
93
  addIndicator: string;
94
94
  indicatorSettings: string;
95
95
  removeIndicator: string;
96
+ hideVolume: string;
97
+ volumeDesc: string;
96
98
  apply: string;
97
99
  cancel: string;
98
100
  numbersHint: string;
@@ -238,6 +240,8 @@ export declare const STRINGS: {
238
240
  addIndicator: string;
239
241
  indicatorSettings: string;
240
242
  removeIndicator: string;
243
+ hideVolume: string;
244
+ volumeDesc: string;
241
245
  apply: string;
242
246
  cancel: string;
243
247
  numbersHint: string;
package/dist/index.js CHANGED
@@ -518,6 +518,8 @@ var STRINGS = {
518
518
  addIndicator: "\uC9C0\uD45C \uCD94\uAC00",
519
519
  indicatorSettings: "\uC9C0\uD45C \uC124\uC815",
520
520
  removeIndicator: "\uC9C0\uD45C \uC0AD\uC81C",
521
+ hideVolume: "\uAC70\uB798\uB7C9 \uC228\uAE30\uAE30",
522
+ volumeDesc: "\uBD09\uB9C8\uB2E4 \uAC70\uB798\uB41C \uC591 (\uAC00\uACA9 \uC544\uB798 \uC601\uC5ED)",
521
523
  apply: "\uC801\uC6A9",
522
524
  cancel: "\uCDE8\uC18C",
523
525
  numbersHint: "\uC27C\uD45C\uB85C \uAD6C\uBD84 (\uC608: 5, 20, 60)",
@@ -665,6 +667,8 @@ var STRINGS = {
665
667
  addIndicator: "Add indicator",
666
668
  indicatorSettings: "Indicator settings",
667
669
  removeIndicator: "Remove indicator",
670
+ hideVolume: "Hide volume",
671
+ volumeDesc: "How much traded in each bar (pane under the price)",
668
672
  apply: "Apply",
669
673
  cancel: "Cancel",
670
674
  numbersHint: "Comma separated (e.g. 5, 20, 60)",
@@ -1451,11 +1455,16 @@ function IndicatorPicker({ ctx }) {
1451
1455
  const all = ctx.chart.indicatorDefinitions().filter((d3) => !d3.hidden);
1452
1456
  const q2 = query.trim().toLowerCase();
1453
1457
  const matches = (d3) => !q2 || [d3.type, d3.name.ko, d3.name.en, d3.description[locale]].some((s3) => s3.toLowerCase().includes(q2));
1458
+ const volumeHidden = !ctx.chart.settings.volume && (!q2 || [t3.settingVolume, t3.volume, "volume"].some((s3) => s3.toLowerCase().includes(q2)));
1459
+ const showVolume = () => {
1460
+ ctx.chart.setVolumeVisible(true);
1461
+ close();
1462
+ };
1454
1463
  const groups = [
1455
- [locale === "ko" ? "\uAC00\uACA9 \uCC28\uD2B8\uC5D0 \uD45C\uC2DC" : "On price", all.filter((d3) => d3.overlay && matches(d3))],
1456
- [locale === "ko" ? "\uC544\uB798 \uC601\uC5ED\uC5D0 \uD45C\uC2DC" : "Separate pane", all.filter((d3) => !d3.overlay && matches(d3))]
1457
- ].filter(([, defs]) => defs.length > 0);
1458
- const first = groups[0]?.[1][0];
1464
+ { label: locale === "ko" ? "\uAC00\uACA9 \uCC28\uD2B8\uC5D0 \uD45C\uC2DC" : "On price", defs: all.filter((d3) => d3.overlay && matches(d3)), volume: false },
1465
+ { label: locale === "ko" ? "\uC544\uB798 \uC601\uC5ED\uC5D0 \uD45C\uC2DC" : "Separate pane", defs: all.filter((d3) => !d3.overlay && matches(d3)), volume: volumeHidden }
1466
+ ].filter((g3) => g3.defs.length > 0 || g3.volume);
1467
+ const first = groups.find((g3) => g3.defs.length)?.defs[0];
1459
1468
  return /* @__PURE__ */ a3(Dialog, { title: t3.addIndicator, onClose: close, children: [
1460
1469
  all.length > SEARCH_THRESHOLD && /* @__PURE__ */ a3("div", { class: "fnc-search fnc-ind-search", children: /* @__PURE__ */ a3(
1461
1470
  "input",
@@ -1470,8 +1479,12 @@ function IndicatorPicker({ ctx }) {
1470
1479
  ) }),
1471
1480
  /* @__PURE__ */ a3("div", { class: "fnc-sr-list fnc-scroll", children: [
1472
1481
  groups.length === 0 && /* @__PURE__ */ a3("div", { class: "fnc-empty", children: t3.noResults }),
1473
- groups.map(([label, defs]) => /* @__PURE__ */ a3($, { children: [
1482
+ groups.map(({ label, defs, volume }) => /* @__PURE__ */ a3($, { children: [
1474
1483
  /* @__PURE__ */ a3("div", { class: "fnc-sr-section", children: label }),
1484
+ volume && /* @__PURE__ */ a3("button", { class: "fnc-sr-row", onClick: showVolume, children: /* @__PURE__ */ a3("span", { class: "fnc-sr-main", children: [
1485
+ /* @__PURE__ */ a3("span", { class: "fnc-sr-name", children: t3.settingVolume }),
1486
+ /* @__PURE__ */ a3("span", { class: "fnc-sr-meta", children: t3.volumeDesc })
1487
+ ] }) }),
1475
1488
  defs.map((def) => {
1476
1489
  const type = def.type;
1477
1490
  return /* @__PURE__ */ a3("button", { class: "fnc-sr-row", onClick: () => add(type), children: /* @__PURE__ */ a3("span", { class: "fnc-sr-main", children: [
@@ -2645,6 +2658,26 @@ function AppItem({ ctx, item }) {
2645
2658
  ] })
2646
2659
  ] });
2647
2660
  }
2661
+ function VolumeItem({ ctx, value }) {
2662
+ const t3 = stringsOf(ctx.store.get());
2663
+ return /* @__PURE__ */ a3("div", { class: "fnc-ind fnc-volume-item", children: [
2664
+ /* @__PURE__ */ a3("span", { class: "fnc-ind-title", children: t3.settingVolume }),
2665
+ value !== null && /* @__PURE__ */ a3("b", { class: "fnc-flat", children: value }),
2666
+ /* @__PURE__ */ a3("span", { class: "fnc-ind-actions", children: [
2667
+ /* @__PURE__ */ a3(
2668
+ "button",
2669
+ {
2670
+ class: "fnc-ind-btn",
2671
+ "data-tip": t3.chartSettings,
2672
+ "aria-label": `${t3.settingVolume} ${t3.chartSettings}`,
2673
+ onClick: () => ctx.store.set({ dialog: { kind: "chartSettings" } }),
2674
+ children: /* @__PURE__ */ a3(GearIcon, {})
2675
+ }
2676
+ ),
2677
+ /* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "data-tip": t3.hideVolume, "aria-label": t3.hideVolume, onClick: () => ctx.chart.setVolumeVisible(false), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) })
2678
+ ] })
2679
+ ] });
2680
+ }
2648
2681
  function Legend({ ctx }) {
2649
2682
  const s3 = useStore(ctx.store);
2650
2683
  const t3 = stringsOf(s3);
@@ -2722,6 +2755,7 @@ function Legend({ ctx }) {
2722
2755
  const items = s3.indicators.length ? ctx.chart.indicatorLegend(hover?.index) : [];
2723
2756
  const overlayItems = items.filter((i3) => i3.overlay);
2724
2757
  const paneLegends = s3.layout.panes.filter((p3) => p3.kind === "indicator").map((pane) => ({ pane, item: items.find((i3) => i3.id === pane.id) }));
2758
+ const volumePane = s3.layout.panes.find((p3) => p3.kind === "volume");
2725
2759
  return /* @__PURE__ */ a3($, { children: [
2726
2760
  /* @__PURE__ */ a3("div", { class: "fnc-legend", ref, children: [
2727
2761
  /* @__PURE__ */ a3("div", { class: "fnc-legend-title", children: [
@@ -2753,6 +2787,7 @@ function Legend({ ctx }) {
2753
2787
  !collapsed && s3.legendItems.map((item) => /* @__PURE__ */ a3(AppItem, { ctx, item })),
2754
2788
  overlayItems.length + s3.legendItems.length > 0 && (collapsed ? /* @__PURE__ */ a3("button", { class: "fnc-ind-handle", "aria-expanded": "false", "aria-label": t3.expand, "data-tip": t3.expand, onClick: () => setCollapsed(false), children: /* @__PURE__ */ a3("span", {}) }) : /* @__PURE__ */ a3("button", { class: "fnc-ind-collapse", "aria-expanded": "true", "aria-label": t3.collapse, "data-tip": t3.collapse, onClick: () => setCollapsed(true), children: /* @__PURE__ */ a3(ChevronUpIcon, {}) }))
2755
2789
  ] }),
2790
+ volumePane && /* @__PURE__ */ a3("div", { class: "fnc-legend fnc-pane-legend", style: { top: `${volumePane.top + 4}px` }, children: /* @__PURE__ */ a3(VolumeItem, { ctx, value: bar?.volume !== void 0 ? formatCompact(bar.volume, s3.locale) : null }) }),
2756
2791
  paneLegends.map(
2757
2792
  ({ pane, item }) => item && /* @__PURE__ */ a3("div", { class: "fnc-legend fnc-pane-legend", style: { top: `${pane.top + 4}px` }, children: /* @__PURE__ */ a3(IndicatorItem, { ctx, item }) })
2758
2793
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.6.21",
3
+ "version": "0.6.23",
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.6.21"
45
+ "@funnest/charts": "0.6.23"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"