@funnest/charts-ui 0.8.7 → 0.9.1

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/context.d.ts CHANGED
@@ -29,6 +29,7 @@ export interface UiState {
29
29
  /** Open dialog: indicator picker, or settings for one indicator id. */
30
30
  dialog: {
31
31
  kind: 'indicators';
32
+ on?: string;
32
33
  } | {
33
34
  kind: 'indicatorSettings';
34
35
  id: string;
package/dist/i18n.d.ts CHANGED
@@ -28,6 +28,11 @@ export declare const STRINGS: {
28
28
  stepLine: string;
29
29
  baseline: string;
30
30
  area: string;
31
+ volumeCandles: string;
32
+ renko: string;
33
+ kagi: string;
34
+ lineBreak: string;
35
+ pointFigure: string;
31
36
  drawingTools: string;
32
37
  cursor: string;
33
38
  trendline: string;
@@ -100,6 +105,11 @@ export declare const STRINGS: {
100
105
  customColor: string;
101
106
  partColors: string;
102
107
  resetColors: string;
108
+ templates: string;
109
+ saveTemplate: string;
110
+ templateName: string;
111
+ noTemplates: string;
112
+ deleteTemplate: string;
103
113
  lineWidth: string;
104
114
  lineStyle: string;
105
115
  lineSolid: string;
@@ -115,6 +125,8 @@ export declare const STRINGS: {
115
125
  addIndicator: string;
116
126
  indicatorSettings: string;
117
127
  removeIndicator: string;
128
+ addIndicatorOn: string;
129
+ onIndicatorSection: string;
118
130
  moveIndicatorUp: string;
119
131
  moveIndicatorDown: string;
120
132
  textEditHint: string;
@@ -228,6 +240,11 @@ export declare const STRINGS: {
228
240
  stepLine: string;
229
241
  baseline: string;
230
242
  area: string;
243
+ volumeCandles: string;
244
+ renko: string;
245
+ kagi: string;
246
+ lineBreak: string;
247
+ pointFigure: string;
231
248
  drawingTools: string;
232
249
  cursor: string;
233
250
  trendline: string;
@@ -300,6 +317,11 @@ export declare const STRINGS: {
300
317
  customColor: string;
301
318
  partColors: string;
302
319
  resetColors: string;
320
+ templates: string;
321
+ saveTemplate: string;
322
+ templateName: string;
323
+ noTemplates: string;
324
+ deleteTemplate: string;
303
325
  lineWidth: string;
304
326
  lineStyle: string;
305
327
  lineSolid: string;
@@ -315,6 +337,8 @@ export declare const STRINGS: {
315
337
  addIndicator: string;
316
338
  indicatorSettings: string;
317
339
  removeIndicator: string;
340
+ addIndicatorOn: string;
341
+ onIndicatorSection: string;
318
342
  moveIndicatorUp: string;
319
343
  moveIndicatorDown: string;
320
344
  textEditHint: string;
package/dist/icons.d.ts CHANGED
@@ -27,8 +27,16 @@ export declare const OhlcBarsIcon: () => import("preact").JSX.Element;
27
27
  export declare const StepLineIcon: () => import("preact").JSX.Element;
28
28
  export declare const BaselineIcon: () => import("preact").JSX.Element;
29
29
  export declare const AreaChartIcon: () => import("preact").JSX.Element;
30
+ export declare const VolumeCandlesIcon: () => import("preact").JSX.Element;
31
+ export declare const RenkoIcon: () => import("preact").JSX.Element;
32
+ export declare const KagiIcon: () => import("preact").JSX.Element;
33
+ export declare const LineBreakIcon: () => import("preact").JSX.Element;
34
+ export declare const PointFigureIcon: () => import("preact").JSX.Element;
30
35
  export declare const IndicatorIcon: () => import("preact").JSX.Element;
31
36
  export declare const GearIcon: () => import("preact").JSX.Element;
37
+ /** 그리기 템플릿: stacked cards. */
38
+ export declare const TemplateIcon: () => import("preact").JSX.Element;
39
+ export declare const SmallPlusIcon: () => import("preact").JSX.Element;
32
40
  export declare const SmallCloseIcon: () => import("preact").JSX.Element;
33
41
  export declare const EyeIcon: () => import("preact").JSX.Element;
34
42
  export declare const EyeOffIcon: () => import("preact").JSX.Element;
package/dist/index.js CHANGED
@@ -454,6 +454,11 @@ var STRINGS = {
454
454
  stepLine: "\uACC4\uB2E8\uC120",
455
455
  baseline: "\uBCA0\uC774\uC2A4\uB77C\uC778",
456
456
  area: "\uC601\uC5ED",
457
+ volumeCandles: "\uAC70\uB798\uB7C9 \uCE94\uB4E4",
458
+ renko: "\uB80C\uCF54",
459
+ kagi: "\uCE74\uAE30",
460
+ lineBreak: "\uB77C\uC778 \uBE0C\uB808\uC774\uD06C",
461
+ pointFigure: "P&F",
457
462
  drawingTools: "\uADF8\uB9AC\uAE30 \uB3C4\uAD6C",
458
463
  cursor: "\uCEE4\uC11C",
459
464
  trendline: "\uCD94\uC138\uC120",
@@ -526,6 +531,11 @@ var STRINGS = {
526
531
  customColor: "\uB2E4\uB978 \uC0C9",
527
532
  partColors: "\uBD80\uBD84 \uC0C9\uC0C1",
528
533
  resetColors: "\uAE30\uBCF8 \uC0C9\uC73C\uB85C",
534
+ templates: "\uD15C\uD50C\uB9BF",
535
+ saveTemplate: "\uC9C0\uAE08 \uBAA8\uC591\uC744 \uD15C\uD50C\uB9BF\uC73C\uB85C \uC800\uC7A5",
536
+ templateName: "\uD15C\uD50C\uB9BF \uC774\uB984",
537
+ noTemplates: "\uC774 \uB3C4\uAD6C\uB85C \uC800\uC7A5\uD55C \uD15C\uD50C\uB9BF\uC774 \uC5C6\uC5B4\uC694",
538
+ deleteTemplate: "\uD15C\uD50C\uB9BF \uC9C0\uC6B0\uAE30",
529
539
  lineWidth: "\uC120 \uAD75\uAE30",
530
540
  lineStyle: "\uC120 \uBAA8\uC591",
531
541
  lineSolid: "\uC2E4\uC120",
@@ -541,6 +551,8 @@ var STRINGS = {
541
551
  addIndicator: "\uC9C0\uD45C \uCD94\uAC00",
542
552
  indicatorSettings: "\uC9C0\uD45C \uC124\uC815",
543
553
  removeIndicator: "\uC9C0\uD45C \uC0AD\uC81C",
554
+ addIndicatorOn: "\uC774 \uC9C0\uD45C \uC704\uC5D0 \uC9C0\uD45C \uCD94\uAC00",
555
+ onIndicatorSection: "{name} \uC704\uC5D0 \uD45C\uC2DC",
544
556
  moveIndicatorUp: "\uC704\uB85C \uC62E\uAE30\uAE30",
545
557
  moveIndicatorDown: "\uC544\uB798\uB85C \uC62E\uAE30\uAE30",
546
558
  textEditHint: "Enter\uB85C \uC800\uC7A5 \xB7 Shift+Enter \uC904\uBC14\uAFC8 \xB7 Esc \uCDE8\uC18C",
@@ -656,6 +668,11 @@ var STRINGS = {
656
668
  stepLine: "Step line",
657
669
  baseline: "Baseline",
658
670
  area: "Area",
671
+ volumeCandles: "Volume candles",
672
+ renko: "Renko",
673
+ kagi: "Kagi",
674
+ lineBreak: "Line break",
675
+ pointFigure: "Point & figure",
659
676
  drawingTools: "Drawing tools",
660
677
  cursor: "Cursor",
661
678
  trendline: "Trend line",
@@ -728,6 +745,11 @@ var STRINGS = {
728
745
  customColor: "Other color",
729
746
  partColors: "Part colors",
730
747
  resetColors: "Reset colors",
748
+ templates: "Templates",
749
+ saveTemplate: "Save this look as a template",
750
+ templateName: "Template name",
751
+ noTemplates: "No templates for this tool yet",
752
+ deleteTemplate: "Delete template",
731
753
  lineWidth: "Line width",
732
754
  lineStyle: "Line style",
733
755
  lineSolid: "Solid",
@@ -743,6 +765,8 @@ var STRINGS = {
743
765
  addIndicator: "Add indicator",
744
766
  indicatorSettings: "Indicator settings",
745
767
  removeIndicator: "Remove indicator",
768
+ addIndicatorOn: "Add indicator on this",
769
+ onIndicatorSection: "Drawn on {name}",
746
770
  moveIndicatorUp: "Move up",
747
771
  moveIndicatorDown: "Move down",
748
772
  textEditHint: "Enter to save \xB7 Shift+Enter for a new line \xB7 Esc to cancel",
@@ -935,6 +959,34 @@ var AreaChartIcon = () => /* @__PURE__ */ a3(Icon, { children: [
935
959
  /* @__PURE__ */ a3("path", { d: "M3 14l4.5-5 3.5 3 6-7" }),
936
960
  /* @__PURE__ */ a3("path", { d: "M3 14l4.5-5 3.5 3 6-7V17H3z", fill: "currentColor", "fill-opacity": "0.25", stroke: "none" })
937
961
  ] });
962
+ var VolumeCandlesIcon = () => /* @__PURE__ */ a3(Icon, { children: [
963
+ /* @__PURE__ */ a3("path", { d: "M4.5 4v12M10 3v14M15.5 6v9" }),
964
+ /* @__PURE__ */ a3("rect", { x: "3.6", y: "7", width: "1.8", height: "5", rx: "0.5", fill: "currentColor" }),
965
+ /* @__PURE__ */ a3("rect", { x: "7", y: "6", width: "6", height: "7", rx: "0.8", fill: "currentColor" }),
966
+ /* @__PURE__ */ a3("rect", { x: "14", y: "8", width: "3", height: "4", rx: "0.6" })
967
+ ] });
968
+ var RenkoIcon = () => /* @__PURE__ */ a3(Icon, { children: [
969
+ /* @__PURE__ */ a3("rect", { x: "2.5", y: "11", width: "4", height: "4", rx: "0.5", fill: "currentColor" }),
970
+ /* @__PURE__ */ a3("rect", { x: "7.5", y: "7", width: "4", height: "4", rx: "0.5", fill: "currentColor" }),
971
+ /* @__PURE__ */ a3("rect", { x: "12.5", y: "3", width: "4", height: "4", rx: "0.5", fill: "currentColor" }),
972
+ /* @__PURE__ */ a3("rect", { x: "12.5", y: "7.5", width: "4", height: "4", rx: "0.5" })
973
+ ] });
974
+ var KagiIcon = () => /* @__PURE__ */ a3(Icon, { children: [
975
+ /* @__PURE__ */ a3("path", { d: "M3 15V8h4v5h4V4h5v8" }),
976
+ /* @__PURE__ */ a3("path", { d: "M11 4v5", "stroke-width": "2.8" })
977
+ ] });
978
+ var LineBreakIcon = () => /* @__PURE__ */ a3(Icon, { children: [
979
+ /* @__PURE__ */ a3("rect", { x: "2.5", y: "11", width: "3.5", height: "5", rx: "0.5", fill: "currentColor" }),
980
+ /* @__PURE__ */ a3("rect", { x: "6.5", y: "6", width: "3.5", height: "5", rx: "0.5", fill: "currentColor" }),
981
+ /* @__PURE__ */ a3("rect", { x: "10.5", y: "3", width: "3.5", height: "3", rx: "0.5", fill: "currentColor" }),
982
+ /* @__PURE__ */ a3("rect", { x: "14.5", y: "3", width: "3.5", height: "9", rx: "0.5" })
983
+ ] });
984
+ var PointFigureIcon = () => /* @__PURE__ */ a3(Icon, { children: [
985
+ /* @__PURE__ */ a3("path", { d: "M3 12l3 3M6 12l-3 3M3 8l3 3M6 8l-3 3M3 4l3 3M6 4l-3 3", "stroke-width": "1.3" }),
986
+ /* @__PURE__ */ a3("circle", { cx: "11", cy: "7.5", r: "1.6" }),
987
+ /* @__PURE__ */ a3("circle", { cx: "11", cy: "11.5", r: "1.6" }),
988
+ /* @__PURE__ */ a3("path", { d: "M14 10l3 3M17 10l-3 3M14 6l3 3M17 6l-3 3", "stroke-width": "1.3" })
989
+ ] });
938
990
  var IndicatorIcon = () => /* @__PURE__ */ a3(Icon, { children: [
939
991
  /* @__PURE__ */ a3("path", { d: "M3 15.5l4-5 3 2.5 3.5-5L17 11" }),
940
992
  /* @__PURE__ */ a3("path", { d: "M3 4.5v11.5h14" })
@@ -943,6 +995,11 @@ var GearIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: [
943
995
  /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "2.4" }),
944
996
  /* @__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" })
945
997
  ] });
998
+ var TemplateIcon = () => /* @__PURE__ */ a3(Icon, { children: [
999
+ /* @__PURE__ */ a3("rect", { x: "3", y: "7", width: "10", height: "10", rx: "2" }),
1000
+ /* @__PURE__ */ a3("path", { d: "M7 4h8a2 2 0 0 1 2 2v8" })
1001
+ ] });
1002
+ var SmallPlusIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M5 10h10M10 5v10" }) });
946
1003
  var SmallCloseIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M6 6l8 8M14 6l-8 8" }) });
947
1004
  var EyeIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: [
948
1005
  /* @__PURE__ */ a3("path", { d: "M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z" }),
@@ -1353,6 +1410,12 @@ var FONT_SIZES = [10, 12, 14, 16, 20, 24, 32];
1353
1410
  var DASH_ORDER = ["solid", "dashed", "dotted"];
1354
1411
  var RECENT_KEY = "fnc-drawing-colors";
1355
1412
  var POS_KEY = "fnc-selbar-pos";
1413
+ var TEMPLATES_KEY = "fnc-drawing-templates";
1414
+ var TEMPLATES_MAX = 20;
1415
+ var lookOf = (style) => {
1416
+ const { width, dash, fontSize, colors } = style;
1417
+ return { ...width ? { width } : {}, ...dash ? { dash } : {}, ...fontSize ? { fontSize } : {}, ...colors ? { colors: { ...colors } } : {} };
1418
+ };
1356
1419
  var readJson = (key, fallback) => {
1357
1420
  try {
1358
1421
  const raw = localStorage.getItem(key);
@@ -1378,6 +1441,8 @@ function SelectionBar({ ctx }) {
1378
1441
  const [offset, setOffset] = d2(() => readJson(POS_KEY, [0, 0]));
1379
1442
  const [recent, setRecent] = d2(() => readJson(RECENT_KEY, []));
1380
1443
  const [menu, setMenu] = d2(null);
1444
+ const [templates, setTemplates] = d2(() => readJson(TEMPLATES_KEY, {}));
1445
+ const [naming, setNaming] = d2(null);
1381
1446
  const colorInput = T2(null);
1382
1447
  if (!d3 || s3.layout.plotWidth <= 0) return null;
1383
1448
  const def = ctx.chart.drawingDefinitions().find((x2) => x2.type === d3.type);
@@ -1399,6 +1464,28 @@ function SelectionBar({ ctx }) {
1399
1464
  };
1400
1465
  const locked = !!style.locked;
1401
1466
  const dash = style.dash ?? "solid";
1467
+ const mine = templates[d3.type] ?? [];
1468
+ const keepTemplates = (next) => {
1469
+ const all = { ...templates, [d3.type]: next };
1470
+ if (!next.length) delete all[d3.type];
1471
+ setTemplates(all);
1472
+ writeJson(TEMPLATES_KEY, all);
1473
+ };
1474
+ const saveTemplate = () => {
1475
+ const name = (naming ?? "").trim().slice(0, 30);
1476
+ if (!name) return setNaming(null);
1477
+ keepTemplates([{ name, ...d3.color ? { color: d3.color } : {}, style: lookOf(style) }, ...mine.filter((x2) => x2.name !== name)].slice(0, TEMPLATES_MAX));
1478
+ setNaming(null);
1479
+ setMenu(null);
1480
+ };
1481
+ const applyTemplate = (tpl) => {
1482
+ const { text, locked: lock, hidden } = style;
1483
+ ctx.chart.updateDrawing(d3.id, {
1484
+ ...tpl.color ? { color: tpl.color } : {},
1485
+ style: { ...tpl.style, ...text !== void 0 ? { text } : {}, ...lock ? { locked: lock } : {}, ...hidden ? { hidden } : {} }
1486
+ });
1487
+ setMenu(null);
1488
+ };
1402
1489
  const actions = ctx.drawingActions?.(d3, ctx.chart) ?? [];
1403
1490
  const startMove = (e3) => {
1404
1491
  e3.preventDefault();
@@ -1542,6 +1629,69 @@ function SelectionBar({ ctx }) {
1542
1629
  }
1543
1630
  )) })
1544
1631
  ] }),
1632
+ /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
1633
+ /* @__PURE__ */ a3(
1634
+ "button",
1635
+ {
1636
+ class: "fnc-btn",
1637
+ "data-tip": t3.templates,
1638
+ "aria-label": t3.templates,
1639
+ "aria-expanded": menu === "template",
1640
+ onClick: () => {
1641
+ setNaming(null);
1642
+ setMenu(menu === "template" ? null : "template");
1643
+ },
1644
+ children: /* @__PURE__ */ a3(TemplateIcon, {})
1645
+ }
1646
+ ),
1647
+ menu === "template" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-template-menu", role: "menu", children: [
1648
+ mine.length === 0 && /* @__PURE__ */ a3("div", { class: "fnc-menu-note", children: t3.noTemplates }),
1649
+ mine.map((tpl) => /* @__PURE__ */ a3("div", { class: "fnc-template-row", children: [
1650
+ /* @__PURE__ */ a3("button", { class: "fnc-menu-item", role: "menuitem", onClick: () => applyTemplate(tpl), children: [
1651
+ /* @__PURE__ */ a3("span", { class: "fnc-swatch", style: { background: tpl.color ?? current } }),
1652
+ /* @__PURE__ */ a3("svg", { width: "28", height: "12", viewBox: "0 0 28 12", "aria-hidden": "true", children: /* @__PURE__ */ a3(
1653
+ "path",
1654
+ {
1655
+ d: "M2 6h24",
1656
+ stroke: tpl.color ?? current,
1657
+ "stroke-width": tpl.style.width ?? 2,
1658
+ "stroke-linecap": "round",
1659
+ "stroke-dasharray": tpl.style.dash === "dashed" ? "4 3" : tpl.style.dash === "dotted" ? "1 3" : void 0
1660
+ }
1661
+ ) }),
1662
+ /* @__PURE__ */ a3("span", { children: tpl.name })
1663
+ ] }),
1664
+ /* @__PURE__ */ a3(
1665
+ "button",
1666
+ {
1667
+ class: "fnc-ind-btn",
1668
+ "data-tip": t3.deleteTemplate,
1669
+ "aria-label": `${tpl.name} ${t3.deleteTemplate}`,
1670
+ onClick: () => keepTemplates(mine.filter((x2) => x2 !== tpl)),
1671
+ children: /* @__PURE__ */ a3(SmallCloseIcon, {})
1672
+ }
1673
+ )
1674
+ ] })),
1675
+ /* @__PURE__ */ a3("div", { class: "fnc-menu-sep" }),
1676
+ naming === null ? /* @__PURE__ */ a3("button", { class: "fnc-menu-item", role: "menuitem", onClick: () => setNaming(""), children: t3.saveTemplate }) : /* @__PURE__ */ a3(
1677
+ "input",
1678
+ {
1679
+ class: "fnc-selbar-text fnc-template-name",
1680
+ value: naming,
1681
+ placeholder: t3.templateName,
1682
+ "aria-label": t3.templateName,
1683
+ maxLength: 30,
1684
+ autoFocus: true,
1685
+ onInput: (e3) => setNaming(e3.target.value),
1686
+ onKeyDown: (e3) => {
1687
+ e3.stopPropagation();
1688
+ if (e3.key === "Enter") saveTemplate();
1689
+ if (e3.key === "Escape") setNaming(null);
1690
+ }
1691
+ }
1692
+ )
1693
+ ] })
1694
+ ] }),
1545
1695
  actions.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-sep" }),
1546
1696
  actions.map((a4) => /* @__PURE__ */ a3(
1547
1697
  "button",
@@ -1987,6 +2137,35 @@ function Dialog({ title, onClose, children, wide }) {
1987
2137
  ) });
1988
2138
  }
1989
2139
  var SEARCH_THRESHOLD = 8;
2140
+ function paramsOnIndicator(def) {
2141
+ if (!Array.isArray(def.defaults.lines)) return void 0;
2142
+ return { lines: [{ period: def.type === "ema" ? 9 : 14, source: "close" }] };
2143
+ }
2144
+ function IndicatorOnPicker({ ctx, on }) {
2145
+ const { locale } = useStore(ctx.store);
2146
+ const t3 = stringsOf(ctx.store.get());
2147
+ const close = () => ctx.store.set({ dialog: null });
2148
+ const host = ctx.chart.indicatorLegend().find((i3) => i3.id === on);
2149
+ if (!host) return null;
2150
+ const defs = ctx.chart.indicatorsOnIndicator();
2151
+ return /* @__PURE__ */ a3(Dialog, { title: t3.addIndicatorOn, onClose: close, children: /* @__PURE__ */ a3("div", { class: "fnc-sr-list fnc-scroll", children: [
2152
+ /* @__PURE__ */ a3("div", { class: "fnc-sr-section", children: t3.onIndicatorSection.replace("{name}", host.title) }),
2153
+ defs.map((def) => /* @__PURE__ */ a3(
2154
+ "button",
2155
+ {
2156
+ class: "fnc-sr-row",
2157
+ onClick: () => {
2158
+ ctx.chart.addIndicatorOn(on, def.type, paramsOnIndicator(def));
2159
+ close();
2160
+ },
2161
+ children: /* @__PURE__ */ a3("span", { class: "fnc-sr-main", children: [
2162
+ /* @__PURE__ */ a3("span", { class: "fnc-sr-name", children: def.name[locale] }),
2163
+ /* @__PURE__ */ a3("span", { class: "fnc-sr-meta", children: def.description[locale] })
2164
+ ] })
2165
+ }
2166
+ ))
2167
+ ] }) });
2168
+ }
1990
2169
  function IndicatorPicker({ ctx }) {
1991
2170
  const { locale } = useStore(ctx.store);
1992
2171
  const t3 = stringsOf(ctx.store.get());
@@ -2085,6 +2264,7 @@ function IndicatorSettings({ ctx, id }) {
2085
2264
  const config = indicators.find((c3) => c3.id === id);
2086
2265
  const def = config ? ctx.chart.indicatorDefinition(config.type) ?? null : null;
2087
2266
  const hasLines = !!def?.params.some((p3) => p3.kind === "lines");
2267
+ const onIndicator = !!config?.on;
2088
2268
  const [lines, setLines] = d2(() => {
2089
2269
  if (!config || !def || !hasLines) return [];
2090
2270
  const defaults = defaultSeries(def, config.params);
@@ -2155,7 +2335,7 @@ function IndicatorSettings({ ctx, id }) {
2155
2335
  i3 + 1
2156
2336
  ] }),
2157
2337
  /* @__PURE__ */ a3(StyleControls, { t: t3, row: l3, onChange: (p3) => updateLine(i3, p3) }),
2158
- /* @__PURE__ */ a3(SourceSelect, { value: l3.source, locale, label: t3.source, onChange: (source) => updateLine(i3, { source }) }),
2338
+ !onIndicator && /* @__PURE__ */ a3(SourceSelect, { value: l3.source, locale, label: t3.source, onChange: (source) => updateLine(i3, { source }) }),
2159
2339
  /* @__PURE__ */ a3(
2160
2340
  "input",
2161
2341
  {
@@ -2174,7 +2354,7 @@ function IndicatorSettings({ ctx, id }) {
2174
2354
  ] })
2175
2355
  ] }) : /* @__PURE__ */ a3($, { children: [
2176
2356
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.inputs }),
2177
- def.params.map((spec) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
2357
+ def.params.filter((spec) => !(onIndicator && spec.kind === "source")).map((spec) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
2178
2358
  /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: spec.label[locale] }),
2179
2359
  spec.kind === "source" ? /* @__PURE__ */ a3(
2180
2360
  SourceSelect,
@@ -2221,7 +2401,7 @@ function IndicatorSettings({ ctx, id }) {
2221
2401
  }
2222
2402
  function Dialogs({ ctx }) {
2223
2403
  const { dialog } = useStore(ctx.store);
2224
- if (dialog?.kind === "indicators") return /* @__PURE__ */ a3(IndicatorPicker, { ctx });
2404
+ if (dialog?.kind === "indicators") return dialog.on ? /* @__PURE__ */ a3(IndicatorOnPicker, { ctx, on: dialog.on }) : /* @__PURE__ */ a3(IndicatorPicker, { ctx });
2225
2405
  if (dialog?.kind === "indicatorSettings") return /* @__PURE__ */ a3(IndicatorSettings, { ctx, id: dialog.id });
2226
2406
  if (dialog?.kind === "chartSettings") return /* @__PURE__ */ a3(SettingsDialog, { ctx });
2227
2407
  if (dialog?.kind === "goToDate") return /* @__PURE__ */ a3(GoToDateDialog, { ctx });
@@ -2884,7 +3064,12 @@ var TYPES = [
2884
3064
  { type: "line", label: "line", icon: LineChartIcon },
2885
3065
  { type: "step", label: "stepLine", icon: StepLineIcon },
2886
3066
  { type: "baseline", label: "baseline", icon: BaselineIcon },
2887
- { type: "area", label: "area", icon: AreaChartIcon }
3067
+ { type: "area", label: "area", icon: AreaChartIcon },
3068
+ { type: "volumeCandles", label: "volumeCandles", icon: VolumeCandlesIcon },
3069
+ { type: "renko", label: "renko", icon: RenkoIcon },
3070
+ { type: "kagi", label: "kagi", icon: KagiIcon },
3071
+ { type: "lineBreak", label: "lineBreak", icon: LineBreakIcon },
3072
+ { type: "pnf", label: "pointFigure", icon: PointFigureIcon }
2888
3073
  ];
2889
3074
  var SCALES2 = [
2890
3075
  { mode: "normal", label: "scaleNormal" },
@@ -3330,6 +3515,19 @@ function IndicatorItem({ ctx, item }) {
3330
3515
  e3.stopPropagation();
3331
3516
  ctx.chart.moveIndicator(item.id, 1);
3332
3517
  }, children: /* @__PURE__ */ a3(ChevronDownIcon, {}) }),
3518
+ item.hostable && ctx.chart.indicatorsOnIndicator().length > 0 && /* @__PURE__ */ a3(
3519
+ "button",
3520
+ {
3521
+ class: "fnc-ind-btn",
3522
+ "data-tip": t3.addIndicatorOn,
3523
+ "aria-label": `${item.title} ${t3.addIndicatorOn}`,
3524
+ onClick: (e3) => {
3525
+ e3.stopPropagation();
3526
+ ctx.store.set({ dialog: { kind: "indicators", on: item.id } });
3527
+ },
3528
+ children: /* @__PURE__ */ a3(SmallPlusIcon, {})
3529
+ }
3530
+ ),
3333
3531
  /* @__PURE__ */ a3(
3334
3532
  "button",
3335
3533
  {
@@ -3477,7 +3675,7 @@ function Legend({ ctx }) {
3477
3675
  }
3478
3676
  const items = s3.indicators.length ? ctx.chart.indicatorLegend(hover?.index) : [];
3479
3677
  const overlayItems = items.filter((i3) => i3.overlay);
3480
- const paneLegends = s3.layout.panes.filter((p3) => p3.kind === "indicator").map((pane) => ({ pane, item: items.find((i3) => i3.id === pane.id) }));
3678
+ 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) }));
3481
3679
  const volumePane = s3.layout.panes.find((p3) => p3.kind === "volume");
3482
3680
  return /* @__PURE__ */ a3($, { children: [
3483
3681
  /* @__PURE__ */ a3("div", { class: "fnc-legend", ref, children: [
@@ -3512,7 +3710,10 @@ function Legend({ ctx }) {
3512
3710
  ] }),
3513
3711
  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 }) }),
3514
3712
  paneLegends.map(
3515
- ({ pane, item }) => item && /* @__PURE__ */ a3("div", { class: "fnc-legend fnc-pane-legend", style: { top: `${pane.top + 4}px` }, children: /* @__PURE__ */ a3(IndicatorItem, { ctx, item }) })
3713
+ ({ pane, item, kids }) => item && /* @__PURE__ */ a3("div", { class: "fnc-legend fnc-pane-legend", style: { top: `${pane.top + 4}px` }, children: [
3714
+ /* @__PURE__ */ a3(IndicatorItem, { ctx, item }),
3715
+ kids.map((kid) => /* @__PURE__ */ a3(IndicatorItem, { ctx, item: kid }))
3716
+ ] })
3516
3717
  )
3517
3718
  ] });
3518
3719
  }
@@ -4780,11 +4981,18 @@ var CSS = (
4780
4981
  .fnc-tools-menu { width: 300px; padding: 8px; gap: 2px; max-height: 72vh; overflow-y: auto; }
4781
4982
  .fnc-tools-section { padding: 8px 6px 6px; font-size: 12px; font-weight: 700; color: var(--fnc-text-2); }
4782
4983
  .fnc-tools-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0 2px 4px; }
4783
- .fnc-tools-seg[data-count="5"], .fnc-tools-seg[data-count="8"] { display: grid; grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); gap: 2px; }
4784
- .fnc-tools-seg[data-count="8"] { grid-template-columns: repeat(4, 1fr); }
4785
- .fnc-tools-seg[data-count="5"] button, .fnc-tools-seg[data-count="8"] button { flex-direction: column; gap: 2px; height: auto; min-height: 40px; padding: 5px 4px; font-size: 12px; white-space: normal; word-break: keep-all; text-align: center; line-height: 1.25; }
4984
+ .fnc-tools-seg[data-count="5"], .fnc-tools-seg[data-count="8"], .fnc-tools-seg[data-count="13"] { display: grid; grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); gap: 2px; }
4985
+ .fnc-tools-seg[data-count="8"], .fnc-tools-seg[data-count="13"] { grid-template-columns: repeat(4, 1fr); }
4986
+ .fnc-tools-seg[data-count="5"] button, .fnc-tools-seg[data-count="8"] button, .fnc-tools-seg[data-count="13"] button { flex-direction: column; gap: 2px; height: auto; min-height: 40px; padding: 5px 4px; font-size: 12px; white-space: normal; word-break: keep-all; text-align: center; line-height: 1.25; }
4786
4987
  .fnc-tools-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 0 6px; }
4787
4988
  .fnc-tools-seg svg { width: 16px; height: 16px; flex: none; }
4989
+ .fnc-template-menu { min-width: 220px; }
4990
+ .fnc-template-row { display: flex; align-items: center; }
4991
+ .fnc-template-row .fnc-menu-item { flex: 1; min-width: 0; gap: 8px; }
4992
+ .fnc-template-row .fnc-menu-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
4993
+ .fnc-template-name { width: calc(100% - 8px); margin: 4px; }
4994
+ .fnc-menu-note { padding: 8px 10px; color: var(--fnc-text-2); font-size: 12px; }
4995
+ .fnc-menu-sep { height: 1px; margin: 4px 6px; background: var(--fnc-border); }
4788
4996
  .fnc-tools-layouts { display: flex; flex-direction: column; gap: 2px; padding: 0 2px 4px; }
4789
4997
  .fnc-tools-sep { height: 1px; margin: 6px 4px; background: var(--fnc-border); }
4790
4998
  .fnc-tools-icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.8.7",
3
+ "version": "0.9.1",
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.8.7"
45
+ "@funnest/charts": "0.9.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"