@funnest/charts-ui 0.11.68 → 0.11.70

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
@@ -196,6 +196,8 @@ export interface WidgetContext {
196
196
  showLogo: boolean;
197
197
  /** Ctrl/⌘+K opens symbol search (off when the page uses the shortcut for its own search). */
198
198
  searchHotkey: boolean;
199
+ /** ChartOptions.keyboardShortcuts: false — no key hints (Ctrl+Z…) in the menus either. */
200
+ keyboardShortcuts: boolean;
199
201
  drawingToolbar: boolean;
200
202
  /** Show the Funnest logo badge on the chart. */
201
203
  attribution: boolean;
package/dist/index.js CHANGED
@@ -3445,7 +3445,7 @@ function createShell(container, options) {
3445
3445
  }
3446
3446
  };
3447
3447
  }
3448
- function bindWidgetKeys(shell, active, searchHotkey, extra) {
3448
+ function bindWidgetKeys(shell, active, searchHotkey, extra, shortcuts = true) {
3449
3449
  const { root } = shell;
3450
3450
  let focused = false;
3451
3451
  const onPointerDown = (e3) => focused = root.contains(e3.target);
@@ -3456,7 +3456,7 @@ function bindWidgetKeys(shell, active, searchHotkey, extra) {
3456
3456
  const target = e3.target;
3457
3457
  const typing = !!target && (target.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName));
3458
3458
  const key = e3.key.toLowerCase();
3459
- if (focused && !typing && !s3.dialog && !s3.searchOpen && (e3.ctrlKey || e3.metaKey) && !e3.altKey && (key === "z" || key === "y")) {
3459
+ if (shortcuts && focused && !typing && !s3.dialog && !s3.searchOpen && (e3.ctrlKey || e3.metaKey) && !e3.altKey && (key === "z" || key === "y")) {
3460
3460
  e3.preventDefault();
3461
3461
  if (key === "y" || e3.shiftKey) pane.chart.redo();
3462
3462
  else pane.chart.undo();
@@ -3476,7 +3476,7 @@ function bindWidgetKeys(shell, active, searchHotkey, extra) {
3476
3476
  shell.toggleFullscreen();
3477
3477
  return;
3478
3478
  }
3479
- if (extra?.(e3)) e3.preventDefault();
3479
+ if (shortcuts && extra?.(e3)) e3.preventDefault();
3480
3480
  };
3481
3481
  const onKeyUp = (e3) => {
3482
3482
  const pane = active();
@@ -4606,6 +4606,12 @@ function SelectionBar({ ctx }) {
4606
4606
  const [menu, setMenu] = d2(null);
4607
4607
  const [sheet, setSheet] = d2(false);
4608
4608
  const [settingsTab, setSettingsTab] = d2("options");
4609
+ const selectedId = d3?.id ?? null;
4610
+ A2(() => {
4611
+ setMenu(null);
4612
+ setSheet(false);
4613
+ setNaming(null);
4614
+ }, [selectedId]);
4609
4615
  const [templates, setTemplates] = d2(() => readJson(TEMPLATES_KEY, {}));
4610
4616
  const [naming, setNaming] = d2(null);
4611
4617
  const bar = T2(null);
@@ -8236,8 +8242,8 @@ function ContextMenu({ ctx }) {
8236
8242
  const mod = mac ? "\u2318" : "Ctrl+";
8237
8243
  const extra = ctx.contextMenuItems?.({ ...target, chart: ctx.chart }) ?? [];
8238
8244
  const items = [
8239
- { label: t3.undo, icon: "undo", shortcut: `${mod}Z`, disabled: !s3.canUndo, onSelect: () => ctx.chart.undo() },
8240
- { label: t3.redo, icon: "redo", shortcut: `${mod}${mac ? "\u21E7" : "Shift+"}Z`, disabled: !s3.canRedo, onSelect: () => ctx.chart.redo() },
8245
+ { label: t3.undo, icon: "undo", ...ctx.keyboardShortcuts ? { shortcut: `${mod}Z` } : {}, disabled: !s3.canUndo, onSelect: () => ctx.chart.undo() },
8246
+ { label: t3.redo, icon: "redo", ...ctx.keyboardShortcuts ? { shortcut: `${mod}${mac ? "\u21E7" : "Shift+"}Z` } : {}, disabled: !s3.canRedo, onSelect: () => ctx.chart.redo() },
8241
8247
  "separator",
8242
8248
  ...extra.length ? [...extra, "separator"] : []
8243
8249
  ];
@@ -9135,6 +9141,7 @@ function createPane(shell, config) {
9135
9141
  displayTimezone: config.displayTimezone,
9136
9142
  showLogo: config.symbolLogo,
9137
9143
  searchHotkey: config.searchHotkey,
9144
+ keyboardShortcuts: config.chartOptions.keyboardShortcuts !== false,
9138
9145
  drawingToolbar: config.drawingToolbar,
9139
9146
  attribution: config.attribution,
9140
9147
  contextMenuItems: config.contextMenuItems,
@@ -9287,7 +9294,7 @@ function createTradingChart(container, options) {
9287
9294
  });
9288
9295
  shell.main.insertBefore(pane.stage, shell.rangeHost);
9289
9296
  shell.setPanes(() => [pane]);
9290
- const unbindKeys = bindWidgetKeys(shell, () => pane, searchHotkey);
9297
+ const unbindKeys = bindWidgetKeys(shell, () => pane, searchHotkey, void 0, chartOptions.keyboardShortcuts !== false);
9291
9298
  Q(/* @__PURE__ */ a3(Toolbar, { ctx: pane.ctx }), shell.toolbarHost);
9292
9299
  Q(/* @__PURE__ */ a3(RangeBar, { ctx: pane.ctx }), shell.rangeHost);
9293
9300
  if (shell.drawbarHost) Q(/* @__PURE__ */ a3(DrawingToolbar, { ctx: pane.ctx }), shell.drawbarHost);
@@ -9721,7 +9728,8 @@ function createMultiChart(container, options) {
9721
9728
  if (!digit) return false;
9722
9729
  activate(Number(digit) - 1);
9723
9730
  return true;
9724
- }
9731
+ },
9732
+ chartOptions.keyboardShortcuts !== false
9725
9733
  );
9726
9734
  const save = () => {
9727
9735
  const s3 = store.get();
package/dist/shell.d.ts CHANGED
@@ -129,4 +129,6 @@ export declare function bindWidgetKeys(shell: Shell, active: () => {
129
129
  undo(): void;
130
130
  redo(): void;
131
131
  };
132
- } | null, searchHotkey: boolean, extra?: (e: KeyboardEvent) => boolean): () => void;
132
+ } | null, searchHotkey: boolean, extra?: (e: KeyboardEvent) => boolean,
133
+ /** ChartOptions.keyboardShortcuts: false leaves Ctrl+Z / Ctrl+Y and `extra` to the app (Esc still closes). */
134
+ shortcuts?: boolean): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.68",
3
+ "version": "0.11.70",
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.68"
45
+ "@funnest/charts": "0.11.70"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"