@funnest/charts-ui 0.11.26 → 0.11.27
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 +3 -1
- package/dist/i18n.d.ts +2 -0
- package/dist/index.js +22 -6
- package/dist/multi-chart.d.ts +1 -1
- package/package.json +2 -2
package/dist/context.d.ts
CHANGED
|
@@ -237,6 +237,8 @@ export interface LayoutSync {
|
|
|
237
237
|
symbol: boolean;
|
|
238
238
|
/** Changing the interval changes it in every pane. */
|
|
239
239
|
interval: boolean;
|
|
240
|
+
/** The same indicators in every pane: adding, removing or editing one in a pane does it in all. */
|
|
241
|
+
indicators: boolean;
|
|
240
242
|
}
|
|
241
243
|
export interface MultiState {
|
|
242
244
|
layout: LayoutId;
|
|
@@ -245,7 +247,7 @@ export interface MultiState {
|
|
|
245
247
|
active: number;
|
|
246
248
|
/** A pane temporarily filling the whole grid. */
|
|
247
249
|
maximized: number | null;
|
|
248
|
-
/** The container is too narrow to split
|
|
250
|
+
/** The container is too narrow to split side by side: two panes stack, more show one at a time with pane tabs. */
|
|
249
251
|
narrow: boolean;
|
|
250
252
|
}
|
|
251
253
|
export interface MultiControls {
|
package/dist/i18n.d.ts
CHANGED
|
@@ -325,6 +325,7 @@ export declare const STRINGS: {
|
|
|
325
325
|
syncTime: string;
|
|
326
326
|
syncSymbol: string;
|
|
327
327
|
syncInterval: string;
|
|
328
|
+
syncIndicators: string;
|
|
328
329
|
syncHint: string;
|
|
329
330
|
maximizePane: string;
|
|
330
331
|
restorePane: string;
|
|
@@ -683,6 +684,7 @@ export declare const STRINGS: {
|
|
|
683
684
|
syncTime: string;
|
|
684
685
|
syncSymbol: string;
|
|
685
686
|
syncInterval: string;
|
|
687
|
+
syncIndicators: string;
|
|
686
688
|
syncHint: string;
|
|
687
689
|
maximizePane: string;
|
|
688
690
|
restorePane: string;
|
package/dist/index.js
CHANGED
|
@@ -762,6 +762,7 @@ var STRINGS = {
|
|
|
762
762
|
syncTime: "\uC2DC\uAC04 \uBC94\uC704",
|
|
763
763
|
syncSymbol: "\uC885\uBAA9",
|
|
764
764
|
syncInterval: "\uC8FC\uAE30",
|
|
765
|
+
syncIndicators: "\uC9C0\uD45C",
|
|
765
766
|
syncHint: "\uCF1C\uBA74 \uBAA8\uB4E0 \uCE78\uC774 \uAC19\uC774 \uC6C0\uC9C1\uC5EC\uC694",
|
|
766
767
|
maximizePane: "\uC774 \uCE78 \uD06C\uAC8C \uBCF4\uAE30",
|
|
767
768
|
restorePane: "\uBD84\uD560 \uD654\uBA74\uC73C\uB85C",
|
|
@@ -1120,6 +1121,7 @@ var STRINGS = {
|
|
|
1120
1121
|
syncTime: "Time range",
|
|
1121
1122
|
syncSymbol: "Symbol",
|
|
1122
1123
|
syncInterval: "Interval",
|
|
1124
|
+
syncIndicators: "Indicators",
|
|
1123
1125
|
syncHint: "Linked panes move together",
|
|
1124
1126
|
maximizePane: "Maximize pane",
|
|
1125
1127
|
restorePane: "Back to split view",
|
|
@@ -6185,7 +6187,8 @@ var SCALES2 = [
|
|
|
6185
6187
|
var SYNC_KEYS = [
|
|
6186
6188
|
{ key: "crosshair", label: "syncCrosshair" },
|
|
6187
6189
|
{ key: "symbol", label: "syncSymbol" },
|
|
6188
|
-
{ key: "interval", label: "syncInterval" }
|
|
6190
|
+
{ key: "interval", label: "syncInterval" },
|
|
6191
|
+
{ key: "indicators", label: "syncIndicators" }
|
|
6189
6192
|
];
|
|
6190
6193
|
function LayoutSection({ ctx, multi, close }) {
|
|
6191
6194
|
const s3 = useStore(ctx.store);
|
|
@@ -6953,7 +6956,7 @@ function PaneTools({ ctx }) {
|
|
|
6953
6956
|
function PaneMaximize({ ctx, multi }) {
|
|
6954
6957
|
const s3 = useStore(ctx.store);
|
|
6955
6958
|
const m3 = useStore(multi.store);
|
|
6956
|
-
if (s3.layout.plotWidth <= 0 || m3.narrow || m3.layout === "1" && m3.maximized === null) return null;
|
|
6959
|
+
if (s3.layout.plotWidth <= 0 || m3.narrow && paneCount(LAYOUTS[m3.layout]) > 2 || m3.layout === "1" && m3.maximized === null) return null;
|
|
6957
6960
|
const t3 = stringsOf(s3);
|
|
6958
6961
|
const maximized = m3.maximized !== null;
|
|
6959
6962
|
const label = maximized ? t3.restorePane : t3.maximizePane;
|
|
@@ -7399,7 +7402,7 @@ function createTradingChart(container, options) {
|
|
|
7399
7402
|
|
|
7400
7403
|
// src/multi-chart.tsx
|
|
7401
7404
|
import { browserLocale as browserLocale3, parseChartState } from "@funnest/charts";
|
|
7402
|
-
var DEFAULT_SYNC = { crosshair: true, time: false, symbol: false, interval: false };
|
|
7405
|
+
var DEFAULT_SYNC = { crosshair: true, time: false, symbol: false, interval: false, indicators: false };
|
|
7403
7406
|
function PaneTab({ pane, index, active, onSelect }) {
|
|
7404
7407
|
const s3 = useStore(pane.store);
|
|
7405
7408
|
const t3 = stringsOf(s3);
|
|
@@ -7412,7 +7415,7 @@ function PaneTab({ pane, index, active, onSelect }) {
|
|
|
7412
7415
|
function PaneTabs({ multi, panes }) {
|
|
7413
7416
|
const m3 = useStore(multi.store);
|
|
7414
7417
|
const visible = panes().slice(0, paneCount(LAYOUTS[m3.layout]));
|
|
7415
|
-
if (!m3.narrow || visible.length <
|
|
7418
|
+
if (!m3.narrow || visible.length < 3) return null;
|
|
7416
7419
|
return /* @__PURE__ */ a3("div", { class: "fnc-pane-tabs", role: "tablist", children: visible.map((p3, i3) => /* @__PURE__ */ a3(PaneTab, { pane: p3, index: i3, active: i3 === m3.active, onSelect: () => multi.activate(i3) })) });
|
|
7417
7420
|
}
|
|
7418
7421
|
function createMultiChart(container, options) {
|
|
@@ -7572,12 +7575,22 @@ function createMultiChart(container, options) {
|
|
|
7572
7575
|
if (sym && (sym !== other.chart.symbolInfo?.symbol || r3 !== other.chart.currentResolution)) void other.load(sym, r3);
|
|
7573
7576
|
}
|
|
7574
7577
|
});
|
|
7578
|
+
c3.on("indicatorsChange", (list) => {
|
|
7579
|
+
if (store.get().sync.indicators && panes[store.get().active] === pane) shareIndicators(pane, list);
|
|
7580
|
+
});
|
|
7575
7581
|
c3.on("stateChange", queueState);
|
|
7576
7582
|
panes[index] = pane;
|
|
7577
7583
|
cells[index] = cell;
|
|
7578
7584
|
void pane.load(spec.symbol, spec.resolution ?? resolution);
|
|
7579
7585
|
return pane;
|
|
7580
7586
|
}
|
|
7587
|
+
function shareIndicators(from, list = from.chart.getIndicators()) {
|
|
7588
|
+
const json = JSON.stringify(list);
|
|
7589
|
+
for (const other of visible()) {
|
|
7590
|
+
if (other === from || JSON.stringify(other.chart.getIndicators()) === json) continue;
|
|
7591
|
+
other.chart.setIndicators(JSON.parse(json));
|
|
7592
|
+
}
|
|
7593
|
+
}
|
|
7581
7594
|
let markTime = null;
|
|
7582
7595
|
const marks = /* @__PURE__ */ new Map();
|
|
7583
7596
|
function setMark(time) {
|
|
@@ -7689,8 +7702,9 @@ function createMultiChart(container, options) {
|
|
|
7689
7702
|
if (i3 >= count) parking.appendChild(cells[i3]);
|
|
7690
7703
|
cells[i3].classList.toggle("fnc-pane-active", i3 === s3.active && count > 1);
|
|
7691
7704
|
}
|
|
7692
|
-
const
|
|
7693
|
-
const
|
|
7705
|
+
const stacked = s3.narrow && count === 2;
|
|
7706
|
+
const single = s3.maximized ?? (s3.narrow && !stacked ? s3.active : null);
|
|
7707
|
+
const top = single !== null && single < count ? cells[single] : stacked ? buildNode(LAYOUTS["2-rows"], "", "2-rows") : buildNode(LAYOUTS[s3.layout], "", s3.layout);
|
|
7694
7708
|
top.style.flex = "1 1 0px";
|
|
7695
7709
|
grid.replaceChildren(top);
|
|
7696
7710
|
shell.root.classList.toggle("fnc-split-on", count > 1 && single === null);
|
|
@@ -7719,6 +7733,7 @@ function createMultiChart(container, options) {
|
|
|
7719
7733
|
for (const p3 of panes.slice(count)) p3.chart.setSyncedCrosshair(null);
|
|
7720
7734
|
store.set({ layout, maximized: null, active: Math.min(s3.active, count - 1) });
|
|
7721
7735
|
if (s3.active !== store.get().active) bindToolbar();
|
|
7736
|
+
if (s3.sync.indicators) shareIndicators(panes[store.get().active]);
|
|
7722
7737
|
renderGrid();
|
|
7723
7738
|
emit("layoutChange", { layout, panes: count });
|
|
7724
7739
|
queueState();
|
|
@@ -7735,6 +7750,7 @@ function createMultiChart(container, options) {
|
|
|
7735
7750
|
store.set({ sync });
|
|
7736
7751
|
const active = panes[store.get().active];
|
|
7737
7752
|
if (!sync.crosshair) for (const p3 of panes) p3.chart.setSyncedCrosshair(null);
|
|
7753
|
+
if (sync.indicators && !before.indicators) shareIndicators(active);
|
|
7738
7754
|
if (sync.symbol && !before.symbol || sync.interval && !before.interval) {
|
|
7739
7755
|
const info = active.chart.symbolInfo;
|
|
7740
7756
|
const res = active.chart.currentResolution;
|
package/dist/multi-chart.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface MultiChartOptions extends Omit<TradingChartOptions, 'symbol'> {
|
|
|
19
19
|
layout?: LayoutId;
|
|
20
20
|
/** Default: crosshair on, everything else off. */
|
|
21
21
|
sync?: Partial<LayoutSync>;
|
|
22
|
-
/** Below this container width
|
|
22
|
+
/** Below this container width two panes stack (top, bottom); more show one at a time, with tabs to switch. Default 640. */
|
|
23
23
|
narrowWidth?: number;
|
|
24
24
|
}
|
|
25
25
|
/** Everything `load()` needs to rebuild the widget: split, sync, sizes and every pane's chart. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.27",
|
|
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.
|
|
45
|
+
"@funnest/charts": "0.11.27"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|