@funnest/charts-ui 0.11.20 → 0.11.21

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
@@ -200,7 +200,10 @@ export interface WidgetContext {
200
200
  export interface LayoutSync {
201
201
  /** Mirror the crosshair's time in every pane. */
202
202
  crosshair: boolean;
203
- /** Scroll/zoom every pane to the same time span. */
203
+ /**
204
+ * Old 시간 범위 동기화, now ChartSettings.timeLink 'follow' (같이 이동): turning it on sets that on
205
+ * every chart; it reads false.
206
+ */
204
207
  time: boolean;
205
208
  /** Changing the symbol changes it in every pane. */
206
209
  symbol: boolean;
package/dist/i18n.d.ts CHANGED
@@ -112,6 +112,22 @@ export declare const STRINGS: {
112
112
  hintPriceAnimation: string;
113
113
  hintDrawOnLoad: string;
114
114
  hintSymbolWatermark: string;
115
+ settingsSplit: string;
116
+ splitSyncCrosshair: string;
117
+ hintSplitSyncCrosshair: string;
118
+ splitSyncSymbol: string;
119
+ hintSplitSyncSymbol: string;
120
+ splitSyncInterval: string;
121
+ hintSplitSyncInterval: string;
122
+ settingsTimeLink: string;
123
+ timeLinkOff: string;
124
+ timeLinkMark: string;
125
+ timeLinkJump: string;
126
+ timeLinkFollow: string;
127
+ hintTimeLinkOff: string;
128
+ hintTimeLinkMark: string;
129
+ hintTimeLinkJump: string;
130
+ hintTimeLinkFollow: string;
115
131
  hintReplayWatermark: string;
116
132
  undo: string;
117
133
  tools: string;
@@ -442,6 +458,22 @@ export declare const STRINGS: {
442
458
  hintPriceAnimation: string;
443
459
  hintDrawOnLoad: string;
444
460
  hintSymbolWatermark: string;
461
+ settingsSplit: string;
462
+ splitSyncCrosshair: string;
463
+ hintSplitSyncCrosshair: string;
464
+ splitSyncSymbol: string;
465
+ hintSplitSyncSymbol: string;
466
+ splitSyncInterval: string;
467
+ hintSplitSyncInterval: string;
468
+ settingsTimeLink: string;
469
+ timeLinkOff: string;
470
+ timeLinkMark: string;
471
+ timeLinkJump: string;
472
+ timeLinkFollow: string;
473
+ hintTimeLinkOff: string;
474
+ hintTimeLinkMark: string;
475
+ hintTimeLinkJump: string;
476
+ hintTimeLinkFollow: string;
445
477
  hintReplayWatermark: string;
446
478
  undo: string;
447
479
  tools: string;
package/dist/index.js CHANGED
@@ -547,6 +547,22 @@ var STRINGS = {
547
547
  hintPriceAnimation: "\uC0C8 \uAC00\uACA9\uC774 \uB4E4\uC5B4\uC624\uBA74 \uB9C8\uC9C0\uB9C9 \uCE94\uB4E4\uACFC \uD604\uC7AC\uAC00 \uC120\uC774 \uC0C8 \uAC00\uACA9\uAE4C\uC9C0 \uBBF8\uB044\uB7EC\uC9C0\uB4EF \uC6C0\uC9C1\uC5EC\uC694.",
548
548
  hintDrawOnLoad: "\uC885\uBAA9\uC774\uB098 \uC8FC\uAE30\uB97C \uBC14\uAFD4 \uCC28\uD2B8\uB97C \uBD88\uB7EC\uC62C \uB54C \uCE94\uB4E4\uC774 \uC67C\uCABD\uBD80\uD130 \uCC28\uB840\uB85C \uADF8\uB824\uC838\uC694.",
549
549
  hintSymbolWatermark: "\uAC00\uACA9 \uC601\uC5ED \uAC00\uC6B4\uB370\uC5D0 \uC885\uBAA9 \uC774\uB984\uACFC \uC8FC\uAE30\uB97C \uD750\uB9AC\uAC8C \uBCF4\uC5EC\uC918\uC694.",
550
+ settingsSplit: "\uBD84\uD560 \uD654\uBA74",
551
+ splitSyncCrosshair: "\uC2ED\uC790\uC120 \uAC19\uC774 \uBCF4\uAE30",
552
+ hintSplitSyncCrosshair: "\uD55C \uCC28\uD2B8\uC5D0 \uB9C8\uC6B0\uC2A4\uB97C \uC62C\uB9AC\uBA74 \uB098\uBA38\uC9C0 \uCC28\uD2B8\uC5D0\uB3C4 \uAC19\uC740 \uC2DC\uAC01\uC5D0 \uC138\uB85C\uC120\uC774 \uBCF4\uC5EC\uC694.",
553
+ splitSyncSymbol: "\uC885\uBAA9 \uAC19\uC774 \uBC14\uAFB8\uAE30",
554
+ hintSplitSyncSymbol: "\uD55C \uCC28\uD2B8\uC758 \uC885\uBAA9\uC744 \uBC14\uAFB8\uBA74 \uB098\uBA38\uC9C0 \uCC28\uD2B8\uB3C4 \uADF8 \uC885\uBAA9\uC73C\uB85C \uBC14\uB00C\uC5B4\uC694.",
555
+ splitSyncInterval: "\uC8FC\uAE30 \uAC19\uC774 \uBC14\uAFB8\uAE30",
556
+ hintSplitSyncInterval: "\uD55C \uCC28\uD2B8\uC758 \uC8FC\uAE30\uB97C \uBC14\uAFB8\uBA74 \uB098\uBA38\uC9C0 \uCC28\uD2B8\uB3C4 \uADF8 \uC8FC\uAE30\uB85C \uBC14\uB00C\uC5B4\uC694.",
557
+ settingsTimeLink: "\uC2DC\uC810 \uB9DE\uCD94\uAE30",
558
+ timeLinkOff: "\uB044\uAE30",
559
+ timeLinkMark: "\uD45C\uC2DC\uB9CC",
560
+ timeLinkJump: "\uD074\uB9AD \uC2DC \uC774\uB3D9",
561
+ timeLinkFollow: "\uAC19\uC774 \uC774\uB3D9",
562
+ hintTimeLinkOff: "\uCC28\uD2B8\uB9C8\uB2E4 \uB530\uB85C \uC6C0\uC9C1\uC5EC\uC694.",
563
+ hintTimeLinkMark: "\uCE94\uB4E4\uC744 \uD074\uB9AD\uD558\uBA74 \uBAA8\uB4E0 \uCC28\uD2B8\uC5D0 \uADF8 \uC2DC\uC810\uC744 \uC138\uB85C \uC810\uC120\uC73C\uB85C \uD45C\uC2DC\uD574\uC694. \uCC28\uD2B8\uB294 \uC6C0\uC9C1\uC774\uC9C0 \uC54A\uC544\uC694.",
564
+ hintTimeLinkJump: "\uCE94\uB4E4\uC744 \uD074\uB9AD\uD558\uBA74 \uADF8 \uC2DC\uC810\uC744 \uD45C\uC2DC\uD558\uACE0, \uB098\uBA38\uC9C0 \uCC28\uD2B8\uB3C4 \uADF8 \uC2DC\uC810\uC73C\uB85C \uAC00\uC694. \uC8FC\uAE30\uC640 \uD655\uB300 \uC815\uB3C4\uB294 \uCC28\uD2B8\uB9C8\uB2E4 \uADF8\uB300\uB85C\uC608\uC694.",
565
+ hintTimeLinkFollow: "\uD55C \uCC28\uD2B8\uB97C \uC6C0\uC9C1\uC774\uBA74 \uB098\uBA38\uC9C0\uB3C4 \uB530\uB77C\uC640\uC694. \uC8FC\uAE30\uAC00 \uAC19\uC73C\uBA74 \uBCF4\uC774\uB294 \uBC94\uC704\uAE4C\uC9C0 \uB611\uAC19\uC774, \uB2E4\uB974\uBA74 \uAC19\uC740 \uC2DC\uC810\uC744 \uAC00\uC6B4\uB370\uC5D0 \uB46C\uC694. \uD074\uB9AD\uD55C \uC2DC\uC810\uB3C4 \uD45C\uC2DC\uD574\uC694.",
550
566
  hintReplayWatermark: '\uB9AC\uD50C\uB808\uC774 \uC911\uC5D0\uB294 \uAC00\uACA9 \uC601\uC5ED\uC5D0 "\uB9AC\uD50C\uB808\uC774"\uB97C \uD750\uB9AC\uAC8C \uBCF4\uC5EC\uC918\uC694.',
551
567
  undo: "\uB418\uB3CC\uB9AC\uAE30",
552
568
  tools: "\uB3C4\uAD6C",
@@ -879,6 +895,22 @@ var STRINGS = {
879
895
  hintPriceAnimation: "A new price slides the last candle and the last-price line to it.",
880
896
  hintDrawOnLoad: "Candles draw in from the left when a symbol or interval loads.",
881
897
  hintSymbolWatermark: "The symbol and interval, faint in the middle of the price pane.",
898
+ settingsSplit: "Split view",
899
+ splitSyncCrosshair: "Crosshair on every chart",
900
+ hintSplitSyncCrosshair: "Hovering one chart shows a line at the same time on the others.",
901
+ splitSyncSymbol: "Symbol on every chart",
902
+ hintSplitSyncSymbol: "Changing one chart\u2019s symbol changes the others\u2019 too.",
903
+ splitSyncInterval: "Interval on every chart",
904
+ hintSplitSyncInterval: "Changing one chart\u2019s interval changes the others\u2019 too.",
905
+ settingsTimeLink: "One moment",
906
+ timeLinkOff: "Off",
907
+ timeLinkMark: "Mark",
908
+ timeLinkJump: "Jump on click",
909
+ timeLinkFollow: "Move together",
910
+ hintTimeLinkOff: "Each chart moves on its own.",
911
+ hintTimeLinkMark: "A click on a candle marks that time on every chart with a dashed line. Nothing moves.",
912
+ hintTimeLinkJump: "A click on a candle marks that time and takes the other charts there, each keeping its own interval and zoom.",
913
+ hintTimeLinkFollow: "Moving one chart moves the others: the same range at the same interval, the same time in the middle otherwise. Clicks are marked too.",
882
914
  hintReplayWatermark: '"Replay", faint in the price pane while a replay runs.',
883
915
  undo: "Undo",
884
916
  tools: "Tools",
@@ -3053,6 +3085,17 @@ var WATERMARK_ROWS = [
3053
3085
  { key: "symbolWatermark", label: "settingSymbolWatermark", hint: "hintSymbolWatermark" },
3054
3086
  { key: "replayWatermark", label: "settingReplayWatermark", hint: "hintReplayWatermark" }
3055
3087
  ];
3088
+ var SPLIT_SYNC = [
3089
+ { key: "crosshair", label: "splitSyncCrosshair", hint: "hintSplitSyncCrosshair" },
3090
+ { key: "symbol", label: "splitSyncSymbol", hint: "hintSplitSyncSymbol" },
3091
+ { key: "interval", label: "splitSyncInterval", hint: "hintSplitSyncInterval" }
3092
+ ];
3093
+ var TIME_LINK_CHOICES = [
3094
+ { link: "off", label: "timeLinkOff", hint: "hintTimeLinkOff" },
3095
+ { link: "mark", label: "timeLinkMark", hint: "hintTimeLinkMark" },
3096
+ { link: "jump", label: "timeLinkJump", hint: "hintTimeLinkJump" },
3097
+ { link: "follow", label: "timeLinkFollow", hint: "hintTimeLinkFollow" }
3098
+ ];
3056
3099
  var MOTION_ROWS = [
3057
3100
  { key: "zoomAnimation", label: "settingZoomAnimation", hint: "hintZoomAnimation" },
3058
3101
  { key: "scrollInertia", label: "settingScrollInertia", hint: "hintScrollInertia" },
@@ -3196,7 +3239,8 @@ function SettingsDialog({ ctx }) {
3196
3239
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsDisplay }),
3197
3240
  toggles(VIEW_ROWS),
3198
3241
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsWatermark }),
3199
- toggles(WATERMARK_ROWS)
3242
+ toggles(WATERMARK_ROWS),
3243
+ ctx.multi && /* @__PURE__ */ a3(SplitSettings, { multi: ctx.multi, timeLink: settings.timeLink, t: t3 })
3200
3244
  ] }),
3201
3245
  shown === "motion" && /* @__PURE__ */ a3($, { children: [
3202
3246
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsTabMotion }),
@@ -3391,6 +3435,20 @@ function demoBars(price, interval, count, volume) {
3391
3435
  const won = (v3) => Math.round(v3 + shift);
3392
3436
  return bars.map((b) => ({ ...b, open: won(b.open), high: won(b.high), low: won(b.low), close: won(b.close) }));
3393
3437
  }
3438
+ function SplitSettings({ multi, timeLink, t: t3 }) {
3439
+ const m3 = useStore(multi.store);
3440
+ return /* @__PURE__ */ a3($, { children: [
3441
+ /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsSplit }),
3442
+ SPLIT_SYNC.map(({ key, label, hint }) => /* @__PURE__ */ a3("label", { class: "fnc-row fnc-toggle-row", children: [
3443
+ /* @__PURE__ */ a3("span", { class: "fnc-toggle-label", children: t3[label] }),
3444
+ /* @__PURE__ */ a3(Info, { text: t3[hint] }),
3445
+ /* @__PURE__ */ a3("input", { type: "checkbox", role: "switch", class: "fnc-switch", checked: m3.sync[key], onChange: (e3) => multi.setSync({ [key]: e3.currentTarget.checked }) })
3446
+ ] })),
3447
+ /* @__PURE__ */ a3("div", { class: "fnc-row fnc-timelink-label", children: t3.settingsTimeLink }),
3448
+ /* @__PURE__ */ a3("div", { class: "fnc-seg fnc-settings-seg fnc-timelink-seg", role: "radiogroup", "aria-label": t3.settingsTimeLink, children: TIME_LINK_CHOICES.map(({ link, label }) => /* @__PURE__ */ a3("button", { type: "button", role: "radio", "aria-checked": timeLink === link, onClick: () => multi.applySettings({ timeLink: link }), children: t3[label] })) }),
3449
+ /* @__PURE__ */ a3("p", { class: "fnc-timelink-note", children: t3[TIME_LINK_CHOICES.find((c3) => c3.link === timeLink)?.hint ?? "hintTimeLinkOff"] })
3450
+ ] });
3451
+ }
3394
3452
 
