@funnest/charts-ui 0.11.29 → 0.11.31

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
@@ -764,6 +764,8 @@ var STRINGS = {
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",
@@ -1123,6 +1125,8 @@ var STRINGS = {
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; }
@@ -5703,7 +5709,6 @@ function IntervalPicker({ ctx }) {
5703
5709
  const groups = ctx.intervalGroups.filter((g3) => g3.id !== "ticks" || g3.intervals.some(isSupported));
5704
5710
  const listed = new Set(ctx.intervalGroups.flatMap((g3) => g3.intervals));
5705
5711
  const custom = s3.customIntervals.filter((r3) => !listed.has(r3)).sort((a4, b) => resolutionToMs3(a4) - resolutionToMs3(b));
5706
- const order = [...ctx.intervalGroups.flatMap((g3) => g3.intervals), ...custom];
5707
5712
  const [amount, setAmount] = d2("2");
5708
5713
  const [unit, setUnit] = d2(1);
5709
5714
  const add = () => {
@@ -5714,7 +5719,11 @@ function IntervalPicker({ ctx }) {
5714
5719
  select(r3);
5715
5720
  };
5716
5721
  const favorites = s3.favoriteIntervals;
5717
- const byTime = (a4, b) => order.includes(a4) && order.includes(b) ? order.indexOf(a4) - order.indexOf(b) : resolutionToMs3(a4) - resolutionToMs3(b);
5722
+ const byTime = (a4, b) => {
5723
+ const ta = tickCount(a4), tb = tickCount(b);
5724
+ if (ta !== null || tb !== null) return ta === null ? 1 : tb === null ? -1 : ta - tb;
5725
+ return resolutionToMs3(a4) - resolutionToMs3(b);
5726
+ };
5718
5727
  const chips = [.../* @__PURE__ */ new Set([...favorites, ...s3.resolution ? [s3.resolution] : []])].sort(byTime);
5719
5728
  const select = (r3) => {
5720
5729
  setOpen(false);
@@ -6251,39 +6260,40 @@ function LayoutSection({ ctx, multi, close, open, onToggle }) {
6251
6260
  const t3 = stringsOf(s3);
6252
6261
  return /* @__PURE__ */ a3($, { children: [
6253
6262
  /* @__PURE__ */ a3(Fold, { label: t3.layout, open, onToggle, children: /* @__PURE__ */ a3(LayoutGlyph, { id: m3.layout }) }),
6254
- open && /* @__PURE__ */ a3($, { children: [
6255
- /* @__PURE__ */ a3("div", { class: "fnc-tools-layouts", children: LAYOUT_GROUPS.map((group) => /* @__PURE__ */ a3("div", { class: "fnc-layout-row", children: [
6256
- /* @__PURE__ */ a3("span", { class: "fnc-layout-count", children: group[0].split("-")[0] }),
6257
- group.map((id) => /* @__PURE__ */ a3(
6258
- "button",
6259
- {
6260
- class: "fnc-layout-opt",
6261
- role: "menuitemradio",
6262
- "aria-checked": id === m3.layout,
6263
- "aria-label": `${t3.layout} ${id}`,
6264
- "data-layout": id,
6265
- onClick: () => {
6266
- multi.setLayout(id);
6267
- close();
6268
- },
6269
- children: /* @__PURE__ */ a3(LayoutGlyph, { id })
6270
- }
6271
- ))
6272
- ] })) }),
6273
- paneCount(LAYOUTS[m3.layout]) > 1 && /* @__PURE__ */ a3("div", { class: "fnc-tools-section", children: t3.sync }),
6274
- 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(
6275
6266
  "button",
6276
6267
  {
6277
- class: "fnc-menu-item fnc-sync-item",
6278
- role: "menuitemcheckbox",
6279
- "aria-checked": m3.sync[key],
6280
- onClick: () => multi.setSync({ [key]: !m3.sync[key] }),
6281
- children: [
6282
- /* @__PURE__ */ a3("span", { children: t3[label] }),
6283
- /* @__PURE__ */ a3("span", { class: "fnc-switch", "data-on": m3.sync[key] ? "true" : "false", "aria-hidden": "true" })
6284
- ]
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 })
6285
6278
  }
6286
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
+ ] }))
6287
6297
  ] })
6288
6298
  ] });
6289
6299
  }
@@ -6293,6 +6303,8 @@ function ToolsMenu({ ctx }) {
6293
6303
  const [open, setOpen] = d2(false);
6294
6304
  const [typesOpen, setTypesOpen] = d2(false);
6295
6305
  const [layoutOpen, setLayoutOpen] = d2(false);
6306
+ const [syncOpen, setSyncOpen] = d2(false);
6307
+ const [scaleOpen, setScaleOpen] = d2(false);
6296
6308
  const [scale, setScale] = d2(ctx.chart.settings.priceScale);
6297
6309
  const ref = T2(null);
6298
6310
  const menuRef = useKeepInView(open);
@@ -6371,6 +6383,9 @@ function ToolsMenu({ ctx }) {
6371
6383
  }
6372
6384
  )) }),
6373
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] }) })) }),
6374
6389
  /* @__PURE__ */ a3("div", { class: "fnc-tools-sep" }),
6375
6390
  canSearch && item("fnc-btn-compare", t3.compareSymbol, /* @__PURE__ */ a3(CompareIcon, {}), () => ctx.setSearchOpen(true, "compare"), {
6376
6391
  disabled: s3.compares.length >= 5
@@ -6383,8 +6398,6 @@ function ToolsMenu({ ctx }) {
6383
6398
  { pressed: s3.replay.active || s3.replay.selecting }
6384
6399
  ),
6385
6400
  item("fnc-btn-screenshot", t3.screenshot, /* @__PURE__ */ a3(CameraIcon, {}), ctx.screenshot),
6386
- /* @__PURE__ */ a3("div", { class: "fnc-tools-section", children: t3.settingsScale }),
6387
- /* @__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] }) })) }),
6388
6401
  /* @__PURE__ */ a3("div", { class: "fnc-tools-sep" }),
6389
6402
  (ctx.toolsMenuItems?.(ctx.chart) ?? []).map(
6390
6403
  (extra) => item(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.29",
3
+ "version": "0.11.31",
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.29"
45
+ "@funnest/charts": "0.11.31"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"