@funnest/charts-ui 0.11.27 → 0.11.28

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.
Files changed (2) hide show
  1. package/dist/index.js +57 -33
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4301,6 +4301,13 @@ var CSS = (
4301
4301
  /* \u2500\u2500 \uB3C4\uAD6C menu: chart type, split, compare, replay, axis, screenshot, settings \u2500\u2500 */
4302
4302
  .fnc-tools-menu { width: 300px; padding: 8px; gap: 2px; max-height: 72vh; overflow-y: auto; }
4303
4303
  .fnc-tools-section { padding: 8px 6px 6px; font-size: 12px; font-weight: 700; color: var(--fnc-text-2); }
4304
+ .fnc-tools-fold { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 6px; border-radius: 6px; text-align: left; cursor: pointer; }
4305
+ .fnc-tools-fold:hover { background: var(--fnc-surface); color: var(--fnc-text); }
4306
+ .fnc-tools-fold > span:first-child { flex: 1; }
4307
+ .fnc-tools-fold-now { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; color: var(--fnc-text-2); }
4308
+ .fnc-tools-fold-now svg { width: 15px; height: 15px; }
4309
+ .fnc-tools-fold > svg { width: 14px; height: 14px; transition: transform 0.15s; transform: rotate(-90deg); }
4310
+ .fnc-tools-fold[aria-expanded="true"] > svg { transform: none; }
4304
4311
  .fnc-tools-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0 2px 4px; }
4305
4312
  .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; }
4306
4313
  .fnc-tools-seg[data-count="8"], .fnc-tools-seg[data-count="13"] { grid-template-columns: repeat(4, 1fr); }
@@ -6190,50 +6197,61 @@ var SYNC_KEYS = [
6190
6197
  { key: "interval", label: "syncInterval" },
6191
6198
  { key: "indicators", label: "syncIndicators" }
6192
6199
  ];