3395
3453
  // src/components/indicator-dialogs.tsx
3396
3454
  function Dialog({ title, onClose, children, wide }) {
@@ -4148,7 +4206,6 @@ var SCALES2 = [
4148
4206
  ];
4149
4207
  var SYNC_KEYS = [
4150
4208
  { key: "crosshair", label: "syncCrosshair" },
4151
- { key: "time", label: "syncTime" },
4152
4209
  { key: "symbol", label: "syncSymbol" },
4153
4210
  { key: "interval", label: "syncInterval" }
4154
4211
  ];
@@ -6227,6 +6284,9 @@ var CSS = (
6227
6284
  .fnc-tools-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 0 6px; }
6228
6285
  .fnc-tools-seg svg { width: 16px; height: 16px; flex: none; }
6229
6286
  .fnc-template-menu { min-width: 220px; }
6287
+ .fnc-timelink-seg button { flex: 1; white-space: nowrap; }
6288
+ .fnc-timelink-label { margin-top: 6px; font-size: 13px; color: var(--fnc-text); }
6289
+ .fnc-timelink-note { margin: 6px 2px 2px; font-size: 12px; line-height: 1.5; color: var(--fnc-text-2); }
6230
6290
  .fnc-levels-menu { min-width: 340px; }
6231
6291
  .fnc-level-text { flex: 1; min-width: 0; width: 110px; height: 28px; padding: 0 8px; font-size: 13px; }
6232
6292
  .fnc-options-menu { min-width: 280px; max-height: min(70vh, 560px); overflow-y: auto; }
@@ -7354,9 +7414,22 @@ function createMultiChart(container, options) {
7354
7414
  for (const other of visible()) if (other !== pane) other.chart.setSyncedCrosshair(info ? info.time : null);
7355
7415
  });
