@funnest/charts-ui 0.11.30 → 0.11.32

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.
@@ -2,8 +2,9 @@ import type { JSX } from 'preact';
2
2
  import type { WidgetContext } from '../context.js';
3
3
  /**
4
4
  * One "도구" button for the chart's less frequent tools, so the toolbar keeps symbol, interval,
5
- * market info and 지표 in view: chart type, split layout (+ sync), compare, replay, price axis,
6
- * screenshot, the app's own rows (toolsMenuItems) and chart settings.
5
+ * market info and 지표 in view. On top, sections that open (what's chosen shows on the right):
6
+ * chart type, split layout, pane sync, price axis; then compare, replay, screenshot, the app's own
7
+ * rows (toolsMenuItems) and chart settings.
7
8
  */
8
9
  export declare function ToolsMenu({ ctx }: {
9
10
  ctx: WidgetContext;
package/dist/i18n.d.ts CHANGED
@@ -327,6 +327,8 @@ export declare const STRINGS: {
327
327
  syncInterval: string;
328
328
  syncIndicators: string;
329
329
  syncHint: string;
330
+ syncOff: string;
331
+ syncOnePane: string;
330
332
  maximizePane: string;
331
333
  restorePane: string;
332
334
  pane: string;
@@ -686,6 +688,8 @@ export declare const STRINGS: {
686
688
  syncInterval: string;
687
689
  syncIndicators: string;
688
690
  syncHint: string;
691
+ syncOff: string;
692
+ syncOnePane: string;
689
693
  maximizePane: string;
690
694
  restorePane: string;
691
695
  pane: string;
package/dist/index.js CHANGED
@@ -757,13 +757,15 @@ var STRINGS = {
757
757
  searchHint: "\u2191\u2193 \uC774\uB3D9 \xB7 Enter \uC120\uD0DD \xB7 Esc \uB2EB\uAE30",
758
758
  current: "\uD604\uC7AC",
759
759
  layout: "\uD654\uBA74 \uBD84\uD560",
760
- sync: "\uCE78 \uB3D9\uAE30\uD654",
760
+ sync: "\uD654\uBA74 \uBD84\uD560 \uB3D9\uAE30\uD654",
761
761
  syncCrosshair: "\uC2ED\uC790\uC120",
762
762
  syncTime: "\uC2DC\uAC04 \uBC94\uC704",
763
763
  syncSymbol: "\uC885\uBAA9",
764
764
  syncInterval: "\uC8FC\uAE30",
765
765
  syncIndicators: "\uC9C0\uD45C",
766
766
  syncHint: "\uCF1C\uBA74 \uBAA8\uB4E0 \uCE78\uC774 \uAC19\uC774 \uC6C0\uC9C1\uC5EC\uC694",
767
+ syncOff: "\uAEBC\uC9D0",
768
+ syncOnePane: "\uD654\uBA74\uC744 \uB450 \uCE78 \uC774\uC0C1\uC73C\uB85C \uB098\uB204\uBA74 \uCF20 \uAC83\uB07C\uB9AC \uB9DE\uCDB0\uC838\uC694.",
767
769
  maximizePane: "\uC774 \uCE78 \uD06C\uAC8C \uBCF4\uAE30",
768
770
  restorePane: "\uBD84\uD560 \uD654\uBA74\uC73C\uB85C",
769
771
  pane: "\uCE78",
@@ -1116,13 +1118,15 @@ var STRINGS = {
1116
1118
  searchHint: "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc close",
1117
1119
  current: "Current",
1118
1120
  layout: "Layout",
1119
- sync: "Sync panes",
1121
+ sync: "Split sync",
1120
1122
  syncCrosshair: "Crosshair",
1121
1123
  syncTime: "Time range",
1122
1124
  syncSymbol: "Symbol",
1123
1125
  syncInterval: "Interval",
1124
1126
  syncIndicators: "Indicators",
1125
1127
  syncHint: "Linked panes move together",
1128
+ syncOff: "Off",
1129
+ syncOnePane: "Split the screen into two or more panes and what\u2019s on stays in step.",
1126
1130
  maximizePane: "Maximize pane",
1127
1131
  restorePane: "Back to split view",
1128
1132
  pane: "Pane",
@@ -4306,6 +4310,8 @@ var CSS = (
4306
4310
  .fnc-tools-fold > span:first-child { flex: 1; }
4307
4311
  .fnc-tools-fold-now { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; color: var(--fnc-text-2); }
4308
4312
  .fnc-tools-fold-now svg { width: 15px; height: 15px; }
4313
+ .fnc-tools-fold-now { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
4314
+ .fnc-tools-note { margin: 2px 8px 6px; font-size: 12px; line-height: 1.45; color: var(--fnc-text-2); }
4309
4315
  .fnc-tools-fold > svg { width: 14px; height: 14px; transition: transform 0.15s; transform: rotate(-90deg); }
4310
4316
  .fnc-tools-fold[aria-expanded="true"] > svg { transform: none; }
4311
4317
  .fnc-tools-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0 2px 4px; }
@@ -6254,39 +6260,40 @@ function LayoutSection({ ctx, multi, close, open, onToggle }) {
6254
6260
  const t3 = stringsOf(s3);
6255
6261
  return /* @__PURE__ */ a3($, { children: [
6256
6262
  /* @__PURE__ */ a3(Fold, { label: t3.layout, open, onToggle, children: /* @__PURE__ */ a3(LayoutGlyph, { id: m3.layout }) }),
6257
- open && /* @__PURE__ */ a3($, { children: [
6258
- /* @__PURE__ */ a3("div", { class: "fnc-tools-layouts", children: LAYOUT_GROUPS.map((group) => /* @__PURE__ */ a3("div", { class: "fnc-layout-row", children: [
6259
- /* @__PURE__ */ a3("span", { class: "fnc-layout-count", children: group[0].split("-")[0] }),
6260
- group.map((id) => /* @__PURE__ */ a3(
6261
- "button",
6262
- {
6263
- class: "fnc-layout-opt",
6264
- role: "menuitemradio",
6265
- "aria-checked": id === m3.layout,
6266
- "aria-label": `${t3.layout} ${id}`,
6267
- "data-layout": id,
6268
- onClick: () => {
6269
- multi.setLayout(id);
6270
- close();
6271
- },
6272
- children: /* @__PURE__ */ a3(LayoutGlyph, { id })
6273
- }
6274
- ))
6275
- ] })) }),
6276
- paneCount(LAYOUTS[m3.layout]) > 1 && /* @__PURE__ */ a3("div", { class: "fnc-tools-section", children: t3.sync }),
6277
- paneCount(LAYOUTS[m3.layout]) > 1 && SYNC_KEYS.map(({ key, label }) => /* @__PURE__ */ a3(
6263
+ open && /* @__PURE__ */ a3($, { children: /* @__PURE__ */ a3("div", { class: "fnc-tools-layouts", children: LAYOUT_GROUPS.map((group) => /* @__PURE__ */ a3("div", { class: "fnc-layout-row", children: [
6264
+ /* @__PURE__ */ a3("span", { class: "fnc-layout-count", children: group[0].split("-")[0] }),
6265
+ group.map((id) => /* @__PURE__ */ a3(
6278
6266
  "button",
6279
6267
  {
6280
- class: "fnc-menu-item fnc-sync-item",
6281
- role: "menuitemcheckbox",
6282
- "aria-checked": m3.sync[key],
6283
- onClick: () => multi.setSync({ [key]: !m3.sync[key] }),
6284
- children: [
6285
- /* @__PURE__ */ a3("span", { children: t3[label] }),
6286
- /* @__PURE__ */ a3("span", { class: "fnc-switch", "data-on": m3.sync[key] ? "true" : "false", "aria-hidden": "true" })
6287
- ]
6268
+ class: "fnc-layout-opt",
6269
+ role: "menuitemradio",
6270
+ "aria-checked": id === m3.layout,
6271
+ "aria-label": `${t3.layout} ${id}`,
6272
+ "data-layout": id,
6273
+ onClick: () => {
6274
+ multi.setLayout(id);
6275
+ close();
6276
+ },
6277
+ children: /* @__PURE__ */ a3(LayoutGlyph, { id })
6288
6278
  }
6289
6279
  ))
6280
+ ] })) }) })
6281
+ ] });
6282
+ }
6283
+ function SyncSection({ ctx, multi, open, onToggle }) {
6284
+ const s3 = useStore(ctx.store);
6285
+ const m3 = useStore(multi.store);
6286
+ const t3 = stringsOf(s3);
6287
+ const on = SYNC_KEYS.filter(({ key }) => m3.sync[key]).map(({ label }) => t3[label]);
6288
+ const now = on.length === 0 ? t3.syncOff : on.length <= 2 ? on.join(" \xB7 ") : `${on[0]} +${on.length - 1}`;
6289
+ return /* @__PURE__ */ a3($, { children: [
6290
+ /* @__PURE__ */ a3(Fold, { label: t3.sync, open, onToggle, children: now }),
6291
+ open && /* @__PURE__ */ a3($, { children: [
6292
+ paneCount(LAYOUTS[m3.layout]) < 2 && /* @__PURE__ */ a3("p", { class: "fnc-tools-note", children: t3.syncOnePane }),
6293
+ SYNC_KEYS.map(({ key, label }) => /* @__PURE__ */ a3("button", { class: "fnc-menu-item fnc-sync-item", role: "menuitemcheckbox", "aria-checked": m3.sync[key], onClick: () => multi.setSync({ [key]: !m3.sync[key] }), children: [
6294
+ /* @__PURE__ */ a3("span", { children: t3[label] }),
6295
+ /* @__PURE__ */ a3("span", { class: "fnc-switch", "data-on": m3.sync[key] ? "true" : "false", "aria-hidden": "true" })
6296
+ ] }))
6290
6297
  ] })
6291
6298
  ] });
6292
6299
  }
@@ -6296,6 +6303,8 @@ function ToolsMenu({ ctx }) {
6296
6303
  const [open, setOpen] = d2(false);
6297
6304
  const [typesOpen, setTypesOpen] = d2(false);
6298
6305
  const [layoutOpen, setLayoutOpen] = d2(false);
6306
+ const [syncOpen, setSyncOpen] = d2(false);
6307
+ const [scaleOpen, setScaleOpen] = d2(false);
6299
6308
  const [scale, setScale] = d2(ctx.chart.settings.priceScale);
6300
6309
  const ref = T2(null);
6301
6310
  const menuRef = useKeepInView(open);
@@ -6374,6 +6383,9 @@ function ToolsMenu({ ctx }) {
6374
6383
  }
6375
6384
  )) }),
6376
6385
  ctx.multi && /* @__PURE__ */ a3(LayoutSection, { ctx, multi: ctx.multi, close, open: layoutOpen, onToggle: () => setLayoutOpen(!layoutOpen) }),
6386
+ ctx.multi && /* @__PURE__ */ a3(SyncSection, { ctx, multi: ctx.multi, open: syncOpen, onToggle: () => setSyncOpen(!syncOpen) }),
6387
+ /* @__PURE__ */ a3(Fold, { label: t3.settingsScale, open: scaleOpen, onToggle: () => setScaleOpen(!scaleOpen), children: t3[(SCALES2.find((x2) => x2.mode === scale) ?? SCALES2[0]).label] }),
6388
+ scaleOpen && /* @__PURE__ */ a3("div", { class: "fnc-seg fnc-tools-seg", role: "radiogroup", "aria-label": t3.settingsScale, children: SCALES2.map(({ mode, label }) => /* @__PURE__ */ a3("button", { type: "button", role: "radio", "aria-checked": scale === mode, onClick: () => ctx.chart.setSettings({ priceScale: mode }), children: /* @__PURE__ */ a3("span", { children: t3[label] }) })) }),
6377
6389
  /* @__PURE__ */ a3("div", { class: "fnc-tools-sep" }),
6378
6390
  canSearch && item("fnc-btn-compare", t3.compareSymbol, /* @__PURE__ */ a3(CompareIcon, {}), () => ctx.setSearchOpen(true, "compare"), {
6379
6391
  disabled: s3.compares.length >= 5
@@ -6386,8 +6398,6 @@ function ToolsMenu({ ctx }) {
6386
6398
  { pressed: s3.replay.active || s3.replay.selecting }
6387
6399
  ),
6388
6400
  item("fnc-btn-screenshot", t3.screenshot, /* @__PURE__ */ a3(CameraIcon, {}), ctx.screenshot),
6389
- /* @__PURE__ */ a3("div", { class: "fnc-tools-section", children: t3.settingsScale }),
6390
- /* @__PURE__ */ a3("div", { class: "fnc-seg fnc-tools-seg", role: "radiogroup", "aria-label": t3.settingsScale, children: SCALES2.map(({ mode, label }) => /* @__PURE__ */ a3("button", { type: "button", role: "radio", "aria-checked": scale === mode, onClick: () => ctx.chart.setSettings({ priceScale: mode }), children: /* @__PURE__ */ a3("span", { children: t3[label] }) })) }),
6391
6401
  /* @__PURE__ */ a3("div", { class: "fnc-tools-sep" }),
6392
6402
  (ctx.toolsMenuItems?.(ctx.chart) ?? []).map(
6393
6403
  (extra) => item(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.30",
3
+ "version": "0.11.32",
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.30"
45
+ "@funnest/charts": "0.11.32"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"