@funnest/charts-ui 0.10.0 → 0.10.1

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/i18n.d.ts CHANGED
@@ -200,6 +200,9 @@ export declare const STRINGS: {
200
200
  saveDefaults: string;
201
201
  forgetDefaults: string;
202
202
  ok: string;
203
+ lockView: string;
204
+ unlockView: string;
205
+ lockRatio: string;
203
206
  levelValuesLabel: string;
204
207
  note: string;
205
208
  noteText: string;
@@ -484,6 +487,9 @@ export declare const STRINGS: {
484
487
  saveDefaults: string;
485
488
  forgetDefaults: string;
486
489
  ok: string;
490
+ lockView: string;
491
+ unlockView: string;
492
+ lockRatio: string;
487
493
  levelValuesLabel: string;
488
494
  note: string;
489
495
  noteText: string;
package/dist/index.js CHANGED
@@ -629,6 +629,9 @@ var STRINGS = {
629
629
  saveDefaults: "\uAE30\uBCF8\uAC12\uC73C\uB85C \uC800\uC7A5",
630
630
  forgetDefaults: "\uC800\uC7A5\uD55C \uAE30\uBCF8\uAC12 \uC9C0\uC6B0\uAE30",
631
631
  ok: "\uD655\uC778",
632
+ lockView: "\uCC28\uD2B8 \uACE0\uC815",
633
+ unlockView: "\uCC28\uD2B8 \uACE0\uC815 \uD480\uAE30",
634
+ lockRatio: "\uAC00\uACA9 \uCD95 \uBE44\uC728 \uACE0\uC815",
632
635
  levelValuesLabel: "\uAE30\uC900\uC120 \uAC12",
633
636
  note: "\uD14D\uC2A4\uD2B8",
634
637
  noteText: "\uD14D\uC2A4\uD2B8 \uC785\uB825",
@@ -915,6 +918,9 @@ var STRINGS = {
915
918
  saveDefaults: "Save as default",
916
919
  forgetDefaults: "Forget saved default",
917
920
  ok: "Ok",
921
+ lockView: "Lock chart",
922
+ unlockView: "Unlock chart",
923
+ lockRatio: "Lock price to bar ratio",
918
924
  levelValuesLabel: "Level values",
919
925
  note: "Text",
920
926
  noteText: "Type text",
@@ -2855,7 +2861,9 @@ var SECTIONS = [
2855
2861
  { key: "extendedPriceLine", label: "settingExtendedPrice" },
2856
2862
  { key: "volume", label: "settingVolume" },
2857
2863
  { key: "navigationButtons", label: "settingNavButtons" },
2858
- { key: "smoothScroll", label: "smoothScroll" }
2864
+ { key: "smoothScroll", label: "smoothScroll" },
2865
+ { key: "lockView", label: "lockView" },
2866
+ { key: "lockRatio", label: "lockRatio" }
2859
2867
  ]
2860
2868
  },
2861
2869
  {
@@ -4054,12 +4062,14 @@ function ContextMenu({ ctx }) {
4054
4062
  onSelect: () => ctx.chart.addDrawing({ type: "horizontal", points: [{ time, price }] })
4055
4063
  });
4056
4064
  }
4057
- const smooth = ctx.chart.settings.smoothScroll;
4065
+ const { smoothScroll: smooth, lockView, lockRatio } = ctx.chart.settings;
4058
4066
  items.push(
4059
4067
  { label: t3.goToDateMore, onSelect: () => ctx.store.set({ dialog: { kind: "goToDate" } }) },
4060
4068
  { label: t3.smoothScroll, checked: smooth, onSelect: () => ctx.chart.setSettings({ smoothScroll: !smooth }) },
4069
+ { label: t3.lockView, checked: lockView, onSelect: () => ctx.chart.setSettings({ lockView: !lockView }) },
4070
+ { label: t3.lockRatio, checked: lockRatio, onSelect: () => ctx.chart.setSettings({ lockRatio: !lockRatio }) },
4061
4071
  "separator",
4062
- { label: t3.resetChart, onSelect: () => ctx.chart.resetView() },
4072
+ { label: t3.resetChart, disabled: lockView, onSelect: () => ctx.chart.resetView() },
4063
4073
  { label: t3.chartSettingsMore, onSelect: () => ctx.store.set({ dialog: { kind: "chartSettings" } }) }
4064
4074
  );
4065
4075
  return /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-ctx-menu", role: "menu", ref, onContextMenu: (e3) => e3.preventDefault(), children: items.map(
@@ -4416,7 +4426,14 @@ function NavControls({ ctx }) {
4416
4426
  const s3 = useStore(ctx.store);
4417
4427
  const t3 = stringsOf(s3);
4418
4428
  const [showButtons, setShowButtons] = d2(ctx.chart.settings.navigationButtons);
4419
- A2(() => ctx.chart.on("settingsChange", (settings) => setShowButtons(settings.navigationButtons)), [ctx.chart]);
4429
+ const [locked, setLocked] = d2(ctx.chart.settings.lockView);
4430
+ A2(
4431
+ () => ctx.chart.on("settingsChange", (settings) => {
4432
+ setShowButtons(settings.navigationButtons);
4433
+ setLocked(settings.lockView);
4434
+ }),
4435
+ [ctx.chart]
4436
+ );
4420
4437
  const { plotWidth, panesHeight } = s3.layout;
4421
4438
  if (plotWidth <= 0) return null;
4422
4439
  const top = panesHeight - CONTROL_OFFSET;
@@ -4424,12 +4441,23 @@ function NavControls({ ctx }) {
4424
4441
  const button = (label, onClick, icon) => /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": label, "aria-label": label, onClick, children: icon });
4425
4442
  const replaying = s3.replay.active || s3.replay.selecting;
4426
4443
  return /* @__PURE__ */ a3($, { children: [
4427
- showButtons && !replaying && /* @__PURE__ */ a3("div", { class: "fnc-nav", style: { left: `${plotWidth / 2}px`, top: `${top}px` }, children: [
4428
- button(t3.zoomOut, () => ctx.chart.zoom(1 / ZOOM_STEP), /* @__PURE__ */ a3(MinusIcon, {})),
4429
- button(t3.zoomIn, () => ctx.chart.zoom(ZOOM_STEP), /* @__PURE__ */ a3(PlusIcon, {})),
4430
- button(t3.scrollBack, () => ctx.chart.scrollBars(-page()), /* @__PURE__ */ a3(ChevronLeftIcon, {})),
4431
- button(t3.scrollForward, () => ctx.chart.scrollBars(page()), /* @__PURE__ */ a3(ChevronRightIcon, {})),
4432
- button(t3.resetView, () => ctx.chart.resetView(), /* @__PURE__ */ a3(ResetIcon, {}))
4444
+ (showButtons || locked) && !replaying && /* @__PURE__ */ a3("div", { class: locked ? "fnc-nav fnc-nav-locked" : "fnc-nav", style: { left: `${plotWidth / 2}px`, top: `${top}px` }, children: [
4445
+ !locked && button(t3.zoomOut, () => ctx.chart.zoom(1 / ZOOM_STEP), /* @__PURE__ */ a3(MinusIcon, {})),
4446
+ !locked && button(t3.zoomIn, () => ctx.chart.zoom(ZOOM_STEP), /* @__PURE__ */ a3(PlusIcon, {})),
4447
+ !locked && button(t3.scrollBack, () => ctx.chart.scrollBars(-page()), /* @__PURE__ */ a3(ChevronLeftIcon, {})),
4448
+ !locked && button(t3.scrollForward, () => ctx.chart.scrollBars(page()), /* @__PURE__ */ a3(ChevronRightIcon, {})),
4449
+ !locked && button(t3.resetView, () => ctx.chart.resetView(), /* @__PURE__ */ a3(ResetIcon, {})),
4450
+ /* @__PURE__ */ a3(
4451
+ "button",
4452
+ {
4453
+ class: locked ? "fnc-btn fnc-btn-on" : "fnc-btn",
4454
+ "data-tip": locked ? t3.unlockView : t3.lockView,
4455
+ "aria-label": locked ? t3.unlockView : t3.lockView,
4456
+ "aria-pressed": locked,
4457
+ onClick: () => ctx.chart.setSettings({ lockView: !locked }),
4458
+ children: /* @__PURE__ */ a3(LockIcon, { open: !locked })
4459
+ }
4460
+ )
4433
4461
  ] }),
4434
4462
  !s3.atRealtime && /* @__PURE__ */ a3(
4435
4463
  "button",
@@ -5486,6 +5514,8 @@ var CSS = (
5486
5514
  .fnc-coord-price { flex: 0 0 110px; height: 32px; font-size: 13px; }
5487
5515
  .fnc-coord-time { flex: 0 0 180px; height: 32px; font-size: 13px; }
5488
5516
  .fnc-btn-on { color: var(--fnc-accent); }
5517
+ /* \uCC28\uD2B8 \uACE0\uC815: the bar shows just the lock, always (not only on hover). */
5518
+ .fnc-nav.fnc-nav-locked { opacity: 1; display: flex; }
5489
5519
  .fnc-color-field { display: flex; align-items: center; gap: 6px; flex: none; }
5490
5520
  .fnc-opacity { width: 64px; accent-color: var(--fnc-accent); }
5491
5521
  .fnc-level-values { flex-wrap: wrap; row-gap: 6px; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
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.10.0"
45
+ "@funnest/charts": "0.10.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"