7356
7416
  c3.on("visibleRangeChange", () => {
7357
- if (!store.get().sync.time || panes[driver] !== pane) return;
7358
- broadcastTime(pane);
7417
+ if (panes[driver] !== pane) return;
7418
+ if (c3.settings.timeLink === "follow") followTime(pane);
7419
+ });
7420
+ c3.on("barClick", ({ time }) => {
7421
+ const link = c3.settings.timeLink;
7422
+ if (time === null || link === "off") return;
7423
+ if (markTime === time) return setMark(null);
7424
+ setMark(time);
7425
+ if (link === "jump" || link === "follow") {
7426
+ for (const other of visible()) if (other !== pane) void other.chart.goToTime(time);
7427
+ }
7428
+ });
7429
+ c3.on("settingsChange", (s3) => {
7430
+ if (s3.timeLink === "off" && markTime !== null) setMark(null);
7359
7431
  });
7432
+ marks.set(pane, c3.addOverlay({ render: (rc) => drawMark(rc) }));
7360
7433
  c3.on("symbolChange", (info) => {
7361
7434
  queueState();
7362
7435
  if (panes[store.get().active] !== pane) return;
@@ -7376,12 +7449,41 @@ function createMultiChart(container, options) {
7376
7449
  void pane.load(spec.symbol, spec.resolution ?? resolution);
7377
7450
  return pane;
7378
7451
  }
7379
- function broadcastTime(from) {
7452
+ let markTime = null;
7453
+ const marks = /* @__PURE__ */ new Map();
7454
+ function setMark(time) {
7455
+ markTime = time;
7456
+ for (const m3 of marks.values()) m3.redraw();
7457
+ }
7458
+ function drawMark(rc) {
7459
+ if (markTime === null) return;
7460
+ const x2 = rc.coords.timeToX(markTime);
7461
+ if (!(x2 >= 0 && x2 <= rc.coords.plotWidth)) return;
7462
+ rc.painter.line(x2, 0, x2, rc.coords.height, rc.palette.accent, 1.5, [5, 4]);
7463
+ }
7464
+ const following = /* @__PURE__ */ new Set();
7465
+ function followTime(from) {
7380
7466
  const range = from.chart.getVisibleTimeRange();
7381
7467
  if (!range) return;
7468
+ const mid = (range.from + range.to) / 2;
7382
7469
  const res = from.chart.currentResolution;
7383
7470
  for (const other of visible()) {
7384
- if (other !== from && other.chart.currentResolution === res) other.chart.setVisibleTimeRange(range);
7471
+ if (other === from) continue;
7472
+ if (other.chart.currentResolution === res) {
7473
+ other.chart.setVisibleTimeRange(range);
7474
+ continue;
7475
+ }
7476
+ const own = other.chart.getVisibleTimeRange();
7477
+ const first = other.chart.bars[0];
7478
+ if (!own || !first) continue;
7479
+ if (mid < first.time) {
7480
+ if (following.has(other)) continue;
7481
+ following.add(other);
7482
+ void other.chart.goToTime(mid).finally(() => following.delete(other));
7483
+ continue;
7484
+ }
7485
+ const span = own.to - own.from;
7486
+ other.chart.setVisibleTimeRange({ from: mid - span / 2, to: mid + span / 2 });
7385
7487
  }
7386
7488
  }
7387
7489
  function ensurePanes(count) {
@@ -7493,12 +7595,17 @@ function createMultiChart(container, options) {
7493
7595
  queueState();
7494
7596
  }
7495
7597
  function setSync(patch) {
7598
+ if (patch.time !== void 0) {
7599
+ const { time, ...rest } = patch;
7600
+ if (time) controls.applySettings({ timeLink: "follow" });
7601
+ else if (panes[store.get().active]?.chart.settings.timeLink === "follow") controls.applySettings({ timeLink: "off" });
7602
+ patch = rest;
7603
+ }
7496
7604
  const before = store.get().sync;
7497
- const sync = { ...before, ...patch };
7605
+ const sync = { ...before, ...patch, time: false };
7498
7606
  store.set({ sync });
7499
7607
  const active = panes[store.get().active];
7500
7608
  if (!sync.crosshair) for (const p3 of panes) p3.chart.setSyncedCrosshair(null);
7501
- if (sync.time && !before.time) broadcastTime(active);
7502
7609
  if (sync.symbol && !before.symbol || sync.interval && !before.interval) {
7503
7610
  const info = active.chart.symbolInfo;
7504
7611
  const res = active.chart.currentResolution;
@@ -7612,6 +7719,8 @@ function createMultiChart(container, options) {
7612
7719
  setLayout(layout);
7613
7720
  activate(Math.min(Math.max(0, Number(raw.active) || 0), visibleCount() - 1));
7614
7721
  await Promise.all(states.map((state, i3) => panes[i3].chart.load(state)));
7722
+ if (raw.sync?.time && panes.every((p3) => p3.chart.settings.timeLink === "off")) controls.applySettings({ timeLink: "follow" });
7723
+ store.set({ sync: { ...store.get().sync, time: false } });
7615
7724
  },
7616
7725
  on: (event, listener) => {
7617
7726
  let set = listeners.get(event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.20",
3
+ "version": "0.11.21",
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.20"
45
+ "@funnest/charts": "0.11.21"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"