@funnest/charts-ui 0.11.53 → 0.11.54

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 +53 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4394,6 +4394,25 @@ var CSS = (
4394
4394
  .fnc-ind-handle span { width: 24px; height: 4px; border-radius: 2px; background: currentColor; opacity: 0.55; }
4395
4395
  .fnc-ind-handle:hover span { opacity: 0.9; }
4396
4396
  .fnc-ind b { font-weight: 600; }
4397
+ /* \uCC28\uD2B8 \uC704 \uCEE8\uD2B8\uB864: small, in the row's text size. */
4398
+ .fnc-ind-controls { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
4399
+ .fnc-ind-toggle, .fnc-ind-select, .fnc-ind-step {
4400
+ height: 20px;
4401
+ border: 1px solid var(--fnc-border);
4402
+ border-radius: 6px;
4403
+ background: var(--fnc-bg);
4404
+ color: var(--fnc-text-2);
4405
+ font: inherit;
4406
+ font-size: 11.5px;
4407
+ }
4408
+ .fnc-ind-toggle { padding: 0 7px; cursor: pointer; }
4409
+ .fnc-ind-toggle:hover, .fnc-ind-select:hover, .fnc-ind-step button:hover { color: var(--fnc-text); }
4410
+ .fnc-ind-toggle[aria-pressed='true'] { border-color: var(--fnc-accent); background: color-mix(in srgb, var(--fnc-accent) 14%, transparent); color: var(--fnc-accent); }
4411
+ .fnc-ind-select { padding: 0 2px 0 5px; cursor: pointer; }
4412
+ .fnc-ind-step { display: inline-flex; align-items: center; }
4413
+ .fnc-ind-step button { width: 18px; height: 18px; border: 0; background: none; color: var(--fnc-text-2); font: inherit; cursor: pointer; }
4414
+ .fnc-ind-step button:disabled { opacity: 0.35; cursor: default; }
4415
+ .fnc-ind-step b { min-width: 22px; color: var(--fnc-text); text-align: center; font-variant-numeric: tabular-nums; }
4397
4416
  .fnc-ind-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
4398
4417
  .fnc-ind:hover .fnc-ind-actions, .fnc-ind:focus-within .fnc-ind-actions { opacity: 1; }
4399
4418
  .fnc-ind-btn {
@@ -7837,6 +7856,39 @@ function PriceAxisPlus({ ctx }) {
7837
7856
  var ZOOM_STEP = 1.25;
7838
7857
  var CONTROL_OFFSET = 52;
7839
7858
  var dirClass = (v3) => v3 > 0 ? "fnc-up" : v3 < 0 ? "fnc-down" : "fnc-flat";
7859
+ function IndicatorControls({ ctx, id, controls }) {
7860
+ const set = (key, value) => ctx.chart.setIndicatorControl(id, key, value);
7861
+ const keep = (e3) => e3.stopPropagation();
7862
+ return /* @__PURE__ */ a3("span", { class: "fnc-ind-controls", onClick: keep, onPointerDown: keep, onKeyDown: keep, children: controls.map((c3) => {
7863
+ if (c3.kind === "toggle")
7864
+ return /* @__PURE__ */ a3("button", { type: "button", class: "fnc-ind-toggle", "aria-pressed": c3.value === true, title: c3.label, onClick: () => set(c3.key, c3.value !== true), children: c3.label });
7865
+ if (c3.kind === "select")
7866
+ return /* @__PURE__ */ a3(
7867
+ "select",
7868
+ {
7869
+ class: "fnc-ind-select",
7870
+ "aria-label": c3.label,
7871
+ title: c3.label,
7872
+ value: String(c3.value),
7873
+ onChange: (e3) => {
7874
+ const raw = e3.currentTarget.value;
7875
+ const option = c3.options?.find((o4) => String(o4.value) === raw);
7876
+ if (option) set(c3.key, option.value);
7877
+ },
7878
+ children: (c3.options ?? []).map((o4) => /* @__PURE__ */ a3("option", { value: String(o4.value), children: o4.label }))
7879
+ }
7880
+ );
7881
+ const n2 = Number(c3.value);
7882
+ const step2 = c3.step && c3.step > 0 ? c3.step : 1;
7883
+ const decimals = Math.max(0, (String(step2).split(".")[1] ?? "").length);
7884
+ const bound = (v3) => Math.min(c3.max ?? Infinity, Math.max(c3.min ?? -Infinity, Number(v3.toFixed(decimals))));
7885
+ return /* @__PURE__ */ a3("span", { class: "fnc-ind-step", title: c3.label, children: [
7886
+ /* @__PURE__ */ a3("button", { type: "button", "aria-label": `${c3.label} \u2212`, disabled: c3.min !== void 0 && n2 <= c3.min, onClick: () => set(c3.key, bound(n2 - step2)), children: "\u2212" }),
7887
+ /* @__PURE__ */ a3("b", { children: Number.isFinite(n2) ? n2.toFixed(decimals) : "\u2014" }),
7888
+ /* @__PURE__ */ a3("button", { type: "button", "aria-label": `${c3.label} +`, disabled: c3.max !== void 0 && n2 >= c3.max, onClick: () => set(c3.key, bound(n2 + step2)), children: "+" })
7889
+ ] });
7890
+ }) });
7891
+ }
7840
7892
  function IndicatorItem({ ctx, item, values = true }) {
7841
7893
  const t3 = stringsOf(ctx.store.get());
7842
7894
  return /* @__PURE__ */ a3(
@@ -7867,6 +7919,7 @@ function IndicatorItem({ ctx, item, values = true }) {
7867
7919
  }
7868
7920
  ),
7869
7921
  /* @__PURE__ */ a3("span", { class: "fnc-ind-title", children: item.title }),
7922
+ item.controls && item.visible && /* @__PURE__ */ a3(IndicatorControls, { ctx, id: item.id, controls: item.controls }),
7870
7923
  values && item.visible && item.values.map((v3) => /* @__PURE__ */ a3("b", { style: { color: v3.color }, "data-tip": v3.label, children: v3.value })),
7871
7924
  /* @__PURE__ */ a3("span", { class: "fnc-ind-actions", children: [
7872
7925
  ctx.chart.canMoveIndicator(item.id, -1) && /* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "data-tip": t3.moveIndicatorUp, "aria-label": `${item.title} ${t3.moveIndicatorUp}`, onClick: (e3) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.53",
3
+ "version": "0.11.54",
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.53"
45
+ "@funnest/charts": "0.11.54"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"