6193
- function LayoutSection({ ctx, multi, close }) {
6200
+ function Fold({ label, open, onToggle, children }) {
6201
+ return /* @__PURE__ */ a3("button", { type: "button", class: "fnc-tools-section fnc-tools-fold", "aria-expanded": open, onClick: onToggle, children: [
6202
+ /* @__PURE__ */ a3("span", { children: label }),
6203
+ /* @__PURE__ */ a3("span", { class: "fnc-tools-fold-now", children }),
6204
+ /* @__PURE__ */ a3(ChevronDownIcon, {})
6205
+ ] });
6206
+ }
6207
+ function LayoutSection({ ctx, multi, close, open, onToggle }) {
6194
6208
  const s3 = useStore(ctx.store);
6195
6209
  const m3 = useStore(multi.store);
6196
6210
  const t3 = stringsOf(s3);
6197
6211
  return /* @__PURE__ */ a3($, { children: [
6198
- /* @__PURE__ */ a3("div", { class: "fnc-tools-section", children: t3.layout }),
6199
- /* @__PURE__ */ a3("div", { class: "fnc-tools-layouts", children: LAYOUT_GROUPS.map((group) => /* @__PURE__ */ a3("div", { class: "fnc-layout-row", children: [
6200
- /* @__PURE__ */ a3("span", { class: "fnc-layout-count", children: group[0].split("-")[0] }),
6201
- group.map((id) => /* @__PURE__ */ a3(
6212
+ /* @__PURE__ */ a3(Fold, { label: t3.layout, open, onToggle, children: /* @__PURE__ */ a3(LayoutGlyph, { id: m3.layout }) }),
6213
+ open && /* @__PURE__ */ a3($, { children: [
6214
+ /* @__PURE__ */ a3("div", { class: "fnc-tools-layouts", children: LAYOUT_GROUPS.map((group) => /* @__PURE__ */ a3("div", { class: "fnc-layout-row", children: [
6215
+ /* @__PURE__ */ a3("span", { class: "fnc-layout-count", children: group[0].split("-")[0] }),
6216
+ group.map((id) => /* @__PURE__ */ a3(
6217
+ "button",
6218
+ {
6219
+ class: "fnc-layout-opt",
6220
+ role: "menuitemradio",
6221
+ "aria-checked": id === m3.layout,
6222
+ "aria-label": `${t3.layout} ${id}`,
6223
+ "data-layout": id,
6224
+ onClick: () => {
6225
+ multi.setLayout(id);
6226
+ close();
6227
+ },
6228
+ children: /* @__PURE__ */ a3(LayoutGlyph, { id })
6229
+ }
6230
+ ))
6231
+ ] })) }),
6232
+ paneCount(LAYOUTS[m3.layout]) > 1 && /* @__PURE__ */ a3("div", { class: "fnc-tools-section", children: t3.sync }),
6233
+ paneCount(LAYOUTS[m3.layout]) > 1 && SYNC_KEYS.map(({ key, label }) => /* @__PURE__ */ a3(
6202
6234
  "button",
6203
6235
  {
6204
- class: "fnc-layout-opt",
6205
- role: "menuitemradio",
6206
- "aria-checked": id === m3.layout,
6207
- "aria-label": `${t3.layout} ${id}`,
6208
- "data-layout": id,
6209
- onClick: () => {
6210
- multi.setLayout(id);
6211
- close();
6212
- },
6213
- children: /* @__PURE__ */ a3(LayoutGlyph, { id })
6236
+ class: "fnc-menu-item fnc-sync-item",
6237
+ role: "menuitemcheckbox",
6238
+ "aria-checked": m3.sync[key],
6239
+ onClick: () => multi.setSync({ [key]: !m3.sync[key] }),
6240
+ children: [
6241
+ /* @__PURE__ */ a3("span", { children: t3[label] }),
6242
+ /* @__PURE__ */ a3("span", { class: "fnc-switch", "data-on": m3.sync[key] ? "true" : "false", "aria-hidden": "true" })
6243
+ ]
6214
6244
  }
6215
6245
  ))
6216
- ] })) }),
6217
- paneCount(LAYOUTS[m3.layout]) > 1 && /* @__PURE__ */ a3("div", { class: "fnc-tools-section", children: t3.sync }),
6218
- paneCount(LAYOUTS[m3.layout]) > 1 && SYNC_KEYS.map(({ key, label }) => /* @__PURE__ */ a3(
6219
- "button",
6220
- {
6221
- class: "fnc-menu-item fnc-sync-item",
6222
- role: "menuitemcheckbox",
6223
- "aria-checked": m3.sync[key],
6224
- onClick: () => multi.setSync({ [key]: !m3.sync[key] }),
6225
- children: [
6226
- /* @__PURE__ */ a3("span", { children: t3[label] }),
6227
- /* @__PURE__ */ a3("span", { class: "fnc-switch", "data-on": m3.sync[key] ? "true" : "false", "aria-hidden": "true" })
6228
- ]
6229
- }
6230
- ))
6246
+ ] })
6231
6247
  ] });
6232
6248
  }
6233
6249
  function ToolsMenu({ ctx }) {
6234
6250
  const s3 = useStore(ctx.store);
6235
6251
  const t3 = stringsOf(s3);
6236
6252
  const [open, setOpen] = d2(false);
6253
+ const [typesOpen, setTypesOpen] = d2(false);
6254
+ const [layoutOpen, setLayoutOpen] = d2(false);
6237
6255
  const [scale, setScale] = d2(ctx.chart.settings.priceScale);
6238
6256
  const ref = T2(null);
6239
6257
  const menuRef = useKeepInView(open);
@@ -6287,8 +6305,14 @@ function ToolsMenu({ ctx }) {
6287
6305
  }
6288
6306
  ),
6289
6307
  open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-tools-menu", role: "menu", "aria-label": t3.tools, ref: menuRef, children: [
6290
- /* @__PURE__ */ a3("div", { class: "fnc-tools-section", children: t3.chartType }),
6291
- /* @__PURE__ */ a3("div", { class: "fnc-seg fnc-tools-seg", role: "radiogroup", "aria-label": t3.chartType, "data-count": TYPES.length, children: TYPES.map(({ type, label, icon: Icon2 }) => /* @__PURE__ */ a3(
6308
+ /* @__PURE__ */ a3(Fold, { label: t3.chartType, open: typesOpen, onToggle: () => setTypesOpen(!typesOpen), children: (() => {
6309
+ const now = TYPES.find((x2) => x2.type === s3.chartType) ?? TYPES[0];
6310
+ return /* @__PURE__ */ a3($, { children: [
6311
+ /* @__PURE__ */ a3(now.icon, {}),
6312
+ t3[now.label]
6313
+ ] });
6314
+ })() }),
6315
+ typesOpen && /* @__PURE__ */ a3("div", { class: "fnc-seg fnc-tools-seg", role: "radiogroup", "aria-label": t3.chartType, "data-count": TYPES.length, children: TYPES.map(({ type, label, icon: Icon2 }) => /* @__PURE__ */ a3(
6292
6316
  "button",
6293
6317
  {
6294
6318
  type: "button",
@@ -6305,7 +6329,7 @@ function ToolsMenu({ ctx }) {
6305
6329
  ]
6306
6330
  }
6307
6331
  )) }),
6308
- ctx.multi && /* @__PURE__ */ a3(LayoutSection, { ctx, multi: ctx.multi, close }),
6332
+ ctx.multi && /* @__PURE__ */ a3(LayoutSection, { ctx, multi: ctx.multi, close, open: layoutOpen, onToggle: () => setLayoutOpen(!layoutOpen) }),
6309
6333
  /* @__PURE__ */ a3("div", { class: "fnc-tools-sep" }),
6310
6334
  canSearch && item("fnc-btn-compare", t3.compareSymbol, /* @__PURE__ */ a3(CompareIcon, {}), () => ctx.setSearchOpen(true, "compare"), {
6311
6335
  disabled: s3.compares.length >= 5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.27",
3
+ "version": "0.11.28",
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.27"
45
+ "@funnest/charts": "0.11.28"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"